Merge "Benchmark: Add CSV support for NDK gtest"
diff --git a/apex/Android.bp b/apex/Android.bp
index 73dc264..c5dd420 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -42,7 +42,14 @@
// Use a custom AndroidManifest.xml used for API targeting.
androidManifest: ":com.android.media-androidManifest",
- legacy_android10_support: true,
+ // IMPORTANT: For the APEX to be installed on Android 10 (API 29),
+ // min_sdk_version should be 29. This enables the build system to make
+ // sure the package compatible to Android 10 in two ways:
+ // - build the APEX package compatible to Android 10
+ // so that the package can be installed.
+ // - build artifacts (lib/javalib/bin) against Android 10 SDK
+ // so that the artifacts can run.
+ min_sdk_version: "29",
}
apex {
@@ -79,7 +86,14 @@
// Use a custom AndroidManifest.xml used for API targeting.
androidManifest: ":com.android.media.swcodec-androidManifest",
- legacy_android10_support: true,
+ // IMPORTANT: For the APEX to be installed on Android 10 (API 29),
+ // min_sdk_version should be 29. This enables the build system to make
+ // sure the package compatible to Android 10 in two ways:
+ // - build the APEX package compatible to Android 10
+ // so that the package can be installed.
+ // - build artifacts (lib/javalib/bin) against Android 10 SDK
+ // so that the artifacts can run.
+ min_sdk_version: "29",
}
prebuilt_etc {
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
index 477c371..376d3e4 100644
--- a/apex/testing/Android.bp
+++ b/apex/testing/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-apex {
+apex_test {
name: "test_com.android.media",
manifest: "test_manifest.json",
file_contexts: ":com.android.media-file_contexts",
@@ -20,7 +20,7 @@
installable: false,
}
-apex {
+apex_test {
name: "test_com.android.media.swcodec",
manifest: "test_manifest_codec.json",
file_contexts: ":com.android.media.swcodec-file_contexts",
diff --git a/camera/include/camera/VendorTagDescriptor.h b/camera/include/camera/VendorTagDescriptor.h
index 6f55890..b2fbf3a 100644
--- a/camera/include/camera/VendorTagDescriptor.h
+++ b/camera/include/camera/VendorTagDescriptor.h
@@ -188,8 +188,8 @@
sp<android::VendorTagDescriptor> *desc /*out*/);
// Parcelable interface
- status_t writeToParcel(Parcel* parcel) const override;
- status_t readFromParcel(const Parcel* parcel) override;
+ status_t writeToParcel(android::Parcel* parcel) const override;
+ status_t readFromParcel(const android::Parcel* parcel) override;
// Returns the number of vendor tags defined.
int getTagCount(metadata_vendor_id_t id) const;
diff --git a/camera/ndk/impl/ACameraCaptureSession.cpp b/camera/ndk/impl/ACameraCaptureSession.cpp
index d6f1412..68db233 100644
--- a/camera/ndk/impl/ACameraCaptureSession.cpp
+++ b/camera/ndk/impl/ACameraCaptureSession.cpp
@@ -33,7 +33,9 @@
dev->unlockDevice();
}
// Fire onClosed callback
- (*mUserSessionCallback.onClosed)(mUserSessionCallback.context, this);
+ if (mUserSessionCallback.onClosed != nullptr) {
+ (*mUserSessionCallback.onClosed)(mUserSessionCallback.context, this);
+ }
ALOGV("~ACameraCaptureSession: %p is deleted", this);
}
diff --git a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
index 70c887a..9aab29a 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
+++ b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
@@ -574,9 +574,8 @@
if (!serviceRet.isOk() || status != Status::NO_ERROR) {
ALOGE("%s: connect camera device failed", __FUNCTION__);
- // TODO: Convert serviceRet to camera_status_t
delete device;
- return ACAMERA_ERROR_UNKNOWN;
+ return utils::convertFromHidl(status);
}
if (deviceRemote == nullptr) {
ALOGE("%s: connect camera device failed! remote device is null", __FUNCTION__);
diff --git a/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp b/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
index 7ab0124..938b5f5 100644
--- a/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
+++ b/camera/ndk/ndk_vendor/tests/AImageReaderVendorTest.cpp
@@ -253,21 +253,9 @@
return true;
}
- static void onDeviceDisconnected(void* /*obj*/, ACameraDevice* /*device*/) {}
-
- static void onDeviceError(void* /*obj*/, ACameraDevice* /*device*/, int /*errorCode*/) {}
-
- static void onSessionClosed(void* /*obj*/, ACameraCaptureSession* /*session*/) {}
-
- static void onSessionReady(void* /*obj*/, ACameraCaptureSession* /*session*/) {}
-
- static void onSessionActive(void* /*obj*/, ACameraCaptureSession* /*session*/) {}
-
private:
- ACameraDevice_StateCallbacks mDeviceCb{this, onDeviceDisconnected,
- onDeviceError};
- ACameraCaptureSession_stateCallbacks mSessionCb{
- this, onSessionClosed, onSessionReady, onSessionActive};
+ ACameraDevice_StateCallbacks mDeviceCb{this, nullptr, nullptr};
+ ACameraCaptureSession_stateCallbacks mSessionCb{ this, nullptr, nullptr, nullptr};
native_handle_t* mImgReaderAnw = nullptr; // not owned by us.
diff --git a/media/bufferpool/2.0/AccessorImpl.cpp b/media/bufferpool/2.0/AccessorImpl.cpp
index cacd465..0d591d7 100644
--- a/media/bufferpool/2.0/AccessorImpl.cpp
+++ b/media/bufferpool/2.0/AccessorImpl.cpp
@@ -37,7 +37,7 @@
static constexpr int64_t kLogDurationUs = 5000000; // 5 secs
static constexpr size_t kMinAllocBytesForEviction = 1024*1024*15;
- static constexpr size_t kMinBufferCountForEviction = 40;
+ static constexpr size_t kMinBufferCountForEviction = 25;
}
// Buffer structure in bufferpool process
@@ -718,8 +718,8 @@
mStats.mTotalFetches, mStats.mTotalTransfers);
}
for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) {
- if (!clearCache && mStats.mSizeCached < kMinAllocBytesForEviction
- && mBuffers.size() < kMinBufferCountForEviction) {
+ if (!clearCache && (mStats.mSizeCached < kMinAllocBytesForEviction
+ || mBuffers.size() < kMinBufferCountForEviction)) {
break;
}
auto it = mBuffers.find(*freeIt);
diff --git a/media/codec2/components/aac/C2SoftAacEnc.cpp b/media/codec2/components/aac/C2SoftAacEnc.cpp
index 1dc676b..4db94f5 100644
--- a/media/codec2/components/aac/C2SoftAacEnc.cpp
+++ b/media/codec2/components/aac/C2SoftAacEnc.cpp
@@ -155,11 +155,10 @@
mNumBytesPerInputFrame(0u),
mOutBufferSize(0u),
mSentCodecSpecificData(false),
- mInputTimeSet(false),
mInputSize(0),
- mNextFrameTimestampUs(0),
mSignalledError(false),
- mOutIndex(0u) {
+ mOutIndex(0u),
+ mRemainderLen(0u) {
}
C2SoftAacEnc::~C2SoftAacEnc() {
@@ -181,10 +180,11 @@
c2_status_t C2SoftAacEnc::onStop() {
mSentCodecSpecificData = false;
- mInputTimeSet = false;
mInputSize = 0u;
- mNextFrameTimestampUs = 0;
+ mNextFrameTimestampUs.reset();
+ mLastFrameEndTimestampUs.reset();
mSignalledError = false;
+ mRemainderLen = 0;
return C2_OK;
}
@@ -199,9 +199,9 @@
c2_status_t C2SoftAacEnc::onFlush_sm() {
mSentCodecSpecificData = false;
- mInputTimeSet = false;
mInputSize = 0u;
- mNextFrameTimestampUs = 0;
+ mNextFrameTimestampUs.reset();
+ mLastFrameEndTimestampUs.reset();
return C2_OK;
}
@@ -364,23 +364,35 @@
data = view.data();
capacity = view.capacity();
}
- if (!mInputTimeSet && capacity > 0) {
- mNextFrameTimestampUs = work->input.ordinal.timestamp;
- mInputTimeSet = true;
+ c2_cntr64_t inputTimestampUs = work->input.ordinal.timestamp;
+ if (inputTimestampUs < mLastFrameEndTimestampUs.value_or(inputTimestampUs)) {
+ ALOGW("Correcting overlapping timestamp: last frame ended at %lldus but "
+ "current frame is starting at %lldus. Using the last frame's end timestamp",
+ mLastFrameEndTimestampUs->peekll(), inputTimestampUs.peekll());
+ inputTimestampUs = *mLastFrameEndTimestampUs;
+ }
+ if (capacity > 0) {
+ if (!mNextFrameTimestampUs) {
+ mNextFrameTimestampUs = work->input.ordinal.timestamp;
+ }
+ mLastFrameEndTimestampUs = inputTimestampUs
+ + (capacity / sizeof(int16_t) * 1000000ll / channelCount / sampleRate);
}
- size_t numFrames = (capacity + mInputSize + (eos ? mNumBytesPerInputFrame - 1 : 0))
- / mNumBytesPerInputFrame;
+ size_t numFrames =
+ (mRemainderLen + capacity + mInputSize + (eos ? mNumBytesPerInputFrame - 1 : 0))
+ / mNumBytesPerInputFrame;
ALOGV("capacity = %zu; mInputSize = %zu; numFrames = %zu "
- "mNumBytesPerInputFrame = %u inputTS = %lld",
- capacity, mInputSize, numFrames,
- mNumBytesPerInputFrame, work->input.ordinal.timestamp.peekll());
+ "mNumBytesPerInputFrame = %u inputTS = %lld remaining = %zu",
+ capacity, mInputSize, numFrames, mNumBytesPerInputFrame, inputTimestampUs.peekll(),
+ mRemainderLen);
std::shared_ptr<C2LinearBlock> block;
std::unique_ptr<C2WriteView> wView;
uint8_t *outPtr = temp;
size_t outAvailable = 0u;
uint64_t inputIndex = work->input.ordinal.frameIndex.peeku();
+ size_t bytesPerSample = channelCount * sizeof(int16_t);
AACENC_InArgs inargs;
AACENC_OutArgs outargs;
@@ -449,7 +461,25 @@
};
std::list<OutputBuffer> outputBuffers;
- while (encoderErr == AACENC_OK && inargs.numInSamples > 0) {
+ if (mRemainderLen > 0) {
+ size_t offset = 0;
+ for (; mRemainderLen < bytesPerSample && offset < capacity; ++offset) {
+ mRemainder[mRemainderLen++] = data[offset];
+ }
+ data += offset;
+ capacity -= offset;
+ if (mRemainderLen == bytesPerSample) {
+ inBuffer[0] = mRemainder;
+ inBufferSize[0] = bytesPerSample;
+ inargs.numInSamples = channelCount;
+ mRemainderLen = 0;
+ ALOGV("Processing remainder");
+ } else {
+ // We have exhausted the input already
+ inargs.numInSamples = 0;
+ }
+ }
+ while (encoderErr == AACENC_OK && inargs.numInSamples >= channelCount) {
if (numFrames && !block) {
C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE };
// TODO: error handling, proper usage, etc.
@@ -482,11 +512,13 @@
mInputSize = 0;
int consumed = (capacity / sizeof(int16_t)) - inargs.numInSamples
+ outargs.numInSamples;
- c2_cntr64_t currentFrameTimestampUs = mNextFrameTimestampUs;
- mNextFrameTimestampUs = work->input.ordinal.timestamp
+ ALOGV("consumed = %d, capacity = %zu, inSamples = %d, outSamples = %d",
+ consumed, capacity, inargs.numInSamples, outargs.numInSamples);
+ c2_cntr64_t currentFrameTimestampUs = *mNextFrameTimestampUs;
+ mNextFrameTimestampUs = inputTimestampUs
+ (consumed * 1000000ll / channelCount / sampleRate);
std::shared_ptr<C2Buffer> buffer = createLinearBuffer(block, 0, outargs.numOutBytes);
-#if defined(LOG_NDEBUG) && !LOG_NDEBUG
+#if 0
hexdump(outPtr, std::min(outargs.numOutBytes, 256));
#endif
outPtr = temp;
@@ -498,7 +530,11 @@
mInputSize += outargs.numInSamples * sizeof(int16_t);
}
- if (outargs.numInSamples > 0) {
+ if (inBuffer[0] == mRemainder) {
+ inBuffer[0] = const_cast<uint8_t *>(data);
+ inBufferSize[0] = capacity;
+ inargs.numInSamples = capacity / sizeof(int16_t);
+ } else if (outargs.numInSamples > 0) {
inBuffer[0] = (int16_t *)inBuffer[0] + outargs.numInSamples;
inBufferSize[0] -= outargs.numInSamples * sizeof(int16_t);
inargs.numInSamples -= outargs.numInSamples;
@@ -506,9 +542,8 @@
}
ALOGV("encoderErr = %d mInputSize = %zu "
"inargs.numInSamples = %d, mNextFrameTimestampUs = %lld",
- encoderErr, mInputSize, inargs.numInSamples, mNextFrameTimestampUs.peekll());
+ encoderErr, mInputSize, inargs.numInSamples, mNextFrameTimestampUs->peekll());
}
-
if (eos && inBufferSize[0] > 0) {
if (numFrames && !block) {
C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE };
@@ -539,6 +574,14 @@
&outBufDesc,
&inargs,
&outargs);
+ inBufferSize[0] = 0;
+ }
+
+ if (inBufferSize[0] > 0) {
+ for (size_t i = 0; i < inBufferSize[0]; ++i) {
+ mRemainder[i] = static_cast<uint8_t *>(inBuffer[0])[i];
+ }
+ mRemainderLen = inBufferSize[0];
}
while (outputBuffers.size() > 1) {
@@ -583,9 +626,9 @@
(void)pool;
mSentCodecSpecificData = false;
- mInputTimeSet = false;
mInputSize = 0u;
- mNextFrameTimestampUs = 0;
+ mNextFrameTimestampUs.reset();
+ mLastFrameEndTimestampUs.reset();
// TODO: we don't have any pending work at this time to drain.
return C2_OK;
diff --git a/media/codec2/components/aac/C2SoftAacEnc.h b/media/codec2/components/aac/C2SoftAacEnc.h
index 2655039..9a28280 100644
--- a/media/codec2/components/aac/C2SoftAacEnc.h
+++ b/media/codec2/components/aac/C2SoftAacEnc.h
@@ -18,6 +18,7 @@
#define ANDROID_C2_SOFT_AAC_ENC_H_
#include <atomic>
+#include <optional>
#include <SimpleC2Component.h>
@@ -54,13 +55,17 @@
UINT mOutBufferSize;
bool mSentCodecSpecificData;
- bool mInputTimeSet;
size_t mInputSize;
- c2_cntr64_t mNextFrameTimestampUs;
+ std::optional<c2_cntr64_t> mNextFrameTimestampUs;
+ std::optional<c2_cntr64_t> mLastFrameEndTimestampUs;
bool mSignalledError;
std::atomic_uint64_t mOutIndex;
+ // We support max 6 channels
+ uint8_t mRemainder[6 * sizeof(int16_t)];
+ size_t mRemainderLen;
+
status_t initEncoder();
status_t setAudioParams();
diff --git a/media/codec2/components/avc/C2SoftAvcDec.cpp b/media/codec2/components/avc/C2SoftAvcDec.cpp
index 75a6122..2be51dd 100644
--- a/media/codec2/components/avc/C2SoftAvcDec.cpp
+++ b/media/codec2/components/avc/C2SoftAvcDec.cpp
@@ -500,7 +500,7 @@
status_t C2SoftAvcDec::initDecoder() {
if (OK != createDecoder()) return UNKNOWN_ERROR;
mNumCores = MIN(getCpuCoreCount(), MAX_NUM_CORES);
- mStride = ALIGN64(mWidth);
+ mStride = ALIGN128(mWidth);
mSignalledError = false;
resetPlugin();
(void) setNumCores();
@@ -908,7 +908,7 @@
if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
if (mHeaderDecoded == false) {
mHeaderDecoded = true;
- setParams(ALIGN64(s_decode_op.u4_pic_wd), IVD_DECODE_FRAME);
+ setParams(ALIGN128(s_decode_op.u4_pic_wd), IVD_DECODE_FRAME);
}
if (s_decode_op.u4_pic_wd != mWidth || s_decode_op.u4_pic_ht != mHeight) {
mWidth = s_decode_op.u4_pic_wd;
diff --git a/media/codec2/components/hevc/C2SoftHevcDec.cpp b/media/codec2/components/hevc/C2SoftHevcDec.cpp
index 389ea61..6db4387 100644
--- a/media/codec2/components/hevc/C2SoftHevcDec.cpp
+++ b/media/codec2/components/hevc/C2SoftHevcDec.cpp
@@ -497,7 +497,7 @@
status_t C2SoftHevcDec::initDecoder() {
if (OK != createDecoder()) return UNKNOWN_ERROR;
mNumCores = MIN(getCpuCoreCount(), MAX_NUM_CORES);
- mStride = ALIGN64(mWidth);
+ mStride = ALIGN128(mWidth);
mSignalledError = false;
resetPlugin();
(void) setNumCores();
@@ -904,7 +904,7 @@
if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
if (mHeaderDecoded == false) {
mHeaderDecoded = true;
- setParams(ALIGN64(s_decode_op.u4_pic_wd), IVD_DECODE_FRAME);
+ setParams(ALIGN128(s_decode_op.u4_pic_wd), IVD_DECODE_FRAME);
}
if (s_decode_op.u4_pic_wd != mWidth || s_decode_op.u4_pic_ht != mHeight) {
mWidth = s_decode_op.u4_pic_wd;
diff --git a/media/codec2/components/vorbis/C2SoftVorbisDec.cpp b/media/codec2/components/vorbis/C2SoftVorbisDec.cpp
index 18e6db2..15564d9 100644
--- a/media/codec2/components/vorbis/C2SoftVorbisDec.cpp
+++ b/media/codec2/components/vorbis/C2SoftVorbisDec.cpp
@@ -66,7 +66,7 @@
addParameter(
DefineParam(mSampleRate, C2_PARAMKEY_SAMPLE_RATE)
.withDefault(new C2StreamSampleRateInfo::output(0u, 48000))
- .withFields({C2F(mSampleRate, value).inRange(8000, 96000)})
+ .withFields({C2F(mSampleRate, value).inRange(8000, 192000)})
.withSetter((Setter<decltype(*mSampleRate)>::StrictValueWithNoDeps))
.build());
diff --git a/media/codec2/components/vpx/C2SoftVpxDec.cpp b/media/codec2/components/vpx/C2SoftVpxDec.cpp
index a52ca15..a759e8f 100644
--- a/media/codec2/components/vpx/C2SoftVpxDec.cpp
+++ b/media/codec2/components/vpx/C2SoftVpxDec.cpp
@@ -593,12 +593,10 @@
}
}
- int64_t frameIndex = work->input.ordinal.frameIndex.peekll();
-
if (inSize) {
uint8_t *bitstream = const_cast<uint8_t *>(rView.data() + inOffset);
vpx_codec_err_t err = vpx_codec_decode(
- mCodecCtx, bitstream, inSize, &frameIndex, 0);
+ mCodecCtx, bitstream, inSize, &work->input.ordinal.frameIndex, 0);
if (err != VPX_CODEC_OK) {
ALOGE("on2 decoder failed to decode frame. err: %d", err);
mSignalledError = true;
@@ -608,7 +606,20 @@
}
}
- (void)outputBuffer(pool, work);
+ status_t err = outputBuffer(pool, work);
+ if (err == NOT_ENOUGH_DATA) {
+ if (inSize > 0) {
+ ALOGV("Maybe non-display frame at %lld.",
+ work->input.ordinal.frameIndex.peekll());
+ // send the work back with empty buffer.
+ inSize = 0;
+ }
+ } else if (err != OK) {
+ ALOGD("Error while getting the output frame out");
+ // work->result would be already filled; do fillEmptyWork() below to
+ // send the work back.
+ inSize = 0;
+ }
if (eos) {
drainInternal(DRAIN_COMPONENT_WITH_EOS, pool, work);
@@ -742,16 +753,16 @@
}
return;
}
-bool C2SoftVpxDec::outputBuffer(
+status_t C2SoftVpxDec::outputBuffer(
const std::shared_ptr<C2BlockPool> &pool,
const std::unique_ptr<C2Work> &work)
{
- if (!(work && pool)) return false;
+ if (!(work && pool)) return BAD_VALUE;
vpx_codec_iter_t iter = nullptr;
vpx_image_t *img = vpx_codec_get_frame(mCodecCtx, &iter);
- if (!img) return false;
+ if (!img) return NOT_ENOUGH_DATA;
if (img->d_w != mWidth || img->d_h != mHeight) {
mWidth = img->d_w;
@@ -768,7 +779,7 @@
mSignalledError = true;
work->workletsProcessed = 1u;
work->result = C2_CORRUPTED;
- return false;
+ return UNKNOWN_ERROR;
}
}
@@ -791,18 +802,19 @@
if (err != C2_OK) {
ALOGE("fetchGraphicBlock for Output failed with status %d", err);
work->result = err;
- return false;
+ return UNKNOWN_ERROR;
}
C2GraphicView wView = block->map().get();
if (wView.error()) {
ALOGE("graphic view map failed %d", wView.error());
work->result = C2_CORRUPTED;
- return false;
+ return UNKNOWN_ERROR;
}
- ALOGV("provided (%dx%d) required (%dx%d), out frameindex %d",
- block->width(), block->height(), mWidth, mHeight, (int)*(int64_t *)img->user_priv);
+ ALOGV("provided (%dx%d) required (%dx%d), out frameindex %lld",
+ block->width(), block->height(), mWidth, mHeight,
+ ((c2_cntr64_t *)img->user_priv)->peekll());
uint8_t *dst = const_cast<uint8_t *>(wView.data()[C2PlanarLayout::PLANE_Y]);
size_t srcYStride = img->stride[VPX_PLANE_Y];
@@ -858,8 +870,8 @@
dstYStride, dstUVStride,
mWidth, mHeight);
}
- finishWork(*(int64_t *)img->user_priv, work, std::move(block));
- return true;
+ finishWork(((c2_cntr64_t *)img->user_priv)->peekull(), work, std::move(block));
+ return OK;
}
c2_status_t C2SoftVpxDec::drainInternal(
@@ -875,7 +887,7 @@
return C2_OMITTED;
}
- while ((outputBuffer(pool, work))) {
+ while (outputBuffer(pool, work) == OK) {
}
if (drainMode == DRAIN_COMPONENT_WITH_EOS &&
diff --git a/media/codec2/components/vpx/C2SoftVpxDec.h b/media/codec2/components/vpx/C2SoftVpxDec.h
index e51bcee..2065165 100644
--- a/media/codec2/components/vpx/C2SoftVpxDec.h
+++ b/media/codec2/components/vpx/C2SoftVpxDec.h
@@ -85,7 +85,7 @@
status_t destroyDecoder();
void finishWork(uint64_t index, const std::unique_ptr<C2Work> &work,
const std::shared_ptr<C2GraphicBlock> &block);
- bool outputBuffer(
+ status_t outputBuffer(
const std::shared_ptr<C2BlockPool> &pool,
const std::unique_ptr<C2Work> &work);
c2_status_t drainInternal(
diff --git a/media/codec2/hidl/1.0/utils/Android.bp b/media/codec2/hidl/1.0/utils/Android.bp
index bdff29a..a2930a6 100644
--- a/media/codec2/hidl/1.0/utils/Android.bp
+++ b/media/codec2/hidl/1.0/utils/Android.bp
@@ -63,6 +63,7 @@
],
header_libs: [
+ "libbinder_headers",
"libsystem_headers",
"libcodec2_internal", // private
],
diff --git a/media/codec2/hidl/client/client.cpp b/media/codec2/hidl/client/client.cpp
index c620bad..c747190 100644
--- a/media/codec2/hidl/client/client.cpp
+++ b/media/codec2/hidl/client/client.cpp
@@ -125,6 +125,9 @@
if (!mClient) {
mClient = Codec2Client::_CreateFromIndex(mIndex);
}
+ CHECK(mClient) << "Failed to create Codec2Client to service \""
+ << GetServiceNames()[mIndex] << "\". (Index = "
+ << mIndex << ").";
return mClient;
}
@@ -832,6 +835,7 @@
c2_status_t Codec2Client::ForAllServices(
const std::string &key,
+ size_t numberOfAttempts,
std::function<c2_status_t(const std::shared_ptr<Codec2Client>&)>
predicate) {
c2_status_t status = C2_NO_INIT; // no IComponentStores present
@@ -860,23 +864,31 @@
for (size_t index : indices) {
Cache& cache = Cache::List()[index];
- std::shared_ptr<Codec2Client> client{cache.getClient()};
- if (client) {
+ for (size_t tries = numberOfAttempts; tries > 0; --tries) {
+ std::shared_ptr<Codec2Client> client{cache.getClient()};
status = predicate(client);
if (status == C2_OK) {
std::scoped_lock lock{key2IndexMutex};
key2Index[key] = index; // update last known client index
return C2_OK;
+ } else if (status == C2_TRANSACTION_FAILED) {
+ LOG(WARNING) << "\"" << key << "\" failed for service \""
+ << client->getName()
+ << "\" due to transaction failure. "
+ << "(Service may have crashed.)"
+ << (tries > 1 ? " Retrying..." : "");
+ cache.invalidate();
+ continue;
}
- }
- if (wasMapped) {
- LOG(INFO) << "Could not find \"" << key << "\""
- " in the last instance. Retrying...";
- wasMapped = false;
- cache.invalidate();
+ if (wasMapped) {
+ LOG(INFO) << "\"" << key << "\" became invalid in service \""
+ << client->getName() << "\". Retrying...";
+ wasMapped = false;
+ }
+ break;
}
}
- return status; // return the last status from a valid client
+ return status; // return the last status from a valid client
}
std::shared_ptr<Codec2Client::Component>
@@ -885,35 +897,37 @@
const std::shared_ptr<Listener>& listener,
std::shared_ptr<Codec2Client>* owner,
size_t numberOfAttempts) {
- while (true) {
- std::shared_ptr<Component> component;
- c2_status_t status = ForAllServices(
- componentName,
- [owner, &component, componentName, &listener](
- const std::shared_ptr<Codec2Client> &client)
- -> c2_status_t {
- c2_status_t status = client->createComponent(componentName,
- listener,
- &component);
- if (status == C2_OK) {
- if (owner) {
- *owner = client;
- }
- } else if (status != C2_NOT_FOUND) {
- LOG(DEBUG) << "IComponentStore("
- << client->getServiceName()
- << ")::createComponent(\"" << componentName
- << "\") returned status = "
- << status << ".";
+ std::string key{"create:"};
+ key.append(componentName);
+ std::shared_ptr<Component> component;
+ c2_status_t status = ForAllServices(
+ key,
+ numberOfAttempts,
+ [owner, &component, componentName, &listener](
+ const std::shared_ptr<Codec2Client> &client)
+ -> c2_status_t {
+ c2_status_t status = client->createComponent(componentName,
+ listener,
+ &component);
+ if (status == C2_OK) {
+ if (owner) {
+ *owner = client;
}
- return status;
- });
- if (numberOfAttempts > 0 && status == C2_TRANSACTION_FAILED) {
- --numberOfAttempts;
- continue;
- }
- return component;
+ } else if (status != C2_NOT_FOUND) {
+ LOG(DEBUG) << "IComponentStore("
+ << client->getServiceName()
+ << ")::createComponent(\"" << componentName
+ << "\") returned status = "
+ << status << ".";
+ }
+ return status;
+ });
+ if (status != C2_OK) {
+ LOG(DEBUG) << "Failed to create component \"" << componentName
+ << "\" from all known services. "
+ "Last returned status = " << status << ".";
}
+ return component;
}
std::shared_ptr<Codec2Client::Interface>
@@ -921,34 +935,36 @@
const char* interfaceName,
std::shared_ptr<Codec2Client>* owner,
size_t numberOfAttempts) {
- while (true) {
- std::shared_ptr<Interface> interface;
- c2_status_t status = ForAllServices(
- interfaceName,
- [owner, &interface, interfaceName](
- const std::shared_ptr<Codec2Client> &client)
- -> c2_status_t {
- c2_status_t status = client->createInterface(interfaceName,
- &interface);
- if (status == C2_OK) {
- if (owner) {
- *owner = client;
- }
- } else if (status != C2_NOT_FOUND) {
- LOG(DEBUG) << "IComponentStore("
- << client->getServiceName()
- << ")::createInterface(\"" << interfaceName
- << "\") returned status = "
- << status << ".";
+ std::string key{"create:"};
+ key.append(interfaceName);
+ std::shared_ptr<Interface> interface;
+ c2_status_t status = ForAllServices(
+ key,
+ numberOfAttempts,
+ [owner, &interface, interfaceName](
+ const std::shared_ptr<Codec2Client> &client)
+ -> c2_status_t {
+ c2_status_t status = client->createInterface(interfaceName,
+ &interface);
+ if (status == C2_OK) {
+ if (owner) {
+ *owner = client;
}
- return status;
- });
- if (numberOfAttempts > 0 && status == C2_TRANSACTION_FAILED) {
- --numberOfAttempts;
- continue;
- }
- return interface;
+ } else if (status != C2_NOT_FOUND) {
+ LOG(DEBUG) << "IComponentStore("
+ << client->getServiceName()
+ << ")::createInterface(\"" << interfaceName
+ << "\") returned status = "
+ << status << ".";
+ }
+ return status;
+ });
+ if (status != C2_OK) {
+ LOG(DEBUG) << "Failed to create interface \"" << interfaceName
+ << "\" from all known services. "
+ "Last returned status = " << status << ".";
}
+ return interface;
}
std::vector<C2Component::Traits> const& Codec2Client::ListComponents() {
diff --git a/media/codec2/hidl/client/include/codec2/hidl/client.h b/media/codec2/hidl/client/include/codec2/hidl/client.h
index 848901d..c37407f 100644
--- a/media/codec2/hidl/client/include/codec2/hidl/client.h
+++ b/media/codec2/hidl/client/include/codec2/hidl/client.h
@@ -208,11 +208,25 @@
protected:
sp<Base> mBase;
- // Finds the first store where the predicate returns OK, and returns the last
- // predicate result. Uses key to remember the last store found, and if cached,
- // it tries that store before trying all stores (one retry).
+ // Finds the first store where the predicate returns C2_OK and returns the
+ // last predicate result. The predicate will be tried on all stores. The
+ // function will return C2_OK the first time the predicate returns C2_OK,
+ // or it will return the value from the last time that predicate is tried.
+ // (The latter case corresponds to a failure on every store.) The order of
+ // the stores to try is the same as the return value of GetServiceNames().
+ //
+ // key is used to remember the last store with which the predicate last
+ // succeeded. If the last successful store is cached, it will be tried
+ // first before all the stores are tried. Note that the last successful
+ // store will be tried twice---first before all the stores, and another time
+ // with all the stores.
+ //
+ // If an attempt to evaluate the predicate results in a transaction failure,
+ // repeated attempts will be made until the predicate returns without a
+ // transaction failure or numberOfAttempts attempts have been made.
static c2_status_t ForAllServices(
const std::string& key,
+ size_t numberOfAttempts,
std::function<c2_status_t(std::shared_ptr<Codec2Client> const&)>
predicate);
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 4a31953..78ddd6d 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1286,7 +1286,8 @@
{
Mutexed<Config>::Locked config(mConfig);
inputFormat = config->mInputFormat;
- outputFormat = config->mOutputFormat;
+ // start triggers format dup
+ outputFormat = config->mOutputFormat = config->mOutputFormat->dup();
if (config->mInputSurface) {
err2 = config->mInputSurface->start();
}
@@ -1295,6 +1296,8 @@
mCallback->onError(err2, ACTION_CODE_FATAL);
return;
}
+ // We're not starting after flush.
+ (void)mSentConfigAfterResume.test_and_set();
err2 = mChannel->start(inputFormat, outputFormat);
if (err2 != OK) {
mCallback->onError(err2, ACTION_CODE_FATAL);
@@ -1523,18 +1526,26 @@
}
void CCodec::signalResume() {
- auto setResuming = [this] {
+ std::shared_ptr<Codec2Client::Component> comp;
+ auto setResuming = [this, &comp] {
Mutexed<State>::Locked state(mState);
if (state->get() != FLUSHED) {
return UNKNOWN_ERROR;
}
state->set(RESUMING);
+ comp = state->comp;
return OK;
};
if (tryAndReportOnError(setResuming) != OK) {
return;
}
+ mSentConfigAfterResume.clear();
+ {
+ Mutexed<Config>::Locked config(mConfig);
+ config->queryConfiguration(comp);
+ }
+
(void)mChannel->start(nullptr, nullptr);
{
@@ -1730,7 +1741,7 @@
// handle configuration changes in work done
Mutexed<Config>::Locked config(mConfig);
- bool changed = false;
+ bool changed = !mSentConfigAfterResume.test_and_set();
Config::Watcher<C2StreamInitDataInfo::output> initData =
config->watch<C2StreamInitDataInfo::output>();
if (!work->worklets.empty()
@@ -1762,7 +1773,9 @@
++stream;
}
- changed = config->updateConfiguration(updates, config->mOutputDomain);
+ if (config->updateConfiguration(updates, config->mOutputDomain)) {
+ changed = true;
+ }
// copy standard infos to graphic buffers if not already present (otherwise, we
// may overwrite the actual intermediate value with a final value)
diff --git a/media/codec2/sfplugin/CCodec.h b/media/codec2/sfplugin/CCodec.h
index b0b3c4f..a580d1d 100644
--- a/media/codec2/sfplugin/CCodec.h
+++ b/media/codec2/sfplugin/CCodec.h
@@ -17,6 +17,7 @@
#ifndef C_CODEC_H_
#define C_CODEC_H_
+#include <atomic>
#include <chrono>
#include <list>
#include <memory>
@@ -175,6 +176,7 @@
typedef CCodecConfig Config;
Mutexed<Config> mConfig;
Mutexed<std::list<std::unique_ptr<C2Work>>> mWorkDoneQueue;
+ std::atomic_flag mSentConfigAfterResume;
friend class CCodecCallbackImpl;
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 375ce17..a4c30fa 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1073,7 +1073,7 @@
} else {
output->buffers.reset(new LinearOutputBuffers(mName));
}
- output->buffers->setFormat(outputFormat->dup());
+ output->buffers->setFormat(outputFormat);
// Try to set output surface to created block pool if given.
@@ -1277,6 +1277,24 @@
std::unique_ptr<C2Work> work,
const sp<AMessage> &outputFormat,
const C2StreamInitDataInfo::output *initData) {
+ if (outputFormat != nullptr) {
+ Mutexed<Output>::Locked output(mOutput);
+ ALOGD("[%s] onWorkDone: output format changed to %s",
+ mName, outputFormat->debugString().c_str());
+ output->buffers->setFormat(outputFormat);
+
+ AString mediaType;
+ if (outputFormat->findString(KEY_MIME, &mediaType)
+ && mediaType == MIMETYPE_AUDIO_RAW) {
+ int32_t channelCount;
+ int32_t sampleRate;
+ if (outputFormat->findInt32(KEY_CHANNEL_COUNT, &channelCount)
+ && outputFormat->findInt32(KEY_SAMPLE_RATE, &sampleRate)) {
+ output->buffers->updateSkipCutBuffer(sampleRate, channelCount);
+ }
+ }
+ }
+
if ((work->input.ordinal.frameIndex - mFirstValidFrameIndex.load()).peek() < 0) {
// Discard frames from previous generation.
ALOGD("[%s] Discard frames from previous generation.", mName);
@@ -1454,24 +1472,6 @@
}
}
- if (outputFormat != nullptr) {
- Mutexed<Output>::Locked output(mOutput);
- ALOGD("[%s] onWorkDone: output format changed to %s",
- mName, outputFormat->debugString().c_str());
- output->buffers->setFormat(outputFormat);
-
- AString mediaType;
- if (outputFormat->findString(KEY_MIME, &mediaType)
- && mediaType == MIMETYPE_AUDIO_RAW) {
- int32_t channelCount;
- int32_t sampleRate;
- if (outputFormat->findInt32(KEY_CHANNEL_COUNT, &channelCount)
- && outputFormat->findInt32(KEY_SAMPLE_RATE, &sampleRate)) {
- output->buffers->updateSkipCutBuffer(sampleRate, channelCount);
- }
- }
- }
-
int32_t flags = 0;
if (worklet->output.flags & C2FrameData::FLAG_END_OF_STREAM) {
flags |= MediaCodec::BUFFER_FLAG_EOS;
diff --git a/media/codec2/vndk/Android.bp b/media/codec2/vndk/Android.bp
index 6fbad0a..52cc7ad 100644
--- a/media/codec2/vndk/Android.bp
+++ b/media/codec2/vndk/Android.bp
@@ -71,8 +71,6 @@
"libutils",
],
- tidy: false, // b/146435095, clang-tidy segmentation fault
-
cflags: [
"-Werror",
"-Wall",
diff --git a/media/codec2/vndk/C2AllocatorIon.cpp b/media/codec2/vndk/C2AllocatorIon.cpp
index 752bc46..0470a31 100644
--- a/media/codec2/vndk/C2AllocatorIon.cpp
+++ b/media/codec2/vndk/C2AllocatorIon.cpp
@@ -600,7 +600,7 @@
}
std::shared_ptr<C2AllocationIon> alloc
- = std::make_shared<C2AllocationIon>(dup(mIonFd), capacity, align, heapMask, flags, mTraits->id);
+ = std::make_shared<C2AllocationIon>(dup(mIonFd), capacity, align, heapMask, flags, getId());
ret = alloc->status();
if (ret == C2_OK) {
*allocation = alloc;
@@ -622,7 +622,7 @@
// TODO: get capacity and validate it
const C2HandleIon *h = static_cast<const C2HandleIon*>(handle);
std::shared_ptr<C2AllocationIon> alloc
- = std::make_shared<C2AllocationIon>(dup(mIonFd), h->size(), h->bufferFd(), mTraits->id);
+ = std::make_shared<C2AllocationIon>(dup(mIonFd), h->size(), h->bufferFd(), getId());
c2_status_t ret = alloc->status();
if (ret == C2_OK) {
*allocation = alloc;
diff --git a/media/codec2/vndk/C2Store.cpp b/media/codec2/vndk/C2Store.cpp
index 5b2bd7b..e0408b7 100644
--- a/media/codec2/vndk/C2Store.cpp
+++ b/media/codec2/vndk/C2Store.cpp
@@ -35,6 +35,10 @@
#include <memory>
#include <mutex>
+#ifdef __ANDROID_APEX__
+#include <android-base/properties.h>
+#endif
+
namespace android {
/**
@@ -599,9 +603,33 @@
struct Setter {
static C2R setIonUsage(bool /* mayBlock */, C2P<C2StoreIonUsageInfo> &me) {
+#ifdef __ANDROID_APEX__
+ static int32_t defaultHeapMask = [] {
+ int32_t heapmask = base::GetIntProperty(
+ "ro.com.android.media.swcodec.ion.heapmask", int32_t(0xFFFFFFFF));
+ ALOGD("Default ION heapmask = %d", heapmask);
+ return heapmask;
+ }();
+ static int32_t defaultFlags = [] {
+ int32_t flags = base::GetIntProperty(
+ "ro.com.android.media.swcodec.ion.flags", 0);
+ ALOGD("Default ION flags = %d", flags);
+ return flags;
+ }();
+ static uint32_t defaultAlign = [] {
+ uint32_t align = base::GetUintProperty(
+ "ro.com.android.media.swcodec.ion.align", 0u);
+ ALOGD("Default ION align = %d", align);
+ return align;
+ }();
+ me.set().heapMask = defaultHeapMask;
+ me.set().allocFlags = defaultFlags;
+ me.set().minAlignment = defaultAlign;
+#else
me.set().heapMask = ~0;
me.set().allocFlags = 0;
me.set().minAlignment = 0;
+#endif
return C2R::Ok();
}
};
diff --git a/media/codec2/vndk/util/C2InterfaceUtils.cpp b/media/codec2/vndk/util/C2InterfaceUtils.cpp
index 61ec911..0c1729b 100644
--- a/media/codec2/vndk/util/C2InterfaceUtils.cpp
+++ b/media/codec2/vndk/util/C2InterfaceUtils.cpp
@@ -216,9 +216,14 @@
if (limit.contains(minMask) && contains(minMask)) {
values[0] = minMask;
// keep only flags that are covered by limit
- std::remove_if(values.begin(), values.end(), [&limit, minMask](const C2Value::Primitive &v) -> bool {
- T value = v.ref<ValueType>() | minMask;
- return value == minMask || !limit.contains(value); });
+ values.erase(std::remove_if(values.begin(), values.end(),
+ [&limit, minMask](
+ const C2Value::Primitive &v) -> bool {
+ T value = v.ref<ValueType>() | minMask;
+ return value == minMask ||
+ !limit.contains(value);
+ }),
+ values.end());
// we also need to do it vice versa
for (const C2Value::Primitive &v : _mValues) {
T value = v.ref<ValueType>() | minMask;
@@ -264,24 +269,33 @@
template<typename T>
C2SupportedValueSet<T> C2SupportedValueSet<T>::limitedTo(const C2SupportedValueSet<T> &limit) const {
std::vector<C2Value::Primitive> values = _mValues; // make a copy
- std::remove_if(values.begin(), values.end(), [&limit](const C2Value::Primitive &v) -> bool {
- return !limit.contains(v.ref<ValueType>()); });
+ values.erase(std::remove_if(values.begin(), values.end(),
+ [&limit](const C2Value::Primitive &v) -> bool {
+ return !limit.contains(v.ref<ValueType>());
+ }),
+ values.end());
return C2SupportedValueSet(std::move(values));
}
template<typename T>
C2SupportedValueSet<T> C2SupportedValueSet<T>::limitedTo(const C2SupportedRange<T> &limit) const {
std::vector<C2Value::Primitive> values = _mValues; // make a copy
- std::remove_if(values.begin(), values.end(), [&limit](const C2Value::Primitive &v) -> bool {
- return !limit.contains(v.ref<ValueType>()); });
+ values.erase(std::remove_if(values.begin(), values.end(),
+ [&limit](const C2Value::Primitive &v) -> bool {
+ return !limit.contains(v.ref<ValueType>());
+ }),
+ values.end());
return C2SupportedValueSet(std::move(values));
}
template<typename T>
C2SupportedValueSet<T> C2SupportedValueSet<T>::limitedTo(const C2SupportedFlags<T> &limit) const {
std::vector<C2Value::Primitive> values = _mValues; // make a copy
- std::remove_if(values.begin(), values.end(), [&limit](const C2Value::Primitive &v) -> bool {
- return !limit.contains(v.ref<ValueType>()); });
+ values.erase(std::remove_if(values.begin(), values.end(),
+ [&limit](const C2Value::Primitive &v) -> bool {
+ return !limit.contains(v.ref<ValueType>());
+ }),
+ values.end());
return C2SupportedValueSet(std::move(values));
}
diff --git a/media/extractors/amr/AMRExtractor.cpp b/media/extractors/amr/AMRExtractor.cpp
index ffeff42..26431a4 100644
--- a/media/extractors/amr/AMRExtractor.cpp
+++ b/media/extractors/amr/AMRExtractor.cpp
@@ -144,6 +144,7 @@
AMRExtractor::AMRExtractor(DataSourceHelper *source)
: mDataSource(source),
+ mMeta(NULL),
mInitCheck(NO_INIT),
mOffsetTableLength(0) {
float confidence;
@@ -191,7 +192,9 @@
AMRExtractor::~AMRExtractor() {
delete mDataSource;
- AMediaFormat_delete(mMeta);
+ if (mMeta) {
+ AMediaFormat_delete(mMeta);
+ }
}
media_status_t AMRExtractor::getMetaData(AMediaFormat *meta) {
diff --git a/media/extractors/mp4/ItemTable.cpp b/media/extractors/mp4/ItemTable.cpp
index 8c8e6d1..0773387 100644
--- a/media/extractors/mp4/ItemTable.cpp
+++ b/media/extractors/mp4/ItemTable.cpp
@@ -700,8 +700,8 @@
}
private:
- uint32_t mWidth;
- uint32_t mHeight;
+ int32_t mWidth;
+ int32_t mHeight;
};
status_t IspeBox::parse(off64_t offset, size_t size) {
@@ -715,12 +715,19 @@
if (size < 8) {
return ERROR_MALFORMED;
}
- if (!source()->getUInt32(offset, &mWidth)
- || !source()->getUInt32(offset + 4, &mHeight)) {
+ if (!source()->getUInt32(offset, (uint32_t *)&mWidth)
+ || !source()->getUInt32(offset + 4, (uint32_t *)&mHeight)) {
return ERROR_IO;
}
- ALOGV("property ispe: %dx%d", mWidth, mHeight);
+ // Validate that the dimension doesn't cause overflow on calculated max input size.
+ // Max input size is width*height*1.5, restrict width*height to 1<<29 so that
+ // we don't need to cast to int64_t when doing mults.
+ if (mWidth <= 0 || mHeight <= 0 || mWidth > (1 << 29) / mHeight) {
+ return ERROR_MALFORMED;
+ }
+
+ ALOGV("property ispe: %dx%d", mWidth, mHeight);
return OK;
}
@@ -1524,8 +1531,9 @@
default: break; // don't set if invalid
}
}
+ // we validated no overflow in IspeBox::parse()
AMediaFormat_setInt32(meta,
- AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, image->width * image->height * 1.5);
+ AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, image->width * image->height * 3 / 2);
if (!image->thumbnails.empty()) {
ssize_t thumbItemIndex = mItemIdToItemMap.indexOfKey(image->thumbnails[0]);
@@ -1561,8 +1569,9 @@
AMEDIAFORMAT_KEY_TILE_WIDTH, image->width);
AMediaFormat_setInt32(meta,
AMEDIAFORMAT_KEY_TILE_HEIGHT, image->height);
+ // we validated no overflow in IspeBox::parse()
AMediaFormat_setInt32(meta,
- AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, image->width * image->height * 1.5);
+ AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, image->width * image->height * 3 / 2);
}
if (image->hvcc == NULL) {
diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp
index 9d5890c..86ed610 100755
--- a/media/extractors/mp4/MPEG4Extractor.cpp
+++ b/media/extractors/mp4/MPEG4Extractor.cpp
@@ -1561,8 +1561,12 @@
{
*offset += chunk_size;
- if (mLastTrack == NULL)
+ // the absolute minimum size of a compliant mett box is 11 bytes:
+ // 6 byte reserved, 2 byte index, null byte, one char mime_format, null byte
+ // The resulting mime_format would be invalid at that size though.
+ if (mLastTrack == NULL || chunk_data_size < 11) {
return ERROR_MALFORMED;
+ }
auto buffer = heapbuffer<uint8_t>(chunk_data_size);
if (buffer.get() == NULL) {
@@ -1574,10 +1578,24 @@
return ERROR_IO;
}
+ // ISO-14496-12:
+ // int8 reserved[6]; // should be all zeroes
+ // int16_t data_reference_index;
+ // char content_encoding[]; // null terminated, optional (= just the null byte)
+ // char mime_format[]; // null terminated, mandatory
+ // optional other boxes
+ //
+ // API < 29:
+ // char mime_format[]; // null terminated
+ //
+ // API >= 29
+ // char mime_format[]; // null terminated
+ // char mime_format[]; // null terminated
+
// Prior to API 29, the metadata track was not compliant with ISO/IEC
// 14496-12-2015. This led to some ISO-compliant parsers failing to read the
// metatrack. As of API 29 and onwards, a change was made to metadata track to
- // make it compliant with the standard. The workaround is to write the
+ // make it somewhat compatible with the standard. The workaround is to write the
// null-terminated mime_format string twice. This allows compliant parsers to
// read the missing reserved, data_reference_index, and content_encoding fields
// from the first mime_type string. The actual mime_format field would then be
@@ -1586,27 +1604,27 @@
// as it would only read the first null-terminated mime_format string. To enable
// reading metadata tracks generated from both the non-compliant and compliant
// formats, a check needs to be done to see which format is used.
- int null_pos = 0;
- const unsigned char *str = buffer.get();
- while (null_pos < chunk_data_size) {
- if (*(str + null_pos) == '\0') {
- break;
- }
- ++null_pos;
- }
+ const char *str = (const char*) buffer.get();
+ size_t string_length = strnlen(str, chunk_data_size);
- if (null_pos == chunk_data_size - 1) {
- // This is not a standard ompliant metadata track.
- String8 mimeFormat((const char *)(buffer.get()), chunk_data_size);
- AMediaFormat_setString(mLastTrack->meta,
- AMEDIAFORMAT_KEY_MIME, mimeFormat.string());
+ if (string_length == chunk_data_size - 1) {
+ // This is likely a pre API 29 file, since it's a single null terminated
+ // string filling the entire box.
+ AMediaFormat_setString(mLastTrack->meta, AMEDIAFORMAT_KEY_MIME, str);
} else {
- // This is a standard compliant metadata track.
- String8 contentEncoding((const char *)(buffer.get() + 8));
- String8 mimeFormat((const char *)(buffer.get() + 8 + contentEncoding.size() + 1),
- chunk_data_size - 8 - contentEncoding.size() - 1);
- AMediaFormat_setString(mLastTrack->meta,
- AMEDIAFORMAT_KEY_MIME, mimeFormat.string());
+ // This might be a fully compliant metadata track, a "double mime" compatibility
+ // track, or anything else, including a single non-terminated string, so we need
+ // to determine the length of each string we want to parse out of the box.
+ size_t encoding_length = strnlen(str + 8, chunk_data_size - 8);
+ if (encoding_length + 8 >= chunk_data_size - 2) {
+ // the encoding extends to the end of the box, so there's no mime_format
+ return ERROR_MALFORMED;
+ }
+ String8 contentEncoding(str + 8, encoding_length);
+ String8 mimeFormat(str + 8 + encoding_length + 1,
+ chunk_data_size - 8 - encoding_length - 1);
+ AMediaFormat_setString(mLastTrack->meta,
+ AMEDIAFORMAT_KEY_MIME, mimeFormat.string());
}
break;
}
@@ -5775,11 +5793,11 @@
meta, AMEDIAFORMAT_KEY_TIME_US, ((long double)cts * 1000000) / mTimescale);
AMediaFormat_setInt32(meta, AMEDIAFORMAT_KEY_IS_SYNC_FRAME, 1);
- int32_t byteOrder;
- AMediaFormat_getInt32(mFormat,
+ int32_t byteOrder = 0;
+ bool isGetBigEndian = AMediaFormat_getInt32(mFormat,
AMEDIAFORMAT_KEY_PCM_BIG_ENDIAN, &byteOrder);
- if (byteOrder == 1) {
+ if (isGetBigEndian && byteOrder == 1) {
// Big-endian -> little-endian
uint16_t *dstData = (uint16_t *)buf;
uint16_t *srcData = (uint16_t *)buf;
diff --git a/media/extractors/mp4/SampleTable.cpp b/media/extractors/mp4/SampleTable.cpp
index bf29bf1..9dddf2c 100644
--- a/media/extractors/mp4/SampleTable.cpp
+++ b/media/extractors/mp4/SampleTable.cpp
@@ -655,6 +655,7 @@
}
mSampleTimeEntries = new (std::nothrow) SampleTimeEntry[mNumSampleSizes];
+ memset(mSampleTimeEntries, 0, sizeof(SampleTimeEntry) * mNumSampleSizes);
if (!mSampleTimeEntries) {
ALOGE("Cannot allocate sample entry table with %llu entries.",
(unsigned long long)mNumSampleSizes);
diff --git a/media/extractors/tests/AndroidTest.xml b/media/extractors/tests/AndroidTest.xml
new file mode 100644
index 0000000..6bb2c8a
--- /dev/null
+++ b/media/extractors/tests/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for extractor unit tests">
+ <option name="test-suite-tag" value="ExtractorUnitTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="ExtractorUnitTest->/data/local/tmp/ExtractorUnitTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/extractors/tests/extractor.zip?unzip=true"
+ value="/data/local/tmp/ExtractorUnitTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="ExtractorUnitTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/ExtractorUnitTestRes/" />
+ </test>
+</configuration>
diff --git a/media/extractors/tests/ExtractorUnitTest.cpp b/media/extractors/tests/ExtractorUnitTest.cpp
index 518166e..fca66a4 100644
--- a/media/extractors/tests/ExtractorUnitTest.cpp
+++ b/media/extractors/tests/ExtractorUnitTest.cpp
@@ -22,6 +22,7 @@
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaDataUtils.h>
+#include <media/stagefright/foundation/OpusHeader.h>
#include "aac/AACExtractor.h"
#include "amr/AMRExtractor.h"
@@ -43,7 +44,9 @@
#define OUTPUT_DUMP_FILE "/data/local/tmp/extractorOutput"
constexpr int32_t kMaxCount = 10;
-constexpr int32_t kOpusSeekPreRollUs = 80000; // 80 ms;
+constexpr int32_t kAudioDefaultSampleDuration = 20000; // 20ms
+constexpr int32_t kRandomSeekToleranceUs = 2 * kAudioDefaultSampleDuration; // 40 ms;
+constexpr int32_t kRandomSeed = 700;
static ExtractorUnitTestEnvironment *gEnv = nullptr;
@@ -168,6 +171,47 @@
return 0;
}
+void randomSeekTest(MediaTrackHelper *track, int64_t clipDuration) {
+ int32_t status = 0;
+ int32_t seekCount = 0;
+ bool hasTimestamp = false;
+ vector<int64_t> seekToTimeStamp;
+ string seekPtsString;
+
+ srand(kRandomSeed);
+ while (seekCount < kMaxCount) {
+ int64_t timeStamp = ((double)rand() / RAND_MAX) * clipDuration;
+ seekToTimeStamp.push_back(timeStamp);
+ seekPtsString.append(to_string(timeStamp));
+ seekPtsString.append(", ");
+ seekCount++;
+ }
+
+ for (int64_t seekPts : seekToTimeStamp) {
+ MediaTrackHelper::ReadOptions *options = new MediaTrackHelper::ReadOptions(
+ CMediaTrackReadOptions::SEEK_CLOSEST | CMediaTrackReadOptions::SEEK, seekPts);
+ ASSERT_NE(options, nullptr) << "Cannot create read option";
+
+ MediaBufferHelper *buffer = nullptr;
+ status = track->read(&buffer, options);
+ if (buffer) {
+ AMediaFormat *metaData = buffer->meta_data();
+ int64_t timeStamp = 0;
+ hasTimestamp = AMediaFormat_getInt64(metaData, AMEDIAFORMAT_KEY_TIME_US, &timeStamp);
+ ASSERT_TRUE(hasTimestamp) << "Extractor didn't set timestamp for the given sample";
+
+ buffer->release();
+ EXPECT_LE(abs(timeStamp - seekPts), kRandomSeekToleranceUs)
+ << "Seek unsuccessful. Expected timestamp range ["
+ << seekPts - kRandomSeekToleranceUs << ", " << seekPts + kRandomSeekToleranceUs
+ << "] "
+ << "received " << timeStamp << ", list of input seek timestamps ["
+ << seekPtsString << "]";
+ }
+ delete options;
+ }
+}
+
void getSeekablePoints(vector<int64_t> &seekablePoints, MediaTrackHelper *track) {
int32_t status = 0;
if (!seekablePoints.empty()) {
@@ -380,9 +424,7 @@
}
TEST_P(ExtractorUnitTest, SeekTest) {
- // Both Flac and Wav extractor can give samples from any pts and mark the given sample as
- // sync frame. So, this seek test is not applicable to FLAC and WAV extractors
- if (mDisableTest || mExtractorName == FLAC || mExtractorName == WAV) return;
+ if (mDisableTest) return;
ALOGV("Validates %s Extractor behaviour for different seek modes", GetParam().first.c_str());
string inputFileName = gEnv->getRes() + GetParam().second;
@@ -415,6 +457,32 @@
MediaBufferGroup *bufferGroup = new MediaBufferGroup();
status = cTrack->start(track, bufferGroup->wrap());
ASSERT_EQ(OK, (media_status_t)status) << "Failed to start the track";
+
+ // For Flac, Wav and Midi extractor, all samples are seek points.
+ // We cannot create list of all seekable points for these.
+ // This means that if we pass a seekToTimeStamp between two seek points, we may
+ // end up getting the timestamp of next sample as a seekable timestamp.
+ // This timestamp may/may not be a part of the seekable point vector thereby failing the
+ // test. So we test these extractors using random seek test.
+ if (mExtractorName == FLAC || mExtractorName == WAV || mExtractorName == MIDI) {
+ AMediaFormat *trackMeta = AMediaFormat_new();
+ ASSERT_NE(trackMeta, nullptr) << "AMediaFormat_new returned null AMediaformat";
+
+ status = mExtractor->getTrackMetaData(trackMeta, idx, 1);
+ ASSERT_EQ(OK, (media_status_t)status) << "Failed to get trackMetaData";
+
+ int64_t clipDuration = 0;
+ AMediaFormat_getInt64(trackMeta, AMEDIAFORMAT_KEY_DURATION, &clipDuration);
+ ASSERT_GT(clipDuration, 0) << "Invalid clip duration ";
+ randomSeekTest(track, clipDuration);
+ AMediaFormat_delete(trackMeta);
+ continue;
+ }
+ // Request seekable points for remaining extractors which will be used to validate the seek
+ // accuracy for the extractors. Depending on SEEK Mode, we expect the extractors to return
+ // the expected sync frame. We don't prefer random seek test for these extractors because
+ // they aren't expected to seek to random samples. MP4 for instance can seek to
+ // next/previous sync frames but not to samples between two sync frames.
getSeekablePoints(seekablePoints, track);
ASSERT_GT(seekablePoints.size(), 0)
<< "Failed to get seekable points for " << GetParam().first << " extractor";
@@ -425,9 +493,31 @@
ASSERT_EQ(OK, (media_status_t)status) << "Failed to get track meta data";
bool isOpus = false;
+ int64_t opusSeekPreRollUs = 0;
const char *mime;
AMediaFormat_getString(trackFormat, AMEDIAFORMAT_KEY_MIME, &mime);
- if (!strcmp(mime, "audio/opus")) isOpus = true;
+ if (!strcmp(mime, "audio/opus")) {
+ isOpus = true;
+ void *seekPreRollBuf = nullptr;
+ size_t size = 0;
+ if (!AMediaFormat_getBuffer(trackFormat, "csd-2", &seekPreRollBuf, &size)) {
+ size_t opusHeadSize = 0;
+ size_t codecDelayBufSize = 0;
+ size_t seekPreRollBufSize = 0;
+ void *csdBuffer = nullptr;
+ void *opusHeadBuf = nullptr;
+ void *codecDelayBuf = nullptr;
+ AMediaFormat_getBuffer(trackFormat, "csd-0", &csdBuffer, &size);
+ ASSERT_NE(csdBuffer, nullptr);
+
+ GetOpusHeaderBuffers((uint8_t *)csdBuffer, size, &opusHeadBuf, &opusHeadSize,
+ &codecDelayBuf, &codecDelayBufSize, &seekPreRollBuf,
+ &seekPreRollBufSize);
+ }
+ ASSERT_NE(seekPreRollBuf, nullptr)
+ << "Invalid track format. SeekPreRoll info missing for Opus file";
+ opusSeekPreRollUs = *((int64_t *)seekPreRollBuf);
+ }
AMediaFormat_delete(trackFormat);
int32_t seekIdx = 0;
@@ -448,7 +538,7 @@
// extractor is calculated based on (seekPts - seekPreRollUs).
// So we add the preRoll value to the timeStamp we want to seek to.
if (isOpus) {
- seekToTimeStamp += kOpusSeekPreRollUs;
+ seekToTimeStamp += opusSeekPreRollUs;
}
MediaTrackHelper::ReadOptions *options = new MediaTrackHelper::ReadOptions(
@@ -496,8 +586,6 @@
seekablePoints.clear();
}
-// TODO: (b/145332185)
-// Add MIDI inputs
INSTANTIATE_TEST_SUITE_P(ExtractorUnitTestAll, ExtractorUnitTest,
::testing::Values(make_pair("aac", "loudsoftaac.aac"),
make_pair("amr", "testamr.amr"),
@@ -507,6 +595,7 @@
make_pair("mpeg2ts", "segment000001.ts"),
make_pair("flac", "sinesweepflac.flac"),
make_pair("ogg", "testopus.opus"),
+ make_pair("midi", "midi_a.mid"),
make_pair("mkv", "sinesweepvorbis.mkv"),
make_pair("mpeg4", "sinesweepoggmp4.mp4"),
make_pair("mp3", "sinesweepmp3lame.mp3"),
diff --git a/media/extractors/tests/README.md b/media/extractors/tests/README.md
index 6e02d3e..69538b6 100644
--- a/media/extractors/tests/README.md
+++ b/media/extractors/tests/README.md
@@ -22,8 +22,8 @@
adb push ${OUT}/data/nativetest/ExtractorUnitTest/ExtractorUnitTest /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://drive.google.com/drive/folders/1Z9nCIRB6pGLvb5mPkF8BURa5Nc6cY9pY). Push these files into device for testing.
-Download extractor folder and push all the files in this folder to /data/local/tmp/ on the device.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/extractors/tests/extractor.zip). Download, unzip and push these files into device for testing.
+
```
adb push extractor /data/local/tmp/
```
@@ -32,3 +32,8 @@
```
adb shell /data/local/tmp/ExtractorUnitTest -P /data/local/tmp/extractor/
```
+Alternatively, the test can also be run using atest command.
+
+```
+atest ExtractorUnitTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libaaudio/examples/input_monitor/Android.bp b/media/libaaudio/examples/input_monitor/Android.bp
index 5d399b5..d8c5843 100644
--- a/media/libaaudio/examples/input_monitor/Android.bp
+++ b/media/libaaudio/examples/input_monitor/Android.bp
@@ -5,7 +5,6 @@
cflags: ["-Wall", "-Werror"],
shared_libs: ["libaaudio"],
header_libs: ["libaaudio_example_utils"],
- pack_relocations: false,
}
cc_test {
@@ -15,5 +14,4 @@
cflags: ["-Wall", "-Werror"],
shared_libs: ["libaaudio"],
header_libs: ["libaaudio_example_utils"],
- pack_relocations: false,
}
diff --git a/media/libaaudio/examples/loopback/Android.bp b/media/libaaudio/examples/loopback/Android.bp
index 53e5020..5b7d956 100644
--- a/media/libaaudio/examples/loopback/Android.bp
+++ b/media/libaaudio/examples/loopback/Android.bp
@@ -9,5 +9,4 @@
"libaudioutils",
],
header_libs: ["libaaudio_example_utils"],
- pack_relocations: false,
}
diff --git a/media/libaaudio/examples/write_sine/Android.bp b/media/libaaudio/examples/write_sine/Android.bp
index cc80861..aa25e67 100644
--- a/media/libaaudio/examples/write_sine/Android.bp
+++ b/media/libaaudio/examples/write_sine/Android.bp
@@ -4,7 +4,6 @@
cflags: ["-Wall", "-Werror"],
shared_libs: ["libaaudio"],
header_libs: ["libaaudio_example_utils"],
- pack_relocations: false,
}
cc_test {
@@ -13,5 +12,4 @@
cflags: ["-Wall", "-Werror"],
shared_libs: ["libaaudio"],
header_libs: ["libaaudio_example_utils"],
- pack_relocations: false,
}
diff --git a/media/libaudioclient/AudioAttributes.cpp b/media/libaudioclient/AudioAttributes.cpp
index 1ee6930..ff4ba06 100644
--- a/media/libaudioclient/AudioAttributes.cpp
+++ b/media/libaudioclient/AudioAttributes.cpp
@@ -57,7 +57,7 @@
parcel->writeInt32(0);
} else {
parcel->writeInt32(1);
- parcel->writeUtf8AsUtf16(mAttributes.tags);
+ parcel->writeUtf8AsUtf16(std::string(mAttributes.tags));
}
parcel->writeInt32(static_cast<int32_t>(mStreamType));
parcel->writeUint32(static_cast<uint32_t>(mGroupId));
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index a1b04ca..271e186 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -884,7 +884,6 @@
{
// previous and new IAudioRecord sequence numbers are used to detect track re-creation
uint32_t oldSequence = 0;
- uint32_t newSequence;
Proxy::Buffer buffer;
status_t status = NO_ERROR;
@@ -902,7 +901,7 @@
// start of lock scope
AutoMutex lock(mLock);
- newSequence = mSequence;
+ uint32_t newSequence = mSequence;
// did previous obtainBuffer() fail due to media server death or voluntary invalidation?
if (status == DEAD_OBJECT) {
// re-create track, unless someone else has already done so
@@ -939,6 +938,7 @@
audioBuffer->frameCount = buffer.mFrameCount;
audioBuffer->size = buffer.mFrameCount * mFrameSize;
audioBuffer->raw = buffer.mRaw;
+ audioBuffer->sequence = oldSequence;
if (nonContig != NULL) {
*nonContig = buffer.mNonContig;
}
@@ -959,6 +959,12 @@
buffer.mRaw = audioBuffer->raw;
AutoMutex lock(mLock);
+ if (audioBuffer->sequence != mSequence) {
+ // This Buffer came from a different IAudioRecord instance, so ignore the releaseBuffer
+ ALOGD("%s is no-op due to IAudioRecord sequence mismatch %u != %u",
+ __func__, audioBuffer->sequence, mSequence);
+ return;
+ }
mInOverrun = false;
mProxy->releaseBuffer(&buffer);
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 480930b..481becc 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -783,6 +783,13 @@
// ---------------------------------------------------------------------------
+void AudioSystem::onNewAudioModulesAvailable()
+{
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) return;
+ aps->onNewAudioModulesAvailable();
+}
+
status_t AudioSystem::setDeviceConnectionState(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 4a80cd3..9a66d48 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -1665,7 +1665,6 @@
{
// previous and new IAudioTrack sequence numbers are used to detect track re-creation
uint32_t oldSequence = 0;
- uint32_t newSequence;
Proxy::Buffer buffer;
status_t status = NO_ERROR;
@@ -1682,7 +1681,7 @@
{ // start of lock scope
AutoMutex lock(mLock);
- newSequence = mSequence;
+ uint32_t newSequence = mSequence;
// did previous obtainBuffer() fail due to media server death or voluntary invalidation?
if (status == DEAD_OBJECT) {
// re-create track, unless someone else has already done so
@@ -1729,6 +1728,7 @@
audioBuffer->frameCount = buffer.mFrameCount;
audioBuffer->size = buffer.mFrameCount * mFrameSize;
audioBuffer->raw = buffer.mRaw;
+ audioBuffer->sequence = oldSequence;
if (nonContig != NULL) {
*nonContig = buffer.mNonContig;
}
@@ -1752,6 +1752,12 @@
buffer.mRaw = audioBuffer->raw;
AutoMutex lock(mLock);
+ if (audioBuffer->sequence != mSequence) {
+ // This Buffer came from a different IAudioTrack instance, so ignore the releaseBuffer
+ ALOGD("%s is no-op due to IAudioTrack sequence mismatch %u != %u",
+ __func__, audioBuffer->sequence, mSequence);
+ return;
+ }
mReleased += stepCount;
mInUnderrun = false;
mProxy->releaseBuffer(&buffer);
diff --git a/media/libaudioclient/IAudioFlinger.cpp b/media/libaudioclient/IAudioFlinger.cpp
index 3f8b52b..53d46f1 100644
--- a/media/libaudioclient/IAudioFlinger.cpp
+++ b/media/libaudioclient/IAudioFlinger.cpp
@@ -1361,10 +1361,14 @@
}
case GET_EFFECT_DESCRIPTOR: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
- effect_uuid_t uuid;
- data.read(&uuid, sizeof(effect_uuid_t));
- effect_uuid_t type;
- data.read(&type, sizeof(effect_uuid_t));
+ effect_uuid_t uuid = {};
+ if (data.read(&uuid, sizeof(effect_uuid_t)) != NO_ERROR) {
+ android_errorWriteLog(0x534e4554, "139417189");
+ }
+ effect_uuid_t type = {};
+ if (data.read(&type, sizeof(effect_uuid_t)) != NO_ERROR) {
+ android_errorWriteLog(0x534e4554, "139417189");
+ }
uint32_t preferredTypeFlag = data.readUint32();
effect_descriptor_t desc = {};
status_t status = getEffectDescriptor(&uuid, &type, preferredTypeFlag, &desc);
diff --git a/media/libaudioclient/IAudioPolicyService.cpp b/media/libaudioclient/IAudioPolicyService.cpp
index 0facaf8..24d7c92 100644
--- a/media/libaudioclient/IAudioPolicyService.cpp
+++ b/media/libaudioclient/IAudioPolicyService.cpp
@@ -108,6 +108,7 @@
SET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY,
REMOVE_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY,
GET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY,
+ AUDIO_MODULES_UPDATED, // oneway
};
#define MAX_ITEMS_PER_LIST 1024
@@ -1336,6 +1337,13 @@
}
return static_cast<status_t>(reply.readInt32());
}
+
+ virtual void onNewAudioModulesAvailable()
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
+ remote()->transact(AUDIO_MODULES_UPDATED, data, &reply, IBinder::FLAG_ONEWAY);
+ }
};
IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService");
@@ -1401,7 +1409,8 @@
case SET_RTT_ENABLED:
case SET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
case REMOVE_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
- case GET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY: {
+ case GET_PREFERRED_DEVICE_FOR_PRODUCT_STRATEGY:
+ case AUDIO_MODULES_UPDATED: {
if (!isServiceUid(IPCThreadState::self()->getCallingUid())) {
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
__func__, code, IPCThreadState::self()->getCallingPid(),
@@ -2458,6 +2467,12 @@
return NO_ERROR;
}
+ case AUDIO_MODULES_UPDATED: {
+ CHECK_INTERFACE(IAudioPolicyService, data, reply);
+ onNewAudioModulesAvailable();
+ return NO_ERROR;
+ } break;
+
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/media/libaudioclient/include/media/AudioRecord.h b/media/libaudioclient/include/media/AudioRecord.h
index a3c0fe4..574302b 100644
--- a/media/libaudioclient/include/media/AudioRecord.h
+++ b/media/libaudioclient/include/media/AudioRecord.h
@@ -92,6 +92,11 @@
int8_t* i8; // unsigned 8-bit, offset by 0x80
// input to obtainBuffer(): unused, output: pointer to buffer
};
+
+ uint32_t sequence; // IAudioRecord instance sequence number, as of obtainBuffer().
+ // It is set by obtainBuffer() and confirmed by releaseBuffer().
+ // Not "user-serviceable".
+ // TODO Consider sp<IMemory> instead, or in addition to this.
};
/* As a convenience, if a callback is supplied, a handler thread
@@ -420,14 +425,17 @@
* frameCount number of frames requested
* size ignored
* raw ignored
+ * sequence ignored
* After error return:
* frameCount 0
* size 0
* raw undefined
+ * sequence undefined
* After successful return:
* frameCount actual number of frames available, <= number requested
* size actual number of bytes available
* raw pointer to the buffer
+ * sequence IAudioRecord instance sequence number, as of obtainBuffer()
*/
status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount,
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index a86297d..925bc89 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -211,6 +211,7 @@
//
// IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
//
+ static void onNewAudioModulesAvailable();
static status_t setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state,
const char *device_address, const char *device_name,
audio_format_t encodedFormat);
diff --git a/media/libaudioclient/include/media/AudioTrack.h b/media/libaudioclient/include/media/AudioTrack.h
index df5eabc..c607918 100644
--- a/media/libaudioclient/include/media/AudioTrack.h
+++ b/media/libaudioclient/include/media/AudioTrack.h
@@ -107,6 +107,11 @@
int16_t* i16; // signed 16-bit
int8_t* i8; // unsigned 8-bit, offset by 0x80
}; // input to obtainBuffer(): unused, output: pointer to buffer
+
+ uint32_t sequence; // IAudioTrack instance sequence number, as of obtainBuffer().
+ // It is set by obtainBuffer() and confirmed by releaseBuffer().
+ // Not "user-serviceable".
+ // TODO Consider sp<IMemory> instead, or in addition to this.
};
/* As a convenience, if a callback is supplied, a handler thread
@@ -692,14 +697,17 @@
* frameCount number of [empty slots for] frames requested
* size ignored
* raw ignored
+ * sequence ignored
* After error return:
* frameCount 0
* size 0
* raw undefined
+ * sequence undefined
* After successful return:
* frameCount actual number of [empty slots for] frames available, <= number requested
* size actual number of bytes available
* raw pointer to the buffer
+ * sequence IAudioTrack instance sequence number, as of obtainBuffer()
*/
status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount,
size_t *nonContig = NULL);
diff --git a/media/libaudioclient/include/media/IAudioPolicyService.h b/media/libaudioclient/include/media/IAudioPolicyService.h
index 9b91d6d..3edac33 100644
--- a/media/libaudioclient/include/media/IAudioPolicyService.h
+++ b/media/libaudioclient/include/media/IAudioPolicyService.h
@@ -42,6 +42,7 @@
//
// IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
//
+ virtual void onNewAudioModulesAvailable() = 0;
virtual status_t setDeviceConnectionState(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
diff --git a/media/libaudiofoundation/Android.bp b/media/libaudiofoundation/Android.bp
index 8dcc421..93bc4d9 100644
--- a/media/libaudiofoundation/Android.bp
+++ b/media/libaudiofoundation/Android.bp
@@ -12,7 +12,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "libaudiofoundation",
vendor_available: true,
double_loadable: true,
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
index 74b48f3..1709d1e 100644
--- a/media/libaudiohal/Android.bp
+++ b/media/libaudiohal/Android.bp
@@ -4,6 +4,7 @@
srcs: [
"DevicesFactoryHalInterface.cpp",
"EffectsFactoryHalInterface.cpp",
+ "FactoryHalHidl.cpp",
],
cflags: [
@@ -12,11 +13,17 @@
"-Werror",
],
- shared_libs: [
+ required: [
"libaudiohal@2.0",
"libaudiohal@4.0",
"libaudiohal@5.0",
"libaudiohal@6.0",
+ ],
+
+ shared_libs: [
+ "libdl",
+ "libhidlbase",
+ "liblog",
"libutils",
],
diff --git a/media/libaudiohal/DevicesFactoryHalInterface.cpp b/media/libaudiohal/DevicesFactoryHalInterface.cpp
index d5336fa..325a547 100644
--- a/media/libaudiohal/DevicesFactoryHalInterface.cpp
+++ b/media/libaudiohal/DevicesFactoryHalInterface.cpp
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-#include <libaudiohal/FactoryHalHidl.h>
-
#include <media/audiohal/DevicesFactoryHalInterface.h>
+#include <media/audiohal/FactoryHalHidl.h>
namespace android {
// static
sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() {
- return createPreferedImpl<DevicesFactoryHalInterface>();
+ return createPreferredImpl<DevicesFactoryHalInterface>(
+ "android.hardware.audio", "IDevicesFactory");
}
} // namespace android
-
diff --git a/media/libaudiohal/EffectsFactoryHalInterface.cpp b/media/libaudiohal/EffectsFactoryHalInterface.cpp
index d15b14e..bc3b4c1 100644
--- a/media/libaudiohal/EffectsFactoryHalInterface.cpp
+++ b/media/libaudiohal/EffectsFactoryHalInterface.cpp
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#include <libaudiohal/FactoryHalHidl.h>
-
#include <media/audiohal/EffectsFactoryHalInterface.h>
+#include <media/audiohal/FactoryHalHidl.h>
namespace android {
// static
sp<EffectsFactoryHalInterface> EffectsFactoryHalInterface::create() {
- return createPreferedImpl<EffectsFactoryHalInterface>();
+ return createPreferredImpl<EffectsFactoryHalInterface>(
+ "android.hardware.audio.effect", "IEffectsFactory");
}
// static
diff --git a/media/libaudiohal/FactoryHalHidl.cpp b/media/libaudiohal/FactoryHalHidl.cpp
new file mode 100644
index 0000000..5985ef0
--- /dev/null
+++ b/media/libaudiohal/FactoryHalHidl.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "FactoryHalHidl"
+
+#include <media/audiohal/FactoryHalHidl.h>
+
+#include <dlfcn.h>
+
+#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <hidl/ServiceManagement.h>
+#include <hidl/Status.h>
+#include <utils/Log.h>
+
+namespace android::detail {
+
+namespace {
+/** Supported HAL versions, in order of preference.
+ */
+const char* sAudioHALVersions[] = {
+ "6.0",
+ "5.0",
+ "4.0",
+ "2.0",
+ nullptr
+};
+
+bool createHalService(const std::string& version, const std::string& interface,
+ void** rawInterface) {
+ const std::string libName = "libaudiohal@" + version + ".so";
+ const std::string factoryFunctionName = "create" + interface;
+ constexpr int dlMode = RTLD_LAZY;
+ void* handle = nullptr;
+ dlerror(); // clear
+ handle = dlopen(libName.c_str(), dlMode);
+ if (handle == nullptr) {
+ const char* error = dlerror();
+ ALOGE("Failed to dlopen %s: %s", libName.c_str(),
+ error != nullptr ? error : "unknown error");
+ return false;
+ }
+ void* (*factoryFunction)();
+ *(void **)(&factoryFunction) = dlsym(handle, factoryFunctionName.c_str());
+ if (!factoryFunction) {
+ const char* error = dlerror();
+ ALOGE("Factory function %s not found in library %s: %s",
+ factoryFunctionName.c_str(), libName.c_str(),
+ error != nullptr ? error : "unknown error");
+ dlclose(handle);
+ return false;
+ }
+ *rawInterface = (*factoryFunction)();
+ ALOGW_IF(!*rawInterface, "Factory function %s from %s returned nullptr",
+ factoryFunctionName.c_str(), libName.c_str());
+ return true;
+}
+
+bool hasHalService(const std::string& package, const std::string& version,
+ const std::string& interface) {
+ using ::android::hidl::manager::V1_0::IServiceManager;
+ sp<IServiceManager> sm = ::android::hardware::defaultServiceManager();
+ if (!sm) {
+ ALOGE("Failed to obtain HIDL ServiceManager");
+ return false;
+ }
+ // Since audio HAL doesn't support multiple clients, avoid instantiating
+ // the interface right away. Instead, query the transport type for it.
+ using ::android::hardware::Return;
+ using Transport = IServiceManager::Transport;
+ const std::string fqName = package + "@" + version + "::" + interface;
+ const std::string instance = "default";
+ Return<Transport> transport = sm->getTransport(fqName, instance);
+ if (!transport.isOk()) {
+ ALOGE("Failed to obtain transport type for %s/%s: %s",
+ fqName.c_str(), instance.c_str(), transport.description().c_str());
+ return false;
+ }
+ return transport != Transport::EMPTY;
+}
+
+} // namespace
+
+void* createPreferredImpl(const std::string& package, const std::string& interface) {
+ for (auto version = detail::sAudioHALVersions; version != nullptr; ++version) {
+ void* rawInterface = nullptr;
+ if (hasHalService(package, *version, interface)
+ && createHalService(*version, interface, &rawInterface)) {
+ return rawInterface;
+ }
+ }
+ return nullptr;
+}
+
+} // namespace android::detail
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
index e96a68c..967fba1 100644
--- a/media/libaudiohal/impl/Android.bp
+++ b/media/libaudiohal/impl/Android.bp
@@ -16,12 +16,11 @@
"StreamHalHidl.cpp",
],
- export_include_dirs: ["include"],
-
cflags: [
"-Wall",
"-Wextra",
"-Werror",
+ "-fvisibility=hidden",
],
shared_libs: [
"android.hardware.audio.common-util",
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
index c30da3c..1c0eacb 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
+++ b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
@@ -15,12 +15,13 @@
*/
#include <string.h>
-#include <vector>
+#include <set>
#define LOG_TAG "DevicesFactoryHalHidl"
//#define LOG_NDEBUG 0
-#include "android/hidl/manager/1.0/IServiceManager.h"
+#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <android/hidl/manager/1.0/IServiceNotification.h>
#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h)
#include <media/audiohal/hidl/HalDeathHandler.h>
#include <utils/Log.h>
@@ -29,33 +30,57 @@
#include "DeviceHalHidl.h"
#include "DevicesFactoryHalHidl.h"
-#include <set>
-
using ::android::hardware::audio::CPP_VERSION::IDevice;
using ::android::hardware::audio::CPP_VERSION::Result;
using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hidl::manager::V1_0::IServiceManager;
+using ::android::hidl::manager::V1_0::IServiceNotification;
namespace android {
namespace CPP_VERSION {
-DevicesFactoryHalHidl::DevicesFactoryHalHidl(sp<IDevicesFactory> devicesFactory) {
- ALOG_ASSERT(devicesFactory != nullptr, "Provided IDevicesFactory service is NULL");
+class ServiceNotificationListener : public IServiceNotification {
+ public:
+ explicit ServiceNotificationListener(sp<DevicesFactoryHalHidl> factory)
+ : mFactory(factory) {}
- mDeviceFactories.push_back(devicesFactory);
- if (MAJOR_VERSION >= 4) {
- // The MSD factory is optional and only available starting at HAL 4.0
- sp<IDevicesFactory> msdFactory{IDevicesFactory::getService(AUDIO_HAL_SERVICE_NAME_MSD)};
- if (msdFactory) {
- mDeviceFactories.push_back(msdFactory);
+ Return<void> onRegistration(const hidl_string& /*fully_qualified_name*/,
+ const hidl_string& instance_name,
+ bool /*pre_existing*/) override {
+ if (static_cast<std::string>(instance_name) == "default") return Void();
+ sp<DevicesFactoryHalHidl> factory = mFactory.promote();
+ if (!factory) return Void();
+ sp<IDevicesFactory> halFactory = IDevicesFactory::getService(instance_name);
+ if (halFactory) {
+ factory->addDeviceFactory(halFactory, true /*needToNotify*/);
}
+ return Void();
}
- for (const auto& factory : mDeviceFactories) {
- // It is assumed that the DevicesFactoryHalInterface instance is owned
- // by AudioFlinger and thus have the same lifespan.
- factory->linkToDeath(HalDeathHandler::getInstance(), 0 /*cookie*/);
- }
+
+ private:
+ wp<DevicesFactoryHalHidl> mFactory;
+};
+
+DevicesFactoryHalHidl::DevicesFactoryHalHidl(sp<IDevicesFactory> devicesFactory) {
+ ALOG_ASSERT(devicesFactory != nullptr, "Provided default IDevicesFactory service is NULL");
+ addDeviceFactory(devicesFactory, false /*needToNotify*/);
}
+void DevicesFactoryHalHidl::onFirstRef() {
+ sp<IServiceManager> sm = IServiceManager::getService();
+ ALOG_ASSERT(sm != nullptr, "Hardware service manager is not running");
+ sp<ServiceNotificationListener> listener = new ServiceNotificationListener(this);
+ Return<bool> result = sm->registerForNotifications(
+ IDevicesFactory::descriptor, "", listener);
+ if (result.isOk()) {
+ ALOGE_IF(!static_cast<bool>(result),
+ "Hardware service manager refused to register listener");
+ } else {
+ ALOGE("Failed to register for hardware service manager notifications: %s",
+ result.description().c_str());
+ }
+}
#if MAJOR_VERSION == 2
static IDevicesFactory::Device idFromHal(const char *name, status_t* status) {
@@ -83,12 +108,13 @@
#endif
status_t DevicesFactoryHalHidl::openDevice(const char *name, sp<DeviceHalInterface> *device) {
- if (mDeviceFactories.empty()) return NO_INIT;
+ auto factories = copyDeviceFactories();
+ if (factories.empty()) return NO_INIT;
status_t status;
auto hidlId = idFromHal(name, &status);
if (status != OK) return status;
Result retval = Result::NOT_INITIALIZED;
- for (const auto& factory : mDeviceFactories) {
+ for (const auto& factory : factories) {
Return<void> ret = factory->openDevice(
hidlId,
[&](Result r, const sp<IDevice>& result) {
@@ -113,10 +139,9 @@
status_t DevicesFactoryHalHidl::getHalPids(std::vector<pid_t> *pids) {
std::set<pid_t> pidsSet;
-
- for (const auto& factory : mDeviceFactories) {
+ auto factories = copyDeviceFactories();
+ for (const auto& factory : factories) {
using ::android::hidl::base::V1_0::DebugInfo;
- using android::hidl::manager::V1_0::IServiceManager;
DebugInfo debugInfo;
auto ret = factory->getDebugInfo([&] (const auto &info) {
@@ -135,5 +160,48 @@
return NO_ERROR;
}
+status_t DevicesFactoryHalHidl::setCallbackOnce(sp<DevicesFactoryHalCallback> callback) {
+ ALOG_ASSERT(callback != nullptr);
+ bool needToCallCallback = false;
+ {
+ std::lock_guard<std::mutex> lock(mLock);
+ if (mCallback.unsafe_get()) return INVALID_OPERATION;
+ mCallback = callback;
+ if (mHaveUndeliveredNotifications) {
+ needToCallCallback = true;
+ mHaveUndeliveredNotifications = false;
+ }
+ }
+ if (needToCallCallback) {
+ callback->onNewDevicesAvailable();
+ }
+ return NO_ERROR;
+}
+
+void DevicesFactoryHalHidl::addDeviceFactory(sp<IDevicesFactory> factory, bool needToNotify) {
+ // It is assumed that the DevicesFactoryHalInterface instance is owned
+ // by AudioFlinger and thus have the same lifespan.
+ factory->linkToDeath(HalDeathHandler::getInstance(), 0 /*cookie*/);
+ sp<DevicesFactoryHalCallback> callback;
+ {
+ std::lock_guard<std::mutex> lock(mLock);
+ mDeviceFactories.push_back(factory);
+ if (needToNotify) {
+ callback = mCallback.promote();
+ if (!callback) {
+ mHaveUndeliveredNotifications = true;
+ }
+ }
+ }
+ if (callback) {
+ callback->onNewDevicesAvailable();
+ }
+}
+
+std::vector<sp<IDevicesFactory>> DevicesFactoryHalHidl::copyDeviceFactories() {
+ std::lock_guard<std::mutex> lock(mLock);
+ return mDeviceFactories;
+}
+
} // namespace CPP_VERSION
} // namespace android
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHidl.h b/media/libaudiohal/impl/DevicesFactoryHalHidl.h
index 52185c8..6f84efe 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHidl.h
+++ b/media/libaudiohal/impl/DevicesFactoryHalHidl.h
@@ -17,6 +17,9 @@
#ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HIDL_H
#define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HIDL_H
+#include <mutex>
+#include <vector>
+
#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
#include <media/audiohal/DevicesFactoryHalInterface.h>
#include <utils/Errors.h>
@@ -32,16 +35,26 @@
class DevicesFactoryHalHidl : public DevicesFactoryHalInterface
{
public:
- DevicesFactoryHalHidl(sp<IDevicesFactory> devicesFactory);
+ explicit DevicesFactoryHalHidl(sp<IDevicesFactory> devicesFactory);
+ void onFirstRef() override;
// Opens a device with the specified name. To close the device, it is
// necessary to release references to the returned object.
- virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device);
+ status_t openDevice(const char *name, sp<DeviceHalInterface> *device) override;
- status_t getHalPids(std::vector<pid_t> *pids) override;
+ status_t getHalPids(std::vector<pid_t> *pids) override;
+
+ status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) override;
private:
- std::vector<sp<IDevicesFactory>> mDeviceFactories;
+ friend class ServiceNotificationListener;
+ void addDeviceFactory(sp<IDevicesFactory> factory, bool needToNotify);
+ std::vector<sp<IDevicesFactory>> copyDeviceFactories();
+
+ std::mutex mLock;
+ std::vector<sp<IDevicesFactory>> mDeviceFactories; // GUARDED_BY(mLock)
+ wp<DevicesFactoryHalCallback> mCallback; // GUARDED_BY(mLock)
+ bool mHaveUndeliveredNotifications = false; // GUARDED_BY(mLock)
virtual ~DevicesFactoryHalHidl() = default;
};
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp b/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
index a5aef1b..cde8d85 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
+++ b/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
@@ -20,7 +20,6 @@
#include "DevicesFactoryHalHidl.h"
#include "DevicesFactoryHalHybrid.h"
#include "DevicesFactoryHalLocal.h"
-#include <libaudiohal/FactoryHalHidl.h>
namespace android {
namespace CPP_VERSION {
@@ -45,10 +44,16 @@
return INVALID_OPERATION;
}
+status_t DevicesFactoryHalHybrid::setCallbackOnce(sp<DevicesFactoryHalCallback> callback) {
+ if (mHidlFactory) {
+ return mHidlFactory->setCallbackOnce(callback);
+ }
+ return INVALID_OPERATION;
+}
+
} // namespace CPP_VERSION
-template <>
-sp<DevicesFactoryHalInterface> createFactoryHal<AudioHALVersion::CPP_VERSION>() {
+extern "C" __attribute__((visibility("default"))) void* createIDevicesFactory() {
auto service = hardware::audio::CPP_VERSION::IDevicesFactory::getService();
return service ? new CPP_VERSION::DevicesFactoryHalHybrid(service) : nullptr;
}
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHybrid.h b/media/libaudiohal/impl/DevicesFactoryHalHybrid.h
index 2189b36..568a1fb 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHybrid.h
+++ b/media/libaudiohal/impl/DevicesFactoryHalHybrid.h
@@ -38,6 +38,8 @@
status_t getHalPids(std::vector<pid_t> *pids) override;
+ status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) override;
+
private:
sp<DevicesFactoryHalInterface> mLocalFactory;
sp<DevicesFactoryHalInterface> mHidlFactory;
diff --git a/media/libaudiohal/impl/DevicesFactoryHalLocal.h b/media/libaudiohal/impl/DevicesFactoryHalLocal.h
index 2b011f4..32bf362 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalLocal.h
+++ b/media/libaudiohal/impl/DevicesFactoryHalLocal.h
@@ -37,6 +37,10 @@
return INVALID_OPERATION;
}
+ status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback __unused) override {
+ return INVALID_OPERATION;
+ }
+
private:
friend class DevicesFactoryHalHybrid;
diff --git a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
index 867b72d..9192a31 100644
--- a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
+++ b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
@@ -24,7 +24,6 @@
#include "EffectHalHidl.h"
#include "EffectsFactoryHalHidl.h"
#include "HidlUtils.h"
-#include <libaudiohal/FactoryHalHidl.h>
using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
using ::android::hardware::Return;
@@ -162,8 +161,7 @@
} // namespace CPP_VERSION
} // namespace effect
-template<>
-sp<EffectsFactoryHalInterface> createFactoryHal<AudioHALVersion::CPP_VERSION>() {
+extern "C" __attribute__((visibility("default"))) void* createIEffectsFactory() {
auto service = hardware::audio::effect::CPP_VERSION::IEffectsFactory::getService();
return service ? new effect::CPP_VERSION::EffectsFactoryHalHidl(service) : nullptr;
}
diff --git a/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h b/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h
deleted file mode 100644
index 271bafc..0000000
--- a/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
-#define ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
-
-/** @file Library entry points to create the HAL factories. */
-
-#include <media/audiohal/DevicesFactoryHalInterface.h>
-#include <media/audiohal/EffectsFactoryHalInterface.h>
-#include <utils/StrongPointer.h>
-
-#include <array>
-#include <utility>
-
-namespace android {
-
-/** Supported HAL versions, in order of preference.
- * Implementation should use specialize the `create*FactoryHal` for their version.
- * Client should use `createPreferedImpl<*FactoryHal>()` to instantiate
- * the preferred available impl.
- */
-enum class AudioHALVersion {
- V6_0,
- V5_0,
- V4_0,
- V2_0,
- end, // used for iterating over supported versions
-};
-
-/** Template function to fully specialized for each version and each Interface. */
-template <AudioHALVersion, class Interface>
-sp<Interface> createFactoryHal();
-
-/** @Return the preferred available implementation or nullptr if none are available. */
-template <class Interface, AudioHALVersion version = AudioHALVersion{}>
-static sp<Interface> createPreferedImpl() {
- if constexpr (version == AudioHALVersion::end) {
- return nullptr; // tried all version, all returned nullptr
- } else {
- if (auto created = createFactoryHal<version, Interface>(); created != nullptr) {
- return created;
- }
-
- using Raw = std::underlying_type_t<AudioHALVersion>; // cast as enum class do not support ++
- return createPreferedImpl<Interface, AudioHALVersion(Raw(version) + 1)>();
- }
-}
-
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
diff --git a/media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h b/media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h
index e9ac1ce..5091558 100644
--- a/media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h
+++ b/media/libaudiohal/include/media/audiohal/DevicesFactoryHalInterface.h
@@ -24,6 +24,12 @@
namespace android {
+class DevicesFactoryHalCallback : public RefBase
+{
+ public:
+ virtual void onNewDevicesAvailable() = 0;
+};
+
class DevicesFactoryHalInterface : public RefBase
{
public:
@@ -33,6 +39,10 @@
virtual status_t getHalPids(std::vector<pid_t> *pids) = 0;
+ // Sets a DevicesFactoryHalCallback to notify the client.
+ // The callback can be only set once.
+ virtual status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) = 0;
+
static sp<DevicesFactoryHalInterface> create();
protected:
diff --git a/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h b/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h
new file mode 100644
index 0000000..d353ed0
--- /dev/null
+++ b/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
+#define ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
+
+#include <string>
+
+#include <utils/StrongPointer.h>
+
+namespace android {
+
+namespace detail {
+
+void* createPreferredImpl(const std::string& package, const std::string& interface);
+
+} // namespace detail
+
+/** @Return the preferred available implementation or nullptr if none are available. */
+template <class Interface>
+static sp<Interface> createPreferredImpl(const std::string& package, const std::string& interface) {
+ return sp<Interface>{static_cast<Interface*>(detail::createPreferredImpl(package, interface))};
+}
+
+} // namespace android
+
+#endif // ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
diff --git a/media/libaudioprocessing/Android.bp b/media/libaudioprocessing/Android.bp
index 9b5d58c..e756ada 100644
--- a/media/libaudioprocessing/Android.bp
+++ b/media/libaudioprocessing/Android.bp
@@ -19,6 +19,25 @@
// uncomment to disable NEON on architectures that actually do support NEON, for benchmarking
// "-DUSE_NEON=false",
],
+
+ arch: {
+ x86: {
+ avx2: {
+ cflags: [
+ "-mavx2",
+ "-mfma",
+ ],
+ },
+ },
+ x86_64: {
+ avx2: {
+ cflags: [
+ "-mavx2",
+ "-mfma",
+ ],
+ },
+ },
+ },
}
cc_library_shared {
diff --git a/media/libaudioprocessing/AudioResamplerFirOps.h b/media/libaudioprocessing/AudioResamplerFirOps.h
index 2e4cee3..a3f5ff5 100644
--- a/media/libaudioprocessing/AudioResamplerFirOps.h
+++ b/media/libaudioprocessing/AudioResamplerFirOps.h
@@ -36,13 +36,20 @@
#include <arm_neon.h>
#endif
-#if defined(__SSSE3__) // Should be supported in x86 ABI for both 32 & 64-bit.
+#if defined(__AVX2__) // Should be supported in x86 ABI for both 32 & 64-bit.
+#define USE_AVX2 (true) // Inference AVX2/FMA Intrinsics
#define USE_SSE (true)
+#include <immintrin.h>
+#elif defined(__SSSE3__) // Should be supported in x86 ABI for both 32 & 64-bit.
+#define USE_SSE (true) // Inference SSE Intrinsics
+#define USE_AVX2 (false)
#include <tmmintrin.h>
#else
#define USE_SSE (false)
+#define USE_AVX2(false)
#endif
+
template<typename T, typename U>
struct is_same
{
diff --git a/media/libaudioprocessing/AudioResamplerFirProcessSSE.h b/media/libaudioprocessing/AudioResamplerFirProcessSSE.h
index 30233b5..1c16bc4 100644
--- a/media/libaudioprocessing/AudioResamplerFirProcessSSE.h
+++ b/media/libaudioprocessing/AudioResamplerFirProcessSSE.h
@@ -80,11 +80,16 @@
posCoef1 = _mm_sub_ps(posCoef1, posCoef);
negCoef = _mm_sub_ps(negCoef, negCoef1);
+
+ #if USE_AVX2
+ posCoef = _mm_fmadd_ps(posCoef1, interp, posCoef);
+ negCoef = _mm_fmadd_ps(negCoef, interp, negCoef1);
+ #else
posCoef1 = _mm_mul_ps(posCoef1, interp);
negCoef = _mm_mul_ps(negCoef, interp);
-
posCoef = _mm_add_ps(posCoef1, posCoef);
negCoef = _mm_add_ps(negCoef, negCoef1);
+ #endif //USE_AVX2
}
switch (CHANNELS) {
case 1: {
@@ -94,11 +99,17 @@
sN += 4;
posSamp = _mm_shuffle_ps(posSamp, posSamp, 0x1B);
+
+ #if USE_AVX2
+ accL = _mm_fmadd_ps(posSamp, posCoef, accL);
+ accL = _mm_fmadd_ps(negSamp, negCoef, accL);
+ #else
posSamp = _mm_mul_ps(posSamp, posCoef);
negSamp = _mm_mul_ps(negSamp, negCoef);
-
accL = _mm_add_ps(accL, posSamp);
accL = _mm_add_ps(accL, negSamp);
+ #endif
+
} break;
case 2: {
__m128 posSamp0 = _mm_loadu_ps(sP);
@@ -114,15 +125,23 @@
__m128 negSampL = _mm_shuffle_ps(negSamp0, negSamp1, 0x88);
__m128 negSampR = _mm_shuffle_ps(negSamp0, negSamp1, 0xDD);
- posSampL = _mm_mul_ps(posSampL, posCoef);
- posSampR = _mm_mul_ps(posSampR, posCoef);
- negSampL = _mm_mul_ps(negSampL, negCoef);
- negSampR = _mm_mul_ps(negSampR, negCoef);
+ #if USE_AVX2
+ accL = _mm_fmadd_ps(posSampL, posCoef, accL);
+ accR = _mm_fmadd_ps(posSampR, posCoef, accR);
+ accL = _mm_fmadd_ps(negSampL, negCoef, accL);
+ accR = _mm_fmadd_ps(negSampR, negCoef, accR);
+ #else
+ posSampL = _mm_mul_ps(posSampL, posCoef);
+ posSampR = _mm_mul_ps(posSampR, posCoef);
+ negSampL = _mm_mul_ps(negSampL, negCoef);
+ negSampR = _mm_mul_ps(negSampR, negCoef);
- accL = _mm_add_ps(accL, posSampL);
- accR = _mm_add_ps(accR, posSampR);
- accL = _mm_add_ps(accL, negSampL);
- accR = _mm_add_ps(accR, negSampR);
+ accL = _mm_add_ps(accL, posSampL);
+ accR = _mm_add_ps(accR, posSampR);
+ accL = _mm_add_ps(accL, negSampL);
+ accR = _mm_add_ps(accR, negSampR);
+ #endif
+
} break;
}
} while (count -= 4);
@@ -144,9 +163,13 @@
outAccum = _mm_hadd_ps(accL, accR);
outAccum = _mm_hadd_ps(outAccum, outAccum);
}
-
+ #if USE_AVX2
+ outSamp = _mm_fmadd_ps(outAccum, vLR,outSamp);
+ #else
outAccum = _mm_mul_ps(outAccum, vLR);
outSamp = _mm_add_ps(outSamp, outAccum);
+ #endif
+
_mm_storel_pi(reinterpret_cast<__m64*>(out), outSamp);
}
diff --git a/media/libeffects/config/Android.bp b/media/libeffects/config/Android.bp
index 5fa9da9..8476f82 100644
--- a/media/libeffects/config/Android.bp
+++ b/media/libeffects/config/Android.bp
@@ -13,6 +13,8 @@
shared_libs: [
"liblog",
"libtinyxml2",
+ "libutils",
+ "libmedia_helper",
],
header_libs: ["libaudio_system_headers"],
diff --git a/media/libeffects/config/include/media/EffectsConfig.h b/media/libeffects/config/include/media/EffectsConfig.h
index fa0415b..ef10e0d 100644
--- a/media/libeffects/config/include/media/EffectsConfig.h
+++ b/media/libeffects/config/include/media/EffectsConfig.h
@@ -76,6 +76,10 @@
using OutputStream = Stream<audio_stream_type_t>;
using InputStream = Stream<audio_source_t>;
+struct DeviceEffects : Stream<audio_devices_t> {
+ std::string address;
+};
+
/** Parsed configuration.
* Intended to be a transient structure only used for deserialization.
* Note: Everything is copied in the configuration from the xml dom.
@@ -89,6 +93,7 @@
Effects effects;
std::vector<OutputStream> postprocess;
std::vector<InputStream> preprocess;
+ std::vector<DeviceEffects> deviceprocess;
};
/** Result of `parse(const char*)` */
diff --git a/media/libeffects/config/src/EffectsConfig.cpp b/media/libeffects/config/src/EffectsConfig.cpp
index 218249d..85fbf11 100644
--- a/media/libeffects/config/src/EffectsConfig.cpp
+++ b/media/libeffects/config/src/EffectsConfig.cpp
@@ -26,6 +26,7 @@
#include <log/log.h>
#include <media/EffectsConfig.h>
+#include <media/TypeConverter.h>
using namespace tinyxml2;
@@ -117,6 +118,8 @@
{AUDIO_SOURCE_VOICE_COMMUNICATION, "voice_communication"},
{AUDIO_SOURCE_UNPROCESSED, "unprocessed"},
{AUDIO_SOURCE_VOICE_PERFORMANCE, "voice_performance"},
+ {AUDIO_SOURCE_ECHO_REFERENCE, "echo_reference"},
+ {AUDIO_SOURCE_FM_TUNER, "fm_tuner"},
};
/** Find the stream type enum corresponding to the stream type name or return false */
@@ -132,6 +135,11 @@
return false;
}
+template <>
+bool stringToStreamType(const char *streamName, audio_devices_t* type) {
+ return deviceFromString(streamName, *type);
+}
+
/** Parse a library xml note and push the result in libraries or return false on failure. */
bool parseLibrary(const XMLElement& xmlLibrary, Libraries* libraries) {
const char* name = xmlLibrary.Attribute("name");
@@ -219,7 +227,7 @@
return true;
}
-/** Parse an stream from an xml element describing it.
+/** Parse an <Output|Input>stream or a device from an xml element describing it.
* @return true and pushes the stream in streams on success,
* false on failure. */
template <class Stream>
@@ -231,14 +239,14 @@
}
Stream stream;
if (!stringToStreamType(streamType, &stream.type)) {
- ALOGE("Invalid stream type %s: %s", streamType, dump(xmlStream));
+ ALOGE("Invalid <stream|device> type %s: %s", streamType, dump(xmlStream));
return false;
}
for (auto& xmlApply : getChildren(xmlStream, "apply")) {
const char* effectName = xmlApply.get().Attribute("effect");
if (effectName == nullptr) {
- ALOGE("stream/apply must have reference an effect: %s", dump(xmlApply));
+ ALOGE("<stream|device>/apply must have reference an effect: %s", dump(xmlApply));
return false;
}
auto* effect = findByName(effectName, effects);
@@ -252,6 +260,21 @@
return true;
}
+bool parseDeviceEffects(
+ const XMLElement& xmlDevice, Effects& effects, std::vector<DeviceEffects>* deviceEffects) {
+
+ const char* address = xmlDevice.Attribute("address");
+ if (address == nullptr) {
+ ALOGE("device must have an address: %s", dump(xmlDevice));
+ return false;
+ }
+ if (!parseStream(xmlDevice, effects, deviceEffects)) {
+ return false;
+ }
+ deviceEffects->back().address = address;
+ return true;
+}
+
/** Internal version of the public parse(const char* path) where path always exist. */
ParsingResult parseWithPath(std::string&& path) {
XMLDocument doc;
@@ -296,6 +319,14 @@
registerFailure(parseStream(xmlStream, config->effects, &config->postprocess));
}
}
+
+ // Parse device effect chains
+ for (auto& xmlDeviceEffects : getChildren(xmlConfig, "deviceEffects")) {
+ for (auto& xmlDevice : getChildren(xmlDeviceEffects, "devicePort")) {
+ registerFailure(
+ parseDeviceEffects(xmlDevice, config->effects, &config->deviceprocess));
+ }
+ }
}
return {std::move(config), nbSkippedElements, std::move(path)};
}
diff --git a/media/libeffects/data/audio_effects.xml b/media/libeffects/data/audio_effects.xml
index 3f85052..2e5f529 100644
--- a/media/libeffects/data/audio_effects.xml
+++ b/media/libeffects/data/audio_effects.xml
@@ -99,4 +99,31 @@
</postprocess>
-->
+ <!-- Device pre/post processor configurations.
+ The device pre/post processor configuration is described in a deviceEffects element and
+ consists in a list of elements each describing pre/post proecessor settings for a given
+ device or "devicePort".
+ Each devicePort element has a "type" attribute corresponding to the device type (e.g.
+ speaker, bus), an "address" attribute corresponding to the device address and contains a
+ list of "apply" elements indicating one effect to apply.
+ If the device is a source, only pre processing effects are expected, if the
+ device is a sink, only post processing effects are expected.
+ The effect to apply is designated by its name in the "effects" elements.
+ The effect will be enabled by default and the audio framework will automatically add
+ and activate the effect if the given port is involved in an audio patch.
+ If the patch is "HW", the effect must be HW accelerated.
+
+ <deviceEffects>
+ <devicePort type="AUDIO_DEVICE_OUT_BUS" address="BUS00_USAGE_MAIN">
+ <apply effect="equalizer"/>
+ </devicePort>
+ <devicePort type="AUDIO_DEVICE_OUT_BUS" address="BUS04_USAGE_VOICE">
+ <apply effect="volume"/>
+ </devicePort>
+ <devicePort type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="bottom">
+ <apply effect="agc"/>
+ </devicePort>
+ </deviceEffects>
+ -->
+
</audio_effects_conf>
diff --git a/media/libeffects/lvm/lib/Android.bp b/media/libeffects/lvm/lib/Android.bp
index d150f18..1f2a5e1 100644
--- a/media/libeffects/lvm/lib/Android.bp
+++ b/media/libeffects/lvm/lib/Android.bp
@@ -10,107 +10,107 @@
vendor: true,
srcs: [
- "StereoWidening/src/LVCS_BypassMix.c",
- "StereoWidening/src/LVCS_Control.c",
- "StereoWidening/src/LVCS_Equaliser.c",
- "StereoWidening/src/LVCS_Init.c",
- "StereoWidening/src/LVCS_Process.c",
- "StereoWidening/src/LVCS_ReverbGenerator.c",
- "StereoWidening/src/LVCS_StereoEnhancer.c",
- "StereoWidening/src/LVCS_Tables.c",
- "Bass/src/LVDBE_Control.c",
- "Bass/src/LVDBE_Init.c",
- "Bass/src/LVDBE_Process.c",
- "Bass/src/LVDBE_Tables.c",
- "Bundle/src/LVM_API_Specials.c",
- "Bundle/src/LVM_Buffers.c",
- "Bundle/src/LVM_Init.c",
- "Bundle/src/LVM_Process.c",
- "Bundle/src/LVM_Tables.c",
- "Bundle/src/LVM_Control.c",
- "SpectrumAnalyzer/src/LVPSA_Control.c",
- "SpectrumAnalyzer/src/LVPSA_Init.c",
- "SpectrumAnalyzer/src/LVPSA_Memory.c",
- "SpectrumAnalyzer/src/LVPSA_Process.c",
- "SpectrumAnalyzer/src/LVPSA_QPD_Init.c",
- "SpectrumAnalyzer/src/LVPSA_QPD_Process.c",
- "SpectrumAnalyzer/src/LVPSA_Tables.c",
- "Eq/src/LVEQNB_CalcCoef.c",
- "Eq/src/LVEQNB_Control.c",
- "Eq/src/LVEQNB_Init.c",
- "Eq/src/LVEQNB_Process.c",
- "Eq/src/LVEQNB_Tables.c",
- "Common/src/InstAlloc.c",
- "Common/src/DC_2I_D16_TRC_WRA_01.c",
- "Common/src/DC_2I_D16_TRC_WRA_01_Init.c",
- "Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c",
- "Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c",
- "Common/src/FO_1I_D16F16C15_TRC_WRA_01.c",
- "Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c",
- "Common/src/BP_1I_D16F32C30_TRC_WRA_01.c",
- "Common/src/BP_1I_D16F16C14_TRC_WRA_01.c",
- "Common/src/BP_1I_D32F32C30_TRC_WRA_02.c",
- "Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c",
- "Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c",
- "Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c",
- "Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c",
- "Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c",
- "Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c",
- "Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c",
- "Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c",
- "Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c",
- "Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c",
- "Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c",
- "Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c",
- "Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c",
- "Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c",
- "Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c",
- "Common/src/Int16LShiftToInt32_16x32.c",
- "Common/src/From2iToMono_16.c",
- "Common/src/Copy_16.c",
- "Common/src/MonoTo2I_16.c",
- "Common/src/MonoTo2I_32.c",
- "Common/src/LoadConst_16.c",
- "Common/src/LoadConst_32.c",
- "Common/src/dB_to_Lin32.c",
- "Common/src/Shift_Sat_v16xv16.c",
- "Common/src/Shift_Sat_v32xv32.c",
- "Common/src/Abs_32.c",
- "Common/src/Int32RShiftToInt16_Sat_32x16.c",
- "Common/src/From2iToMono_32.c",
- "Common/src/mult3s_16x16.c",
- "Common/src/Mult3s_32x16.c",
- "Common/src/NonLinComp_D16.c",
- "Common/src/DelayMix_16x16.c",
- "Common/src/MSTo2i_Sat_16x16.c",
- "Common/src/From2iToMS_16x16.c",
- "Common/src/Mac3s_Sat_16x16.c",
- "Common/src/Mac3s_Sat_32x16.c",
- "Common/src/Add2_Sat_16x16.c",
- "Common/src/Add2_Sat_32x32.c",
- "Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c",
- "Common/src/LVC_MixSoft_1St_D16C31_SAT.c",
- "Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c",
- "Common/src/LVC_Mixer_SetTimeConstant.c",
- "Common/src/LVC_Mixer_SetTarget.c",
- "Common/src/LVC_Mixer_GetTarget.c",
- "Common/src/LVC_Mixer_Init.c",
- "Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c",
- "Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c",
- "Common/src/LVC_Core_MixInSoft_D16C31_SAT.c",
- "Common/src/LVC_Mixer_GetCurrent.c",
- "Common/src/LVC_MixSoft_2St_D16C31_SAT.c",
- "Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c",
- "Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c",
- "Common/src/LVC_MixInSoft_D16C31_SAT.c",
- "Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c",
- "Common/src/LVM_Timer.c",
- "Common/src/LVM_Timer_Init.c",
+ "StereoWidening/src/LVCS_BypassMix.cpp",
+ "StereoWidening/src/LVCS_Control.cpp",
+ "StereoWidening/src/LVCS_Equaliser.cpp",
+ "StereoWidening/src/LVCS_Init.cpp",
+ "StereoWidening/src/LVCS_Process.cpp",
+ "StereoWidening/src/LVCS_ReverbGenerator.cpp",
+ "StereoWidening/src/LVCS_StereoEnhancer.cpp",
+ "StereoWidening/src/LVCS_Tables.cpp",
+ "Bass/src/LVDBE_Control.cpp",
+ "Bass/src/LVDBE_Init.cpp",
+ "Bass/src/LVDBE_Process.cpp",
+ "Bass/src/LVDBE_Tables.cpp",
+ "Bundle/src/LVM_API_Specials.cpp",
+ "Bundle/src/LVM_Buffers.cpp",
+ "Bundle/src/LVM_Init.cpp",
+ "Bundle/src/LVM_Process.cpp",
+ "Bundle/src/LVM_Tables.cpp",
+ "Bundle/src/LVM_Control.cpp",
+ "SpectrumAnalyzer/src/LVPSA_Control.cpp",
+ "SpectrumAnalyzer/src/LVPSA_Init.cpp",
+ "SpectrumAnalyzer/src/LVPSA_Memory.cpp",
+ "SpectrumAnalyzer/src/LVPSA_Process.cpp",
+ "SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp",
+ "SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp",
+ "SpectrumAnalyzer/src/LVPSA_Tables.cpp",
+ "Eq/src/LVEQNB_CalcCoef.cpp",
+ "Eq/src/LVEQNB_Control.cpp",
+ "Eq/src/LVEQNB_Init.cpp",
+ "Eq/src/LVEQNB_Process.cpp",
+ "Eq/src/LVEQNB_Tables.cpp",
+ "Common/src/InstAlloc.cpp",
+ "Common/src/DC_2I_D16_TRC_WRA_01.cpp",
+ "Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp",
+ "Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp",
+ "Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp",
+ "Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp",
+ "Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp",
+ "Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp",
+ "Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp",
+ "Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp",
+ "Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp",
+ "Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp",
+ "Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp",
+ "Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp",
+ "Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp",
+ "Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp",
+ "Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp",
+ "Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp",
+ "Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp",
+ "Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp",
+ "Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp",
+ "Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp",
+ "Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp",
+ "Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp",
+ "Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp",
+ "Common/src/Int16LShiftToInt32_16x32.cpp",
+ "Common/src/From2iToMono_16.cpp",
+ "Common/src/Copy_16.cpp",
+ "Common/src/MonoTo2I_16.cpp",
+ "Common/src/MonoTo2I_32.cpp",
+ "Common/src/LoadConst_16.cpp",
+ "Common/src/LoadConst_32.cpp",
+ "Common/src/dB_to_Lin32.cpp",
+ "Common/src/Shift_Sat_v16xv16.cpp",
+ "Common/src/Shift_Sat_v32xv32.cpp",
+ "Common/src/Abs_32.cpp",
+ "Common/src/Int32RShiftToInt16_Sat_32x16.cpp",
+ "Common/src/From2iToMono_32.cpp",
+ "Common/src/mult3s_16x16.cpp",
+ "Common/src/Mult3s_32x16.cpp",
+ "Common/src/NonLinComp_D16.cpp",
+ "Common/src/DelayMix_16x16.cpp",
+ "Common/src/MSTo2i_Sat_16x16.cpp",
+ "Common/src/From2iToMS_16x16.cpp",
+ "Common/src/Mac3s_Sat_16x16.cpp",
+ "Common/src/Mac3s_Sat_32x16.cpp",
+ "Common/src/Add2_Sat_16x16.cpp",
+ "Common/src/Add2_Sat_32x32.cpp",
+ "Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp",
+ "Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp",
+ "Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp",
+ "Common/src/LVC_Mixer_SetTimeConstant.cpp",
+ "Common/src/LVC_Mixer_SetTarget.cpp",
+ "Common/src/LVC_Mixer_GetTarget.cpp",
+ "Common/src/LVC_Mixer_Init.cpp",
+ "Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp",
+ "Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp",
+ "Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp",
+ "Common/src/LVC_Mixer_GetCurrent.cpp",
+ "Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp",
+ "Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp",
+ "Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp",
+ "Common/src/LVC_MixInSoft_D16C31_SAT.cpp",
+ "Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp",
+ "Common/src/LVM_Timer.cpp",
+ "Common/src/LVM_Timer_Init.cpp",
],
local_include_dirs: [
@@ -135,10 +135,8 @@
header_libs: [
"libhardware_headers"
],
- cflags: [
+ cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
@@ -159,42 +157,42 @@
vendor: true,
srcs: [
- "Reverb/src/LVREV_ApplyNewSettings.c",
- "Reverb/src/LVREV_ClearAudioBuffers.c",
- "Reverb/src/LVREV_GetControlParameters.c",
- "Reverb/src/LVREV_GetInstanceHandle.c",
- "Reverb/src/LVREV_GetMemoryTable.c",
- "Reverb/src/LVREV_Process.c",
- "Reverb/src/LVREV_SetControlParameters.c",
- "Reverb/src/LVREV_Tables.c",
- "Common/src/Abs_32.c",
- "Common/src/InstAlloc.c",
- "Common/src/LoadConst_16.c",
- "Common/src/LoadConst_32.c",
- "Common/src/From2iToMono_32.c",
- "Common/src/Mult3s_32x16.c",
- "Common/src/FO_1I_D32F32C31_TRC_WRA_01.c",
- "Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c",
- "Common/src/DelayAllPass_Sat_32x16To32.c",
- "Common/src/Copy_16.c",
- "Common/src/Mac3s_Sat_32x16.c",
- "Common/src/DelayWrite_32.c",
- "Common/src/Shift_Sat_v32xv32.c",
- "Common/src/Add2_Sat_32x32.c",
- "Common/src/JoinTo2i_32x32.c",
- "Common/src/MonoTo2I_32.c",
- "Common/src/LVM_FO_HPF.c",
- "Common/src/LVM_FO_LPF.c",
- "Common/src/LVM_Polynomial.c",
- "Common/src/LVM_Power10.c",
- "Common/src/LVM_GetOmega.c",
- "Common/src/MixSoft_2St_D32C31_SAT.c",
- "Common/src/MixSoft_1St_D32C31_WRA.c",
- "Common/src/MixInSoft_D32C31_SAT.c",
- "Common/src/LVM_Mixer_TimeConstant.c",
- "Common/src/Core_MixHard_2St_D32C31_SAT.c",
- "Common/src/Core_MixSoft_1St_D32C31_WRA.c",
- "Common/src/Core_MixInSoft_D32C31_SAT.c",
+ "Reverb/src/LVREV_ApplyNewSettings.cpp",
+ "Reverb/src/LVREV_ClearAudioBuffers.cpp",
+ "Reverb/src/LVREV_GetControlParameters.cpp",
+ "Reverb/src/LVREV_GetInstanceHandle.cpp",
+ "Reverb/src/LVREV_GetMemoryTable.cpp",
+ "Reverb/src/LVREV_Process.cpp",
+ "Reverb/src/LVREV_SetControlParameters.cpp",
+ "Reverb/src/LVREV_Tables.cpp",
+ "Common/src/Abs_32.cpp",
+ "Common/src/InstAlloc.cpp",
+ "Common/src/LoadConst_16.cpp",
+ "Common/src/LoadConst_32.cpp",
+ "Common/src/From2iToMono_32.cpp",
+ "Common/src/Mult3s_32x16.cpp",
+ "Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp",
+ "Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp",
+ "Common/src/DelayAllPass_Sat_32x16To32.cpp",
+ "Common/src/Copy_16.cpp",
+ "Common/src/Mac3s_Sat_32x16.cpp",
+ "Common/src/DelayWrite_32.cpp",
+ "Common/src/Shift_Sat_v32xv32.cpp",
+ "Common/src/Add2_Sat_32x32.cpp",
+ "Common/src/JoinTo2i_32x32.cpp",
+ "Common/src/MonoTo2I_32.cpp",
+ "Common/src/LVM_FO_HPF.cpp",
+ "Common/src/LVM_FO_LPF.cpp",
+ "Common/src/LVM_Polynomial.cpp",
+ "Common/src/LVM_Power10.cpp",
+ "Common/src/LVM_GetOmega.cpp",
+ "Common/src/MixSoft_2St_D32C31_SAT.cpp",
+ "Common/src/MixSoft_1St_D32C31_WRA.cpp",
+ "Common/src/MixInSoft_D32C31_SAT.cpp",
+ "Common/src/LVM_Mixer_TimeConstant.cpp",
+ "Common/src/Core_MixHard_2St_D32C31_SAT.cpp",
+ "Common/src/Core_MixSoft_1St_D32C31_WRA.cpp",
+ "Common/src/Core_MixInSoft_D32C31_SAT.cpp",
],
local_include_dirs: [
@@ -206,10 +204,8 @@
"Common/lib",
],
- cflags: [
+ cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-Wall",
"-Werror",
diff --git a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
index cc066b0..948d79c 100644
--- a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
+++ b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
@@ -55,11 +55,6 @@
#ifndef __LVDBE_H__
#define __LVDBE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -68,7 +63,6 @@
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -85,7 +79,6 @@
#define LVDBE_EFFECT_12DB 12
#define LVDBE_EFFECT_15DB 15
-
/****************************************************************************************/
/* */
/* Types */
@@ -95,7 +88,6 @@
/* Instance handle */
typedef void *LVDBE_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -104,7 +96,6 @@
LVDBE_MODE_MAX = LVM_MAXINT_32
} LVDBE_Mode_en;
-
/* High pass filter */
typedef enum
{
@@ -113,7 +104,6 @@
LVDBE_HPF_MAX = LVM_MAXINT_32
} LVDBE_FilterSelect_en;
-
/* Volume control */
typedef enum
{
@@ -122,7 +112,6 @@
LVDBE_VOLUME_MAX = LVM_MAXINT_32
} LVDBE_Volume_en;
-
/* Memory Types */
typedef enum
{
@@ -134,7 +123,6 @@
} LVDBE_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -146,7 +134,6 @@
LVDBE_STATUS_MAX = LVM_MAXINT_32
} LVDBE_ReturnStatus_en;
-
/****************************************************************************************/
/* */
/* Linked enumerated type and capability definitions */
@@ -185,7 +172,6 @@
LVDBE_CENTRE_MAX = LVM_MAXINT_32
} LVDBE_CentreFreq_en;
-
/*
* Supported sample rates in samples per second
*/
@@ -198,12 +184,10 @@
#define LVDBE_CAP_FS_32000 64
#define LVDBE_CAP_FS_44100 128
#define LVDBE_CAP_FS_48000 256
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVDBE_CAP_FS_88200 512
#define LVDBE_CAP_FS_96000 1024
#define LVDBE_CAP_FS_176400 2048
#define LVDBE_CAP_FS_192000 4096
-#endif
typedef enum
{
@@ -216,16 +200,13 @@
LVDBE_FS_32000 = 6,
LVDBE_FS_44100 = 7,
LVDBE_FS_48000 = 8,
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
LVDBE_FS_88200 = 9,
LVDBE_FS_96000 = 10,
LVDBE_FS_176400 = 11,
LVDBE_FS_192000 = 12,
-#endif
LVDBE_FS_MAX = LVM_MAXINT_32
} LVDBE_Fs_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -241,14 +222,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVDBE_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVDBE_MemoryRegion_t Region[LVDBE_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVDBE_MemTab_t;
-
/* Parameter structure */
typedef struct
{
@@ -266,7 +245,6 @@
} LVDBE_Params_t;
-
/* Capability structure */
typedef struct
{
@@ -275,7 +253,6 @@
LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
} LVDBE_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -317,7 +294,6 @@
LVDBE_MemTab_t *pMemoryTable,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Init */
@@ -355,7 +331,6 @@
LVDBE_MemTab_t *pMemoryTable,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetParameters */
@@ -379,7 +354,6 @@
LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
LVDBE_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetCapabilities */
@@ -403,7 +377,6 @@
LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Control */
@@ -444,7 +417,6 @@
LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
LVDBE_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Process */
@@ -465,20 +437,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* __LVDBE_H__ */
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index 8f058e8..b364dae 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -18,8 +18,6 @@
#ifndef __LVDBE_COEFFS_H__
#define __LVDBE_COEFFS_H__
-
-#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* General */
@@ -28,504 +26,6 @@
#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
-
-/************************************************************************************/
-/* */
-/* High Pass Filter coefficients */
-/* */
-/************************************************************************************/
-
- /* Coefficients for centre frequency 55Hz */
-#define HPF_Fs8000_Fc55_A0 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_A1 (-2059112655) /* Floating point value -1.917698 */
-#define HPF_Fs8000_Fc55_A2 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_B1 (-2081986375) /* Floating point value -1.939001 */
-#define HPF_Fs8000_Fc55_B2 1010183914 /* Floating point value 0.940807 */
-#define HPF_Fs11025_Fc55_A0 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_A1 (-2076421662) /* Floating point value -1.933818 */
-#define HPF_Fs11025_Fc55_A2 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_B1 (-2099950710) /* Floating point value -1.955732 */
-#define HPF_Fs11025_Fc55_B2 1027238450 /* Floating point value 0.956690 */
-#define HPF_Fs12000_Fc55_A0 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_A1 (-2080159885) /* Floating point value -1.937300 */
-#define HPF_Fs12000_Fc55_A2 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_B1 (-2103811702) /* Floating point value -1.959327 */
-#define HPF_Fs12000_Fc55_B2 1030940477 /* Floating point value 0.960138 */
-#define HPF_Fs16000_Fc55_A0 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_A1 (-2090763976) /* Floating point value -1.947176 */
-#define HPF_Fs16000_Fc55_A2 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_B1 (-2114727793) /* Floating point value -1.969494 */
-#define HPF_Fs16000_Fc55_B2 1041478147 /* Floating point value 0.969952 */
-#define HPF_Fs22050_Fc55_A0 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_A1 (-2099533046) /* Floating point value -1.955343 */
-#define HPF_Fs22050_Fc55_A2 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_B1 (-2123714381) /* Floating point value -1.977863 */
-#define HPF_Fs22050_Fc55_B2 1050232780 /* Floating point value 0.978105 */
-#define HPF_Fs24000_Fc55_A0 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_A1 (-2101422103) /* Floating point value -1.957102 */
-#define HPF_Fs24000_Fc55_A2 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_B1 (-2125645498) /* Floating point value -1.979662 */
-#define HPF_Fs24000_Fc55_B2 1052123526 /* Floating point value 0.979866 */
-#define HPF_Fs32000_Fc55_A0 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_A1 (-2106771519) /* Floating point value -1.962084 */
-#define HPF_Fs32000_Fc55_A2 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_B1 (-2131104794) /* Floating point value -1.984746 */
-#define HPF_Fs32000_Fc55_B2 1057486949 /* Floating point value 0.984861 */
-#define HPF_Fs44100_Fc55_A0 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_A1 (-2111184995) /* Floating point value -1.966194 */
-#define HPF_Fs44100_Fc55_A2 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_B1 (-2135598658) /* Floating point value -1.988931 */
-#define HPF_Fs44100_Fc55_B2 1061922249 /* Floating point value 0.988992 */
-#define HPF_Fs48000_Fc55_A0 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_A1 (-2112134551) /* Floating point value -1.967079 */
-#define HPF_Fs48000_Fc55_A2 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_B1 (-2136564296) /* Floating point value -1.989831 */
-#define HPF_Fs48000_Fc55_B2 1062877714 /* Floating point value 0.989882 */
-
- /* Coefficients for centre frequency 66Hz */
-#define HPF_Fs8000_Fc66_A0 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_A1 (-2046586542) /* Floating point value -1.906032 */
-#define HPF_Fs8000_Fc66_A2 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_B1 (-2068896860) /* Floating point value -1.926810 */
-#define HPF_Fs8000_Fc66_B2 997931110 /* Floating point value 0.929396 */
-#define HPF_Fs11025_Fc66_A0 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_A1 (-2067248455) /* Floating point value -1.925275 */
-#define HPF_Fs11025_Fc66_A2 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_B1 (-2090448000) /* Floating point value -1.946881 */
-#define HPF_Fs11025_Fc66_B2 1018182305 /* Floating point value 0.948256 */
-#define HPF_Fs12000_Fc66_A0 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_A1 (-2071715325) /* Floating point value -1.929435 */
-#define HPF_Fs12000_Fc66_A2 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_B1 (-2095080333) /* Floating point value -1.951196 */
-#define HPF_Fs12000_Fc66_B2 1022587158 /* Floating point value 0.952359 */
-#define HPF_Fs16000_Fc66_A0 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_A1 (-2084395056) /* Floating point value -1.941244 */
-#define HPF_Fs16000_Fc66_A2 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_B1 (-2108177912) /* Floating point value -1.963394 */
-#define HPF_Fs16000_Fc66_B2 1035142690 /* Floating point value 0.964052 */
-#define HPF_Fs22050_Fc66_A0 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_A1 (-2094890289) /* Floating point value -1.951019 */
-#define HPF_Fs22050_Fc66_A2 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_B1 (-2118961025) /* Floating point value -1.973436 */
-#define HPF_Fs22050_Fc66_B2 1045593102 /* Floating point value 0.973784 */
-#define HPF_Fs24000_Fc66_A0 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_A1 (-2097152349) /* Floating point value -1.953125 */
-#define HPF_Fs24000_Fc66_A2 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_B1 (-2121278255) /* Floating point value -1.975594 */
-#define HPF_Fs24000_Fc66_B2 1047852379 /* Floating point value 0.975889 */
-#define HPF_Fs32000_Fc66_A0 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_A1 (-2103560237) /* Floating point value -1.959093 */
-#define HPF_Fs32000_Fc66_A2 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_B1 (-2127829187) /* Floating point value -1.981695 */
-#define HPF_Fs32000_Fc66_B2 1054265623 /* Floating point value 0.981861 */
-#define HPF_Fs44100_Fc66_A0 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_A1 (-2108849444) /* Floating point value -1.964019 */
-#define HPF_Fs44100_Fc66_A2 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_B1 (-2133221723) /* Floating point value -1.986718 */
-#define HPF_Fs44100_Fc66_B2 1059573993 /* Floating point value 0.986805 */
-#define HPF_Fs48000_Fc66_A0 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_A1 (-2109987702) /* Floating point value -1.965079 */
-#define HPF_Fs48000_Fc66_A2 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_B1 (-2134380475) /* Floating point value -1.987797 */
-#define HPF_Fs48000_Fc66_B2 1060718118 /* Floating point value 0.987871 */
-
- /* Coefficients for centre frequency 78Hz */
-#define HPF_Fs8000_Fc78_A0 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_A1 (-2033008405) /* Floating point value -1.893387 */
-#define HPF_Fs8000_Fc78_A2 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_B1 (-2054623390) /* Floating point value -1.913517 */
-#define HPF_Fs8000_Fc78_B2 984733853 /* Floating point value 0.917105 */
-#define HPF_Fs11025_Fc78_A0 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_A1 (-2057287482) /* Floating point value -1.915998 */
-#define HPF_Fs11025_Fc78_A2 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_B1 (-2080083769) /* Floating point value -1.937229 */
-#define HPF_Fs11025_Fc78_B2 1008393904 /* Floating point value 0.939140 */
-#define HPF_Fs12000_Fc78_A0 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_A1 (-2062542133) /* Floating point value -1.920892 */
-#define HPF_Fs12000_Fc78_A2 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_B1 (-2085557048) /* Floating point value -1.942326 */
-#define HPF_Fs12000_Fc78_B2 1013551620 /* Floating point value 0.943944 */
-#define HPF_Fs16000_Fc78_A0 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_A1 (-2077469256) /* Floating point value -1.934794 */
-#define HPF_Fs16000_Fc78_A2 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_B1 (-2101033380) /* Floating point value -1.956740 */
-#define HPF_Fs16000_Fc78_B2 1028275228 /* Floating point value 0.957656 */
-#define HPF_Fs22050_Fc78_A0 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_A1 (-2089837169) /* Floating point value -1.946313 */
-#define HPF_Fs22050_Fc78_A2 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_B1 (-2113775854) /* Floating point value -1.968607 */
-#define HPF_Fs22050_Fc78_B2 1040555007 /* Floating point value 0.969092 */
-#define HPF_Fs24000_Fc78_A0 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_A1 (-2092504328) /* Floating point value -1.948797 */
-#define HPF_Fs24000_Fc78_A2 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_B1 (-2116514229) /* Floating point value -1.971157 */
-#define HPF_Fs24000_Fc78_B2 1043212719 /* Floating point value 0.971568 */
-#define HPF_Fs32000_Fc78_A0 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_A1 (-2100062603) /* Floating point value -1.955836 */
-#define HPF_Fs32000_Fc78_A2 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_B1 (-2124255900) /* Floating point value -1.978367 */
-#define HPF_Fs32000_Fc78_B2 1050762639 /* Floating point value 0.978599 */
-#define HPF_Fs44100_Fc78_A0 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_A1 (-2106304516) /* Floating point value -1.961649 */
-#define HPF_Fs44100_Fc78_A2 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_B1 (-2130628742) /* Floating point value -1.984303 */
-#define HPF_Fs44100_Fc78_B2 1057018180 /* Floating point value 0.984425 */
-#define HPF_Fs48000_Fc78_A0 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_A1 (-2107648173) /* Floating point value -1.962900 */
-#define HPF_Fs48000_Fc78_A2 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_B1 (-2131998154) /* Floating point value -1.985578 */
-#define HPF_Fs48000_Fc78_B2 1058367200 /* Floating point value 0.985681 */
-
- /* Coefficients for centre frequency 90Hz */
-#define HPF_Fs8000_Fc90_A0 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_A1 (-2019520105) /* Floating point value -1.880825 */
-#define HPF_Fs8000_Fc90_A2 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_B1 (-2040357139) /* Floating point value -1.900231 */
-#define HPF_Fs8000_Fc90_B2 971711129 /* Floating point value 0.904977 */
-#define HPF_Fs11025_Fc90_A0 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_A1 (-2047374434) /* Floating point value -1.906766 */
-#define HPF_Fs11025_Fc90_A2 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_B1 (-2069722397) /* Floating point value -1.927579 */
-#define HPF_Fs11025_Fc90_B2 998699604 /* Floating point value 0.930111 */
-#define HPF_Fs12000_Fc90_A0 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_A1 (-2053409508) /* Floating point value -1.912387 */
-#define HPF_Fs12000_Fc90_A2 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_B1 (-2076035996) /* Floating point value -1.933459 */
-#define HPF_Fs12000_Fc90_B2 1004595918 /* Floating point value 0.935603 */
-#define HPF_Fs16000_Fc90_A0 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_A1 (-2070566451) /* Floating point value -1.928365 */
-#define HPF_Fs16000_Fc90_A2 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_B1 (-2093889811) /* Floating point value -1.950087 */
-#define HPF_Fs16000_Fc90_B2 1021453326 /* Floating point value 0.951303 */
-#define HPF_Fs22050_Fc90_A0 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_A1 (-2084796232) /* Floating point value -1.941618 */
-#define HPF_Fs22050_Fc90_A2 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_B1 (-2108591057) /* Floating point value -1.963778 */
-#define HPF_Fs22050_Fc90_B2 1035541188 /* Floating point value 0.964423 */
-#define HPF_Fs24000_Fc90_A0 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_A1 (-2087866604) /* Floating point value -1.944477 */
-#define HPF_Fs24000_Fc90_A2 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_B1 (-2111750495) /* Floating point value -1.966721 */
-#define HPF_Fs24000_Fc90_B2 1038593601 /* Floating point value 0.967266 */
-#define HPF_Fs32000_Fc90_A0 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_A1 (-2096570783) /* Floating point value -1.952584 */
-#define HPF_Fs32000_Fc90_A2 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_B1 (-2120682737) /* Floating point value -1.975040 */
-#define HPF_Fs32000_Fc90_B2 1047271295 /* Floating point value 0.975347 */
-#define HPF_Fs44100_Fc90_A0 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_A1 (-2103762660) /* Floating point value -1.959282 */
-#define HPF_Fs44100_Fc90_A2 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_B1 (-2128035809) /* Floating point value -1.981888 */
-#define HPF_Fs44100_Fc90_B2 1054468533 /* Floating point value 0.982050 */
-#define HPF_Fs48000_Fc90_A0 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_A1 (-2105311238) /* Floating point value -1.960724 */
-#define HPF_Fs48000_Fc90_A2 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_B1 (-2129615871) /* Floating point value -1.983359 */
-#define HPF_Fs48000_Fc90_B2 1056021492 /* Floating point value 0.983497 */
-
-
-/************************************************************************************/
-/* */
-/* Band Pass Filter coefficients */
-/* */
-/************************************************************************************/
-
- /* Coefficients for centre frequency 55Hz */
-#define BPF_Fs8000_Fc55_A0 9875247 /* Floating point value 0.009197 */
-#define BPF_Fs8000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc55_A2 (-9875247) /* Floating point value -0.009197 */
-#define BPF_Fs8000_Fc55_B1 (-2125519830) /* Floating point value -1.979545 */
-#define BPF_Fs8000_Fc55_B2 1053762629 /* Floating point value 0.981393 */
-#define BPF_Fs11025_Fc55_A0 7183952 /* Floating point value 0.006691 */
-#define BPF_Fs11025_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc55_A2 (-7183952) /* Floating point value -0.006691 */
-#define BPF_Fs11025_Fc55_B1 (-2131901658) /* Floating point value -1.985488 */
-#define BPF_Fs11025_Fc55_B2 1059207548 /* Floating point value 0.986464 */
-#define BPF_Fs12000_Fc55_A0 6603871 /* Floating point value 0.006150 */
-#define BPF_Fs12000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc55_A2 (-6603871) /* Floating point value -0.006150 */
-#define BPF_Fs12000_Fc55_B1 (-2133238092) /* Floating point value -1.986733 */
-#define BPF_Fs12000_Fc55_B2 1060381143 /* Floating point value 0.987557 */
-#define BPF_Fs16000_Fc55_A0 4960591 /* Floating point value 0.004620 */
-#define BPF_Fs16000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc55_A2 (-4960591) /* Floating point value -0.004620 */
-#define BPF_Fs16000_Fc55_B1 (-2136949052) /* Floating point value -1.990189 */
-#define BPF_Fs16000_Fc55_B2 1063705760 /* Floating point value 0.990653 */
-#define BPF_Fs22050_Fc55_A0 3604131 /* Floating point value 0.003357 */
-#define BPF_Fs22050_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc55_A2 (-3604131) /* Floating point value -0.003357 */
-#define BPF_Fs22050_Fc55_B1 (-2139929085) /* Floating point value -1.992964 */
-#define BPF_Fs22050_Fc55_B2 1066450095 /* Floating point value 0.993209 */
-#define BPF_Fs24000_Fc55_A0 3312207 /* Floating point value 0.003085 */
-#define BPF_Fs24000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc55_A2 (-3312207) /* Floating point value -0.003085 */
-#define BPF_Fs24000_Fc55_B1 (-2140560606) /* Floating point value -1.993552 */
-#define BPF_Fs24000_Fc55_B2 1067040703 /* Floating point value 0.993759 */
-#define BPF_Fs32000_Fc55_A0 2486091 /* Floating point value 0.002315 */
-#define BPF_Fs32000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc55_A2 (-2486091) /* Floating point value -0.002315 */
-#define BPF_Fs32000_Fc55_B1 (-2142328962) /* Floating point value -1.995199 */
-#define BPF_Fs32000_Fc55_B2 1068712067 /* Floating point value 0.995316 */
-#define BPF_Fs44100_Fc55_A0 1805125 /* Floating point value 0.001681 */
-#define BPF_Fs44100_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc55_A2 (-1805125) /* Floating point value -0.001681 */
-#define BPF_Fs44100_Fc55_B1 (-2143765772) /* Floating point value -1.996537 */
-#define BPF_Fs44100_Fc55_B2 1070089770 /* Floating point value 0.996599 */
-#define BPF_Fs48000_Fc55_A0 1658687 /* Floating point value 0.001545 */
-#define BPF_Fs48000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc55_A2 (-1658687) /* Floating point value -0.001545 */
-#define BPF_Fs48000_Fc55_B1 (-2144072292) /* Floating point value -1.996823 */
-#define BPF_Fs48000_Fc55_B2 1070386036 /* Floating point value 0.996875 */
-
- /* Coefficients for centre frequency 66Hz */
-#define BPF_Fs8000_Fc66_A0 13580189 /* Floating point value 0.012648 */
-#define BPF_Fs8000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc66_A2 (-13580189) /* Floating point value -0.012648 */
-#define BPF_Fs8000_Fc66_B1 (-2117161175) /* Floating point value -1.971760 */
-#define BPF_Fs8000_Fc66_B2 1046266945 /* Floating point value 0.974412 */
-#define BPF_Fs11025_Fc66_A0 9888559 /* Floating point value 0.009209 */
-#define BPF_Fs11025_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc66_A2 (-9888559) /* Floating point value -0.009209 */
-#define BPF_Fs11025_Fc66_B1 (-2125972738) /* Floating point value -1.979966 */
-#define BPF_Fs11025_Fc66_B2 1053735698 /* Floating point value 0.981368 */
-#define BPF_Fs12000_Fc66_A0 9091954 /* Floating point value 0.008468 */
-#define BPF_Fs12000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc66_A2 (-9091954) /* Floating point value -0.008468 */
-#define BPF_Fs12000_Fc66_B1 (-2127818004) /* Floating point value -1.981685 */
-#define BPF_Fs12000_Fc66_B2 1055347356 /* Floating point value 0.982869 */
-#define BPF_Fs16000_Fc66_A0 6833525 /* Floating point value 0.006364 */
-#define BPF_Fs16000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc66_A2 (-6833525) /* Floating point value -0.006364 */
-#define BPF_Fs16000_Fc66_B1 (-2132941739) /* Floating point value -1.986457 */
-#define BPF_Fs16000_Fc66_B2 1059916517 /* Floating point value 0.987124 */
-#define BPF_Fs22050_Fc66_A0 4967309 /* Floating point value 0.004626 */
-#define BPF_Fs22050_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc66_A2 (-4967309) /* Floating point value -0.004626 */
-#define BPF_Fs22050_Fc66_B1 (-2137056003) /* Floating point value -1.990288 */
-#define BPF_Fs22050_Fc66_B2 1063692170 /* Floating point value 0.990641 */
-#define BPF_Fs24000_Fc66_A0 4565445 /* Floating point value 0.004252 */
-#define BPF_Fs24000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc66_A2 (-4565445) /* Floating point value -0.004252 */
-#define BPF_Fs24000_Fc66_B1 (-2137927842) /* Floating point value -1.991100 */
-#define BPF_Fs24000_Fc66_B2 1064505202 /* Floating point value 0.991398 */
-#define BPF_Fs32000_Fc66_A0 3427761 /* Floating point value 0.003192 */
-#define BPF_Fs32000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc66_A2 (-3427761) /* Floating point value -0.003192 */
-#define BPF_Fs32000_Fc66_B1 (-2140369007) /* Floating point value -1.993374 */
-#define BPF_Fs32000_Fc66_B2 1066806920 /* Floating point value 0.993541 */
-#define BPF_Fs44100_Fc66_A0 2489466 /* Floating point value 0.002318 */
-#define BPF_Fs44100_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc66_A2 (-2489466) /* Floating point value -0.002318 */
-#define BPF_Fs44100_Fc66_B1 (-2142352342) /* Floating point value -1.995221 */
-#define BPF_Fs44100_Fc66_B2 1068705240 /* Floating point value 0.995309 */
-#define BPF_Fs48000_Fc66_A0 2287632 /* Floating point value 0.002131 */
-#define BPF_Fs48000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc66_A2 (-2287632) /* Floating point value -0.002131 */
-#define BPF_Fs48000_Fc66_B1 (-2142775436) /* Floating point value -1.995615 */
-#define BPF_Fs48000_Fc66_B2 1069113581 /* Floating point value 0.995690 */
-
- /* Coefficients for centre frequency 78Hz */
-#define BPF_Fs8000_Fc78_A0 19941180 /* Floating point value 0.018572 */
-#define BPF_Fs8000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc78_A2 (-19941180) /* Floating point value -0.018572 */
-#define BPF_Fs8000_Fc78_B1 (-2103186749) /* Floating point value -1.958745 */
-#define BPF_Fs8000_Fc78_B2 1033397648 /* Floating point value 0.962427 */
-#define BPF_Fs11025_Fc78_A0 14543934 /* Floating point value 0.013545 */
-#define BPF_Fs11025_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc78_A2 (-14543934) /* Floating point value -0.013545 */
-#define BPF_Fs11025_Fc78_B1 (-2115966638) /* Floating point value -1.970647 */
-#define BPF_Fs11025_Fc78_B2 1044317135 /* Floating point value 0.972596 */
-#define BPF_Fs12000_Fc78_A0 13376999 /* Floating point value 0.012458 */
-#define BPF_Fs12000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc78_A2 (-13376999) /* Floating point value -0.012458 */
-#define BPF_Fs12000_Fc78_B1 (-2118651708) /* Floating point value -1.973148 */
-#define BPF_Fs12000_Fc78_B2 1046678029 /* Floating point value 0.974795 */
-#define BPF_Fs16000_Fc78_A0 10064222 /* Floating point value 0.009373 */
-#define BPF_Fs16000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc78_A2 (-10064222) /* Floating point value -0.009373 */
-#define BPF_Fs16000_Fc78_B1 (-2126124342) /* Floating point value -1.980108 */
-#define BPF_Fs16000_Fc78_B2 1053380304 /* Floating point value 0.981037 */
-#define BPF_Fs22050_Fc78_A0 7321780 /* Floating point value 0.006819 */
-#define BPF_Fs22050_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc78_A2 (-7321780) /* Floating point value -0.006819 */
-#define BPF_Fs22050_Fc78_B1 (-2132143771) /* Floating point value -1.985714 */
-#define BPF_Fs22050_Fc78_B2 1058928700 /* Floating point value 0.986204 */
-#define BPF_Fs24000_Fc78_A0 6730640 /* Floating point value 0.006268 */
-#define BPF_Fs24000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc78_A2 (-6730640) /* Floating point value -0.006268 */
-#define BPF_Fs24000_Fc78_B1 (-2133421607) /* Floating point value -1.986904 */
-#define BPF_Fs24000_Fc78_B2 1060124669 /* Floating point value 0.987318 */
-#define BPF_Fs32000_Fc78_A0 5055965 /* Floating point value 0.004709 */
-#define BPF_Fs32000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc78_A2 (-5055965) /* Floating point value -0.004709 */
-#define BPF_Fs32000_Fc78_B1 (-2137003977) /* Floating point value -1.990240 */
-#define BPF_Fs32000_Fc78_B2 1063512802 /* Floating point value 0.990473 */
-#define BPF_Fs44100_Fc78_A0 3673516 /* Floating point value 0.003421 */
-#define BPF_Fs44100_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc78_A2 (-3673516) /* Floating point value -0.003421 */
-#define BPF_Fs44100_Fc78_B1 (-2139919394) /* Floating point value -1.992955 */
-#define BPF_Fs44100_Fc78_B2 1066309718 /* Floating point value 0.993078 */
-#define BPF_Fs48000_Fc78_A0 3375990 /* Floating point value 0.003144 */
-#define BPF_Fs48000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc78_A2 (-3375990) /* Floating point value -0.003144 */
-#define BPF_Fs48000_Fc78_B1 (-2140541906) /* Floating point value -1.993535 */
-#define BPF_Fs48000_Fc78_B2 1066911660 /* Floating point value 0.993639 */
-
- /* Coefficients for centre frequency 90Hz */
-#define BPF_Fs8000_Fc90_A0 24438548 /* Floating point value 0.022760 */
-#define BPF_Fs8000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc90_A2 (-24438548) /* Floating point value -0.022760 */
-#define BPF_Fs8000_Fc90_B1 (-2092801347) /* Floating point value -1.949073 */
-#define BPF_Fs8000_Fc90_B2 1024298757 /* Floating point value 0.953953 */
-#define BPF_Fs11025_Fc90_A0 17844385 /* Floating point value 0.016619 */
-#define BPF_Fs11025_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc90_A2 (-17844385) /* Floating point value -0.016619 */
-#define BPF_Fs11025_Fc90_B1 (-2108604921) /* Floating point value -1.963791 */
-#define BPF_Fs11025_Fc90_B2 1037639797 /* Floating point value 0.966377 */
-#define BPF_Fs12000_Fc90_A0 16416707 /* Floating point value 0.015289 */
-#define BPF_Fs12000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc90_A2 (-16416707) /* Floating point value -0.015289 */
-#define BPF_Fs12000_Fc90_B1 (-2111922936) /* Floating point value -1.966882 */
-#define BPF_Fs12000_Fc90_B2 1040528216 /* Floating point value 0.969067 */
-#define BPF_Fs16000_Fc90_A0 12359883 /* Floating point value 0.011511 */
-#define BPF_Fs16000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc90_A2 (-12359883) /* Floating point value -0.011511 */
-#define BPF_Fs16000_Fc90_B1 (-2121152162) /* Floating point value -1.975477 */
-#define BPF_Fs16000_Fc90_B2 1048735817 /* Floating point value 0.976711 */
-#define BPF_Fs22050_Fc90_A0 8997173 /* Floating point value 0.008379 */
-#define BPF_Fs22050_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc90_A2 (-8997173) /* Floating point value -0.008379 */
-#define BPF_Fs22050_Fc90_B1 (-2128580762) /* Floating point value -1.982395 */
-#define BPF_Fs22050_Fc90_B2 1055539113 /* Floating point value 0.983047 */
-#define BPF_Fs24000_Fc90_A0 8271818 /* Floating point value 0.007704 */
-#define BPF_Fs24000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc90_A2 (-8271818) /* Floating point value -0.007704 */
-#define BPF_Fs24000_Fc90_B1 (-2130157013) /* Floating point value -1.983863 */
-#define BPF_Fs24000_Fc90_B2 1057006621 /* Floating point value 0.984414 */
-#define BPF_Fs32000_Fc90_A0 6215918 /* Floating point value 0.005789 */
-#define BPF_Fs32000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc90_A2 (-6215918) /* Floating point value -0.005789 */
-#define BPF_Fs32000_Fc90_B1 (-2134574521) /* Floating point value -1.987977 */
-#define BPF_Fs32000_Fc90_B2 1061166033 /* Floating point value 0.988288 */
-#define BPF_Fs44100_Fc90_A0 4517651 /* Floating point value 0.004207 */
-#define BPF_Fs44100_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc90_A2 (-4517651) /* Floating point value -0.004207 */
-#define BPF_Fs44100_Fc90_B1 (-2138167926) /* Floating point value -1.991324 */
-#define BPF_Fs44100_Fc90_B2 1064601898 /* Floating point value 0.991488 */
-#define BPF_Fs48000_Fc90_A0 4152024 /* Floating point value 0.003867 */
-#define BPF_Fs48000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc90_A2 (-4152024) /* Floating point value -0.003867 */
-#define BPF_Fs48000_Fc90_B1 (-2138935002) /* Floating point value -1.992038 */
-#define BPF_Fs48000_Fc90_B2 1065341620 /* Floating point value 0.992177 */
-
-
-/************************************************************************************/
-/* */
-/* Automatic Gain Control time constants and gain settings */
-/* */
-/************************************************************************************/
-
-/* AGC Time constants */
-#define AGC_ATTACK_Fs8000 27571 /* Floating point value 0.841395 */
-#define AGC_ATTACK_Fs11025 28909 /* Floating point value 0.882223 */
-#define AGC_ATTACK_Fs12000 29205 /* Floating point value 0.891251 */
-#define AGC_ATTACK_Fs16000 30057 /* Floating point value 0.917276 */
-#define AGC_ATTACK_Fs22050 30778 /* Floating point value 0.939267 */
-#define AGC_ATTACK_Fs24000 30935 /* Floating point value 0.944061 */
-#define AGC_ATTACK_Fs32000 31383 /* Floating point value 0.957745 */
-#define AGC_ATTACK_Fs44100 31757 /* Floating point value 0.969158 */
-#define AGC_ATTACK_Fs48000 31838 /* Floating point value 0.971628 */
-#define DECAY_SHIFT 10 /* As a power of 2 */
-#define AGC_DECAY_Fs8000 44 /* Floating point value 0.000042 */
-#define AGC_DECAY_Fs11025 32 /* Floating point value 0.000030 */
-#define AGC_DECAY_Fs12000 29 /* Floating point value 0.000028 */
-#define AGC_DECAY_Fs16000 22 /* Floating point value 0.000021 */
-#define AGC_DECAY_Fs22050 16 /* Floating point value 0.000015 */
-#define AGC_DECAY_Fs24000 15 /* Floating point value 0.000014 */
-#define AGC_DECAY_Fs32000 11 /* Floating point value 0.000010 */
-#define AGC_DECAY_Fs44100 8 /* Floating point value 0.000008 */
-#define AGC_DECAY_Fs48000 7 /* Floating point value 0.000007 */
-
-/* AGC Gain settings */
-#define AGC_GAIN_SCALE 31 /* As a power of 2 */
-#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
-#define AGC_TARGETLEVEL 33170337 /* Floating point value -0.100000dB */
-#define AGC_HPFGAIN_0dB 110739704 /* Floating point value 0.412538 */
-#define AGC_GAIN_0dB 0 /* Floating point value 0.000000 */
-#define AGC_HPFGAIN_1dB 157006071 /* Floating point value 0.584893 */
-#define AGC_GAIN_1dB 32754079 /* Floating point value 0.122018 */
-#define AGC_HPFGAIN_2dB 208917788 /* Floating point value 0.778279 */
-#define AGC_GAIN_2dB 69504761 /* Floating point value 0.258925 */
-#define AGC_HPFGAIN_3dB 267163693 /* Floating point value 0.995262 */
-#define AGC_GAIN_3dB 110739704 /* Floating point value 0.412538 */
-#define AGC_HPFGAIN_4dB 332516674 /* Floating point value 1.238721 */
-#define AGC_GAIN_4dB 157006071 /* Floating point value 0.584893 */
-#define AGC_HPFGAIN_5dB 405843924 /* Floating point value 1.511886 */
-#define AGC_GAIN_5dB 208917788 /* Floating point value 0.778279 */
-#define AGC_HPFGAIN_6dB 488118451 /* Floating point value 1.818383 */
-#define AGC_GAIN_6dB 267163693 /* Floating point value 0.995262 */
-#define AGC_HPFGAIN_7dB 580431990 /* Floating point value 2.162278 */
-#define AGC_GAIN_7dB 332516674 /* Floating point value 1.238721 */
-#define AGC_HPFGAIN_8dB 684009483 /* Floating point value 2.548134 */
-#define AGC_GAIN_8dB 405843924 /* Floating point value 1.511886 */
-#define AGC_HPFGAIN_9dB 800225343 /* Floating point value 2.981072 */
-#define AGC_GAIN_9dB 488118451 /* Floating point value 1.818383 */
-#define AGC_HPFGAIN_10dB 930621681 /* Floating point value 3.466836 */
-#define AGC_GAIN_10dB 580431990 /* Floating point value 2.162278 */
-#define AGC_HPFGAIN_11dB 1076928780 /* Floating point value 4.011872 */
-#define AGC_GAIN_11dB 684009483 /* Floating point value 2.548134 */
-#define AGC_HPFGAIN_12dB 1241088045 /* Floating point value 4.623413 */
-#define AGC_GAIN_12dB 800225343 /* Floating point value 2.981072 */
-#define AGC_HPFGAIN_13dB 1425277769 /* Floating point value 5.309573 */
-#define AGC_GAIN_13dB 930621681 /* Floating point value 3.466836 */
-#define AGC_HPFGAIN_14dB 1631942039 /* Floating point value 6.079458 */
-#define AGC_GAIN_14dB 1076928780 /* Floating point value 4.011872 */
-#define AGC_HPFGAIN_15dB 1863823163 /* Floating point value 6.943282 */
-#define AGC_GAIN_15dB 1241088045 /* Floating point value 4.623413 */
-
-
-/************************************************************************************/
-/* */
-/* Volume control */
-/* */
-/************************************************************************************/
-
-/* Volume control gain */
-#define VOLUME_MAX 0 /* In dBs */
-#define VOLUME_SHIFT 0 /* In dBs */
-
-/* Volume control time constants */
-#define VOL_TC_SHIFT 21 /* As a power of 2 */
-#define VOL_TC_Fs8000 25889 /* Floating point value 0.024690 */
-#define VOL_TC_Fs11025 18850 /* Floating point value 0.017977 */
-#define VOL_TC_Fs12000 17331 /* Floating point value 0.016529 */
-#define VOL_TC_Fs16000 13026 /* Floating point value 0.012422 */
-#define VOL_TC_Fs22050 9468 /* Floating point value 0.009029 */
-#define VOL_TC_Fs24000 8702 /* Floating point value 0.008299 */
-#define VOL_TC_Fs32000 6533 /* Floating point value 0.006231 */
-#define VOL_TC_Fs44100 4745 /* Floating point value 0.004525 */
-#define VOL_TC_Fs48000 4360 /* Floating point value 0.004158 */
-#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
-#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
-#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
-#define MIX_TC_Fs16000 30978 /* Floating point value 0.945387 */
-#define MIX_TC_Fs22050 31451 /* Floating point value 0.959804 */
-#define MIX_TC_Fs24000 31554 /* Floating point value 0.962956 */
-#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
-#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
-#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
-
-#else /*BUILD_FLOAT*/
-
-/************************************************************************************/
-/* */
-/* General */
-/* */
-/************************************************************************************/
-
-#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
-
-
/************************************************************************************/
/* */
/* High Pass Filter coefficients */
@@ -579,7 +79,6 @@
#define HPF_Fs48000_Fc55_B1 (-1.989831f)
#define HPF_Fs48000_Fc55_B2 0.989882f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc55_A0 0.985818f
#define HPF_Fs88200_Fc55_A1 (-1.971636f)
#define HPF_Fs88200_Fc55_A2 0.985818f
@@ -603,8 +102,6 @@
#define HPF_Fs192000_Fc55_A2 0.987294f
#define HPF_Fs192000_Fc55_B1 (-1.997458f)
#define HPF_Fs192000_Fc55_B2 0.997461f
-#endif
-
/* Coefficients for centre frequency 66Hz */
#define HPF_Fs8000_Fc66_A0 0.953016f
@@ -653,7 +150,6 @@
#define HPF_Fs48000_Fc66_B1 (-1.987797f)
#define HPF_Fs48000_Fc66_B2 0.987871f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc66_A0 0.985273f
#define HPF_Fs88200_Fc66_A1 (-1.970546f)
#define HPF_Fs88200_Fc66_A2 0.985273f
@@ -677,7 +173,6 @@
#define HPF_Fs192000_Fc66_A2 0.987043f
#define HPF_Fs192000_Fc66_B1 (-1.996949f)
#define HPF_Fs192000_Fc66_B2 0.996954f
-#endif
/* Coefficients for centre frequency 78Hz */
#define HPF_Fs8000_Fc78_A0 0.946693f
@@ -726,7 +221,6 @@
#define HPF_Fs48000_Fc78_B1 (-1.985578f)
#define HPF_Fs48000_Fc78_B2 0.985681f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc78_A0 0.984678f
#define HPF_Fs88200_Fc78_A1 (-1.969356f)
#define HPF_Fs88200_Fc78_A2 0.984678f
@@ -750,7 +244,6 @@
#define HPF_Fs192000_Fc78_A2 0.986769f
#define HPF_Fs192000_Fc78_B1 (-1.996394f)
#define HPF_Fs192000_Fc78_B2 0.996401f
-#endif
/* Coefficients for centre frequency 90Hz */
#define HPF_Fs8000_Fc90_A0 0.940412f
@@ -799,7 +292,6 @@
#define HPF_Fs48000_Fc90_B1 (-1.983359f)
#define HPF_Fs48000_Fc90_B2 0.983497f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc90_A0 0.984084f
#define HPF_Fs88200_Fc90_A1 (-1.968168f)
#define HPF_Fs88200_Fc90_A2 0.984084f
@@ -823,7 +315,6 @@
#define HPF_Fs192000_Fc90_A2 0.986496f
#define HPF_Fs192000_Fc90_B1 (-1.995840f)
#define HPF_Fs192000_Fc90_B2 0.995848f
-#endif
/************************************************************************************/
/* */
@@ -878,7 +369,6 @@
#define BPF_Fs48000_Fc55_B1 (-1.996823f)
#define BPF_Fs48000_Fc55_B2 0.996875f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc55_A0 0.000831f
#define BPF_Fs88200_Fc55_A1 0.000000f
#define BPF_Fs88200_Fc55_A2 (-0.000831f)
@@ -902,7 +392,6 @@
#define BPF_Fs192000_Fc55_A2 (-0.000381f)
#define BPF_Fs192000_Fc55_B1 (-1.999234f)
#define BPF_Fs192000_Fc55_B2 0.999238f
-#endif
/* Coefficients for centre frequency 66Hz */
#define BPF_Fs8000_Fc66_A0 0.012648f
@@ -951,7 +440,6 @@
#define BPF_Fs48000_Fc66_B1 (-1.995615f)
#define BPF_Fs48000_Fc66_B2 0.995690f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc66_A0 0.001146f
#define BPF_Fs88200_Fc66_A1 0.000000f
#define BPF_Fs88200_Fc66_A2 (-0.001146f)
@@ -975,7 +463,6 @@
#define BPF_Fs192000_Fc66_A2 (-0.000528f)
#define BPF_Fs192000_Fc66_B1 (-1.998939f)
#define BPF_Fs192000_Fc66_B2 0.998945f
-#endif
/* Coefficients for centre frequency 78Hz */
#define BPF_Fs8000_Fc78_A0 0.018572f
@@ -1024,7 +511,6 @@
#define BPF_Fs48000_Fc78_B1 (-1.993535f)
#define BPF_Fs48000_Fc78_B2 0.993639f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc78_A0 0.001693f
#define BPF_Fs88200_Fc78_A1 0.000000f
#define BPF_Fs88200_Fc78_A2 (-0.001693f)
@@ -1048,7 +534,6 @@
#define BPF_Fs192000_Fc78_A2 (-0.000778f)
#define BPF_Fs192000_Fc78_B1 (-1.998437f)
#define BPF_Fs192000_Fc78_B2 0.998444f
-#endif
/* Coefficients for centre frequency 90Hz */
#define BPF_Fs8000_Fc90_A0 0.022760f
@@ -1097,7 +582,6 @@
#define BPF_Fs48000_Fc90_B1 (-1.992038f)
#define BPF_Fs48000_Fc90_B2 0.992177f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc90_A0 0.002083f
#define BPF_Fs88200_Fc90_A1 0.000000f
#define BPF_Fs88200_Fc90_A2 (-0.002083f)
@@ -1121,7 +605,6 @@
#define BPF_Fs192000_Fc90_A2 (-0.000958f)
#define BPF_Fs192000_Fc90_B1 (-1.998075f)
#define BPF_Fs192000_Fc90_B2 0.998085f
-#endif
/************************************************************************************/
/* */
@@ -1140,12 +623,10 @@
#define AGC_ATTACK_Fs44100 0.969158f
#define AGC_ATTACK_Fs48000 0.971628f
-#ifdef HIGHER_FS
#define AGC_ATTACK_Fs88200 0.984458f
#define AGC_ATTACK_Fs96000 0.985712f
#define AGC_ATTACK_Fs176400 0.992199f
#define AGC_ATTACK_Fs192000 0.992830f
-#endif
#define DECAY_SHIFT 10
@@ -1159,12 +640,10 @@
#define AGC_DECAY_Fs44100 0.000008f
#define AGC_DECAY_Fs48000 0.000007f
-#ifdef HIGHER_FS
#define AGC_DECAY_Fs88200 0.0000038f
#define AGC_DECAY_FS96000 0.0000035f
#define AGC_DECAY_Fs176400 0.00000188f
#define AGC_DECAY_FS192000 0.00000175f
-#endif
/* AGC Gain settings */
#define AGC_GAIN_SCALE 31 /* As a power of 2 */
@@ -1224,12 +703,10 @@
#define VOL_TC_Fs32000 0.006231f
#define VOL_TC_Fs44100 0.004525f
#define VOL_TC_Fs48000 0.004158f
-#ifdef HIGHER_FS
#define VOL_TC_Fs88200 0.002263f
#define VOL_TC_Fs96000 0.002079f
#define VOL_TC_Fs176400 0.001131f
#define VOL_TC_Fs192000 0.001039f
-#endif
#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
@@ -1239,14 +716,11 @@
#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
-#ifdef HIGHER_FS
/* Floating point value 0.989704 */
#define MIX_TC_Fs88200 32430
#define MIX_TC_Fs96000 32456 /* Floating point value 0.990530 */
/* Floating point value 0.994838 */
#define MIX_TC_Fs176400 32598
#define MIX_TC_Fs192000 32611 /* Floating point value 0.992524 */
-#endif
-#endif /*BUILD_FLOAT*/
#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
rename to media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
index 0ba2c86..53feae8 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
@@ -58,7 +58,6 @@
return(LVDBE_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetCapabilities */
@@ -89,7 +88,6 @@
return(LVDBE_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetFilters */
@@ -107,72 +105,33 @@
LVDBE_Params_t *pParams)
{
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
/*
* Calculate the table offsets
*/
LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
(LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_192000)));
-#else
- /*
- * Calculate the table offsets
- */
- LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
- (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_48000)));
-#endif
/*
* Setup the high pass filter
*/
-#ifndef BUILD_FLOAT
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- sizeof(pInstance->pData->HPFTaps)/sizeof(LVM_INT16)); /* Number of words */
-#else
LoadConst_Float(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pInstance->pData->HPFTaps, /* Destination */
sizeof(pInstance->pData->HPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
-#endif
-#ifndef BUILD_FLOAT
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
- &pInstance->pData->HPFTaps,
- (BQ_C32_Coefs_t *)&LVDBE_HPF_Table[Offset]);
-#else
BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
&pInstance->pData->HPFTaps,
(BQ_FLOAT_Coefs_t *)&LVDBE_HPF_Table[Offset]);
-#endif
-
/*
* Setup the band pass filter
*/
-#ifndef BUILD_FLOAT
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- sizeof(pInstance->pData->BPFTaps)/sizeof(LVM_INT16)); /* Number of words */
-#else
LoadConst_Float(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pInstance->pData->BPFTaps, /* Destination */
sizeof(pInstance->pData->BPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
-#endif
-#ifndef BUILD_FLOAT
- BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
- &pInstance->pData->BPFTaps,
- (BP_C32_Coefs_t *)&LVDBE_BPF_Table[Offset]);
-#else
BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
&pInstance->pData->BPFTaps,
(BP_FLOAT_Coefs_t *)&LVDBE_BPF_Table[Offset]);
-#endif
}
-
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetAGC */
@@ -196,7 +155,6 @@
pInstance->pData->AGCInstance.AGC_Attack = LVDBE_AGC_ATTACK_Table[(LVM_UINT16)pParams->SampleRate]; /* Attack multiplier */
pInstance->pData->AGCInstance.AGC_Decay = LVDBE_AGC_DECAY_Table[(LVM_UINT16)pParams->SampleRate]; /* Decay multipler */
-
/*
* Get the boost gain
*/
@@ -208,14 +166,10 @@
{
pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
}
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.AGC_GainShift = AGC_GAIN_SHIFT;
-#endif
pInstance->pData->AGCInstance.AGC_Target = AGC_TARGETLEVEL;
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetVolume */
@@ -247,9 +201,7 @@
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
-#ifdef BUILD_FLOAT
LVM_FLOAT dBShifts_fac;
-#endif
/*
* Apply the volume if enabled
*/
@@ -268,68 +220,41 @@
}
}
-
/*
* Calculate the required gain and shifts
*/
dBOffset = (LVM_UINT16)(6 + Volume % 6); /* Get the dBs 0-5 */
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
-#ifdef BUILD_FLOAT
dBShifts_fac = (LVM_FLOAT)(1 << dBShifts);
-#endif
/*
* When DBE is enabled use AGC volume
*/
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.Target = ((LVM_INT32)LVDBE_VolumeTable[dBOffset] << 16);
- pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target >> dBShifts;
-#else
pInstance->pData->AGCInstance.Target = (LVDBE_VolumeTable[dBOffset]);
pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target / dBShifts_fac;
-#endif
pInstance->pData->AGCInstance.VolumeTC = LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.VolumeShift = VOLUME_SHIFT+1;
-#endif
/*
* When DBE is disabled use the bypass volume control
*/
if(dBShifts > 0)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(((LVM_INT32)LVDBE_VolumeTable[dBOffset]) >> dBShifts));
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset] / dBShifts_fac);
-#endif
}
else
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(LVM_INT32)LVDBE_VolumeTable[dBOffset]);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset]);
-#endif
}
pInstance->pData->BypassVolume.MixerStream[0].CallbackSet = 1;
-#ifndef BUILD_FLOAT
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_MIXER_TC,
(LVM_Fs_en)pInstance->Params.SampleRate,
2);
-#else
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
- LVDBE_MIXER_TC,
- (LVM_Fs_en)pInstance->Params.SampleRate,
- 2);
-#endif
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Control */
@@ -372,12 +297,7 @@
{
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
-#ifndef BUILD_FLOAT
- LVMixer3_2St_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
-#else
LVMixer3_2St_FLOAT_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
-#endif
-
/*
* Update the filters
@@ -389,7 +309,6 @@
pParams); /* New parameters */
}
-
/*
* Update the AGC is the effect level has changed
*/
@@ -399,24 +318,14 @@
{
LVDBE_SetAGC(pInstance, /* Instance pointer */
pParams); /* New parameters */
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-#else
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
-#endif
-
}
-
/*
* Update the Volume if the volume demand has changed
*/
@@ -431,23 +340,13 @@
if (pInstance->Params.OperatingMode==LVDBE_ON && pParams->OperatingMode==LVDBE_OFF)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0);
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0x00007FFF);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 0);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 1.0f);
-#endif
}
if (pInstance->Params.OperatingMode==LVDBE_OFF && pParams->OperatingMode==LVDBE_ON)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0x00007FFF);
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 0);
-#endif
}
/*
@@ -455,6 +354,5 @@
*/
pInstance->Params = *pParams;
-
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
similarity index 90%
rename from media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
rename to media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
index 2946734..ad77696 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
@@ -63,7 +63,6 @@
LVM_UINT32 ScratchSize;
LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)hInstance;
-
/*
* Fill in the memory table
*/
@@ -80,11 +79,7 @@
/*
* Data memory
*/
-#ifdef BUILD_FLOAT
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_FLOAT_t);
-#else
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_t);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
@@ -92,11 +87,7 @@
/*
* Coef memory
*/
-#ifdef BUILD_FLOAT
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_FLOAT_t);
-#else
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -104,12 +95,8 @@
/*
* Scratch memory
*/
-#ifdef BUILD_FLOAT
ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_FLOAT) * \
pCapabilities->MaxBlockSize);
-#else /*BUILD_FLOAT*/
- ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH;
@@ -124,7 +111,6 @@
return(LVDBE_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Init */
@@ -164,18 +150,11 @@
{
LVDBE_Instance_t *pInstance;
-#ifdef BUILD_FLOAT
LVMixer3_1St_FLOAT_st *pMixer_Instance;
LVMixer3_2St_FLOAT_st *pBypassMixer_Instance;
LVM_FLOAT MixGain;
-#else
- LVMixer3_1St_st *pMixer_Instance;
- LVMixer3_2St_st *pBypassMixer_Instance;
- LVM_INT32 MixGain;
-#endif
LVM_INT16 i;
-
/*
* Set the instance handle if not already initialised
*/
@@ -185,7 +164,6 @@
}
pInstance =(LVDBE_Instance_t *)*phInstance;
-
/*
* Check the memory table for NULL pointers and incorrectly aligned data
*/
@@ -203,19 +181,16 @@
}
}
-
/*
* Save the memory table in the instance structure
*/
pInstance->Capabilities = *pCapabilities;
-
/*
* Save the memory table in the instance structure
*/
pInstance->MemoryTable = *pMemoryTable;
-
/*
* Set the default instance parameters
*/
@@ -228,13 +203,13 @@
pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
pInstance->Params.VolumedB = 0;
-
/*
* Set pointer to data and coef memory
*/
- pInstance->pData = pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress;
- pInstance->pCoef = pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress;
-
+ pInstance->pData =
+ (LVDBE_Data_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress;
+ pInstance->pCoef =
+ (LVDBE_Coef_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress;
/*
* Initialise the filters
@@ -242,7 +217,6 @@
LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
&pInstance->Params);
-
/*
* Initialise the AGC
*/
@@ -254,11 +228,7 @@
// initialize the mixer with some fixes values since otherwise LVDBE_SetVolume ends up
// reading uninitialized data
pMixer_Instance = &pInstance->pData->BypassVolume;
-#ifndef BUILD_FLOAT
- LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],0x00007FFF,0x00007FFF);
-#else
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], 1.0, 1.0);
-#endif
/*
* Initialise the volume
@@ -268,13 +238,8 @@
pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target;
/* Initialise as the target */
-#ifndef BUILD_FLOAT
- MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
- LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],MixGain,MixGain);
-#else
MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], MixGain, MixGain);
-#endif
/* Configure the mixer process path */
pMixer_Instance->MixerStream[0].CallbackParam = 0;
@@ -307,15 +272,9 @@
pBypassMixer_Instance->MixerStream[1].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].pCallBack = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
-#ifndef BUILD_FLOAT
- LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1],0x00007FFF,0x00007FFF);
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
-#else
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1], 1.0, 1.0);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate, 2);
-#endif
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
index 4225a30..f3faaed 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -27,11 +27,6 @@
#ifndef __LVDBE_PRIVATE_H__
#define __LVDBE_PRIVATE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -43,7 +38,6 @@
#include "LVC_Mixer.h"
#include "AGC.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -74,7 +68,6 @@
#define LVDBE_MIXER_TC 5 /* Mixer time */
#define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */
-
/****************************************************************************************/
/* */
/* Structures */
@@ -82,29 +75,6 @@
/****************************************************************************************/
/* Data structure */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- /* AGC parameters */
- AGC_MIX_VOL_2St1Mon_D32_t AGCInstance; /* AGC instance parameters */
-
- /* Process variables */
- Biquad_2I_Order2_Taps_t HPFTaps; /* High pass filter taps */
- Biquad_1I_Order2_Taps_t BPFTaps; /* Band pass filter taps */
- LVMixer3_1St_st BypassVolume; /* Bypass volume scaler */
- LVMixer3_2St_st BypassMixer; /* Bypass Mixer for Click Removal */
-
-} LVDBE_Data_t;
-
-/* Coefs structure */
-typedef struct
-{
- /* Process variables */
- Biquad_Instance_t HPFInstance; /* High pass filter instance */
- Biquad_Instance_t BPFInstance; /* Band pass filter instance */
-
-} LVDBE_Coef_t;
-#else
/* Data structure */
typedef struct
{
@@ -126,7 +96,6 @@
Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */
Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */
} LVDBE_Coef_FLOAT_t;
-#endif
/* Instance structure */
typedef struct
{
@@ -136,16 +105,10 @@
LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
/* Data and coefficient pointers */
-#ifndef BUILD_FLOAT
- LVDBE_Data_t *pData; /* Instance data */
- LVDBE_Coef_t *pCoef; /* Instance coefficients */
-#else
LVDBE_Data_FLOAT_t *pData; /* Instance data */
LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */
-#endif
} LVDBE_Instance_t;
-
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -155,17 +118,10 @@
void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
void LVDBE_SetVolume(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVDBE_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
similarity index 72%
rename from media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
rename to media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
index c4d3403..b4a71c7 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
@@ -73,119 +73,6 @@
/* overall end to end gain is odB. */
/* */
/********************************************************************************************/
-#ifndef BUILD_FLOAT
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_INT16 *pInData, LVM_INT16 *pOutData, LVM_UINT16 NumSamples) {
-
- LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *) hInstance;
- LVM_INT32 *pScratch =
- (LVM_INT32 *) pInstance->MemoryTable.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress;
- LVM_INT32 *pMono;
- LVM_INT16 *pInput = (LVM_INT16 *) pInData;
-
- /* Scratch for Volume Control starts at offset of 2*NumSamples short values from pScratch */
- LVM_INT16 *pScratchVol = (LVM_INT16 *) (&pScratch[NumSamples]);
-
- /* Scratch for Mono path starts at offset of 2*NumSamples 32-bit values from pScratch */
- pMono = &pScratch[2 * NumSamples];
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize) {
- return (LVDBE_TOOMANYSAMPLES);
- }
-
- /*
- * Check if the algorithm is enabled
- */
- /* DBE path is processed when DBE is ON or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_ON)
- || (LVC_Mixer_GetCurrent(
- &pInstance->pData->BypassMixer.MixerStream[0])
- != LVC_Mixer_GetTarget(
- &pInstance->pData->BypassMixer.MixerStream[0]))) {
-
- /*
- * Convert 16-bit samples to 32-bit and scale
- * (For a 16-bit implementation apply headroom loss here)
- */
- Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
- pScratch, /* Dest. 32-bit data */
- (LVM_INT16) (2 * NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
- /*
- * Apply the high pass filter if selected
- */
- if (pInstance->Params.HPFSelect == LVDBE_HPF_ON) {
- BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
- (LVM_INT32 *) pScratch, /* Source */
- (LVM_INT32 *) pScratch, /* Destination */
- (LVM_INT16) NumSamples); /* Number of samples */
- }
-
- /*
- * Create the mono stream
- */
- From2iToMono_32(pScratch, /* Stereo source */
- pMono, /* Mono destination */
- (LVM_INT16) NumSamples); /* Number of samples */
-
- /*
- * Apply the band pass filter
- */
- BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
- (LVM_INT32 *) pMono, /* Source */
- (LVM_INT32 *) pMono, /* Destination */
- (LVM_INT16) NumSamples); /* Number of samples */
-
- /*
- * Apply the AGC and mix
- */
- AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
- pScratch, /* Stereo source */
- pMono, /* Mono band pass source */
- pScratch, /* Stereo destination */
- NumSamples); /* Number of samples */
-
- /*
- * Convert 32-bit samples to 16-bit and saturate
- * (Not required for 16-bit implemenations)
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
- (LVM_INT16 *) pScratch, /* Dest. 16-bit data */
- (LVM_INT16) (2 * NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
- }
-
- /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_OFF)
- || (LVC_Mixer_GetCurrent(
- &pInstance->pData->BypassMixer.MixerStream[1])
- != LVC_Mixer_GetTarget(
- &pInstance->pData->BypassMixer.MixerStream[1]))) {
-
- /*
- * The algorithm is disabled but volume management is required to compensate for
- * headroom and volume (if enabled)
- */
- LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume, pInData,
- pScratchVol, (LVM_INT16) (2 * NumSamples)); /* Left and right */
-
- }
-
- /*
- * Mix DBE processed path and bypass volume path
- */
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
- (LVM_INT16 *) pScratch, pScratchVol, pOutData,
- (LVM_INT16) (2 * NumSamples));
-
- return (LVDBE_SUCCESS);
-}
-#else /*BUILD_FLOAT*/
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -362,4 +249,3 @@
#endif
return LVDBE_SUCCESS;
}
-#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
similarity index 93%
rename from media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
rename to media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
index a2ce404..728575c 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -24,9 +23,9 @@
#include "LVDBE.h"
#include "LVDBE_Coeffs.h" /* Filter coefficients */
+#include "LVDBE_Tables.h"
#include "BIQUAD.h"
-
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -36,11 +35,7 @@
/*
* High Pass Filter Coefficient table
*/
-#ifndef BUILD_FLOAT
-const BQ_C32_Coefs_t LVDBE_HPF_Table[] = {
-#else /*BUILD_FLOAT*/
const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[] = {
-#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
HPF_Fs8000_Fc55_A1,
@@ -87,7 +82,6 @@
HPF_Fs48000_Fc55_A0,
-HPF_Fs48000_Fc55_B2,
-HPF_Fs48000_Fc55_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc55_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc55_A1,
HPF_Fs88200_Fc55_A0,
@@ -108,7 +102,6 @@
HPF_Fs192000_Fc55_A0,
-HPF_Fs192000_Fc55_B2,
-HPF_Fs192000_Fc55_B1},
-#endif
/* Coefficients for 66Hz centre frequency */
{HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
@@ -156,7 +149,6 @@
HPF_Fs48000_Fc66_A0,
-HPF_Fs48000_Fc66_B2,
-HPF_Fs48000_Fc66_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc66_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc66_A1,
HPF_Fs88200_Fc66_A0,
@@ -177,8 +169,6 @@
HPF_Fs192000_Fc66_A0,
-HPF_Fs192000_Fc66_B2,
-HPF_Fs192000_Fc66_B1},
-#endif
-
/* Coefficients for 78Hz centre frequency */
{HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
@@ -226,7 +216,6 @@
HPF_Fs48000_Fc78_A0,
-HPF_Fs48000_Fc78_B2,
-HPF_Fs48000_Fc78_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc78_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc78_A1,
HPF_Fs88200_Fc78_A0,
@@ -247,8 +236,6 @@
HPF_Fs192000_Fc78_A0,
-HPF_Fs192000_Fc78_B2,
-HPF_Fs192000_Fc78_B1},
-#endif
-
/* Coefficients for 90Hz centre frequency */
{HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
@@ -297,7 +284,6 @@
-HPF_Fs48000_Fc90_B2,
-HPF_Fs48000_Fc90_B1}
-#ifdef HIGHER_FS
,
{HPF_Fs88200_Fc90_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc90_A1,
@@ -319,18 +305,13 @@
HPF_Fs192000_Fc90_A0,
-HPF_Fs192000_Fc90_B2,
-HPF_Fs192000_Fc90_B1}
-#endif
};
/*
* Band Pass Filter coefficient table
*/
-#ifndef BUILD_FLOAT
-const BP_C32_Coefs_t LVDBE_BPF_Table[] = {
-#else /*BUILD_FLOAT*/
const BP_FLOAT_Coefs_t LVDBE_BPF_Table[] = {
-#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
-BPF_Fs8000_Fc55_B2,
@@ -359,7 +340,6 @@
{BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc55_B2,
-BPF_Fs48000_Fc55_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc55_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc55_B2,
-BPF_Fs88200_Fc55_B1},
@@ -372,7 +352,6 @@
{BPF_Fs192000_Fc55_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc55_B2,
-BPF_Fs192000_Fc55_B1},
-#endif
/* Coefficients for 66Hz centre frequency */
{BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
@@ -402,7 +381,6 @@
{BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc66_B2,
-BPF_Fs48000_Fc66_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc66_B2,
-BPF_Fs88200_Fc66_B1},
@@ -415,7 +393,6 @@
{BPF_Fs192000_Fc66_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc66_B2,
-BPF_Fs192000_Fc66_B1},
-#endif
/* Coefficients for 78Hz centre frequency */
{BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
@@ -445,7 +422,6 @@
{BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc78_B2,
-BPF_Fs48000_Fc78_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc66_B2,
-BPF_Fs88200_Fc66_B1},
@@ -458,7 +434,6 @@
{BPF_Fs192000_Fc78_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc78_B2,
-BPF_Fs192000_Fc78_B1},
-#endif
/* Coefficients for 90Hz centre frequency */
{BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
@@ -488,7 +463,6 @@
{BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc90_B2,
-BPF_Fs48000_Fc90_B1}
-#ifdef HIGHER_FS
,
{BPF_Fs88200_Fc90_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc90_B2,
@@ -502,12 +476,9 @@
{BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc90_B2,
-BPF_Fs192000_Fc90_B1}
-#endif
-
};
-
/************************************************************************************/
/* */
/* AGC constant tables */
@@ -515,11 +486,7 @@
/************************************************************************************/
/* Attack time (signal too large) */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_AGC_ATTACK_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_ATTACK_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_ATTACK_Fs8000,
AGC_ATTACK_Fs11025,
AGC_ATTACK_Fs12000,
@@ -529,21 +496,15 @@
AGC_ATTACK_Fs32000,
AGC_ATTACK_Fs44100,
AGC_ATTACK_Fs48000
-#ifdef HIGHER_FS
,AGC_ATTACK_Fs88200
,AGC_ATTACK_Fs96000
,AGC_ATTACK_Fs176400
,AGC_ATTACK_Fs192000
-#endif
};
/* Decay time (signal too small) */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_AGC_DECAY_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_DECAY_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_DECAY_Fs8000,
AGC_DECAY_Fs11025,
AGC_DECAY_Fs12000,
@@ -553,21 +514,15 @@
AGC_DECAY_Fs32000,
AGC_DECAY_Fs44100,
AGC_DECAY_Fs48000
-#ifdef HIGHER_FS
,AGC_DECAY_Fs88200
,AGC_DECAY_FS96000
,AGC_DECAY_Fs176400
,AGC_DECAY_FS192000
-#endif
};
/* Gain for use without the high pass filter */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVDBE_AGC_GAIN_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_GAIN_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_GAIN_0dB,
AGC_GAIN_1dB,
AGC_GAIN_2dB,
@@ -586,11 +541,7 @@
AGC_GAIN_15dB};
/* Gain for use with the high pass filter */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_HPFGAIN_0dB,
AGC_HPFGAIN_1dB,
AGC_HPFGAIN_2dB,
@@ -608,7 +559,6 @@
AGC_HPFGAIN_14dB,
AGC_HPFGAIN_15dB};
-
/************************************************************************************/
/* */
/* Volume control gain and time constant tables */
@@ -616,16 +566,6 @@
/************************************************************************************/
/* dB to linear conversion table */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_VolumeTable[] = {
- 0x4000, /* -6dB */
- 0x47FB, /* -5dB */
- 0x50C3, /* -4dB */
- 0x5A9E, /* -3dB */
- 0x65AD, /* -2dB */
- 0x7215, /* -1dB */
- 0x7FFF}; /* 0dB */
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_VolumeTable[] = {
0.500000f, /* -6dB */
0.562341f, /* -5dB */
@@ -634,13 +574,8 @@
0.794328f, /* -2dB */
0.891251f, /* -1dB */
1.000000f}; /* 0dB */
-#endif /*BUILD_FLOAT*/
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_VolumeTCTable[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_VolumeTCTable[] = {
-#endif /*BUILD_FLOAT*/
VOL_TC_Fs8000,
VOL_TC_Fs11025,
VOL_TC_Fs12000,
@@ -650,16 +585,12 @@
VOL_TC_Fs32000,
VOL_TC_Fs44100,
VOL_TC_Fs48000
-#ifdef HIGHER_FS
,VOL_TC_Fs88200
,VOL_TC_Fs96000
,VOL_TC_Fs176400
,VOL_TC_Fs192000
-#endif
};
-
-
const LVM_INT16 LVDBE_MixerTCTable[] = {
MIX_TC_Fs8000,
@@ -671,11 +602,9 @@
MIX_TC_Fs32000,
MIX_TC_Fs44100,
MIX_TC_Fs48000
-#ifdef HIGHER_FS
,MIX_TC_Fs88200
,MIX_TC_Fs96000
,MIX_TC_Fs176400
,MIX_TC_Fs192000
-#endif
};
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
index ca46e37..6eabdd2 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -24,61 +23,9 @@
#ifndef __LVBDE_TABLES_H__
#define __LVBDE_TABLES_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "BIQUAD.h"
#include "LVM_Types.h"
-#ifndef BUILD_FLOAT
-/************************************************************************************/
-/* */
-/* Coefficients constant table */
-/* */
-/************************************************************************************/
-
-/*
- * High Pass Filter Coefficient table
- */
-extern const BQ_C32_Coefs_t LVDBE_HPF_Table[];
-
-/*
- * Band Pass Filter coefficient table
- */
-extern const BP_C32_Coefs_t LVDBE_BPF_Table[];
-
-/************************************************************************************/
-/* */
-/* AGC constant tables */
-/* */
-/************************************************************************************/
-
-/* Attack time (signal too large) */
-extern const LVM_INT16 LVDBE_AGC_ATTACK_Table[];
-
-/* Decay time (signal too small) */
-extern const LVM_INT16 LVDBE_AGC_DECAY_Table[];
-
-/* Gain for use without the high pass filter */
-extern const LVM_INT32 LVDBE_AGC_GAIN_Table[];
-
-/* Gain for use with the high pass filter */
-extern const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[];
-
-/************************************************************************************/
-/* */
-/* Volume control gain and time constant tables */
-/* */
-/************************************************************************************/
-
-/* dB to linear conversion table */
-extern const LVM_INT16 LVDBE_VolumeTable[];
-
-extern const LVM_INT16 LVDBE_VolumeTCTable[];
-
-#else /*BUILD_FLOAT*/
-
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -123,13 +70,6 @@
extern const LVM_FLOAT LVDBE_VolumeTable[];
extern const LVM_FLOAT LVDBE_VolumeTCTable[];
-#endif /*BUILD_FLOAT*/
-
extern const LVM_INT16 LVDBE_MixerTCTable[];
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVBDE_TABLES_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/lib/LVM.h b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
index 5082a53..e4e8450 100644
--- a/media/libeffects/lvm/lib/Bundle/lib/LVM.h
+++ b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
@@ -53,11 +53,6 @@
#ifndef __LVM_H__
#define __LVM_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -66,7 +61,6 @@
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -108,7 +102,6 @@
/* Instance handle */
typedef void *LVM_Handle_t;
-
/* Status return values */
typedef enum
{
@@ -123,7 +116,6 @@
LVM_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVM_ReturnStatus_en;
-
/* Buffer Management mode */
typedef enum
{
@@ -227,7 +219,6 @@
LVM_CHAR *pPlatform; /* Pointer to the library platform type */
} LVM_VersionInfo_st;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -248,7 +239,6 @@
LVM_UINT16 QFactor; /* Band quality factor (x100) */
} LVM_EQNB_BandDef_t;
-
/* Headroom band definition */
typedef struct
{
@@ -257,7 +247,6 @@
LVM_INT16 Headroom_Offset; /* Headroom = biggest band gain - Headroom_Offset */
} LVM_HeadroomBandDef_t;
-
/* Control Parameter structure */
typedef struct
{
@@ -303,7 +292,6 @@
} LVM_ControlParams_t;
-
/* Instance Parameter structure */
typedef struct
{
@@ -333,7 +321,6 @@
/* */
/****************************************************************************************/
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetVersionInfo */
@@ -354,7 +341,6 @@
/****************************************************************************************/
LVM_ReturnStatus_en LVM_GetVersionInfo(LVM_VersionInfo_st *pVersion);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetMemoryTable */
@@ -391,7 +377,6 @@
LVM_MemTab_t *pMemoryTable,
LVM_InstParams_t *pInstParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetInstanceHandle */
@@ -418,7 +403,6 @@
LVM_MemTab_t *pMemoryTable,
LVM_InstParams_t *pInstParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ClearAudioBuffers */
@@ -439,7 +423,6 @@
/****************************************************************************************/
LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetControlParameters */
@@ -463,7 +446,6 @@
LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetControlParameters */
@@ -487,7 +469,6 @@
LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_Process */
@@ -518,20 +499,11 @@
/* STEREO the number of sample pairs in the block */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples,
LVM_UINT32 AudioTime);
-#else
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime);
-#endif
-
/****************************************************************************************/
/* */
@@ -555,7 +527,6 @@
LVM_ReturnStatus_en LVM_SetHeadroomParams( LVM_Handle_t hInstance,
LVM_HeadroomParams_t *pHeadroomParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetHeadroomParams */
@@ -578,7 +549,6 @@
LVM_ReturnStatus_en LVM_GetHeadroomParams( LVM_Handle_t hInstance,
LVM_HeadroomParams_t *pHeadroomParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetSpectrum */
@@ -632,10 +602,5 @@
LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVM_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.c b/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
index 07b7f0e..e241cdd 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -60,7 +59,6 @@
pLVPSA_Handle_t *hPSAInstance;
LVPSA_RETURN LVPSA_Status;
-
if(pInstance == LVM_NULL)
{
return LVM_NULLADDRESS;
@@ -72,7 +70,7 @@
return LVM_SUCCESS;
}
- hPSAInstance = pInstance->hPSAInstance;
+ hPSAInstance = (pLVPSA_Handle_t *)pInstance->hPSAInstance;
if((pCurrentPeaks == LVM_NULL) ||
(pPastPeaks == LVM_NULL))
@@ -80,7 +78,6 @@
return LVM_NULLADDRESS;
}
-
/*
* Update new parameters if necessary
*/
@@ -115,7 +112,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetVolumeNoSmoothing */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
similarity index 61%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
index bdca5e3..3aeddbb 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -50,7 +49,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferManagedIn(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
@@ -94,7 +92,6 @@
pBuffer->SamplesToOutput = 0; /* Samples to output is same as
number read for inplace processing */
-
/*
* Calculate the number of samples to process this call and update the buffer state
*/
@@ -131,7 +128,6 @@
}
*pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
-
/*
* Copy samples from the delay buffer as required
*/
@@ -147,7 +143,6 @@
pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
}
-
/*
* Copy the rest of the samples for this call from the input buffer
*/
@@ -165,7 +160,6 @@
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples);
}
-
/*
* Update the sample count and input pointer
*/
@@ -173,7 +167,6 @@
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
pInstance->pInputSamples = pStart; /* Update input sample pointer */
-
/*
* Save samples to the delay buffer if any left unprocessed
*/
@@ -190,7 +183,6 @@
(LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
}
-
/*
* Update the delay sample count
*/
@@ -198,147 +190,6 @@
pInstance->SamplesToProcess = 0; /* All Samples used */
}
}
-#else
-void LVM_BufferManagedIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_INT16 SampleCount; /* Number of samples to be processed this call */
- LVM_INT16 NumSamples; /* Number of samples in scratch buffer */
- LVM_INT16 *pStart;
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer;
- LVM_INT16 *pDest;
- LVM_INT16 NumChannels = 2;
-
- /*
- * Set the processing address pointers
- */
- pBuffer = pInstance->pBufferManagement;
- pDest = pBuffer->pScratch;
- *pToProcess = pBuffer->pScratch;
- *pProcessed = pBuffer->pScratch;
-
- /*
- * Check if it is the first call of a block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- /*
- * First call for a new block of samples
- */
- pInstance->SamplesToProcess = (LVM_INT16)(*pNumSamples + pBuffer->InDelaySamples);
- pInstance->pInputSamples = (LVM_INT16 *)pInData;
- pBuffer->BufferState = LVM_FIRSTCALL;
- }
- pStart = pInstance->pInputSamples; /* Pointer to the input samples */
- pBuffer->SamplesToOutput = 0; /* Samples to output is same as number read for inplace processing */
-
-
- /*
- * Calculate the number of samples to process this call and update the buffer state
- */
- if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
- {
- /*
- * Process the maximum bock size of samples.
- */
- SampleCount = pInstance->InternalBlockSize;
- NumSamples = pInstance->InternalBlockSize;
- }
- else
- {
- /*
- * Last call for the block, so calculate how many frames and samples to process
- */
- LVM_INT16 NumFrames;
-
- NumSamples = pInstance->SamplesToProcess;
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
-
- /*
- * Update the buffer state
- */
- if (pBuffer->BufferState == LVM_FIRSTCALL)
- {
- pBuffer->BufferState = LVM_FIRSTLASTCALL;
- }
- else
- {
- pBuffer->BufferState = LVM_LASTCALL;
- }
- }
- *pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
-
-
- /*
- * Copy samples from the delay buffer as required
- */
- if (((pBuffer->BufferState == LVM_FIRSTCALL) ||
- (pBuffer->BufferState == LVM_FIRSTLASTCALL)) &&
- (pBuffer->InDelaySamples != 0))
- {
- Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels*pBuffer->InDelaySamples)); /* Number of delay samples, left and right */
- NumSamples = (LVM_INT16)(NumSamples - pBuffer->InDelaySamples); /* Update sample count */
- pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
- }
-
-
- /*
- * Copy the rest of the samples for this call from the input buffer
- */
- if (NumSamples > 0)
- {
- Copy_16(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
- pStart += NumChannels * NumSamples; /* Update the input pointer */
-
- /*
- * Update the input data pointer and samples to output
- */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples); /* Update samples to output */
- }
-
-
- /*
- * Update the sample count and input pointer
- */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Update the count of samples */
- pInstance->pInputSamples = pStart; /* Update input sample pointer */
-
-
- /*
- * Save samples to the delay buffer if any left unprocessed
- */
- if ((pBuffer->BufferState == LVM_FIRSTLASTCALL) ||
- (pBuffer->BufferState == LVM_LASTCALL))
- {
- NumSamples = pInstance->SamplesToProcess;
- pStart = pBuffer->pScratch; /* Start of the buffer */
- pStart += NumChannels*SampleCount; /* Offset by the number of processed samples */
- if (NumSamples != 0)
- {
- Copy_16(pStart, /* Source */
- &pBuffer->InDelayBuffer[0], /* Destination */
- (LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
- }
-
-
- /*
- * Update the delay sample count
- */
- pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
- pInstance->SamplesToProcess = 0; /* All Samples used */
- }
-}
-#endif
/****************************************************************************************/
/* */
@@ -362,7 +213,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
LVM_FLOAT **pToProcess,
LVM_FLOAT **pProcessed,
@@ -371,7 +221,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check if this is the first call of a block
*/
@@ -382,7 +231,6 @@
pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
pInstance->pOutputSamples = *pProcessed;
-
/*
* Set te block size to process
*/
@@ -402,46 +250,6 @@
*pToProcess = pInstance->pInputSamples;
*pProcessed = pInstance->pOutputSamples;
}
-#else
-void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check if this is the first call of a block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples; /* Get the number of samples on first call */
- pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
- pInstance->pOutputSamples = *pProcessed;
-
-
- /*
- * Set te block size to process
- */
- if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
- {
- *pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
- }
- else
- {
- *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
- }
- }
-
- /*
- * Set the process pointers
- */
- *pToProcess = pInstance->pInputSamples;
- *pProcessed = pInstance->pOutputSamples;
-}
-#endif
/****************************************************************************************/
/* */
@@ -467,146 +275,6 @@
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVM_BufferOptimisedIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
- LVM_INT16 *pDest;
- LVM_INT16 SampleCount;
- LVM_INT16 NumSamples;
- LVM_INT16 NumFrames;
-
- /*
- * Check if it is the first call for this block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- /*
- * First call for a new block of samples
- */
- pBuffer->BufferState = LVM_FIRSTCALL;
- pInstance->pInputSamples = (LVM_INT16 *)pInData;
- pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples;
- pBuffer->SamplesToOutput = (LVM_INT16)*pNumSamples;
- pDest = *pProcessed; /* The start of the output buffer */
-
-
- /*
- * Copy the already processed samples to the output buffer
- */
- if (pBuffer->OutDelaySamples != 0)
- {
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
- pDest += 2 * pBuffer->OutDelaySamples; /* Update the output pointer */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - pBuffer->OutDelaySamples); /* Update the numbr of samples to output */
- }
- *pToProcess = pDest; /* Set the address to start processing */
- *pProcessed = pDest; /* Process in the output buffer, now inplace */
-
- /*
- * Copy the input delay buffer (unprocessed) samples to the output buffer
- */
- if (pBuffer->InDelaySamples != 0)
- {
- Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*pBuffer->InDelaySamples)); /* Number of delay samples */
- pDest += 2 * pBuffer->InDelaySamples; /* Update the output pointer */
- }
-
-
- /*
- * Calculate how many input samples to process and copy
- */
- NumSamples = (LVM_INT16)(*pNumSamples - pBuffer->OutDelaySamples); /* Number that will fit in the output buffer */
- if (NumSamples >= pInstance->InternalBlockSize)
- {
- NumSamples = pInstance->InternalBlockSize;
- }
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Update the number of samples to output */
- SampleCount = (LVM_INT16)(SampleCount - pBuffer->InDelaySamples); /* The number of samples to copy from the input */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->pOutputSamples = pDest + (2 * SampleCount); /* Update the output pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- }
- else
- {
- /*
- * Second or subsequent call in optimised mode
- */
- if (pBuffer->SamplesToOutput >= MIN_INTERNAL_BLOCKSIZE)
- {
- /*
- * More samples can be processed directly in the output buffer
- */
- *pToProcess = pInstance->pOutputSamples; /* Set the address to start processing */
- *pProcessed = pInstance->pOutputSamples; /* Process in the output buffer, now inplace */
- NumSamples = pBuffer->SamplesToOutput; /* Number that will fit in the output buffer */
- if (NumSamples >= pInstance->InternalBlockSize)
- {
- NumSamples = pInstance->InternalBlockSize;
- }
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pInstance->pOutputSamples, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->pOutputSamples += 2 * SampleCount; /* Update the output pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Number that will fit in the output buffer */
- }
- else
- {
- /*
- * The remaining samples can not be processed in the output buffer
- */
- pBuffer->BufferState = LVM_LASTCALL; /* Indicate this is the last bock to process */
- *pToProcess = pBuffer->pScratch; /* Set the address to start processing */
- *pProcessed = pBuffer->pScratch; /* Process in the output buffer, now inplace */
- NumSamples = pInstance->SamplesToProcess; /* Number left to be processed */
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pBuffer->pScratch, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- }
- }
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferIn */
@@ -661,7 +329,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferIn(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
@@ -671,7 +338,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check which mode, managed or unmanaged
*/
@@ -691,37 +357,6 @@
pNumSamples);
}
}
-#else
-void LVM_BufferIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check which mode, managed or unmanaged
- */
- if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
- {
- LVM_BufferManagedIn(hInstance,
- pInData,
- pToProcess,
- pProcessed,
- pNumSamples);
- }
- else
- {
- LVM_BufferUnmanagedIn(hInstance,
- pToProcess,
- pProcessed,
- pNumSamples);
- }
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferManagedOut */
@@ -742,7 +377,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferManagedOut(LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples)
@@ -777,7 +411,6 @@
}
pDest = pInstance->pOutputSamples; /* Set the output address */
-
/*
* If the number of samples is non-zero then there are still samples to send to
* the output buffer
@@ -859,7 +492,6 @@
}
}
-
/*
* Copy the processed results to the output
*/
@@ -920,7 +552,6 @@
}
}
-
/*
* Copy the remaining processed data to the output delay buffer
*/
@@ -950,157 +581,6 @@
/* This will terminate the loop when all samples processed */
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
}
-#else
-void LVM_BufferManagedOut(LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
- LVM_INT16 SampleCount = (LVM_INT16)*pNumSamples;
- LVM_INT16 NumSamples;
- LVM_INT16 *pStart;
- LVM_INT16 *pDest;
-
-
- /*
- * Set the pointers
- */
- NumSamples = pBuffer->SamplesToOutput;
- pStart = pBuffer->pScratch;
-
-
- /*
- * check if it is the first call of a block
- */
- if ((pBuffer->BufferState == LVM_FIRSTCALL) ||
- (pBuffer->BufferState == LVM_FIRSTLASTCALL))
- {
- /* First call for a new block */
- pInstance->pOutputSamples = pOutData; /* Initialise the destination */
- }
- pDest = pInstance->pOutputSamples; /* Set the output address */
-
-
- /*
- * If the number of samples is non-zero then there are still samples to send to
- * the output buffer
- */
- if ((NumSamples != 0) &&
- (pBuffer->OutDelaySamples != 0))
- {
- /*
- * Copy the delayed output buffer samples to the output
- */
- if (pBuffer->OutDelaySamples <= NumSamples)
- {
- /*
- * Copy all output delay samples to the output
- */
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2*pBuffer->OutDelaySamples; /* Output sample pointer */
- NumSamples = (LVM_INT16)(NumSamples - pBuffer->OutDelaySamples); /* Samples left to send */
- pBuffer->OutDelaySamples = 0; /* No samples left in the buffer */
-
- }
- else
- {
- /*
- * Copy only some of the ouput delay samples to the output
- */
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*NumSamples)); /* Number of delay samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2*NumSamples; /* Output sample pointer */
- pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples - NumSamples); /* No samples left in the buffer */
-
-
- /*
- * Realign the delay buffer data to avoid using circular buffer management
- */
- Copy_16(&pBuffer->OutDelayBuffer[2*NumSamples], /* Source */
- &pBuffer->OutDelayBuffer[0], /* Destination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of samples to move */
- NumSamples = 0; /* Samples left to send */
- }
- }
-
-
- /*
- * Copy the processed results to the output
- */
- if ((NumSamples != 0) &&
- (SampleCount != 0))
- {
- if (SampleCount <= NumSamples)
- {
- /*
- * Copy all processed samples to the output
- */
- Copy_16(pStart, /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*SampleCount)); /* Number of processed samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2 * SampleCount; /* Output sample pointer */
- NumSamples = (LVM_INT16)(NumSamples - SampleCount); /* Samples left to send */
- SampleCount = 0; /* No samples left in the buffer */
- }
- else
- {
- /*
- * Copy only some processed samples to the output
- */
- Copy_16(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Number of processed samples */
-
-
- /*
- * Update the pointers and sample counts
- */
- pStart += 2 * NumSamples; /* Processed sample pointer */
- pDest += 2 * NumSamples; /* Output sample pointer */
- SampleCount = (LVM_INT16)(SampleCount - NumSamples); /* Processed samples left */
- NumSamples = 0; /* Clear the sample count */
- }
- }
-
-
- /*
- * Copy the remaining processed data to the output delay buffer
- */
- if (SampleCount != 0)
- {
- Copy_16(pStart, /* Source */
- &pBuffer->OutDelayBuffer[2*pBuffer->OutDelaySamples], /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of processed samples */
- pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount); /* Update the buffer count */
- }
-
-
- /*
- * pointers, counts and set default buffer processing
- */
- pBuffer->SamplesToOutput = NumSamples; /* Samples left to send */
- pInstance->pOutputSamples = pDest; /* Output sample pointer */
- pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call block size */
- *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess; /* This will terminate the loop when all samples processed */
-}
-#endif
/****************************************************************************************/
/* */
@@ -1139,7 +619,6 @@
LVM_INT16 NumChannels = 2;
#endif
-
/*
* Update sample counts
*/
@@ -1164,7 +643,6 @@
}
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferOptimisedOut */
@@ -1184,73 +662,6 @@
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVM_BufferOptimisedOut(LVM_Handle_t hInstance,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
-
- /*
- * Check if it is the last block to process
- */
- if (pBuffer->BufferState == LVM_LASTCALL)
- {
- LVM_INT16 *pSrc = pBuffer->pScratch;
-
- /*
- * Copy the unprocessed samples to the input delay buffer
- */
- if (pInstance->SamplesToProcess != 0)
- {
- Copy_16(pInstance->pInputSamples, /* Source */
- &pBuffer->InDelayBuffer[0], /* Destination */
- (LVM_INT16)(2*pInstance->SamplesToProcess)); /* Number of input samples */
- pBuffer->InDelaySamples = pInstance->SamplesToProcess;
- pInstance->SamplesToProcess = 0;
- }
- else
- {
- pBuffer->InDelaySamples = 0;
- }
-
-
- /*
- * Fill the last empty spaces in the output buffer
- */
- if (pBuffer->SamplesToOutput != 0)
- {
- Copy_16(pSrc, /* Source */
- pInstance->pOutputSamples, /* Destination */
- (LVM_INT16)(2*pBuffer->SamplesToOutput)); /* Number of input samples */
- *pNumSamples = (LVM_UINT16)(*pNumSamples - pBuffer->SamplesToOutput);
- pSrc += 2 * pBuffer->SamplesToOutput; /* Update scratch pointer */
- pBuffer->SamplesToOutput = 0; /* No more samples in this block */
- }
-
-
- /*
- * Save any remaining processed samples in the output delay buffer
- */
- if (*pNumSamples != 0)
- {
- Copy_16(pSrc, /* Source */
- &pBuffer->OutDelayBuffer[0], /* Destination */
- (LVM_INT16)(2**pNumSamples)); /* Number of input samples */
-
- pBuffer->OutDelaySamples = (LVM_INT16)*pNumSamples;
-
- *pNumSamples = 0; /* No more samples in this block */
- }
- else
- {
- pBuffer->OutDelaySamples = 0;
- }
- }
-}
-#endif
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferOut */
@@ -1287,7 +698,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferOut(LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples)
@@ -1295,7 +705,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check which mode, managed or unmanaged
*/
@@ -1311,28 +720,3 @@
pNumSamples);
}
}
-#else
-void LVM_BufferOut(LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check which mode, managed or unmanaged
- */
- if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
- {
- LVM_BufferManagedOut(hInstance,
- pOutData,
- pNumSamples);
- }
- else
- {
- LVM_BufferUnmanagedOut(hInstance,
- pNumSamples);
- }
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index bab4049..812f8e5 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -18,7 +18,6 @@
#ifndef __LVM_COEFFS_H__
#define __LVM_COEFFS_H__
-
/************************************************************************************/
/* */
/* High Pass Shelving Filter coefficients */
@@ -29,7 +28,6 @@
#define TrebleBoostMinRate 4
#define TrebleBoostSteps 15
-#ifdef BUILD_FLOAT
/* Coefficients for sample rate 22050Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs22050_Gain1_A0 1.038434
@@ -486,7 +484,6 @@
#define HPF_Fs48000_Gain15_B1 (-0.267949)
#define HPF_Fs48000_Gain15_B2 0.000000
-#ifdef HIGHER_FS
/* Coefficients for sample rate 88200 */
/* Gain = 1.000000 dB */
#define HPF_Fs88200_Gain1_A0 1.094374f
@@ -856,547 +853,3 @@
#define HPF_Fs192000_Gain15_B2 0.000000
#endif
-
-#else
-/* Coefficients for sample rate 22050Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs22050_Gain1_A0 5383 /* Floating point value 0.164291 */
-#define HPF_Fs22050_Gain1_A1 16859 /* Floating point value 0.514492 */
-#define HPF_Fs22050_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain1_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs22050_Gain2_A0 4683 /* Floating point value 0.142925 */
-#define HPF_Fs22050_Gain2_A1 17559 /* Floating point value 0.535858 */
-#define HPF_Fs22050_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain2_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs22050_Gain3_A0 3898 /* Floating point value 0.118953 */
-#define HPF_Fs22050_Gain3_A1 18345 /* Floating point value 0.559830 */
-#define HPF_Fs22050_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain3_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs22050_Gain4_A0 3016 /* Floating point value 0.092055 */
-#define HPF_Fs22050_Gain4_A1 19226 /* Floating point value 0.586728 */
-#define HPF_Fs22050_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain4_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs22050_Gain5_A0 2028 /* Floating point value 0.061876 */
-#define HPF_Fs22050_Gain5_A1 20215 /* Floating point value 0.616907 */
-#define HPF_Fs22050_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain5_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs22050_Gain6_A0 918 /* Floating point value 0.028013 */
-#define HPF_Fs22050_Gain6_A1 21324 /* Floating point value 0.650770 */
-#define HPF_Fs22050_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain6_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs22050_Gain7_A0 (-164) /* Floating point value -0.005002 */
-#define HPF_Fs22050_Gain7_A1 11311 /* Floating point value 0.345199 */
-#define HPF_Fs22050_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain7_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs22050_Gain8_A0 (-864) /* Floating point value -0.026368 */
-#define HPF_Fs22050_Gain8_A1 12012 /* Floating point value 0.366565 */
-#define HPF_Fs22050_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain8_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs22050_Gain9_A0 (-1650) /* Floating point value -0.050340 */
-#define HPF_Fs22050_Gain9_A1 12797 /* Floating point value 0.390537 */
-#define HPF_Fs22050_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain9_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs22050_Gain10_A0 (-2531) /* Floating point value -0.077238 */
-#define HPF_Fs22050_Gain10_A1 13679 /* Floating point value 0.417435 */
-#define HPF_Fs22050_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain10_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs22050_Gain11_A0 (-3520) /* Floating point value -0.107417 */
-#define HPF_Fs22050_Gain11_A1 14667 /* Floating point value 0.447615 */
-#define HPF_Fs22050_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain11_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs22050_Gain12_A0 (-4629) /* Floating point value -0.141279 */
-#define HPF_Fs22050_Gain12_A1 15777 /* Floating point value 0.481477 */
-#define HPF_Fs22050_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain12_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs22050_Gain13_A0 (-2944) /* Floating point value -0.089849 */
-#define HPF_Fs22050_Gain13_A1 8531 /* Floating point value 0.260352 */
-#define HPF_Fs22050_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain13_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs22050_Gain14_A0 (-3644) /* Floating point value -0.111215 */
-#define HPF_Fs22050_Gain14_A1 9231 /* Floating point value 0.281718 */
-#define HPF_Fs22050_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain14_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs22050_Gain15_A0 (-4430) /* Floating point value -0.135187 */
-#define HPF_Fs22050_Gain15_A1 10017 /* Floating point value 0.305690 */
-#define HPF_Fs22050_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain15_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 24000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs24000_Gain1_A0 3625 /* Floating point value 0.110628 */
-#define HPF_Fs24000_Gain1_A1 16960 /* Floating point value 0.517578 */
-#define HPF_Fs24000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain1_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs24000_Gain2_A0 2811 /* Floating point value 0.085800 */
-#define HPF_Fs24000_Gain2_A1 17774 /* Floating point value 0.542406 */
-#define HPF_Fs24000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain2_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs24000_Gain3_A0 1899 /* Floating point value 0.057943 */
-#define HPF_Fs24000_Gain3_A1 18686 /* Floating point value 0.570263 */
-#define HPF_Fs24000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain3_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs24000_Gain4_A0 874 /* Floating point value 0.026687 */
-#define HPF_Fs24000_Gain4_A1 19711 /* Floating point value 0.601519 */
-#define HPF_Fs24000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain4_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs24000_Gain5_A0 (-275) /* Floating point value -0.008383 */
-#define HPF_Fs24000_Gain5_A1 20860 /* Floating point value 0.636589 */
-#define HPF_Fs24000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain5_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs24000_Gain6_A0 (-1564) /* Floating point value -0.047733 */
-#define HPF_Fs24000_Gain6_A1 22149 /* Floating point value 0.675938 */
-#define HPF_Fs24000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain6_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs24000_Gain7_A0 (-1509) /* Floating point value -0.046051 */
-#define HPF_Fs24000_Gain7_A1 11826 /* Floating point value 0.360899 */
-#define HPF_Fs24000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain7_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs24000_Gain8_A0 (-2323) /* Floating point value -0.070878 */
-#define HPF_Fs24000_Gain8_A1 12640 /* Floating point value 0.385727 */
-#define HPF_Fs24000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain8_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs24000_Gain9_A0 (-3235) /* Floating point value -0.098736 */
-#define HPF_Fs24000_Gain9_A1 13552 /* Floating point value 0.413584 */
-#define HPF_Fs24000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain9_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs24000_Gain10_A0 (-4260) /* Floating point value -0.129992 */
-#define HPF_Fs24000_Gain10_A1 14577 /* Floating point value 0.444841 */
-#define HPF_Fs24000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain10_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs24000_Gain11_A0 (-5409) /* Floating point value -0.165062 */
-#define HPF_Fs24000_Gain11_A1 15726 /* Floating point value 0.479911 */
-#define HPF_Fs24000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain11_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs24000_Gain12_A0 (-6698) /* Floating point value -0.204411 */
-#define HPF_Fs24000_Gain12_A1 17015 /* Floating point value 0.519260 */
-#define HPF_Fs24000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain12_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs24000_Gain13_A0 (-4082) /* Floating point value -0.124576 */
-#define HPF_Fs24000_Gain13_A1 9253 /* Floating point value 0.282374 */
-#define HPF_Fs24000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain13_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs24000_Gain14_A0 (-4896) /* Floating point value -0.149404 */
-#define HPF_Fs24000_Gain14_A1 10066 /* Floating point value 0.307202 */
-#define HPF_Fs24000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain14_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs24000_Gain15_A0 (-5808) /* Floating point value -0.177261 */
-#define HPF_Fs24000_Gain15_A1 10979 /* Floating point value 0.335059 */
-#define HPF_Fs24000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain15_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 32000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs32000_Gain1_A0 17225 /* Floating point value 0.525677 */
-#define HPF_Fs32000_Gain1_A1 (-990) /* Floating point value -0.030227 */
-#define HPF_Fs32000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain1_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs32000_Gain2_A0 18337 /* Floating point value 0.559593 */
-#define HPF_Fs32000_Gain2_A1 (-2102) /* Floating point value -0.064142 */
-#define HPF_Fs32000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain2_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs32000_Gain3_A0 19584 /* Floating point value 0.597646 */
-#define HPF_Fs32000_Gain3_A1 (-3349) /* Floating point value -0.102196 */
-#define HPF_Fs32000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain3_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs32000_Gain4_A0 20983 /* Floating point value 0.640343 */
-#define HPF_Fs32000_Gain4_A1 (-4748) /* Floating point value -0.144893 */
-#define HPF_Fs32000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain4_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs32000_Gain5_A0 22553 /* Floating point value 0.688250 */
-#define HPF_Fs32000_Gain5_A1 (-6318) /* Floating point value -0.192799 */
-#define HPF_Fs32000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain5_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs32000_Gain6_A0 24314 /* Floating point value 0.742002 */
-#define HPF_Fs32000_Gain6_A1 (-8079) /* Floating point value -0.246551 */
-#define HPF_Fs32000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain6_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs32000_Gain7_A0 13176 /* Floating point value 0.402109 */
-#define HPF_Fs32000_Gain7_A1 (-5040) /* Floating point value -0.153795 */
-#define HPF_Fs32000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain7_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs32000_Gain8_A0 14288 /* Floating point value 0.436024 */
-#define HPF_Fs32000_Gain8_A1 (-6151) /* Floating point value -0.187711 */
-#define HPF_Fs32000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain8_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs32000_Gain9_A0 15535 /* Floating point value 0.474078 */
-#define HPF_Fs32000_Gain9_A1 (-7398) /* Floating point value -0.225764 */
-#define HPF_Fs32000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain9_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs32000_Gain10_A0 16934 /* Floating point value 0.516774 */
-#define HPF_Fs32000_Gain10_A1 (-8797) /* Floating point value -0.268461 */
-#define HPF_Fs32000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain10_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs32000_Gain11_A0 18503 /* Floating point value 0.564681 */
-#define HPF_Fs32000_Gain11_A1 (-10367) /* Floating point value -0.316368 */
-#define HPF_Fs32000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain11_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs32000_Gain12_A0 20265 /* Floating point value 0.618433 */
-#define HPF_Fs32000_Gain12_A1 (-12128) /* Floating point value -0.370120 */
-#define HPF_Fs32000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain12_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs32000_Gain13_A0 11147 /* Floating point value 0.340178 */
-#define HPF_Fs32000_Gain13_A1 (-7069) /* Floating point value -0.215726 */
-#define HPF_Fs32000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain13_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs32000_Gain14_A0 12258 /* Floating point value 0.374093 */
-#define HPF_Fs32000_Gain14_A1 (-8180) /* Floating point value -0.249642 */
-#define HPF_Fs32000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain14_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs32000_Gain15_A0 13505 /* Floating point value 0.412147 */
-#define HPF_Fs32000_Gain15_A1 (-9427) /* Floating point value -0.287695 */
-#define HPF_Fs32000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain15_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 44100Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs44100_Gain1_A0 17442 /* Floating point value 0.532294 */
-#define HPF_Fs44100_Gain1_A1 (-4761) /* Floating point value -0.145294 */
-#define HPF_Fs44100_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs44100_Gain2_A0 18797 /* Floating point value 0.573633 */
-#define HPF_Fs44100_Gain2_A1 (-6116) /* Floating point value -0.186634 */
-#define HPF_Fs44100_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs44100_Gain3_A0 20317 /* Floating point value 0.620016 */
-#define HPF_Fs44100_Gain3_A1 (-7635) /* Floating point value -0.233017 */
-#define HPF_Fs44100_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs44100_Gain4_A0 22022 /* Floating point value 0.672059 */
-#define HPF_Fs44100_Gain4_A1 (-9341) /* Floating point value -0.285060 */
-#define HPF_Fs44100_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs44100_Gain5_A0 23935 /* Floating point value 0.730452 */
-#define HPF_Fs44100_Gain5_A1 (-11254) /* Floating point value -0.343453 */
-#define HPF_Fs44100_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs44100_Gain6_A0 26082 /* Floating point value 0.795970 */
-#define HPF_Fs44100_Gain6_A1 (-13401) /* Floating point value -0.408971 */
-#define HPF_Fs44100_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs44100_Gain7_A0 14279 /* Floating point value 0.435774 */
-#define HPF_Fs44100_Gain7_A1 (-7924) /* Floating point value -0.241815 */
-#define HPF_Fs44100_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs44100_Gain8_A0 15634 /* Floating point value 0.477113 */
-#define HPF_Fs44100_Gain8_A1 (-9278) /* Floating point value -0.283154 */
-#define HPF_Fs44100_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs44100_Gain9_A0 17154 /* Floating point value 0.523496 */
-#define HPF_Fs44100_Gain9_A1 (-10798) /* Floating point value -0.329537 */
-#define HPF_Fs44100_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs44100_Gain10_A0 18859 /* Floating point value 0.575539 */
-#define HPF_Fs44100_Gain10_A1 (-12504) /* Floating point value -0.381580 */
-#define HPF_Fs44100_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs44100_Gain11_A0 20773 /* Floating point value 0.633932 */
-#define HPF_Fs44100_Gain11_A1 (-14417) /* Floating point value -0.439973 */
-#define HPF_Fs44100_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs44100_Gain12_A0 22920 /* Floating point value 0.699450 */
-#define HPF_Fs44100_Gain12_A1 (-16564) /* Floating point value -0.505491 */
-#define HPF_Fs44100_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs44100_Gain13_A0 12694 /* Floating point value 0.387399 */
-#define HPF_Fs44100_Gain13_A1 (-9509) /* Floating point value -0.290189 */
-#define HPF_Fs44100_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs44100_Gain14_A0 14049 /* Floating point value 0.428738 */
-#define HPF_Fs44100_Gain14_A1 (-10864) /* Floating point value -0.331528 */
-#define HPF_Fs44100_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs44100_Gain15_A0 15569 /* Floating point value 0.475121 */
-#define HPF_Fs44100_Gain15_A1 (-12383) /* Floating point value -0.377912 */
-#define HPF_Fs44100_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 48000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs48000_Gain1_A0 17491 /* Floating point value 0.533777 */
-#define HPF_Fs48000_Gain1_A1 (-5606) /* Floating point value -0.171082 */
-#define HPF_Fs48000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs48000_Gain2_A0 18900 /* Floating point value 0.576779 */
-#define HPF_Fs48000_Gain2_A1 (-7015) /* Floating point value -0.214085 */
-#define HPF_Fs48000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs48000_Gain3_A0 20481 /* Floating point value 0.625029 */
-#define HPF_Fs48000_Gain3_A1 (-8596) /* Floating point value -0.262335 */
-#define HPF_Fs48000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs48000_Gain4_A0 22255 /* Floating point value 0.679167 */
-#define HPF_Fs48000_Gain4_A1 (-10370) /* Floating point value -0.316472 */
-#define HPF_Fs48000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs48000_Gain5_A0 24245 /* Floating point value 0.739910 */
-#define HPF_Fs48000_Gain5_A1 (-12361) /* Floating point value -0.377215 */
-#define HPF_Fs48000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs48000_Gain6_A0 26479 /* Floating point value 0.808065 */
-#define HPF_Fs48000_Gain6_A1 (-14594) /* Floating point value -0.445370 */
-#define HPF_Fs48000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs48000_Gain7_A0 14527 /* Floating point value 0.443318 */
-#define HPF_Fs48000_Gain7_A1 (-8570) /* Floating point value -0.261540 */
-#define HPF_Fs48000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs48000_Gain8_A0 15936 /* Floating point value 0.486321 */
-#define HPF_Fs48000_Gain8_A1 (-9979) /* Floating point value -0.304543 */
-#define HPF_Fs48000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs48000_Gain9_A0 17517 /* Floating point value 0.534571 */
-#define HPF_Fs48000_Gain9_A1 (-11560) /* Floating point value -0.352793 */
-#define HPF_Fs48000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs48000_Gain10_A0 19291 /* Floating point value 0.588708 */
-#define HPF_Fs48000_Gain10_A1 (-13334) /* Floating point value -0.406930 */
-#define HPF_Fs48000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs48000_Gain11_A0 21281 /* Floating point value 0.649452 */
-#define HPF_Fs48000_Gain11_A1 (-15325) /* Floating point value -0.467674 */
-#define HPF_Fs48000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs48000_Gain12_A0 23515 /* Floating point value 0.717607 */
-#define HPF_Fs48000_Gain12_A1 (-17558) /* Floating point value -0.535829 */
-#define HPF_Fs48000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs48000_Gain13_A0 13041 /* Floating point value 0.397982 */
-#define HPF_Fs48000_Gain13_A1 (-10056) /* Floating point value -0.306877 */
-#define HPF_Fs48000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs48000_Gain14_A0 14450 /* Floating point value 0.440984 */
-#define HPF_Fs48000_Gain14_A1 (-11465) /* Floating point value -0.349880 */
-#define HPF_Fs48000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs48000_Gain15_A0 16031 /* Floating point value 0.489234 */
-#define HPF_Fs48000_Gain15_A1 (-13046) /* Floating point value -0.398130 */
-#define HPF_Fs48000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_Shift 3 /* Shift value */
-
-
-#endif
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
similarity index 89%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
index 1b27cb4..ff2c90a 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -56,7 +55,6 @@
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
-
if ((pParams == LVM_NULL) || (hInstance == LVM_NULL))
{
return (LVM_NULLADDRESS);
@@ -67,17 +65,11 @@
if(
/* General parameters */
((pParams->OperatingMode != LVM_MODE_OFF) && (pParams->OperatingMode != LVM_MODE_ON)) ||
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
(pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
(pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000) &&
(pParams->SampleRate != LVM_FS_88200) && (pParams->SampleRate != LVM_FS_96000) &&
(pParams->SampleRate != LVM_FS_176400) && (pParams->SampleRate != LVM_FS_192000)) ||
-#else
- ((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
- (pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
- (pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000)) ||
-#endif
#ifdef SUPPORT_MC
((pParams->SourceFormat != LVM_STEREO) &&
(pParams->SourceFormat != LVM_MONOINSTEREO) &&
@@ -198,13 +190,12 @@
/*
* PSA parameters
*/
- if( (pParams->PSA_PeakDecayRate > LVPSA_SPEED_HIGH) ||
+ if (((LVPSA_LevelDetectSpeed_en)pParams->PSA_PeakDecayRate > LVPSA_SPEED_HIGH) ||
(pParams->PSA_Enable > LVM_PSA_ON))
{
return (LVM_OUTOFRANGE);
}
-
/*
* Set the flag to indicate there are new parameters to use
*
@@ -218,7 +209,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetControlParameters */
@@ -245,7 +235,6 @@
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
-
/*
* Check pointer
*/
@@ -272,7 +261,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetTrebleBoost */
@@ -289,11 +277,7 @@
void LVM_SetTrebleBoost(LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams)
{
-#ifdef BUILD_FLOAT
extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#else
- extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#endif
LVM_INT16 Offset;
LVM_INT16 EffectLevel = 0;
@@ -324,7 +308,6 @@
* Load the coefficients and enabled the treble boost
*/
Offset = (LVM_INT16)(EffectLevel - 1 + TrebleBoostSteps * (pParams->SampleRate - TrebleBoostMinRate));
-#ifdef BUILD_FLOAT
FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
&pInstance->pTE_Taps->TrebleBoost_Taps,
&LVM_TrebleBoostCoefs[Offset]);
@@ -333,23 +316,10 @@
* Clear the taps
*/
LoadConst_Float((LVM_FLOAT)0, /* Value */
- (void *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
+ (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
- FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
- &pInstance->pTE_Taps->TrebleBoost_Taps,
- &LVM_TrebleBoostCoefs[Offset]);
-
- /*
- * Clear the taps
- */
- LoadConst_16((LVM_INT16)0, /* Value */
- (void *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
- Cast to void: no dereferencing in function */
- (LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps)/sizeof(LVM_INT16))); /* Number of words */
-#endif
}
}
else
@@ -363,7 +333,6 @@
return;
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVM_SetVolume */
@@ -383,9 +352,7 @@
LVM_UINT16 dBShifts; /* 6dB shifts */
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
-#ifdef BUILD_FLOAT
LVM_FLOAT Temp;
-#endif
/*
* Limit the gain to the maximum allowed
@@ -439,56 +406,36 @@
dBOffset = (LVM_UINT16)((-Volume) % 6); /* Get the dBs 0-5 */
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
-
/*
* Set the parameters
*/
if(dBShifts == 0)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
(LVM_FLOAT)LVM_VolumeTable[dBOffset]);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
- (LVM_INT32)LVM_VolumeTable[dBOffset]);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
Temp = LVM_VolumeTable[dBOffset];
while(dBShifts) {
Temp = Temp / 2.0f;
dBShifts--;
}
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0], Temp);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
- (((LVM_INT32)LVM_VolumeTable[dBOffset])>>dBShifts));
-#endif
}
pInstance->VC_Volume.MixerStream[0].CallbackSet = 1;
if(pInstance->NoSmoothVolume == LVM_TRUE)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0,
pInstance->Params.SampleRate, 2);
-#else
- LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,pInstance->Params.SampleRate,2);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],
LVM_VC_MIXER_TIME, pInstance->Params.SampleRate, 2);
-#else
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],LVM_VC_MIXER_TIME,pInstance->Params.SampleRate,2);
-#endif
}
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVM_SetHeadroom */
@@ -513,8 +460,8 @@
LVM_INT16 Headroom = 0;
LVM_INT16 MaxGain = 0;
-
- if ((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++)
@@ -545,7 +492,6 @@
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ApplyNewSettings */
@@ -570,7 +516,6 @@
LVM_ControlParams_t LocalParams;
LVM_INT16 Count = 5;
-
/*
* Copy the new parameters but make sure they didn't change while copying
*/
@@ -627,13 +572,8 @@
/* Configure Mixer module for gradual changes to volume*/
if(LocalParams.VC_Balance < 0)
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* Drop in right channel volume*/
-#ifdef BUILD_FLOAT
Target_Float = LVM_MAXFLOAT;
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
@@ -643,25 +583,11 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
-#else
- Target = LVM_MAXINT_16;
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- Target = dB_to_Lin32((LVM_INT16)(LocalParams.VC_Balance<<4));
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
else if(LocalParams.VC_Balance >0)
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* Drop in left channel volume*/
-#ifdef BUILD_FLOAT
Target_Float = dB_to_LinFloat((LVM_INT16)((-LocalParams.VC_Balance) << 4));
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
@@ -671,30 +597,12 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
-#else
- Target = dB_to_Lin32((LVM_INT16)((-LocalParams.VC_Balance)<<4));
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- Target = LVM_MAXINT_16;
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* No drop*/
-#ifdef BUILD_FLOAT
Target_Float = LVM_MAXFLOAT;
-#else
- Target = LVM_MAXINT_16;
-#endif
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
@@ -702,13 +610,6 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
}
/*
@@ -717,8 +618,7 @@
{
LVDBE_ReturnStatus_en DBE_Status;
LVDBE_Params_t DBE_Params;
- LVDBE_Handle_t *hDBEInstance = pInstance->hDBEInstance;
-
+ LVDBE_Handle_t *hDBEInstance = (LVDBE_Handle_t *)pInstance->hDBEInstance;
/*
* Set the new parameters
@@ -748,7 +648,6 @@
DBE_Status = LVDBE_Control(hDBEInstance,
&DBE_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -757,7 +656,6 @@
return((LVM_ReturnStatus_en)DBE_Status);
}
-
/*
* Set the control flag
*/
@@ -770,8 +668,7 @@
{
LVEQNB_ReturnStatus_en EQNB_Status;
LVEQNB_Params_t EQNB_Params;
- LVEQNB_Handle_t *hEQNBInstance = pInstance->hEQNBInstance;
-
+ LVEQNB_Handle_t *hEQNBInstance = (LVEQNB_Handle_t *)pInstance->hEQNBInstance;
/*
* Set the new parameters
@@ -829,7 +726,6 @@
EQNB_Status = LVEQNB_Control(hEQNBInstance,
&EQNB_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -840,14 +736,13 @@
}
-
/*
* Update concert sound
*/
{
LVCS_ReturnStatus_en CS_Status;
LVCS_Params_t CS_Params;
- LVCS_Handle_t *hCSInstance = pInstance->hCSInstance;
+ LVCS_Handle_t *hCSInstance = (LVCS_Handle_t *)pInstance->hCSInstance;
LVM_Mode_en CompressorMode=LVM_MODE_ON;
/*
@@ -898,8 +793,8 @@
/*
* Set the control flag
*/
- if ((LocalParams.OperatingMode == LVM_MODE_ON) &&
- (LocalParams.VirtualizerOperatingMode != LVCS_OFF))
+ if (((LVM_Mode_en)LocalParams.OperatingMode == LVM_MODE_ON) &&
+ ((LVCS_Modes_en)LocalParams.VirtualizerOperatingMode != LVCS_OFF))
{
pInstance->CS_Active = LVM_TRUE;
}
@@ -916,7 +811,6 @@
CS_Status = LVCS_Control(hCSInstance,
&CS_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -933,8 +827,7 @@
{
LVPSA_RETURN PSA_Status;
LVPSA_ControlParams_t PSA_Params;
- pLVPSA_Handle_t *hPSAInstance = pInstance->hPSAInstance;
-
+ pLVPSA_Handle_t *hPSAInstance = (pLVPSA_Handle_t *)pInstance->hPSAInstance;
/*
* Set the new parameters
@@ -972,11 +865,9 @@
pInstance->NoSmoothVolume = LVM_FALSE;
pInstance->Params = LocalParams;
-
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetHeadroomParams */
@@ -1070,14 +961,12 @@
pHeadroomParams->NHeadroomBands = pInstance->NewHeadroomParams.NHeadroomBands;
-
/* Copy settings in memory */
for(ii = 0; ii < pInstance->NewHeadroomParams.NHeadroomBands; ii++)
{
pInstance->pHeadroom_UserDefs[ii] = pInstance->pHeadroom_BandDefs[ii];
}
-
pHeadroomParams->pHeadroomDefinition = pInstance->pHeadroom_UserDefs;
pHeadroomParams->Headroom_OperatingMode = pInstance->NewHeadroomParams.Headroom_OperatingMode;
return(LVM_SUCCESS);
@@ -1156,30 +1045,17 @@
short CallBackParam)
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)pBundleHandle;
-#ifdef BUILD_FLOAT
LVM_FLOAT Target;
-#else
- LVM_INT32 Target;
-#endif
(void) pGeneralPurpose;
(void) CallBackParam;
/* When volume mixer has reached 0 dB target then stop it to avoid
unnecessary processing. */
-#ifdef BUILD_FLOAT
Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
if(Target == 1.0f)
{
pInstance->VC_Active = LVM_FALSE;
}
-#else
- Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
-
- if(Target == 0x7FFF)
- {
- pInstance->VC_Active = LVM_FALSE;
- }
-#endif
return 1;
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
similarity index 91%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
index c57498e..5620529 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
@@ -139,7 +139,6 @@
INST_ALLOC AllocMem[LVM_NR_MEMORY_REGIONS];
LVM_INT16 i;
-
/*
* Check parameters
*/
@@ -148,7 +147,6 @@
return LVM_NULLADDRESS;
}
-
/*
* Return memory table if the instance has already been created
*/
@@ -227,20 +225,15 @@
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
sizeof(LVM_Instance_t));
-
/*
* Set the algorithm and bundle scratch requirements
*/
AlgScratchSize = 0;
if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
{
-#ifdef BUILD_FLOAT
BundleScratchSize = 3 * LVM_MAX_CHANNELS \
* (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) \
* sizeof(LVM_FLOAT);
-#else
- BundleScratchSize = 6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16);
-#endif
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch buffer */
BundleScratchSize);
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
@@ -293,7 +286,6 @@
}
-
/*
* Dynamic Bass Enhancement requirements
*/
@@ -304,7 +296,6 @@
/*
* Set the capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 |
LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 |
LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 |
@@ -312,9 +303,6 @@
LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_88200 |
LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_176400 |
LVDBE_CAP_FS_192000;
-#else
- DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
-#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = InternalBlockSize;
@@ -336,7 +324,6 @@
}
-
/*
* N-Band equaliser requirements
*/
@@ -347,7 +334,6 @@
/*
* Set the capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 |
LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 |
LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 |
@@ -355,9 +341,6 @@
LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_88200 |
LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
LVEQNB_CAP_FS_192000;
-#else
- EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
-#endif
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
EQNB_Capabilities.MaxBlockSize = InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
@@ -388,7 +371,6 @@
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
(LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
-
/*
* Spectrum Analyzer memory requirements
*/
@@ -441,13 +423,8 @@
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_FLOAT));
-#else
- InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-#endif
if (PSA_MemTab.Region[LVM_TEMPORARY_FAST].Size > AlgScratchSize)
{
@@ -493,7 +470,6 @@
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetInstanceHandle */
@@ -529,7 +505,6 @@
LVM_UINT16 InternalBlockSize;
LVM_INT32 BundleScratchSize;
-
/*
* Check valid points have been given
*/
@@ -592,7 +567,6 @@
pMemoryTable->Region[i].pBaseAddress);
}
-
/*
* Set the instance handle
*/
@@ -600,14 +574,12 @@
sizeof(LVM_Instance_t));
pInstance =(LVM_Instance_t *)*phInstance;
-
/*
* Save the memory table, parameters and capabilities
*/
pInstance->MemoryTable = *pMemoryTable;
pInstance->InstParams = *pInstParams;
-
/*
* Set the bundle scratch memory and initialse the buffer management
*/
@@ -624,7 +596,6 @@
}
pInstance->InternalBlockSize = (LVM_INT16)InternalBlockSize;
-
/*
* Common settings for managed and unmanaged buffers
*/
@@ -634,33 +605,25 @@
/*
* Managed buffers required
*/
- pInstance->pBufferManagement = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
+ pInstance->pBufferManagement = (LVM_Buffer_t *)
+ InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
sizeof(LVM_Buffer_t));
-#ifdef BUILD_FLOAT
BundleScratchSize = (LVM_INT32)
(3 * LVM_MAX_CHANNELS \
* (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) \
* sizeof(LVM_FLOAT));
-#else
- BundleScratchSize = (LVM_INT32)(6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16));
-#endif
- pInstance->pBufferManagement->pScratch = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch 1 buffer */
- (LVM_UINT32)BundleScratchSize);
-#ifdef BUILD_FLOAT
+ pInstance->pBufferManagement->pScratch = (LVM_FLOAT *)
+ InstAlloc_AddMember(
+ &AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch 1 buffer */
+ (LVM_UINT32)BundleScratchSize);
LoadConst_Float(0, /* Clear the input delay buffer */
(LVM_FLOAT *)&pInstance->pBufferManagement->InDelayBuffer,
(LVM_INT16)(LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE));
-#else
- LoadConst_16(0, /* Clear the input delay buffer */
- (LVM_INT16 *)&pInstance->pBufferManagement->InDelayBuffer,
- (LVM_INT16)(2 * MIN_INTERNAL_BLOCKSIZE));
-#endif
pInstance->pBufferManagement->InDelaySamples = MIN_INTERNAL_BLOCKSIZE; /* Set the number of delay samples */
pInstance->pBufferManagement->OutDelaySamples = 0; /* No samples in the output buffer */
pInstance->pBufferManagement->BufferState = LVM_FIRSTCALL; /* Set the state ready for the first call */
}
-
/*
* Set default parameters
*/
@@ -676,7 +639,6 @@
*/
pInstance->CallBack = LVM_AlgoCallBack;
-
/*
* DC removal filter
*/
@@ -698,7 +660,6 @@
pInstance->Params.TE_EffectLevel = 0;
pInstance->TE_Active = LVM_FALSE;
-
/*
* Set the volume control and initialise Current to Target
*/
@@ -710,26 +671,14 @@
/* In managed buffering, start with low signal level as delay in buffer management causes a click*/
if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], 0, 0);
-#else
- LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],0,0);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
}
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,LVM_FS_8000,2);
-#else
- LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0, LVM_FS_8000, 2);
-#endif
pInstance->VC_VolumedB = 0;
pInstance->VC_AVLFixedVolume = 0;
@@ -739,32 +688,25 @@
pInstance->VC_BalanceMix.MixerStream[0].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[0].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[0].pCallBack = LVM_VCCallBack;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
pInstance->VC_BalanceMix.MixerStream[1].CallbackParam = 0;
pInstance->VC_BalanceMix.MixerStream[1].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[1].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[1].pCallBack = LVM_VCCallBack;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
/*
* Set the default EQNB pre-gain and pointer to the band definitions
*/
- pInstance->pEQNB_BandDefs = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
- (pInstParams->EQNB_NumBands * sizeof(LVM_EQNB_BandDef_t)));
- pInstance->pEQNB_UserDefs = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
- (pInstParams->EQNB_NumBands * sizeof(LVM_EQNB_BandDef_t)));
-
+ pInstance->pEQNB_BandDefs =
+ (LVM_EQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
+ (pInstParams->EQNB_NumBands * sizeof(LVM_EQNB_BandDef_t)));
+ pInstance->pEQNB_UserDefs =
+ (LVM_EQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
+ (pInstParams->EQNB_NumBands * sizeof(LVM_EQNB_BandDef_t)));
/*
* Initialise the Concert Sound module
@@ -790,7 +732,6 @@
CS_Capabilities.CallBack = pInstance->CallBack;
CS_Capabilities.pBundleInstance = (void*)pInstance;
-
/*
* Get the memory requirements and then set the address pointers, forcing alignment
*/
@@ -826,7 +767,6 @@
LVDBE_Capabilities_t DBE_Capabilities; /* Initial capabilities */
LVDBE_ReturnStatus_en LVDBE_Status; /* Function call status */
-
/*
* Set the initialisation parameters
*/
@@ -837,12 +777,9 @@
pInstance->DBE_Active = LVM_FALSE;
-
-
/*
* Set the initialisation capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 |
LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 |
LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 |
@@ -850,13 +787,9 @@
LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_88200 |
LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_176400 |
LVDBE_CAP_FS_192000;
-#else
- DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
-#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
-
/*
* Get the memory requirements and then set the address pointers
*/
@@ -871,7 +804,6 @@
DBE_MemTab.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],
0);
-
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
@@ -883,7 +815,6 @@
pInstance->hDBEInstance = hDBEInstance; /* Save the instance handle */
}
-
/*
* Initialise the N-Band Equaliser module
*/
@@ -893,7 +824,6 @@
LVEQNB_Capabilities_t EQNB_Capabilities; /* Initial capabilities */
LVEQNB_ReturnStatus_en LVEQNB_Status; /* Function call status */
-
/*
* Set the initialisation parameters
*/
@@ -902,11 +832,9 @@
pInstance->Params.pEQNB_BandDefinition = LVM_NULL;
pInstance->EQNB_Active = LVM_FALSE;
-
/*
* Set the initialisation capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 |
LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 |
LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 |
@@ -914,16 +842,12 @@
LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_88200 |
LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
LVEQNB_CAP_FS_192000;
-#else
- EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
-#endif
EQNB_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
EQNB_Capabilities.CallBack = pInstance->CallBack;
EQNB_Capabilities.pBundleInstance = (void*)pInstance;
-
/*
* Get the memory requirements and then set the address pointers, forcing alignment
*/
@@ -938,7 +862,6 @@
EQNB_MemTab.Region[LVEQNB_MEMREGION_SCRATCH].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],
0);
-
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
@@ -954,10 +877,12 @@
* Headroom management memory allocation
*/
{
- pInstance->pHeadroom_BandDefs = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
- (LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
- pInstance->pHeadroom_UserDefs = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
- (LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
+ pInstance->pHeadroom_BandDefs = (LVM_HeadroomBandDef_t *)
+ InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
+ (LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
+ pInstance->pHeadroom_UserDefs = (LVM_HeadroomBandDef_t *)
+ InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
+ (LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
/* Headroom management parameters initialisation */
pInstance->NewHeadroomParams.NHeadroomBands = 2;
@@ -973,7 +898,6 @@
pInstance->Headroom =0;
}
-
/*
* Initialise the PSA module
*/
@@ -1010,28 +934,20 @@
PSA_MemTab.Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
PSA_MemTab.Region[LVM_PERSISTENT_SLOW_DATA].Size);
-
/* Fast Data */
PSA_MemTab.Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
PSA_MemTab.Region[LVM_PERSISTENT_FAST_DATA].Size);
-
/* Fast Coef */
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_COEF],
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
-#ifdef BUILD_FLOAT
- pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
+ pInstance->pPSAInput = (LVM_FLOAT *)InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
(LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * \
sizeof(LVM_FLOAT));
-#else
- pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-#endif
PSA_MemTab.Region[LVM_TEMPORARY_FAST].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],0);
-
/*Initialise PSA instance and save the instance handle*/
pInstance->PSA_ControlParams.Fs = LVM_FS_48000;
pInstance->PSA_ControlParams.LevelDetectionSpeed = LVPSA_SPEED_MEDIUM;
@@ -1066,7 +982,6 @@
*/
pInstance->NewParams = pInstance->Params;
-
/*
* Create configuration number
*/
@@ -1093,7 +1008,6 @@
return(Status);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ClearAudioBuffers */
@@ -1121,7 +1035,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance; /* Pointer to Instance */
LVM_HeadroomParams_t HeadroomParams;
-
if(hInstance == LVM_NULL){
return LVM_NULLADDRESS;
}
@@ -1159,5 +1072,3 @@
return LVM_SUCCESS;
}
-
-
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
index cdd3134..ddaac99 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -27,11 +27,6 @@
#ifndef __LVM_PRIVATE_H__
#define __LVM_PRIVATE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -47,7 +42,6 @@
#include "LVEQNB_Private.h" /* N-Band equaliser */
#include "LVPSA_Private.h" /* Parametric Spectrum Analyzer */
-
/************************************************************************************/
/* */
/* Defines */
@@ -113,7 +107,6 @@
#define LVM_TE_MASK 32
#define LVM_PSA_MASK 2048
-
/************************************************************************************/
/* */
/* Structures */
@@ -129,16 +122,13 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVM_IntMemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVM_IntMemoryRegion_t Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVM_IntMemTab_t;
-
/* Buffer Management */
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT *pScratch; /* Bundle scratch buffer */
@@ -161,39 +151,17 @@
left and right */
LVM_INT16 SamplesToOutput; /* Samples to write to the output */
} LVM_Buffer_t;
-#else
-typedef struct
-{
- LVM_INT16 *pScratch; /* Bundle scratch buffer */
-
- LVM_INT16 BufferState; /* Buffer status */
- LVM_INT16 InDelayBuffer[6*MIN_INTERNAL_BLOCKSIZE]; /* Input buffer delay line, left and right */
- LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
-
- LVM_INT16 OutDelayBuffer[2*MIN_INTERNAL_BLOCKSIZE]; /* Output buffer delay line */
- LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, left and right */
- LVM_INT16 SamplesToOutput; /* Samples to write to the output */
-} LVM_Buffer_t;
-#endif
/* Filter taps */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_2I_Order1_FLOAT_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
-#else
- Biquad_2I_Order1_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
-#endif
} LVM_TE_Data_t;
/* Coefficients */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t TrebleBoost_State; /* State for the treble boost filter */
-#else
- Biquad_Instance_t TrebleBoost_State; /* State for the treble boost filter */
-#endif
} LVM_TE_Coefs_t;
typedef struct
@@ -211,24 +179,15 @@
LVM_INT16 InternalBlockSize; /* Maximum internal block size */
LVM_Buffer_t *pBufferManagement; /* Buffer management variables */
LVM_INT16 SamplesToProcess; /* Input samples left to process */
-#ifdef BUILD_FLOAT
LVM_FLOAT *pInputSamples; /* External input sample pointer */
LVM_FLOAT *pOutputSamples; /* External output sample pointer */
-#else
- LVM_INT16 *pInputSamples; /* External input sample pointer */
- LVM_INT16 *pOutputSamples; /* External output sample pointer */
-#endif
/* Configuration number */
LVM_INT32 ConfigurationNumber;
LVM_INT32 BlickSizeMultiple;
/* DC removal */
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t DC_RemovalInstance; /* DC removal filter instance */
-#else
- Biquad_Instance_t DC_RemovalInstance; /* DC removal filter instance */
-#endif
/* Concert Sound */
LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
@@ -248,16 +207,8 @@
LVM_INT16 DBE_Active; /* Control flag */
/* Volume Control */
-#ifdef BUILD_FLOAT
LVMixer3_1St_FLOAT_st VC_Volume; /* Volume scaler */
-#else
- LVMixer3_1St_st VC_Volume; /* Volume scaler */
-#endif
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st VC_BalanceMix; /* VC balance mixer */
-#else
- LVMixer3_2St_st VC_BalanceMix; /* VC balance mixer */
-#endif
LVM_INT16 VC_VolumedB; /* Gain in dB */
LVM_INT16 VC_Active; /* Control flag */
LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
@@ -281,11 +232,7 @@
LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
LVM_INT16 PSA_GainOffset; /* Tone control flag */
LVM_Callback CallBack;
-#ifdef BUILD_FLOAT
LVM_FLOAT *pPSAInput; /* PSA input pointer */
-#else
- LVM_INT16 *pPSAInput; /* PSA input pointer */
-#endif
LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
@@ -296,7 +243,6 @@
} LVM_Instance_t;
-
/************************************************************************************/
/* */
/* Function Prototypes */
@@ -317,36 +263,18 @@
void LVM_SetHeadroom( LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams);
-#ifdef BUILD_FLOAT
void LVM_BufferIn( LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
LVM_FLOAT **pProcessed,
LVM_UINT16 *pNumSamples);
-#else
-void LVM_BufferIn( LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples);
-#endif
-#ifdef BUILD_FLOAT
void LVM_BufferOut( LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples);
-#else
-void LVM_BufferOut( LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples);
-#endif
LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
void *pData,
LVM_INT16 callbackId);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVM_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
similarity index 64%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
index bc666a9..dc86cfd 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -52,7 +51,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -80,7 +78,6 @@
return(LVM_SUCCESS);
}
-
/*
* Check valid points have been given
*/
@@ -111,7 +108,6 @@
}
}
-
/*
* Update new parameters if necessary
*/
@@ -130,7 +126,6 @@
}
}
-
/*
* Convert from Mono if necessary
*/
@@ -147,7 +142,6 @@
#endif
}
-
/*
* Process the data with managed buffers
*/
@@ -333,226 +327,3 @@
return(LVM_SUCCESS);
}
-#else
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_UINT16 SampleCount = NumSamples;
- LVM_INT16 *pInput = (LVM_INT16 *)pInData;
- LVM_INT16 *pToProcess = (LVM_INT16 *)pInData;
- LVM_INT16 *pProcessed = pOutData;
- LVM_ReturnStatus_en Status;
-
- /*
- * Check if the number of samples is zero
- */
- if (NumSamples == 0)
- {
- return(LVM_SUCCESS);
- }
-
-
- /*
- * Check valid points have been given
- */
- if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
- return (LVM_NULLADDRESS);
- }
-
- /*
- * For unmanaged mode only
- */
- if(pInstance->InstParams.BufferMode == LVM_UNMANAGED_BUFFERS)
- {
- /*
- * Check if the number of samples is a good multiple (unmanaged mode only)
- */
- if((NumSamples % pInstance->BlickSizeMultiple) != 0)
- {
- return(LVM_INVALIDNUMSAMPLES);
- }
-
- /*
- * Check the buffer alignment
- */
- if((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
- {
- return(LVM_ALIGNMENTERROR);
- }
- }
-
-
- /*
- * Update new parameters if necessary
- */
- if (pInstance->ControlPending == LVM_TRUE)
- {
- Status = LVM_ApplyNewSettings(hInstance);
-
- if(Status != LVM_SUCCESS)
- {
- return Status;
- }
- }
-
-
- /*
- * Convert from Mono if necessary
- */
- if (pInstance->Params.SourceFormat == LVM_MONO)
- {
- MonoTo2I_16(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)NumSamples); /* Number of input samples */
- pInput = pOutData;
- pToProcess = pOutData;
- }
-
-
- /*
- * Process the data with managed buffers
- */
- while (SampleCount != 0)
- {
- /*
- * Manage the input buffer and frame processing
- */
- LVM_BufferIn(hInstance,
- pInput,
- &pToProcess,
- &pProcessed,
- &SampleCount);
-
- /*
- * Only process data when SampleCount is none zero, a zero count can occur when
- * the BufferIn routine is working in managed mode.
- */
- if (SampleCount != 0)
- {
-
- /*
- * Apply ConcertSound if required
- */
- if (pInstance->CS_Active == LVM_TRUE)
- {
- (void)LVCS_Process(pInstance->hCSInstance, /* Concert Sound instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Apply volume if required
- */
- if (pInstance->VC_Active!=0)
- {
- LVC_MixSoft_1St_D16C31_SAT(&pInstance->VC_Volume,
- pToProcess,
- pProcessed,
- (LVM_INT16)(2*SampleCount)); /* Left and right*/
- pToProcess = pProcessed;
- }
-
- /*
- * Call N-Band equaliser if enabled
- */
- if (pInstance->EQNB_Active == LVM_TRUE)
- {
- LVEQNB_Process(pInstance->hEQNBInstance, /* N-Band equaliser instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Call bass enhancement if enabled
- */
- if (pInstance->DBE_Active == LVM_TRUE)
- {
- LVDBE_Process(pInstance->hDBEInstance, /* Dynamic Bass Enhancement instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Bypass mode or everything off, so copy the input to the output
- */
- if (pToProcess != pProcessed)
- {
- Copy_16(pToProcess, /* Source */
- pProcessed, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Left and right */
- }
-
- /*
- * Apply treble boost if required
- */
- if (pInstance->TE_Active == LVM_TRUE)
- {
- /*
- * Apply the filter
- */
- FO_2I_D16F32C15_LShx_TRC_WRA_01(&pInstance->pTE_State->TrebleBoost_State,
- pProcessed,
- pProcessed,
- (LVM_INT16)SampleCount);
-
- }
-
- /*
- * Volume balance
- */
- LVC_MixSoft_1St_2i_D16C31_SAT(&pInstance->VC_BalanceMix,
- pProcessed,
- pProcessed,
- SampleCount);
-
- /*
- * Perform Parametric Spectum Analysis
- */
- if ((pInstance->Params.PSA_Enable == LVM_PSA_ON)&&(pInstance->InstParams.PSA_Included==LVM_PSA_ON))
- {
- From2iToMono_16(pProcessed,
- pInstance->pPSAInput,
- (LVM_INT16) (SampleCount));
-
- LVPSA_Process(pInstance->hPSAInstance,
- pInstance->pPSAInput,
- (LVM_UINT16) (SampleCount),
- AudioTime);
- }
-
-
- /*
- * DC removal
- */
- DC_2I_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance,
- pProcessed,
- pProcessed,
- (LVM_INT16)SampleCount);
-
-
- }
-
- /*
- * Manage the output buffer
- */
- LVM_BufferOut(hInstance,
- pOutData,
- &SampleCount);
-
- }
-
- return(LVM_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
similarity index 61%
rename from media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
rename to media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
index a5356d2..66392e2 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
@@ -29,7 +29,6 @@
/* Treble Boost Filter Coefficients */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
@@ -267,7 +266,6 @@
{HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
HPF_Fs48000_Gain15_A0,
-HPF_Fs48000_Gain15_B1}
-#ifdef HIGHER_FS
,
/* 88kHz Sampling rate */
{HPF_Fs88200_Gain1_A1, /* Gain Setting 1 */
@@ -456,322 +454,7 @@
{HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
HPF_Fs192000_Gain15_A0,
-HPF_Fs192000_Gain15_B1}
-#endif
};
-#else
-FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
-
- /* 22kHz sampling rate */
- {HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
- HPF_Fs22050_Gain1_A0,
- -HPF_Fs22050_Gain1_B1,
- HPF_Fs22050_Gain1_Shift},
- {HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
- HPF_Fs22050_Gain2_A0,
- -HPF_Fs22050_Gain2_B1,
- HPF_Fs22050_Gain2_Shift},
- {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
- HPF_Fs22050_Gain3_A0,
- -HPF_Fs22050_Gain3_B1,
- HPF_Fs22050_Gain3_Shift},
- {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
- HPF_Fs22050_Gain4_A0,
- -HPF_Fs22050_Gain4_B1,
- HPF_Fs22050_Gain4_Shift},
- {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
- HPF_Fs22050_Gain5_A0,
- -HPF_Fs22050_Gain5_B1,
- HPF_Fs22050_Gain5_Shift},
- {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
- HPF_Fs22050_Gain6_A0,
- -HPF_Fs22050_Gain6_B1,
- HPF_Fs22050_Gain6_Shift},
- {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
- HPF_Fs22050_Gain7_A0,
- -HPF_Fs22050_Gain7_B1,
- HPF_Fs22050_Gain7_Shift},
- {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
- HPF_Fs22050_Gain8_A0,
- -HPF_Fs22050_Gain8_B1,
- HPF_Fs22050_Gain8_Shift},
- {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
- HPF_Fs22050_Gain9_A0,
- -HPF_Fs22050_Gain9_B1,
- HPF_Fs22050_Gain9_Shift},
- {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
- HPF_Fs22050_Gain10_A0,
- -HPF_Fs22050_Gain10_B1,
- HPF_Fs22050_Gain10_Shift},
- {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
- HPF_Fs22050_Gain11_A0,
- -HPF_Fs22050_Gain11_B1,
- HPF_Fs22050_Gain11_Shift},
- {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
- HPF_Fs22050_Gain12_A0,
- -HPF_Fs22050_Gain12_B1,
- HPF_Fs22050_Gain12_Shift},
- {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
- HPF_Fs22050_Gain13_A0,
- -HPF_Fs22050_Gain13_B1,
- HPF_Fs22050_Gain13_Shift},
- {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
- HPF_Fs22050_Gain14_A0,
- -HPF_Fs22050_Gain14_B1,
- HPF_Fs22050_Gain14_Shift},
- {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
- HPF_Fs22050_Gain15_A0,
- -HPF_Fs22050_Gain15_B1,
- HPF_Fs22050_Gain15_Shift},
-
- /* 24kHz sampling rate */
- {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs24000_Gain1_A0,
- -HPF_Fs24000_Gain1_B1,
- HPF_Fs24000_Gain1_Shift},
- {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs24000_Gain2_A0,
- -HPF_Fs24000_Gain2_B1,
- HPF_Fs24000_Gain2_Shift},
- {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs24000_Gain3_A0,
- -HPF_Fs24000_Gain3_B1,
- HPF_Fs24000_Gain3_Shift},
- {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs24000_Gain4_A0,
- -HPF_Fs24000_Gain4_B1,
- HPF_Fs24000_Gain4_Shift},
- {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs24000_Gain5_A0,
- -HPF_Fs24000_Gain5_B1,
- HPF_Fs24000_Gain5_Shift},
- {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs24000_Gain6_A0,
- -HPF_Fs24000_Gain6_B1,
- HPF_Fs24000_Gain6_Shift},
- {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs24000_Gain7_A0,
- -HPF_Fs24000_Gain7_B1,
- HPF_Fs24000_Gain7_Shift},
- {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs24000_Gain8_A0,
- -HPF_Fs24000_Gain8_B1,
- HPF_Fs24000_Gain8_Shift},
- {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs24000_Gain9_A0,
- -HPF_Fs24000_Gain9_B1,
- HPF_Fs24000_Gain9_Shift},
- {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs24000_Gain10_A0,
- -HPF_Fs24000_Gain10_B1,
- HPF_Fs24000_Gain10_Shift},
- {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs24000_Gain11_A0,
- -HPF_Fs24000_Gain11_B1,
- HPF_Fs24000_Gain11_Shift},
- {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs24000_Gain12_A0,
- -HPF_Fs24000_Gain12_B1,
- HPF_Fs24000_Gain12_Shift},
- {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs24000_Gain13_A0,
- -HPF_Fs24000_Gain13_B1,
- HPF_Fs24000_Gain13_Shift},
- {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs24000_Gain14_A0,
- -HPF_Fs24000_Gain14_B1,
- HPF_Fs24000_Gain14_Shift},
- {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs24000_Gain15_A0,
- -HPF_Fs24000_Gain15_B1,
- HPF_Fs24000_Gain15_Shift},
-
- /* 32kHz sampling rate */
- {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs32000_Gain1_A0,
- -HPF_Fs32000_Gain1_B1,
- HPF_Fs32000_Gain1_Shift},
- {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs32000_Gain2_A0,
- -HPF_Fs32000_Gain2_B1,
- HPF_Fs32000_Gain2_Shift},
- {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs32000_Gain3_A0,
- -HPF_Fs32000_Gain3_B1,
- HPF_Fs32000_Gain3_Shift},
- {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs32000_Gain4_A0,
- -HPF_Fs32000_Gain4_B1,
- HPF_Fs32000_Gain4_Shift},
- {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs32000_Gain5_A0,
- -HPF_Fs32000_Gain5_B1,
- HPF_Fs32000_Gain5_Shift},
- {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs32000_Gain6_A0,
- -HPF_Fs32000_Gain6_B1,
- HPF_Fs32000_Gain6_Shift},
- {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs32000_Gain7_A0,
- -HPF_Fs32000_Gain7_B1,
- HPF_Fs32000_Gain7_Shift},
- {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs32000_Gain8_A0,
- -HPF_Fs32000_Gain8_B1,
- HPF_Fs32000_Gain8_Shift},
- {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs32000_Gain9_A0,
- -HPF_Fs32000_Gain9_B1,
- HPF_Fs32000_Gain9_Shift},
- {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs32000_Gain10_A0,
- -HPF_Fs32000_Gain10_B1,
- HPF_Fs32000_Gain10_Shift},
- {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs32000_Gain11_A0,
- -HPF_Fs32000_Gain11_B1,
- HPF_Fs32000_Gain11_Shift},
- {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs32000_Gain12_A0,
- -HPF_Fs32000_Gain12_B1,
- HPF_Fs32000_Gain12_Shift},
- {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs32000_Gain13_A0,
- -HPF_Fs32000_Gain13_B1,
- HPF_Fs32000_Gain13_Shift},
- {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs32000_Gain14_A0,
- -HPF_Fs32000_Gain14_B1,
- HPF_Fs32000_Gain14_Shift},
- {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs32000_Gain15_A0,
- -HPF_Fs32000_Gain15_B1,
- HPF_Fs32000_Gain15_Shift},
-
- /* 44kHz sampling rate */
- {HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
- HPF_Fs44100_Gain1_A0,
- -HPF_Fs44100_Gain1_B1,
- HPF_Fs44100_Gain1_Shift},
- {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
- HPF_Fs44100_Gain2_A0,
- -HPF_Fs44100_Gain2_B1,
- HPF_Fs44100_Gain2_Shift},
- {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
- HPF_Fs44100_Gain3_A0,
- -HPF_Fs44100_Gain3_B1,
- HPF_Fs44100_Gain3_Shift},
- {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
- HPF_Fs44100_Gain4_A0,
- -HPF_Fs44100_Gain4_B1,
- HPF_Fs44100_Gain4_Shift},
- {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
- HPF_Fs44100_Gain5_A0,
- -HPF_Fs44100_Gain5_B1,
- HPF_Fs44100_Gain5_Shift},
- {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
- HPF_Fs44100_Gain6_A0,
- -HPF_Fs44100_Gain6_B1,
- HPF_Fs44100_Gain6_Shift},
- {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
- HPF_Fs44100_Gain7_A0,
- -HPF_Fs44100_Gain7_B1,
- HPF_Fs44100_Gain7_Shift},
- {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
- HPF_Fs44100_Gain8_A0,
- -HPF_Fs44100_Gain8_B1,
- HPF_Fs44100_Gain8_Shift},
- {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
- HPF_Fs44100_Gain9_A0,
- -HPF_Fs44100_Gain9_B1,
- HPF_Fs44100_Gain9_Shift},
- {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
- HPF_Fs44100_Gain10_A0,
- -HPF_Fs44100_Gain10_B1,
- HPF_Fs44100_Gain10_Shift},
- {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
- HPF_Fs44100_Gain11_A0,
- -HPF_Fs44100_Gain11_B1,
- HPF_Fs44100_Gain11_Shift},
- {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
- HPF_Fs44100_Gain12_A0,
- -HPF_Fs44100_Gain12_B1,
- HPF_Fs44100_Gain12_Shift},
- {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
- HPF_Fs44100_Gain13_A0,
- -HPF_Fs44100_Gain13_B1,
- HPF_Fs44100_Gain13_Shift},
- {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
- HPF_Fs44100_Gain14_A0,
- -HPF_Fs44100_Gain14_B1,
- HPF_Fs44100_Gain14_Shift},
- {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
- HPF_Fs44100_Gain15_A0,
- -HPF_Fs44100_Gain15_B1,
- HPF_Fs44100_Gain15_Shift},
-
- /* 48kHz sampling rate */
- {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs48000_Gain1_A0,
- -HPF_Fs48000_Gain1_B1,
- HPF_Fs48000_Gain1_Shift},
- {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs48000_Gain2_A0,
- -HPF_Fs48000_Gain2_B1,
- HPF_Fs48000_Gain2_Shift},
- {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs48000_Gain3_A0,
- -HPF_Fs48000_Gain3_B1,
- HPF_Fs48000_Gain3_Shift},
- {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs48000_Gain4_A0,
- -HPF_Fs48000_Gain4_B1,
- HPF_Fs48000_Gain4_Shift},
- {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs48000_Gain5_A0,
- -HPF_Fs48000_Gain5_B1,
- HPF_Fs48000_Gain5_Shift},
- {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs48000_Gain6_A0,
- -HPF_Fs48000_Gain6_B1,
- HPF_Fs48000_Gain6_Shift},
- {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs48000_Gain7_A0,
- -HPF_Fs48000_Gain7_B1,
- HPF_Fs48000_Gain7_Shift},
- {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs48000_Gain8_A0,
- -HPF_Fs48000_Gain8_B1,
- HPF_Fs48000_Gain8_Shift},
- {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs48000_Gain9_A0,
- -HPF_Fs48000_Gain9_B1,
- HPF_Fs48000_Gain9_Shift},
- {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs48000_Gain10_A0,
- -HPF_Fs48000_Gain10_B1,
- HPF_Fs48000_Gain10_Shift},
- {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs48000_Gain11_A0,
- -HPF_Fs48000_Gain11_B1,
- HPF_Fs48000_Gain11_Shift},
- {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs48000_Gain12_A0,
- -HPF_Fs48000_Gain12_B1,
- HPF_Fs48000_Gain12_Shift},
- {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs48000_Gain13_A0,
- -HPF_Fs48000_Gain13_B1,
- HPF_Fs48000_Gain13_Shift},
- {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs48000_Gain14_A0,
- -HPF_Fs48000_Gain14_B1,
- HPF_Fs48000_Gain14_Shift},
- {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs48000_Gain15_A0,
- -HPF_Fs48000_Gain15_B1,
- HPF_Fs48000_Gain15_Shift}
- };
-#endif
/************************************************************************************/
/* */
@@ -780,7 +463,6 @@
/************************************************************************************/
/* dB to linear conversion table */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVM_VolumeTable[] = {
1.000f, /* 0dB */
0.891f, /* -1dB */
@@ -789,16 +471,6 @@
0.631f, /* -4dB */
0.562f, /* -5dB */
0.501f}; /* -6dB */
-#else
-const LVM_INT16 LVM_VolumeTable[] = {
- 0x7FFF, /* 0dB */
- 0x7215, /* -1dB */
- 0x65AD, /* -2dB */
- 0x5A9E, /* -3dB */
- 0x50C3, /* -4dB */
- 0x47FB, /* -5dB */
- 0x4000}; /* -6dB */
-#endif
/************************************************************************************/
/* */
@@ -816,7 +488,6 @@
#define LVM_MIX_TC_Fs44100 32734 /* Floating point value 0.998962402 */
#define LVM_MIX_TC_Fs48000 32737 /* Floating point value 0.999053955 */
-
const LVM_INT16 LVM_MixerTCTable[] = {
LVM_MIX_TC_Fs8000,
LVM_MIX_TC_Fs11025,
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
index 4cf7119..fc82194 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
@@ -18,10 +18,6 @@
#ifndef __LVM_TABLES_H__
#define __LVM_TABLES_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/************************************************************************************/
/* */
/* Includes */
@@ -37,30 +33,16 @@
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#else
-extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#endif
/************************************************************************************/
/* */
/* Volume control gain and time constant tables */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
extern const LVM_FLOAT LVM_VolumeTable[];
-#else
-extern const LVM_INT16 LVM_VolumeTable[];
-#endif
extern const LVM_INT16 LVM_MixerTCTable[];
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#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 06e742e..bef7fa1 100644
--- a/media/libeffects/lvm/lib/Common/lib/AGC.h
+++ b/media/libeffects/lvm/lib/Common/lib/AGC.h
@@ -18,11 +18,6 @@
#ifndef __AGC_H__
#define __AGC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/**********************************************************************************/
/* */
/* Includes */
@@ -31,28 +26,11 @@
#include "LVM_Types.h"
-
/**********************************************************************************/
/* */
/* Types */
/* */
/**********************************************************************************/
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT32 AGC_Gain; /* The current AGC gain */
- LVM_INT32 AGC_MaxGain; /* The maximum AGC gain */
- LVM_INT32 Volume; /* The current volume setting */
- LVM_INT32 Target; /* The target volume setting */
- LVM_INT32 AGC_Target; /* AGC target level */
- LVM_INT16 AGC_Attack; /* AGC attack scaler */
- LVM_INT16 AGC_Decay; /* AGC decay scaler */
- LVM_INT16 AGC_GainShift; /* The gain shift */
- LVM_INT16 VolumeShift; /* Volume shift scaling */
- LVM_INT16 VolumeTC; /* Volume update time constant */
-
-} AGC_MIX_VOL_2St1Mon_D32_t;
-#else
typedef struct
{
LVM_FLOAT AGC_Gain; /* The current AGC gain */
@@ -65,14 +43,12 @@
LVM_FLOAT VolumeTC; /* Volume update time constant */
} AGC_MIX_VOL_2St1Mon_FLOAT_t;
-#endif
/**********************************************************************************/
/* */
/* Function Prototypes */
/* */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
const LVM_FLOAT *pStSrc, /* Stereo source */
const LVM_FLOAT *pMonoSrc, /* Mono source */
@@ -87,26 +63,5 @@
LVM_UINT16 NrChannels); /* Number of channels */
#endif
-#else
-void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
- const LVM_INT32 *pStSrc, /* Stereo source */
- const LVM_INT32 *pMonoSrc, /* Mono source */
- LVM_INT32 *pDst, /* Stereo destination */
- LVM_UINT16 n); /* Number of samples */
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
#endif /* __AGC_H__ */
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
index 01539b2..c050cd0 100644
--- a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
+++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
@@ -18,16 +18,10 @@
#ifndef _BIQUAD_H_
#define _BIQUAD_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "LVM_Types.h"
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
#ifdef SUPPORT_MC
@@ -42,19 +36,11 @@
LVM_FLOAT Storage[6];
#endif
} Biquad_FLOAT_Instance_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[6];
-
-} Biquad_Instance_t;
-#endif
/**********************************************************************************
COEFFICIENT TYPE DEFINITIONS
***********************************************************************************/
/*** Biquad coefficients **********************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A2; /* a2 */
@@ -63,93 +49,31 @@
LVM_FLOAT B2; /* -b2! */
LVM_FLOAT B1; /* -b1! */
} BQ_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A2; /* a2 */
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
-} BQ_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A2; /* a2 */
- LVM_INT32 A1; /* a1 */
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
-} BQ_C32_Coefs_t;
-#endif
/*** First order coefficients *****************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A1; /* a1 */
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B1; /* -b1! */
-} FO_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A1; /* a1 */
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B1; /* -b1! */
-} FO_C32_Coefs_t;
-#endif
/*** First order coefficients with Shift*****************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A1; /* a1 */
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_LShx_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B1; /* -b1! */
- LVM_INT16 Shift; /* Shift */
-} FO_C16_LShx_Coefs_t;
-#endif
/*** Band pass coefficients *******************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B2; /* -b2! */
LVM_FLOAT B1; /* -b1! */
} BP_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
-} BP_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
-} BP_C32_Coefs_t;
-#endif
/*** Peaking coefficients *********************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A0; /* a0 */
@@ -157,30 +81,12 @@
LVM_FLOAT B1; /* -b1! */
LVM_FLOAT G; /* Gain */
} PK_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
- LVM_INT16 G; /* Gain */
-} PK_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
- LVM_INT16 G; /* Gain */
-} PK_C32_Coefs_t;
-#endif
/**********************************************************************************
TAPS TYPE DEFINITIONS
***********************************************************************************/
/*** Types used for first order and shelving filter *******************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[ (1 * 2) ]; /* One channel, two taps of size LVM_INT32 */
@@ -195,20 +101,8 @@
LVM_FLOAT Storage[ (2 * 2) ]; /* Two channels, two taps of size LVM_FLOAT */
#endif
} Biquad_2I_Order1_FLOAT_Taps_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[ (1*2) ]; /* One channel, two taps of size LVM_INT32 */
-} Biquad_1I_Order1_Taps_t;
-
-typedef struct
-{
- LVM_INT32 Storage[ (2*2) ]; /* Two channels, two taps of size LVM_INT32 */
-} Biquad_2I_Order1_Taps_t;
-#endif
/*** Types used for biquad, band pass and peaking filter **************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[ (1 * 4) ]; /* One channel, four taps of size LVM_FLOAT */
@@ -223,17 +117,6 @@
LVM_FLOAT Storage[ (2 * 4) ]; /* Two channels, four taps of size LVM_FLOAT */
#endif
} Biquad_2I_Order2_FLOAT_Taps_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[ (1*4) ]; /* One channel, four taps of size LVM_INT32 */
-} Biquad_1I_Order2_Taps_t;
-
-typedef struct
-{
- LVM_INT32 Storage[ (2*4) ]; /* Two channels, four taps of size LVM_INT32 */
-} Biquad_2I_Order2_Taps_t;
-#endif
/* The names of the functions are changed to satisfy QAC rules: Name should be Unique withing 16 characters*/
#define BQ_2I_D32F32Cll_TRC_WRA_01_Init Init_BQ_2I_D32F32Cll_TRC_WRA_01
#define BP_1I_D32F32C30_TRC_WRA_02 TWO_BP_1I_D32F32C30_TRC_WRA_02
@@ -244,140 +127,57 @@
/*** 16 bit data path *************************************************************/
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
@@ -392,67 +192,30 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C32_Coefs_t *pCoef);
-
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: FIRST ORDER FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef);
-#else
-void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_LShx_Coefs_t *pCoef);
-#else
-void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order1_Taps_t *pTaps,
- FO_C16_LShx_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef);
@@ -467,22 +230,11 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C32_Coefs_t *pCoef);
-
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: BAND PASS FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef);
@@ -497,27 +249,7 @@
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C16_Coefs_t *pCoef);
-
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-
-void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef);
-
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef);
@@ -525,37 +257,11 @@
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef);
-
-void BP_1I_D32F32C30_TRC_WRA_02( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path STEREO ******************************************************/
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32CllGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C32_Coefs_t *pCoef);
-void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
PK_FLOAT_Coefs_t *pCoef);
-#else
-void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void PK_2I_D32F32C14G11_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -567,19 +273,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: DC REMOVAL FILTERS
***********************************************************************************/
/*** 16 bit data path STEREO ******************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void DC_Mc_D16_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance);
@@ -596,18 +295,6 @@
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
#endif
-#else
-void DC_2I_D16_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance);
-
-void DC_2I_D16_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/lib/CompLim.h b/media/libeffects/lvm/lib/Common/lib/CompLim.h
index 498faa3..5b7cb1b 100644
--- a/media/libeffects/lvm/lib/Common/lib/CompLim.h
+++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h
@@ -18,11 +18,6 @@
#ifndef _COMP_LIM_H
#define _COMP_LIM_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -31,7 +26,6 @@
#include "LVM_Types.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -57,31 +51,17 @@
LVM_INT32 CompIntSlow; /* Compressor slow integrator current value */
LVM_INT32 CompIntFast; /* Compressor fast integrator current value */
-
} CompLim_Instance_t;
-
/************************************************************************************/
/* */
/* Function Prototypes */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
void NonLinComp_Float(LVM_FLOAT Gain,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT32 BlockLength);
-#else
-void NonLinComp_D16(LVM_INT16 Gain,
- LVM_INT16 *pSterBfIn,
- LVM_INT16 *pSterBfOut,
- LVM_INT32 BlockLength);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#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 0c8955d..1eeb321 100644
--- a/media/libeffects/lvm/lib/Common/lib/Filter.h
+++ b/media/libeffects/lvm/lib/Common/lib/Filter.h
@@ -18,39 +18,27 @@
#ifndef _FILTER_H_
#define _FILTER_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/**********************************************************************************
INCLUDES
***********************************************************************************/
#include "LVM_Types.h"
#include "BIQUAD.h"
-
/**********************************************************************************
DEFINES
***********************************************************************************/
#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
-#ifdef BUILD_FLOAT
#define FILTER_LOSS_FLOAT 0.998849f
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES
***********************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Power10( LVM_FLOAT X);
LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
LVM_FLOAT *pCoefficients,
LVM_FLOAT X);
-#ifdef HIGHER_FS
LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
-#else
-LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
-#endif
LVM_Fs_en SampleRate);
LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
@@ -58,26 +46,7 @@
LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs);
-#else
-LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
- LVM_INT32 *pCoefficients,
- LVM_INT32 X);
-
-LVM_INT32 LVM_Power10( LVM_INT32 X);
-
-LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs);
-
-LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs);
-
-LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en SampleRate);
-#endif
/**********************************************************************************/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /** _FILTER_H_ **/
diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
index 7f725f4..bae84e7 100644
--- a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
+++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
@@ -18,10 +18,6 @@
#ifndef __INSTALLOC_H__
#define __INSTALLOC_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "LVM_Types.h"
/*######################################################################################*/
/* Type declarations */
@@ -32,7 +28,6 @@
uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */
} INST_ALLOC;
-
/*######################################################################################*/
/* Function prototypes */
/*######################################################################################*/
@@ -48,7 +43,6 @@
void InstAlloc_Init( INST_ALLOC *pms, void *StartAddr );
-
/****************************************************************************************
* Name : InstAlloc_AddMember()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -85,8 +79,4 @@
void InstAlloc_InitAll_NULL( INST_ALLOC *pms);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#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 ceccd7b..49f16ad 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
@@ -23,15 +23,9 @@
/* */
/****************************************************************************************/
-
#ifndef __LVM_COMMON_H__
#define __LVM_COMMON_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -39,7 +33,6 @@
/****************************************************************************************/
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -53,9 +46,5 @@
#define ALGORITHM_VC_ID 0x0500
#define ALGORITHM_TE_ID 0x0600
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#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 97d13a5..1a15125 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
@@ -18,10 +18,6 @@
#ifndef _LVM_MACROS_H_
#define _LVM_MACROS_H_
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/**********************************************************************************
MUL32x32INTO32(A,B,C,ShiftR)
C = (A * B) >> ShiftR
@@ -32,7 +28,6 @@
of overflow is undefined.
***********************************************************************************/
-#ifndef MUL32x32INTO32
#define MUL32x32INTO32(A,B,C,ShiftR) \
{LVM_INT32 MUL32x32INTO32_temp,MUL32x32INTO32_temp2,MUL32x32INTO32_mask,MUL32x32INTO32_HH,MUL32x32INTO32_HL,MUL32x32INTO32_LH,MUL32x32INTO32_LL;\
LVM_INT32 shiftValue;\
@@ -58,7 +53,6 @@
}\
(C) = MUL32x32INTO32_temp2;\
}
-#endif
/**********************************************************************************
MUL32x16INTO32(A,B,C,ShiftR)
@@ -71,7 +65,6 @@
of overflow is undefined.
***********************************************************************************/
-#ifndef MUL32x16INTO32
#define MUL32x16INTO32(A,B,C,ShiftR) \
{LVM_INT32 MUL32x16INTO32_mask,MUL32x16INTO32_HH,MUL32x16INTO32_LL;\
LVM_INT32 shiftValue;\
@@ -91,7 +84,6 @@
else {\
(C)=MUL32x16INTO32_HH>>(shiftValue-16);}\
}
-#endif
/**********************************************************************************
ADD2_SAT_32x32(A,B,C)
@@ -99,7 +91,6 @@
A,B and C are 32 bit SIGNED numbers.
***********************************************************************************/
-#ifndef ADD2_SAT_32x32
#define ADD2_SAT_32x32(A,B,C) \
{(C)=(A)+(B);\
if ((((C) ^ (A)) & ((C) ^ (B))) >> 31)\
@@ -110,12 +101,6 @@
(C)=0x7FFFFFFFl;\
}\
}
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#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 a76354d..dbf9e6a 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
@@ -33,11 +33,6 @@
/* The timer currently does not suport changes in sampling rate while timing. */
/****************************************************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/****************************************************************************************/
/* TYPE DEFINITIONS */
/****************************************************************************************/
@@ -74,17 +69,11 @@
void LVM_Timer_Init ( LVM_Timer_Instance_t *pInstance,
LVM_Timer_Params_t *pParams );
-
void LVM_Timer ( LVM_Timer_Instance_t *pInstance,
LVM_INT16 BlockSize );
-
/****************************************************************************************/
/* END OF HEADER */
/****************************************************************************************/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#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 fbfdd4d..8b687f6 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -25,10 +25,6 @@
#ifndef LVM_TYPES_H
#define LVM_TYPES_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <stdint.h>
/****************************************************************************************/
@@ -96,32 +92,15 @@
typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
typedef int64_t LVM_INT64; /* Signed 64-bit word */
-#ifdef BUILD_FLOAT
-
#define LVM_MAXFLOAT 1.f
typedef float LVM_FLOAT; /* single precision floating point */
-// If NATIVE_FLOAT_BUFFER is defined, we expose effects as floating point format;
-// otherwise we expose as integer 16 bit and translate to float for the effect libraries.
-// Hence, NATIVE_FLOAT_BUFFER should only be enabled under BUILD_FLOAT compilation.
-
-#define NATIVE_FLOAT_BUFFER
-
-#endif // BUILD_FLOAT
-
// Select whether we expose int16_t or float buffers.
-#ifdef NATIVE_FLOAT_BUFFER
#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_FLOAT
typedef float effect_buffer_t;
-#else // NATIVE_FLOAT_BUFFER
-
-#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_16_BIT
-typedef int16_t effect_buffer_t;
-
-#endif // NATIVE_FLOAT_BUFFER
#ifdef SUPPORT_MC
#define LVM_MAX_CHANNELS 8 // FCC_8
@@ -143,7 +122,6 @@
LVM_MODE_DUMMY = LVM_MAXENUM
} LVM_Mode_en;
-
/* Format */
typedef enum
{
@@ -156,7 +134,6 @@
LVM_SOURCE_DUMMY = LVM_MAXENUM
} LVM_Format_en;
-
/* LVM sampling rates */
typedef enum
{
@@ -169,17 +146,14 @@
LVM_FS_32000 = 6,
LVM_FS_44100 = 7,
LVM_FS_48000 = 8,
-#ifdef HIGHER_FS
LVM_FS_88200 = 9,
LVM_FS_96000 = 10,
LVM_FS_176400 = 11,
LVM_FS_192000 = 12,
-#endif
LVM_FS_INVALID = LVM_MAXENUM-1,
LVM_FS_DUMMY = LVM_MAXENUM
} LVM_Fs_en;
-
/* Memory Types */
typedef enum
{
@@ -190,7 +164,6 @@
LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM
} LVM_MemoryTypes_en;
-
/* Memory region definition */
typedef struct
{
@@ -199,14 +172,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVM_MemoryRegion_st;
-
/* Memory table containing the region definitions */
typedef struct
{
LVM_MemoryRegion_st Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVM_MemoryTable_st;
-
/****************************************************************************************/
/* */
/* Standard Function Prototypes */
@@ -216,15 +187,10 @@
void *pGeneralPurpose, /* General purpose pointer (e.g. to a data structure needed in the callback) */
LVM_INT16 GeneralPurpose ); /* General purpose variable (e.g. to be used as callback ID) */
-
/****************************************************************************************/
/* */
/* End of file */
/* */
/****************************************************************************************/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#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 07c53cd..b2e0195 100644
--- a/media/libeffects/lvm/lib/Common/lib/Mixer.h
+++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h
@@ -18,19 +18,12 @@
#ifndef __MIXER_H__
#define __MIXER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
#include "LVM_Types.h"
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-#ifdef BUILD_FLOAT /* BUILD_FLOAT*/
typedef struct
{
LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
@@ -66,52 +59,11 @@
void *pGeneralPurpose2;
LVM_Callback pCallBack2;
} Mix_2St_Cll_FLOAT_t;
-#else
-typedef struct
-{
- LVM_INT32 Alpha; /* Time constant. Set by calling application. Can be changed at any time */
- LVM_INT32 Target; /* Target value. Set by calling application. Can be changed at any time */
- LVM_INT32 Current; /* Current value. Set by the mixer function. */
- LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application each time the target value is updated */
- LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
- void *pCallbackHandle; /* Pointer to the instance of the callback function */
- void *pGeneralPurpose; /* Pointer for general purpose usage */
- LVM_Callback pCallBack; /* Pointer to the callback function */
-} Mix_1St_Cll_t;
-
-typedef struct
-{
- LVM_INT32 Alpha1;
- LVM_INT32 Target1;
- LVM_INT32 Current1;
- LVM_INT16 CallbackSet1;
- LVM_INT16 CallbackParam1;
- void *pCallbackHandle1;
- void *pGeneralPurpose1;
- LVM_Callback pCallBack1;
-
- LVM_INT32 Alpha2; /* Warning the address of this location is passed as a pointer to Mix_1St_Cll_t in some functions */
- LVM_INT32 Target2;
- LVM_INT32 Current2;
- LVM_INT16 CallbackSet2;
- LVM_INT16 CallbackParam2;
- void *pCallbackHandle2;
- void *pGeneralPurpose2;
- LVM_Callback pCallBack2;
-
-} Mix_2St_Cll_t;
-
-#endif
/*** General functions ************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
-#ifdef HIGHER_FS
LVM_UINT32 Fs,
-#else
- LVM_UINT16 Fs,
-#endif
LVM_UINT16 NumChannels);
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
@@ -129,34 +81,10 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT16 Fs,
- LVM_UINT16 NumChannels);
-
-
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -170,27 +98,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
index cdb3837..ae54419 100644
--- a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
@@ -18,11 +18,6 @@
#ifndef __SCALARARITHMETIC_H__
#define __SCALARARITHMETIC_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/*######################################################################################*/
/* Include files */
/*######################################################################################*/
@@ -35,11 +30,7 @@
/* Absolute value including the corner case for the extreme negative value */
-#ifdef BUILD_FLOAT
LVM_FLOAT Abs_Float(LVM_FLOAT input);
-#else
-LVM_INT32 Abs_32(LVM_INT32 input);
-#endif
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -53,16 +44,7 @@
* (15->01) = decimal part
* Returns : Lin value format 1.16.15
****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix);
-#else
-LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix);
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* __SCALARARITHMETIC_H__ */
-
diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
index 7468a90..2af1eeb 100644
--- a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
@@ -18,32 +18,16 @@
#ifndef _VECTOR_ARITHMETIC_H_
#define _VECTOR_ARITHMETIC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "LVM_Types.h"
/**********************************************************************************
VARIOUS FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LoadConst_Float( const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void LoadConst_16( const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n );
-void LoadConst_32( const LVM_INT32 val,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
-
-#ifdef BUILD_FLOAT
void Copy_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n );
@@ -57,11 +41,6 @@
LVM_INT16 NrFrames,
LVM_INT32 NrChannels);
#endif
-#else
-void Copy_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n );
-#endif
/*********************************************************************************
* note: In Mult3s_16x16() saturation of result is not taken care when *
@@ -71,17 +50,10 @@
* This is the only case which will give wrong result. *
* For more information refer to Vector_Arithmetic.doc in /doc folder *
*********************************************************************************/
-#ifdef BUILD_FLOAT
void Mult3s_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Mult3s_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
/*********************************************************************************
* note: In Mult3s_32x16() saturation of result is not taken care when *
@@ -95,55 +67,24 @@
const LVM_INT16 val,
LVM_INT32 *dst,
LVM_INT16 n);
-#ifdef BUILD_FLOAT
void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
LVM_FLOAT *delay, /* Delay buffer */
LVM_INT16 size, /* Delay size */
LVM_FLOAT *dst, /* Source/destination */
LVM_INT16 *pOffset, /* Delay offset */
LVM_INT16 n) ; /* Number of stereo samples */
-#else
-void DelayMix_16x16( const LVM_INT16 *src,
- LVM_INT16 *delay,
- LVM_INT16 size,
- LVM_INT16 *dst,
- LVM_INT16 *pOffset,
- LVM_INT16 n);
-#endif
void DelayWrite_32( const LVM_INT32 *src, /* Source 1, to be delayed */
LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_UINT16 *pOffset, /* Delay offset */
LVM_INT16 n);
-#ifdef BUILD_FLOAT
void Add2_Sat_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void Add2_Sat_16x16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n );
-
-void Add2_Sat_32x32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void Mac3s_Sat_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Mac3s_Sat_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void Mac3s_Sat_32x16( const LVM_INT32 *src,
- const LVM_INT16 val,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_INT16 coeff, /* All pass filter coefficient */
@@ -155,39 +96,16 @@
/**********************************************************************************
SHIFT FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Shift_Sat_Float (const LVM_INT16 val,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Shift_Sat_v16xv16 ( const LVM_INT16 val,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void Shift_Sat_v32xv32 ( const LVM_INT16 val,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************
AUDIO FORMAT CONVERSION FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MonoTo2I_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void MonoTo2I_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void MonoTo2I_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void From2iToMono_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
@@ -197,47 +115,18 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void From2iToMono_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void MSTo2i_Sat_Float( const LVM_FLOAT *srcM,
const LVM_FLOAT *srcS,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void MSTo2i_Sat_16x16( const LVM_INT16 *srcM,
- const LVM_INT16 *srcS,
- LVM_INT16 *dst,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void From2iToMS_Float( const LVM_FLOAT *src,
LVM_FLOAT *dstM,
LVM_FLOAT *dstS,
LVM_INT16 n );
-#else
-void From2iToMS_16x16( const LVM_INT16 *src,
- LVM_INT16 *dstM,
- LVM_INT16 *dstS,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void JoinTo2i_Float( const LVM_FLOAT *srcL,
const LVM_FLOAT *srcR,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void From2iToMono_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-void JoinTo2i_32x32( const LVM_INT32 *srcL,
- const LVM_INT32 *srcR,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
/**********************************************************************************
DATA TYPE CONVERSION FUNCTIONS
@@ -253,11 +142,6 @@
LVM_INT16 n,
LVM_INT16 shift );
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
/**********************************************************************************/
#endif /* _VECTOR_ARITHMETIC_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
similarity index 74%
rename from media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
rename to media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
index 5c8655f..e18aa78 100644
--- a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
@@ -24,7 +24,6 @@
#include "AGC.h"
#include "ScalarArithmetic.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -33,10 +32,8 @@
#define VOL_TC_SHIFT 21 /* As a power of 2 */
#define DECAY_SHIFT 10 /* As a power of 2 */
-#ifdef BUILD_FLOAT
#define VOL_TC_FLOAT 2.0f /* As a power of 2 */
#define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */
-#endif
/****************************************************************************************/
/* */
@@ -72,131 +69,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
- const LVM_INT32 *pStSrc, /* Stereo source */
- const LVM_INT32 *pMonoSrc, /* Mono source */
- LVM_INT32 *pDst, /* Stereo destination */
- LVM_UINT16 NumSamples) /* Number of samples */
-{
-
- /*
- * General variables
- */
- LVM_UINT16 i; /* Sample index */
- LVM_INT32 Left; /* Left sample */
- LVM_INT32 Right; /* Right sample */
- LVM_INT32 Mono; /* Mono sample */
- LVM_INT32 AbsPeak; /* Absolute peak signal */
- LVM_INT32 HighWord; /* High word in intermediate calculations */
- LVM_INT32 LowWord; /* Low word in intermediate calculations */
- LVM_INT16 AGC_Mult; /* Short AGC gain */
- LVM_INT16 Vol_Mult; /* Short volume */
-
-
- /*
- * Instance control variables
- */
- LVM_INT32 AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
- LVM_INT32 AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
- LVM_INT16 AGC_GainShift = pInstance->AGC_GainShift; /* Get the AGC shift */
- LVM_INT16 AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
- LVM_INT16 AGC_Decay = pInstance->AGC_Decay; /* Decay scaler */
- LVM_INT32 AGC_Target = pInstance->AGC_Target; /* Get the target level */
- LVM_INT32 Vol_Current = pInstance->Volume; /* Actual volume setting */
- LVM_INT32 Vol_Target = pInstance->Target; /* Target volume setting */
- LVM_INT16 Vol_Shift = pInstance->VolumeShift; /* Volume shift scaling */
- LVM_INT16 Vol_TC = pInstance->VolumeTC; /* Time constant */
-
-
- /*
- * Process on a sample by sample basis
- */
- for (i=0;i<NumSamples;i++) /* For each sample */
- {
-
- /*
- * Get the short scalers
- */
- AGC_Mult = (LVM_INT16)(AGC_Gain >> 16); /* Get the short AGC gain */
- Vol_Mult = (LVM_INT16)(Vol_Current >> 16); /* Get the short volume gain */
-
-
- /*
- * Get the input samples
- */
- Left = *pStSrc++; /* Get the left sample */
- Right = *pStSrc++; /* Get the right sample */
- Mono = *pMonoSrc++; /* Get the mono sample */
-
-
- /*
- * Apply the AGC gain to the mono input and mix with the stereo signal
- */
- HighWord = (AGC_Mult * (Mono >> 16)); /* signed long (Mono) by unsigned short (AGC_Mult) multiply */
- LowWord = (AGC_Mult * (Mono & 0xffff));
- Mono = (HighWord + (LowWord >> 16)) << (AGC_GainShift);
- Left += Mono; /* Mix in the mono signal */
- Right += Mono;
-
-
- /*
- * Apply the volume and write to the output stream
- */
- HighWord = (Vol_Mult * (Left >> 16)); /* signed long (Left) by unsigned short (Vol_Mult) multiply */
- LowWord = (Vol_Mult * (Left & 0xffff));
- Left = (HighWord + (LowWord >> 16)) << (Vol_Shift);
- HighWord = (Vol_Mult * (Right >> 16)); /* signed long (Right) by unsigned short (Vol_Mult) multiply */
- LowWord = (Vol_Mult * (Right & 0xffff));
- Right = (HighWord + (LowWord >> 16)) << (Vol_Shift);
- *pDst++ = Left; /* Save the results */
- *pDst++ = Right;
-
-
- /*
- * Update the AGC gain
- */
- AbsPeak = (Abs_32(Left)>Abs_32(Right)) ? Abs_32(Left) : Abs_32(Right); /* Get the absolute peak */
- if (AbsPeak > AGC_Target)
- {
- /*
- * The signal is too large so decrease the gain
- */
- HighWord = (AGC_Attack * (AGC_Gain >> 16)); /* signed long (AGC_Gain) by unsigned short (AGC_Attack) multiply */
- LowWord = (AGC_Attack * (AGC_Gain & 0xffff));
- AGC_Gain = (HighWord + (LowWord >> 16)) << 1;
- }
- else
- {
- /*
- * The signal is too small so increase the gain
- */
- if (AGC_Gain > AGC_MaxGain)
- {
- AGC_Gain -= (AGC_Decay << DECAY_SHIFT);
- }
- else
- {
- AGC_Gain += (AGC_Decay << DECAY_SHIFT);
- }
- }
-
- /*
- * Update the gain
- */
- Vol_Current += Vol_TC * ((Vol_Target - Vol_Current) >> VOL_TC_SHIFT);
- }
-
-
- /*
- * Update the parameters
- */
- pInstance->Volume = Vol_Current; /* Actual volume setting */
- pInstance->AGC_Gain = AGC_Gain;
-
- return;
-}
-#else
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
const LVM_FLOAT *pStSrc, /* Stereo source */
const LVM_FLOAT *pMonoSrc, /* Mono source */
@@ -215,7 +87,6 @@
LVM_FLOAT AGC_Mult; /* Short AGC gain */
LVM_FLOAT Vol_Mult; /* Short volume */
-
/*
* Instance control variables
*/
@@ -228,7 +99,6 @@
LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
-
/*
* Process on a sample by sample basis
*/
@@ -241,7 +111,6 @@
AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */
Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */
-
/*
* Get the input samples
*/
@@ -249,7 +118,6 @@
Right = *pStSrc++; /* Get the right sample */
Mono = *pMonoSrc++; /* Get the mono sample */
-
/*
* Apply the AGC gain to the mono input and mix with the stereo signal
*/
@@ -296,7 +164,6 @@
Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
-
/*
* Update the parameters
*/
@@ -360,7 +227,6 @@
LVM_FLOAT AGC_Mult; /* Short AGC gain */
LVM_FLOAT Vol_Mult; /* Short volume */
-
/*
* Instance control variables
*/
@@ -374,7 +240,6 @@
LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
-
/*
* Process on a sample by sample basis
*/
@@ -441,7 +306,6 @@
Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
-
/*
* Update the parameters
*/
@@ -451,4 +315,3 @@
return;
}
#endif /*SUPPORT_MC*/
-#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/Abs_32.c b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/Abs_32.c
rename to media/libeffects/lvm/lib/Common/src/Abs_32.cpp
index 84fabd8..e013809 100644
--- a/media/libeffects/lvm/lib/Common/src/Abs_32.c
+++ b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
@@ -47,7 +47,6 @@
}
return input;
}
-#ifdef BUILD_FLOAT
LVM_FLOAT Abs_Float(LVM_FLOAT input)
{
if(input < 0)
@@ -57,4 +56,3 @@
}
return input;
}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.c b/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.c
rename to media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
rename to media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
index 66d6adb..a48e668 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
@@ -21,7 +21,6 @@
#include "VectorArithmetic.h"
-
/**********************************************************************************
FUNCTION ADD2_SAT_32X32
***********************************************************************************/
@@ -57,7 +56,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Add2_Sat_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -85,5 +83,4 @@
}
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
similarity index 60%
rename from media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
index 88f9986..1a5e07f 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -33,13 +32,11 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples)
-
{
LVM_FLOAT ynL;
LVM_INT16 ii;
@@ -48,7 +45,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -77,50 +73,4 @@
}
}
-#else
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q14) * (x(n)L (Q0) - x(n-2)L (Q0) ) ) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* ((*pDataIn)-pBiquadState->pDelays[1]);
-
- // ynL+= ((-B2 (Q14) * y(n-2)L (Q0) ) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[3];
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[2];
-
- ynL=(LVM_INT16)(ynL>>14); // ynL in Q0
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
index 27ab57a..60b6c16 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BP_1I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -50,19 +48,6 @@
pBiquadState->coefs[1] = pCoef->B2;
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C16_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
- pBiquadState->coefs[1]=pCoef->B2;
- pBiquadState->coefs[2]=pCoef->B1;
- }
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
index e194f92..8a000b6 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
@@ -35,5 +34,4 @@
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
deleted file mode 100644
index 3abdd43..0000000
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A0,
- pBiquadState->coefs[1] is -B2,
- pBiquadState->coefs[2] is -B1, these are in Q30 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-2)L in Q0 format
- pBiquadState->pDelays[2] is y(n-1)L in Q16 format
- pBiquadState->pDelays[3] is y(n-2)L in Q16 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
-{
- LVM_FLOAT ynL,templ;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
-
- 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];
- ynL = pBiquadState->coefs[0] * 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;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2] = ynL; // Update y(n-1)L in Q16
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (ynL); // Write Left output
- }
-}
-#else
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>14) in Q16
- templ= (LVM_INT32) *pDataIn-pBiquadState->pDelays[1];
- MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,14)
-
- // ynL+= ((-B2 (Q30) * y(n-2)L (Q16) ) >>30) in Q16
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
- ynL+=templ;
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q16) ) >>30) in Q16
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q16
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)(ynL>>16); // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp
new file mode 100644
index 0000000..c844d03
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A0,
+ pBiquadState->coefs[1] is -B2,
+ pBiquadState->coefs[2] is -B1, these are in Q30 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-2)L in Q0 format
+ 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;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+
+ 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];
+ ynL = pBiquadState->coefs[0] * 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;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L in Q16
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L in Q0
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (ynL); // Write Left output
+ }
+}
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
similarity index 88%
rename from media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
index d6e047a..eb15032 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BP_1I_D16F32Cll_TRC_WRA_01_Init */
@@ -48,7 +47,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -56,24 +54,10 @@
PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
-
pBiquadState->coefs[0] = pCoef->A0;
pBiquadState->coefs[1] = pCoef->B2;
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0] = pCoef->A0;
- pBiquadState->coefs[1] = pCoef->B2;
- pBiquadState->coefs[2] = pCoef->B1;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
index aa9e669..6d754e2 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
@@ -26,12 +26,10 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_Float;
typedef Filter_State_Float * PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
similarity index 60%
rename from media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
rename to media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
index abdb2f7..d0ba206 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
@@ -19,7 +19,6 @@
#include "BP_1I_D32F32Cll_TRC_WRA_02_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -33,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -46,7 +44,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -78,49 +75,3 @@
}
}
-#else
-void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>30) in Q0
- templ=(*pDataIn)-pBiquadState->pDelays[1];
- MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,30)
-
- // ynL+= ((-B2 (Q30) * y(n-2)L (Q0) ) >>30) in Q0
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
- ynL+=templ;
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) >>30) in Q0
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
rename to media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
index 5590c32..6f7d0b5 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -51,21 +50,6 @@
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D32F32Cll_TRC_WRA_02_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
index 80c3920..9f1c66a 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
@@ -26,13 +26,11 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_Float;
typedef Filter_State_Float* PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
similarity index 60%
rename from media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
index ee9bf7a..9aecc40 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
@@ -32,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -45,7 +44,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -77,58 +75,6 @@
***************************************************************************/
*pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
-
}
}
-#else
-void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
-
- // ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= (-B2 (Q15) * y(n-2)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[3];
-
- // ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[2];
-
- ynL=ynL>>15; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
index 3d5befa..f0b5d06 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +55,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
index 811da8b..fad345d 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -35,5 +34,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
deleted file mode 100644
index c74a137..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q14 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-2)L in Q0 format
- pBiquadState->pDelays[2] is y(n-1)L in Q16 format
- pBiquadState->pDelays[3] is y(n-2)L in Q16 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- // 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+= ( (-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];
-
- /**************************************************************************
- 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
-
- }
- }
-#else
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
-
- // ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q14) * x(n)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14
- MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- // ynL+= ( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14
- MUL32x16INTO32(pBiquadState->pDelays[2],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL<<2; // Update y(n-1)L in Q16
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)(ynL>>14); // Write Left output in Q0
-
- }
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp
new file mode 100644
index 0000000..043bc5f
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q14 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-2)L in Q0 format
+ 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;
+
+ 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];
+
+ // 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+= ( (-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];
+
+ /**************************************************************************
+ 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
+
+ }
+ }
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
index 9812274..6a61d9a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -35,5 +34,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
rename to media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
index feae20d..2b80691 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_1I_D16F32Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -58,27 +56,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
deleted file mode 100644
index 9b0fde3..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q14 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q0 format
- pBiquadState->pDelays[5] is y(n-1)R in Q0 format
- pBiquadState->pDelays[6] is y(n-2)L in Q0 format
- pBiquadState->pDelays[7] is y(n-2)R in Q0 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- // 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+= ( -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];
-
-
-
- /**************************************************************************
- 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+=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+=( -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
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
- *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
-
-
- }
-
- }
-#else
-void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- // ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q14) * x(n)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( -B2 (Q14) * y(n-2)L (Q0) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
-
- // ynL+=( -B1 (Q14) * y(n-1)L (Q0) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
-
- ynL=ynL>>14; // ynL in Q0 format
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 (Q14) * x(n-2)R (Q0) in Q14
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- // ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- // ynR+=A0 (Q14) * x(n)R (Q0) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- // ynR+= ( -B2 (Q14) * y(n-2)R (Q0) ) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
-
- // ynR+=( -B1 (Q14) * y(n-1)R (Q0) ) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
-
- ynR=ynR>>14; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
- pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
- pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
- *pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
-
-
- }
-
- }
-
-#endif
\ No newline at end of file
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
new file mode 100644
index 0000000..51cd918
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q14 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q0 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q0 format
+ 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;
+
+ 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];
+
+ // 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+= ( -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];
+
+ /**************************************************************************
+ 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+=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+=( -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
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
+
+ }
+
+ }
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
deleted file mode 100644
index f24db8f..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q15 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q0 format
- pBiquadState->pDelays[5] is y(n-1)R in Q0 format
- pBiquadState->pDelays[6] is y(n-2)L in Q0 format
- pBiquadState->pDelays[7] is y(n-2)R in Q0 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- // 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+= ( -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];
-
-
-
- /**************************************************************************
- 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+=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+=( -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
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
- *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
-
- }
-
- }
-#else
-void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- // ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( -B2 (Q15) * y(n-2)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
-
- // ynL+=( -B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
-
- ynL=ynL>>15; // ynL in Q0 format
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 (Q15) * x(n-2)R (Q0) in Q15
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- // ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- // ynR+=A0 (Q15) * x(n)R (Q0) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- // ynR+= ( -B2 (Q15) * y(n-2)R (Q0) ) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
-
- // ynR+=( -B1 (Q15) * y(n-1)R (Q0) ) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
-
- ynR=ynR>>15; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
- pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
- pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
- *pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp
new file mode 100644
index 0000000..8f74749
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q15 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q0 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q0 format
+ 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;
+
+ 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];
+
+ // 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+= ( -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];
+
+ /**************************************************************************
+ 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+=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+=( -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
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
+
+ }
+
+ }
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
index 39e1bda..987cbcf 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_2I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -58,27 +56,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
index 0691b8c..5a9a0e9 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -36,6 +35,5 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
deleted file mode 100644
index 61c07c7..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q13 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q16 format
- pBiquadState->pDelays[5] is y(n-1)R in Q16 format
- pBiquadState->pDelays[6] is y(n-2)L in Q16 format
- pBiquadState->pDelays[7] is y(n-2)R in Q16 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- /* 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+=-B2*y(n-2)L */
- ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
-
- /* ynL+=-B1*y(n-1)L */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* 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+=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+=-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++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
- pDataOut++;
- }
- }
-#else
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q13) * x(n-2)L (Q0) in Q13*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q13) * x(n-1)L (Q0) in Q13*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q13) * x(n)L (Q0) in Q13*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q13) * y(n-2)L (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q13) * y(n-1)L (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q13) * x(n-2)R (Q0) in Q13*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q13) * x(n-1)R (Q0) in Q13*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q13) * x(n)R (Q0) in Q13*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q13) * y(n-2)R (Q16) )>>16) in Q13*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q13) * y(n-1)R (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<3; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<3; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>13); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>13); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp
new file mode 100644
index 0000000..331c97f
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q13 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q16 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q16 format
+ 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;
+
+ 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];
+
+ /* 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+=-B2*y(n-2)L */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+ /* ynL+=-B1*y(n-1)L */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* 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+=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+=-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++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
+ pDataOut++;
+ }
+ }
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
deleted file mode 100644
index cf19e06..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q14 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q16 format
- pBiquadState->pDelays[5] is y(n-1)R in Q16 format
- pBiquadState->pDelays[6] is y(n-2)L in Q16 format
- pBiquadState->pDelays[7] is y(n-2)R in Q16 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- /* 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+= ( (-B2 * y(n-2)L ))*/
- ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
-
-
- /* ynL+=( (-B1 * y(n-1)L )) */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* 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+=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+=( (-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++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
- pDataOut++;
- }
-
- }
-#else
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q14) * x(n-2)L (Q0) in Q14*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q14) * x(n)L (Q0) in Q14*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q14) * x(n-2)R (Q0) in Q14*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q14) * x(n)R (Q0) in Q14*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q14) * y(n-2)R (Q16) )>>16) in Q14*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q14) * y(n-1)R (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<2; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<2; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>14); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>14); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp
new file mode 100644
index 0000000..3a396df
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q14 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q16 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q16 format
+ 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;
+
+ 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];
+
+ /* 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+= ( (-B2 * y(n-2)L ))*/
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+ /* ynL+=( (-B1 * y(n-1)L )) */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* 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+=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+=( (-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++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
+ pDataOut++;
+ }
+
+ }
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
deleted file mode 100644
index 2611b19..0000000
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
- pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
- pBiquadState->coefs[4] is -B1, these are in Q15 format
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q16 format
- pBiquadState->pDelays[5] is y(n-1)R in Q16 format
- pBiquadState->pDelays[6] is y(n-2)L in Q16 format
- pBiquadState->pDelays[7] is y(n-2)R in Q16 format
-***************************************************************************/
-#ifdef BUILD_FLOAT
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
-
- 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];
-
- /* 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+= ( (-B2 * y(n-2)L ) */
- ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
-
-
- /* ynL+=( (-B1 * y(n-1)L )) */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
-
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* 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+=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+=( (-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++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output*/
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput*/
- pDataOut++;
- }
-
- }
-#else
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q15) * x(n-2)L (Q0) in Q15*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q15) * x(n)L (Q0) in Q15*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q15) * y(n-2)L (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q15) * y(n-1)L (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q15) * x(n-2)R (Q0) in Q15*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q15) * x(n)R (Q0) in Q15*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q15) * y(n-2)R (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q15) * y(n-1)R (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<1; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<1; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>15); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>15); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp
new file mode 100644
index 0000000..1cbff1a
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
+ pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
+ pBiquadState->coefs[4] is -B1, these are in Q15 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q16 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q16 format
+ 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;
+
+ 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];
+
+ /* 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+= ( (-B2 * y(n-2)L ) */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
+
+ /* ynL+=( (-B1 * y(n-1)L )) */
+ ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* 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+=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+=( (-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++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output*/
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput*/
+ 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 c0319c9..314388a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -36,6 +35,5 @@
LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
similarity index 81%
rename from media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
rename to media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
index 4d9bbfe..058541a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_2I_D16F32Css_TRC_WRA_01_Init */
@@ -37,7 +36,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +54,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
index d63365c..78d1ba1 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
@@ -36,13 +36,11 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples)
-
{
LVM_FLOAT ynL,ynR,templ,tempd;
LVM_INT16 ii;
@@ -51,7 +49,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -119,7 +116,6 @@
*pDataOut = (LVM_FLOAT)ynR; /* Write Right ouput */
pDataOut++;
-
}
}
@@ -151,7 +147,6 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels)
-
{
LVM_FLOAT yn, temp;
LVM_INT16 ii, jj;
@@ -204,91 +199,3 @@
}
#endif /*SUPPORT_MC*/
-#else
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL,ynR,templ,tempd;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= ( A2 (Q30) * x(n-2)L (Q0) ) >>30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[2],ynL,30)
-
- /* ynL+= ( A1 (Q30) * x(n-1)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[0],templ,30)
- ynL+=templ;
-
- /* ynL+= ( A0 (Q30) * x(n)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[2],*pDataIn,templ,30)
- ynL+=templ;
-
- /* ynL+= (-B2 (Q30) * y(n-2)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[6],templ,30)
- ynL+=templ;
-
- /* ynL+= (-B1 (Q30) * y(n-1)L (Q0) ) >> 30 in Q0 */
- MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[4],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= ( A2 (Q30) * x(n-2)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[3],ynR,30)
-
- /* ynR+= ( A1 (Q30) * x(n-1)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[1],templ,30)
- ynR+=templ;
-
- /* ynR+= ( A0 (Q30) * x(n)R (Q0) ) >> 30 in Q0*/
- tempd=*(pDataIn+1);
- MUL32x32INTO32(pBiquadState->coefs[2],tempd,templ,30)
- ynR+=templ;
-
- /* ynR+= (-B2 (Q30) * y(n-2)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[7],templ,30)
- ynR+=templ;
-
- /* ynR+= (-B1 (Q30) * y(n-1)R (Q0) ) >> 30 in Q0 */
- MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[5],templ,30)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=(LVM_INT32)ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=(LVM_INT32)ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT32)ynL; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT32)ynR; /* Write Right ouput in Q0*/
- pDataOut++;
-
-
- }
-
- }
-#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
index fff05ed..492a9e0 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +55,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C32_Coefs_t *pCoef)
-{
- LVM_INT32 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D32F32C32_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
index c0f0dcc..7eb6474 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
@@ -18,7 +18,6 @@
#ifndef _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
#define _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
typedef struct _Filter_State_
@@ -29,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -37,6 +35,5 @@
LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/Copy_16.c b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/Copy_16.c
rename to media/libeffects/lvm/lib/Common/src/Copy_16.cpp
index 3858450..7cb642f 100644
--- a/media/libeffects/lvm/lib/Common/src/Copy_16.c
+++ b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
@@ -54,7 +54,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Copy_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -144,5 +143,4 @@
}
}
#endif
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
similarity index 67%
rename from media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
index ea98041..5e77335 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION CORE_MIXHARD_2ST_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -55,35 +54,4 @@
*dst++ = Temp2;
}
}
-#else
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2,Temp3;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
-
- Current1Short = (LVM_INT16)(pInstance->Current1 >> 16);
- Current2Short = (LVM_INT16)(pInstance->Current2 >> 16);
-
- for (ii = n; ii != 0; ii--){
- Temp1=*src1++;
- MUL32x16INTO32(Temp1,Current1Short,Temp3,15)
- Temp2=*src2++;
- MUL32x16INTO32(Temp2,Current2Short,Temp1,15)
- Temp2=(Temp1>>1)+(Temp3>>1);
- if (Temp2 > 0x3FFFFFFF)
- Temp2 = 0x7FFFFFFF;
- else if (Temp2 < - 0x40000000)
- Temp2 = 0x80000000;
- else
- Temp2=(Temp2<<1);
- *dst++ = Temp2;
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
deleted file mode 100644
index 2814f19..0000000
--- a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**********************************************************************************
- INCLUDE FILES
-***********************************************************************************/
-
-#include "Mixer_private.h"
-#include "LVM_Macros.h"
-
-/**********************************************************************************
- FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
-***********************************************************************************/
-
-#ifdef BUILD_FLOAT /* BUILD_FLOAT */
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- 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*/
- }
-
- if (OutLoop){
-
- CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp1 = *src++;
- Temp2 = *dst;
-
- Temp3 = Temp1 * (pInstance->Current);
- Temp1 = Temp2 + Temp3;
-
- if (Temp1 > 1.0f)
- Temp1 = 1.0f;
- else if (Temp1 < -1.0f)
- Temp1 = -1.0f;
-
- *dst++ = Temp1;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
-
- CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
-
- for (jj = 4; jj!=0 ; jj--){
- Temp1 = *src++;
- Temp2 = *dst;
-
- Temp3 = Temp1 * (pInstance->Current);
- Temp1 = Temp2 + Temp3;
-
- if (Temp1 > 1.0f)
- Temp1 = 1.0f;
- else if (Temp1 < -1.0f)
- Temp1 = -1.0f;
- *dst++ = Temp1;
- }
- }
-}
-#else
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2,Temp3;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 TargetTimesOneMinAlpha;
- LVM_INT32 CurrentTimesAlpha;
- LVM_INT16 ii,jj;
- LVM_INT16 CurrentShort;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31); /* Q31 * Q0 in Q0 */
- if (pInstance->Target >= pInstance->Current){
- TargetTimesOneMinAlpha +=2; /* Ceil*/
- }
-
- if (OutLoop){
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp1=*src++;
- Temp2=*dst;
- MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
- Temp1=(Temp2>>1)+(Temp3>>1);
-
- if (Temp1 > 0x3FFFFFFF)
- Temp1 = 0x7FFFFFFF;
- else if (Temp1 < - 0x40000000)
- Temp1 = 0x80000000;
- else
- Temp1=(Temp1<<1);
- *dst++ = Temp1;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp1=*src++;
- Temp2=*dst;
- MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
- Temp1=(Temp2>>1)+(Temp3>>1);
-
- if (Temp1 > 0x3FFFFFFF)
- Temp1 = 0x7FFFFFFF;
- else if (Temp1 < - 0x40000000)
- Temp1 = 0x80000000;
- else
- Temp1=(Temp1<<1);
- *dst++ = Temp1;
- }
- }
-}
-#endif
-/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp
new file mode 100644
index 0000000..8f5c0ae
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**********************************************************************************
+ INCLUDE FILES
+***********************************************************************************/
+
+#include "Mixer_private.h"
+#include "LVM_Macros.h"
+
+/**********************************************************************************
+ 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;
+
+ 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*/
+ }
+
+ if (OutLoop){
+
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp1 = *src++;
+ Temp2 = *dst;
+
+ Temp3 = Temp1 * (pInstance->Current);
+ Temp1 = Temp2 + Temp3;
+
+ if (Temp1 > 1.0f)
+ Temp1 = 1.0f;
+ else if (Temp1 < -1.0f)
+ Temp1 = -1.0f;
+
+ *dst++ = Temp1;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (jj = 4; jj!=0 ; jj--){
+ Temp1 = *src++;
+ Temp2 = *dst;
+
+ Temp3 = Temp1 * (pInstance->Current);
+ Temp1 = Temp2 + Temp3;
+
+ if (Temp1 > 1.0f)
+ Temp1 = 1.0f;
+ else if (Temp1 < -1.0f)
+ Temp1 = -1.0f;
+ *dst++ = Temp1;
+ }
+ }
+}
+/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
deleted file mode 100644
index 814ccee..0000000
--- a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**********************************************************************************
- INCLUDE FILES
-***********************************************************************************/
-
-#include "Mixer_private.h"
-#include "LVM_Macros.h"
-
-/**********************************************************************************
- FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
-***********************************************************************************/
-#ifdef BUILD_FLOAT
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp1,Temp2;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_FLOAT TargetTimesOneMinAlpha;
- LVM_FLOAT CurrentTimesAlpha;
-
- LVM_INT16 ii;
-
- 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 += (LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
- }
-
- if (OutLoop != 0)
- {
- CurrentTimesAlpha = (pInstance->Current * pInstance->Alpha);
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
-
- for (ii = OutLoop; ii != 0; ii--)
- {
- Temp1 = *src;
- src++;
-
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--)
- {
- CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
-
- Temp1 = *src;
- src++;
-
- 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++;
-
- Temp1 = *src;
- src++;
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
- }
-}
-#else
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 TargetTimesOneMinAlpha;
- LVM_INT32 CurrentTimesAlpha;
- LVM_INT16 CurrentShort;
- LVM_INT16 ii;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31) /* Q31 * Q31 in Q31 */
- if (pInstance->Target >= pInstance->Current)
- {
- TargetTimesOneMinAlpha +=2; /* Ceil*/
- }
-
- if (OutLoop!=0)
- {
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--)
- {
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--)
- {
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
- }
-}
-#endif
-/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp
new file mode 100644
index 0000000..6ff7853
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**********************************************************************************
+ INCLUDE FILES
+***********************************************************************************/
+
+#include "Mixer_private.h"
+#include "LVM_Macros.h"
+
+/**********************************************************************************
+ 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;
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_FLOAT TargetTimesOneMinAlpha;
+ LVM_FLOAT CurrentTimesAlpha;
+
+ LVM_INT16 ii;
+
+ 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 += (LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
+ }
+
+ if (OutLoop != 0)
+ {
+ CurrentTimesAlpha = (pInstance->Current * pInstance->Alpha);
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ for (ii = OutLoop; ii != 0; ii--)
+ {
+ Temp1 = *src;
+ src++;
+
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--)
+ {
+ CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
+ pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
+
+ Temp1 = *src;
+ src++;
+
+ 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++;
+
+ 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.c b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
similarity index 71%
rename from media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
index 13fac5e..a7ce4d3 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-#ifdef BUILD_FLOAT
void DC_2I_D16_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -45,7 +44,6 @@
else {
LeftDC += DC_FLOAT_STEP; }
-
/* Subtract DC an saturate */
Diff =* (pDataIn++) - (RightDC);
if (Diff > 1.0f) {
@@ -62,7 +60,6 @@
pBiquadState->LeftDC = LeftDC;
pBiquadState->RightDC = RightDC;
-
}
#ifdef SUPPORT_MC
/*
@@ -116,50 +113,3 @@
}
#endif
-#else
-void DC_2I_D16_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 LeftDC,RightDC;
- LVM_INT32 Diff;
- LVM_INT32 j;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- LeftDC = pBiquadState->LeftDC;
- RightDC = pBiquadState->RightDC;
- for(j=NrSamples-1;j>=0;j--)
- {
- /* Subtract DC an saturate */
- Diff=*(pDataIn++)-(LeftDC>>16);
- if (Diff > 32767) {
- Diff = 32767; }
- else if (Diff < -32768) {
- Diff = -32768; }
- *(pDataOut++)=(LVM_INT16)Diff;
- if (Diff < 0) {
- LeftDC -= DC_D16_STEP; }
- else {
- LeftDC += DC_D16_STEP; }
-
-
- /* Subtract DC an saturate */
- Diff=*(pDataIn++)-(RightDC>>16);
- if (Diff > 32767) {
- Diff = 32767; }
- else if (Diff < -32768) {
- Diff = -32768; }
- *(pDataOut++)=(LVM_INT16)Diff;
- if (Diff < 0) {
- RightDC -= DC_D16_STEP; }
- else {
- RightDC += DC_D16_STEP; }
-
- }
- pBiquadState->LeftDC = LeftDC;
- pBiquadState->RightDC = RightDC;
-
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
similarity index 83%
rename from media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
index 0f941a0..beee112 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
@@ -17,7 +17,6 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
-#ifdef BUILD_FLOAT
void DC_2I_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance)
{
PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
@@ -35,11 +34,3 @@
}
}
#endif
-#else
-void DC_2I_D16_TRC_WRA_01_Init(Biquad_Instance_t *pInstance)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->LeftDC = 0;
- pBiquadState->RightDC = 0;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
index db3a6d3..4170b3c 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
@@ -18,16 +18,10 @@
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
-#ifdef BUILD_FLOAT
-#define DC_FLOAT_STEP 0.0000002384f;
-#else
-#define DC_D16_STEP 0x200;
-#endif
-
+#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.*/
-#ifdef BUILD_FLOAT
typedef struct _Filter_FLOAT_State_
{
LVM_FLOAT LeftDC; /* LeftDC */
@@ -41,13 +35,4 @@
} Filter_FLOAT_State_Mc;
typedef Filter_FLOAT_State_Mc * PFilter_FLOAT_State_Mc ;
#endif
-#else
-typedef struct _Filter_State_
-{
- LVM_INT32 LeftDC; /* LeftDC */
- LVM_INT32 RightDC; /* RightDC */
-}Filter_State;
-
-typedef Filter_State * PFilter_State ;
-#endif
#endif /* _DC_2I_D16_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.c b/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.c
rename to media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
index b04e98e..771fae2 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.c
+++ b/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
@@ -63,7 +63,6 @@
*dst = c;
dst++;
-
MUL32x16INTO32(c, -coeff, temp, 15)
a = temp;
b = delay[AllPassOffset];
diff --git a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
rename to media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
index f502716..52d263f 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
@@ -47,7 +47,6 @@
Offset++;
src++;
-
/* Right channel */
temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
*dst = temp;
@@ -69,7 +68,6 @@
return;
}
-#ifdef BUILD_FLOAT
void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
LVM_FLOAT *delay, /* Delay buffer */
LVM_INT16 size, /* Delay size */
@@ -92,7 +90,6 @@
Offset++;
src++;
-
/* Right channel */
temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
@@ -114,5 +111,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/DelayWrite_32.c b/media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/DelayWrite_32.c
rename to media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
similarity index 60%
rename from media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
index 039c88c..bef0d62 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
@@ -31,7 +31,6 @@
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -70,45 +69,3 @@
}
}
-#else
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
-
- // ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[1];
-
-
- ynL=(LVM_INT16)(ynL>>15); // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
similarity index 83%
rename from media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
index b21b8a4..161225e 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "FO_1I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* FO_1I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef)
@@ -53,23 +51,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-}
-#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
index 6fdb039..34f3df9 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -37,5 +36,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
similarity index 60%
rename from media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
index 416e8eb..e3efad7 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -31,7 +30,6 @@
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -71,44 +69,3 @@
}
}
-#else
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 (Q31) * x(n-1)L (Q0) >>31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[0],ynL,31)
-
- // ynL+=A0 (Q31) * x(n)L (Q0) >> 31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[1],*pDataIn,templ,31)
- ynL+=templ;
-
- // ynL+= (-B1 (Q31) * y(n-1)L (Q0) ) >> 31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[1],templ,31)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT32)ynL; // Write Left output in Q0
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
similarity index 83%
rename from media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
index f33d24d..bb5295c 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* FO_1I_D32F32Cll_TRC_WRA_01_Init */
@@ -37,7 +36,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef)
@@ -53,23 +51,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C32_Coefs_t *pCoef)
-{
- LVM_INT32 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays = (LVM_INT32 *) pTaps;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-}
-#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D32F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
index fdb528b..67d1384 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
@@ -18,7 +18,6 @@
#ifndef _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
#define _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
typedef struct _Filter_State_
@@ -29,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT_
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -37,5 +35,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
similarity index 67%
rename from media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
index 2a50f18..6ca819a 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
@@ -32,7 +32,6 @@
pBiquadState->pDelays[2] is x(n-1)R in Q15 format
pBiquadState->pDelays[3] is y(n-1)R in Q30 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -59,13 +58,11 @@
// ynR =A1 * x(n-1)R
ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
-
// ynL+=A0 * x(n)L
ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
// ynR+=A0 * x(n)L
ynR += (LVM_FLOAT)pBiquadState->coefs[1] * (*(pDataIn+1));
-
// ynL += (-B1 * y(n-1)L )
Temp = pBiquadState->pDelays[1] * pBiquadState->coefs[2];
ynL += Temp;
@@ -73,7 +70,6 @@
Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
ynR += Temp;
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -157,9 +153,6 @@
LVM_FLOAT A1 = pCoefs[0];
LVM_FLOAT B1 = pCoefs[2];
-
-
-
for (ii = NrFrames; ii != 0; ii--)
{
@@ -178,7 +171,6 @@
Temp = B1 * pDelays[1];
yn += Temp;
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -204,97 +196,3 @@
}
}
#endif
-#else
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT32 Temp;
- LVM_INT32 NegSatValue;
- LVM_INT16 ii;
- LVM_INT16 Shift;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- NegSatValue = LVM_MAXINT_16 +1;
- NegSatValue = -NegSatValue;
-
- Shift = pBiquadState->Shift;
-
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
-
- // ynL =A1 (Q15) * x(n-1)L (Q15) in Q30
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
- // ynR =A1 (Q15) * x(n-1)R (Q15) in Q30
- ynR=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
-
- // ynL+=A0 (Q15) * x(n)L (Q15) in Q30
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
- // ynR+=A0 (Q15) * x(n)L (Q15) in Q30
- ynR+=(LVM_INT32)pBiquadState->coefs[1]* (*(pDataIn+1));
-
-
- // ynL += (-B1 (Q15) * y(n-1)L (Q30) ) in Q30
- MUL32x16INTO32(pBiquadState->pDelays[1],pBiquadState->coefs[2],Temp,15);
- ynL +=Temp;
- // ynR += (-B1 (Q15) * y(n-1)R (Q30) ) in Q30
- MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[2],Temp,15);
- ynR +=Temp;
-
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q30
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q15
-
- pBiquadState->pDelays[3]=ynR; // Update y(n-1)R in Q30
- pBiquadState->pDelays[2]=(*pDataIn++); // Update x(n-1)R in Q15
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- /*Apply shift: Instead of left shift on 16-bit result, right shift of (15-shift) is applied
- for better SNR*/
- ynL = ynL>>(15-Shift);
- ynR = ynR>>(15-Shift);
-
- /*Saturate results*/
- if(ynL > LVM_MAXINT_16)
- {
- ynL = LVM_MAXINT_16;
- }
- else
- {
- if(ynL < NegSatValue)
- {
- ynL = NegSatValue;
- }
- }
-
- if(ynR > LVM_MAXINT_16)
- {
- ynR = LVM_MAXINT_16;
- }
- else
- {
- if(ynR < NegSatValue)
- {
- ynR = NegSatValue;
- }
- }
-
- *pDataOut++=(LVM_INT16)ynL;
- *pDataOut++=(LVM_INT16)ynR;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
index 33ca6cf..b81b976 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_LShx_Coefs_t *pCoef)
@@ -53,26 +52,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order1_Taps_t *pTaps,
- FO_C16_LShx_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-
- temp=pCoef->Shift;
- pBiquadState->Shift = temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
index 368bfce..5022500 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
@@ -20,7 +20,6 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_
{
LVM_FLOAT *pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -28,14 +27,4 @@
}Filter_Float_State;
typedef Filter_Float_State * PFilter_Float_State ;
-#else
-typedef struct _Filter_State_
-{
- LVM_INT32 *pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[3]; /* pointer to the filter coefficients */
- LVM_INT16 Shift; /* Shift value*/
-}Filter_State;
-
-typedef Filter_State * PFilter_State ;
-#endif
#endif /* _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/Filters.h b/media/libeffects/lvm/lib/Common/src/Filters.h
index b1fde0c..b5db8f4 100644
--- a/media/libeffects/lvm/lib/Common/src/Filters.h
+++ b/media/libeffects/lvm/lib/Common/src/Filters.h
@@ -18,10 +18,6 @@
#ifndef FILTERS_H
#define FILTERS_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "LVM_Types.h"
/************************************************************************************/
@@ -34,17 +30,6 @@
* Biquad with coefficients A0, A1, A2, B1 and B2 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT16 A0;
- LVM_INT16 A1;
- LVM_INT16 A2;
- LVM_INT16 B1;
- LVM_INT16 B2;
- LVM_UINT16 Scale;
-} BiquadA012B12CoefsSP_t;
-#else
typedef struct
{
LVM_FLOAT A0;
@@ -54,20 +39,10 @@
LVM_FLOAT B2;
LVM_UINT16 Scale;
} BiquadA012B12CoefsSP_t;
-#endif
/*
* Biquad with coefficients A0, A1 and B1 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT16 A0;
- LVM_INT16 A1;
- LVM_INT16 B1;
- LVM_UINT16 Scale;
-} BiquadA01B1CoefsSP_t;
-#else
typedef struct
{
LVM_FLOAT A0;
@@ -75,10 +50,6 @@
LVM_FLOAT B1;
LVM_UINT16 Scale;
} BiquadA01B1CoefsSP_t;
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* FILTERS_H */
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
rename to media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
index 2c6e6c3..c3f6648 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
@@ -53,7 +53,6 @@
return;
}
-#ifdef BUILD_FLOAT
void From2iToMS_Float( const LVM_FLOAT *src,
LVM_FLOAT *dstM,
LVM_FLOAT *dstS,
@@ -82,5 +81,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_16.c b/media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/From2iToMono_16.c
rename to media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
rename to media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
index d02af88..a8688b4 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
@@ -46,7 +46,6 @@
return;
}
-#ifdef BUILD_FLOAT
void From2iToMono_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n)
@@ -110,5 +109,4 @@
}
#endif
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/InstAlloc.c b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Common/src/InstAlloc.c
rename to media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
index a89a5c3..a039bf5 100644
--- a/media/libeffects/lvm/lib/Common/src/InstAlloc.c
+++ b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
@@ -33,7 +33,6 @@
pms->pNextMember = (((uintptr_t)StartAddr + 3) & (uintptr_t)~3);
}
-
/****************************************************************************************
* Name : InstAlloc_AddMember()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -59,7 +58,6 @@
return(NewMemberAddress);
}
-
/****************************************************************************************
* Name : InstAlloc_GetTotal()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -80,7 +78,6 @@
}
}
-
void InstAlloc_InitAll( INST_ALLOC *pms,
LVM_MemoryTable_st *pMemoryTable)
{
@@ -91,19 +88,16 @@
pms[0].TotalSize = 3;
pms[0].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress;
pms[1].TotalSize = 3;
pms[1].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress;
pms[2].TotalSize = 3;
pms[2].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress;
pms[3].TotalSize = 3;
@@ -125,7 +119,6 @@
pms[0].TotalSize = 3;
pms[0].pNextMember = 0;
-
pms[1].TotalSize = 3;
pms[1].pNextMember = 0;
@@ -137,7 +130,6 @@
}
-
void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
LVM_UINT32 Size[],
LVM_MemoryTable_st *pMemoryTable)
@@ -172,7 +164,6 @@
return(NewMemberAddress);
}
-
void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
LVM_UINT32 Size[],
void **ptr)
diff --git a/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.c b/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.c
rename to media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.c b/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.c
rename to media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
rename to media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
index ebc477e..05df656 100644
--- a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
@@ -49,7 +49,6 @@
return;
}
-#ifdef BUILD_FLOAT
void JoinTo2i_Float( const LVM_FLOAT *srcL,
const LVM_FLOAT *srcR,
LVM_FLOAT *dst,
@@ -74,6 +73,5 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
similarity index 70%
rename from media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
index db76cd1..14d61bd 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
@@ -23,11 +23,9 @@
#include "LVM_Macros.h"
#include "ScalarArithmetic.h"
-
/**********************************************************************************
FUNCTION LVC_Core_MixHard_1St_2i_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
LVMixer3_FLOAT_st *ptrInstance2,
const LVM_FLOAT *src,
@@ -57,7 +55,6 @@
*dst++ = (LVM_FLOAT)Temp;
}
-
}
#ifdef SUPPORT_MC
void LVC_Core_MixHard_1St_MC_float_SAT (Mix_Private_FLOAT_st **ptrInstance,
@@ -84,44 +81,4 @@
}
}
#endif
-#else
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
-
- Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
- Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
-
- for (ii = n; ii != 0; ii--)
- {
- Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current1Short)>>15;
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
-
- Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current2Short)>>15;
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
-
-
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
similarity index 65%
rename from media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
index ec0baaf..841fa1e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
@@ -24,7 +24,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXHARD_2ST_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
LVMixer3_FLOAT_st *ptrInstance2,
const LVM_FLOAT *src1,
@@ -39,7 +38,6 @@
Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
-
Current1 = (pInstance1->Current);
Current2 = (pInstance2->Current);
@@ -54,35 +52,4 @@
*dst++ = Temp;
}
}
-#else
-void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src1,
- const LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
-
- Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
- Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
-
- for (ii = n; ii != 0; ii--){
- Temp = (((LVM_INT32)*(src1++) * (LVM_INT32)Current1Short)>>15) +
- (((LVM_INT32)*(src2++) * (LVM_INT32)Current2Short)>>15);
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
similarity index 67%
rename from media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
index 419c7c5..318138d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixInSoft_D16C31_SAT(LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -247,103 +246,4 @@
}
#endif
-#else
-void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
-
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShort;
- LVM_INT32 ii,jj;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
- LVM_INT32 Delta=pInstance->Delta;
- LVM_INT32 Current=pInstance->Current;
- LVM_INT32 Target=pInstance->Target;
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if(Current<Target){
- if (OutLoop){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
- }
- else{
- if (OutLoop){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
- }
- pInstance->Current=Current;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
deleted file mode 100644
index 56b5dae..0000000
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**********************************************************************************
- INCLUDE FILES
-***********************************************************************************/
-
-#include "LVC_Mixer_Private.h"
-#include "ScalarArithmetic.h"
-#include "LVM_Macros.h"
-
-/**********************************************************************************
- FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
-***********************************************************************************/
-#ifdef BUILD_FLOAT
-static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a,
- LVM_FLOAT b,
- LVM_FLOAT c)
-{
- LVM_FLOAT temp;
- temp = a + b ;
- if (temp < -1.0f)
- c = -1.0f;
- else if (temp > 1.0f)
- c = 1.0f;
- else
- 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);
-
- 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 Temp = 0;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if (OutLoop)
- {
- if(CurrentL < TargetL)
- {
- ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
- CurrentL = Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL;
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR < TargetR)
- {
- ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
- CurrentR = Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR;
- 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 = InLoop * 2; ii != 0; ii-=2)
- {
- if(CurrentL < TargetL)
- {
- ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
- CurrentL = Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL;
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR < TargetR)
- {
- ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
- CurrentR = Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR;
- 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));
- }
- pInstanceL->Current = CurrentL;
- pInstanceR->Current = CurrentR;
-
-}
-#ifdef SUPPORT_MC
-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)
- {
- ADD2_SAT_FLOAT(Current, Delta, Temp);
- Current = Temp;
- if (Current > Target)
- Current = Target;
- }
- else
- {
- Current -= Delta;
- if (Current < Target)
- Current = Target;
- }
- *dst++ = *src++ * Current;
- tempCurrent[ch] = Current;
- }
- }
- for (ch = 0; ch < NrChannels; ch++)
- {
- ptrInstance[ch]->Current = tempCurrent[ch];
- }
-}
-#endif
-#else
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShortL;
- LVM_INT16 CurrentShortR;
- LVM_INT32 ii;
- Mix_Private_st *pInstanceL=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstanceR=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
- LVM_INT32 DeltaL=pInstanceL->Delta;
- LVM_INT32 CurrentL=pInstanceL->Current;
- LVM_INT32 TargetL=pInstanceL->Target;
-
- LVM_INT32 DeltaR=pInstanceR->Delta;
- LVM_INT32 CurrentR=pInstanceR->Current;
- LVM_INT32 TargetR=pInstanceR->Target;
-
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if (OutLoop)
- {
- if(CurrentL<TargetL)
- {
- ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
- CurrentL=Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR<TargetR)
- {
- ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
- CurrentR=Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
- if (CurrentR < TargetR)
- CurrentR = TargetR;
- }
-
- CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
- CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop*2; ii != 0; ii-=2)
- {
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop*2; ii != 0; ii-=2)
- {
- if(CurrentL<TargetL)
- {
- ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
- CurrentL=Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR<TargetR)
- {
- ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
- CurrentR=Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
- if (CurrentR < TargetR)
- CurrentR = TargetR;
- }
-
- CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
- CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- }
- pInstanceL->Current=CurrentL;
- pInstanceR->Current=CurrentR;
-
-}
-#endif
-/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp
new file mode 100644
index 0000000..1f4b08a
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**********************************************************************************
+ INCLUDE FILES
+***********************************************************************************/
+
+#include "LVC_Mixer_Private.h"
+#include "ScalarArithmetic.h"
+#include "LVM_Macros.h"
+
+/**********************************************************************************
+ FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
+***********************************************************************************/
+static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a,
+ LVM_FLOAT b,
+ LVM_FLOAT c)
+{
+ LVM_FLOAT temp;
+ temp = a + b ;
+ if (temp < -1.0f)
+ c = -1.0f;
+ else if (temp > 1.0f)
+ c = 1.0f;
+ else
+ 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);
+
+ 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 Temp = 0;
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if (OutLoop)
+ {
+ if(CurrentL < TargetL)
+ {
+ ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
+ CurrentL = Temp;
+ if (CurrentL > TargetL)
+ CurrentL = TargetL;
+ }
+ else
+ {
+ CurrentL -= DeltaL;
+ if (CurrentL < TargetL)
+ CurrentL = TargetL;
+ }
+
+ if(CurrentR < TargetR)
+ {
+ ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
+ CurrentR = Temp;
+ if (CurrentR > TargetR)
+ CurrentR = TargetR;
+ }
+ else
+ {
+ CurrentR -= DeltaR;
+ 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 = InLoop * 2; ii != 0; ii-=2)
+ {
+ if(CurrentL < TargetL)
+ {
+ ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
+ CurrentL = Temp;
+ if (CurrentL > TargetL)
+ CurrentL = TargetL;
+ }
+ else
+ {
+ CurrentL -= DeltaL;
+ if (CurrentL < TargetL)
+ CurrentL = TargetL;
+ }
+
+ if(CurrentR < TargetR)
+ {
+ ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
+ CurrentR = Temp;
+ if (CurrentR > TargetR)
+ CurrentR = TargetR;
+ }
+ else
+ {
+ CurrentR -= DeltaR;
+ 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));
+ }
+ pInstanceL->Current = CurrentL;
+ pInstanceR->Current = CurrentR;
+
+}
+#ifdef SUPPORT_MC
+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)
+ {
+ ADD2_SAT_FLOAT(Current, Delta, Temp);
+ Current = Temp;
+ if (Current > Target)
+ Current = Target;
+ }
+ else
+ {
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+ }
+ *dst++ = *src++ * Current;
+ tempCurrent[ch] = Current;
+ }
+ }
+ for (ch = 0; ch < NrChannels; ch++)
+ {
+ ptrInstance[ch]->Current = tempCurrent[ch];
+ }
+}
+#endif
+/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
similarity index 67%
rename from media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
index 5bfdad8..5d8aadc 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
@@ -26,7 +26,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixSoft_1St_D16C31_WRA(LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -106,7 +105,6 @@
pInstance->Current=Current;
}
-
#ifdef SUPPORT_MC
/*
* FUNCTION: LVC_Core_MixSoft_Mc_D16C31_WRA
@@ -218,80 +216,4 @@
}
#endif
-#else
-void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShort;
- LVM_INT32 ii;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
- LVM_INT32 Delta=pInstance->Delta;
- LVM_INT32 Current=pInstance->Current;
- LVM_INT32 Target=pInstance->Target;
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if(Current<Target){
- if (OutLoop){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- }
- }
- else{
- if (OutLoop){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- }
- }
- pInstance->Current=Current;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
similarity index 70%
rename from media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
index 65956f7..2bec3be 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
@@ -33,7 +33,6 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -84,7 +83,6 @@
}
}
-
/******************************************************************************
CALL BACK
*******************************************************************************/
@@ -107,8 +105,6 @@
}
-
-
#ifdef SUPPORT_MC
/*
* FUNCTION: LVC_MixInSoft_Mc_D16C31_SAT
@@ -185,7 +181,6 @@
}
}
-
/******************************************************************************
CALL BACK
*******************************************************************************/
@@ -209,81 +204,4 @@
}
#endif
-
-#else
-void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
- LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 0x7FFFFFFF){
- pInstance->Current = pInstance->Target;
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- else
- LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
- if ((pInstance->Target>>16) == 0x7FFF){
- if(pInstance->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- Add2_Sat_16x16( src, dst, n );
- }
- else{
- if(pInstance->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- Mac3s_Sat_16x16(src,(LVM_INT16)(pInstance->Target>>16),dst,n);
- pInstance->Current = pInstance->Target; /* In case the LVCore function would have changed the Current value */
- }
- }
- }
-
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(ptrInstance->MixerStream,TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0){
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
-
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
similarity index 74%
rename from media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
index a4682d3..3153ada 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
@@ -37,7 +37,6 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_1St_2i_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
/* This threshold is used to decide on the processing to be applied on
* front center and back center channels
@@ -363,120 +362,4 @@
}
}
}
-#else
-void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance1->Current != pInstance1->Target)||(pInstance2->Current != pInstance2->Target))
- {
- if(pInstance1->Delta == 0x7FFFFFFF)
- {
- pInstance1->Current = pInstance1->Target;
- TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }
- else if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
- {
- pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }
- else
- {
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- }
-
- if(HardMixing == TRUE)
- {
- if(pInstance2->Delta == 0x7FFFFFFF)
- {
- pInstance2->Current = pInstance2->Target;
- TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
- }
- else if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
- {
- pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
- }
- else
- {
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- }
- }
-
- if(HardMixing == FALSE)
- {
- LVC_Core_MixSoft_1St_2i_D16C31_WRA( &(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing)
- {
- if (((pInstance1->Target>>16) == 0x7FFF)&&((pInstance2->Target>>16) == 0x7FFF))
- {
- if(src!=dst)
- {
- Copy_16(src, dst, n);
- }
- }
- else
- {
- LVC_Core_MixHard_1St_2i_D16C31_SAT(&(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
- }
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet)
- {
- if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
- {
- pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance1->Target>>(16-pInstance1->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&ptrInstance->MixerStream[0],TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0)
- {
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
- if (ptrInstance->MixerStream[1].CallbackSet)
- {
- if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
- {
- pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance2->Target>>(16-pInstance2->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&ptrInstance->MixerStream[1],TargetGain);
- ptrInstance->MixerStream[1].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[1].pCallBack != 0)
- {
- (*ptrInstance->MixerStream[1].pCallBack) ( ptrInstance->MixerStream[1].pCallbackHandle, ptrInstance->MixerStream[1].pGeneralPurpose,ptrInstance->MixerStream[1].CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
similarity index 70%
rename from media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
index 0678ae0..4d229da 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
@@ -33,7 +33,6 @@
/**********************************************************************************
FUNCTION LVMixer3_MIXSOFT_1ST_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -198,79 +197,4 @@
#endif
-#else
-void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 0x7FFFFFFF){
- pInstance->Current = pInstance->Target;
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,dst,n);
- LVC_Core_MixSoft_1St_D16C31_WRA( &(ptrInstance->MixerStream[0]), dst, dst, n);
- }
- else
- LVC_Core_MixSoft_1St_D16C31_WRA( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target == 0)
- LoadConst_16(0, dst, n);
- else if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,dst,n);
- if ((pInstance->Target>>16) != 0x7FFF)
- Mult3s_16x16( dst, (LVM_INT16)(pInstance->Target>>16), dst, n );
- }
- else {
- if ((pInstance->Target>>16) != 0x7FFF)
- Mult3s_16x16( src, (LVM_INT16)(pInstance->Target>>16), dst, n );
- else if(src!=dst)
- Copy_16(src, dst, n);
- }
-
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(ptrInstance->MixerStream,TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0){
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
-}
-#endif/*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
similarity index 73%
rename from media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
index 8a89de1..54ab79d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_2St_D16C31_SAT.c
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -131,46 +130,4 @@
}
#endif
-#else
-void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
- const LVM_INT16 *src1,
- LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance1->Current == pInstance1->Target)&&(pInstance1->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
- }
- else if ((pInstance2->Current == pInstance2->Target)&&(pInstance2->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
- }
- else if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
- {
- LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
- LVC_MixInSoft_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
- }
- else{
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
- if(pInstance2->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance2->Shift,src2,src2,n);
- if(pInstance1->Shift!=0)
- {
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance1->Shift,src1,dst,n);
- LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], dst, src2, dst, n);
- }
- else
- LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], src1, src2, dst, n);
- }
-}
-#endif /*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
index 199d529..ce42d2e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
@@ -18,12 +18,6 @@
#ifndef __LVC_MIXER_H__
#define __LVC_MIXER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
#include "LVM_Types.h"
/**********************************************************************************
@@ -31,7 +25,6 @@
***********************************************************************************/
/* LVMixer3_st structure stores Instance parameters for one audio stream */
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
@@ -43,45 +36,14 @@
void *pGeneralPurpose; /* Pointer for general purpose usage */
LVM_Callback pCallBack; /* Pointer to the callback function */
} LVMixer3_FLOAT_st;
-#else
-typedef struct
-{
- LVM_INT32 PrivateParams[4]; /* Private Instance params for Audio Stream */
- LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application each time the target value is updated */
- LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
- void *pCallbackHandle; /* Pointer to the instance of the callback function */
- void *pGeneralPurpose; /* Pointer for general purpose usage */
- LVM_Callback pCallBack; /* Pointer to the callback function */
-} LVMixer3_st;
-#endif
-#ifdef BUILD_FLOAT
typedef struct
{
LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
} LVMixer3_1St_FLOAT_st;
-#else
-typedef struct
-{
- LVMixer3_st MixerStream[1]; /* Instance Params for one Audio Stream */
-} LVMixer3_1St_st;
-#endif
-#ifdef BUILD_FLOAT
typedef struct
{
LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
} LVMixer3_2St_FLOAT_st;
-#else
-typedef struct
-{
- LVMixer3_st MixerStream[2]; /* Instance Params for two Audio Streams */
-} LVMixer3_2St_st;
-#endif
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVMixer3_st MixerStream[3]; /* Instance Params for three Audio Streams */
-} LVMixer3_3St_st;
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES (HIGH LEVEL FUNCTIONS)
***********************************************************************************/
@@ -92,7 +54,6 @@
#define LVMixer3_MixSoft_2St_D16C31_SAT LVMixer3_2St_D16C31_SAT_MixSoft
#define LVMixer3_MixSoft_3St_D16C31_SAT LVMixer3_3St_D16C31_SAT_MixSoft
-
/*** General functions ************************************************************/
/**********************************************************************************/
@@ -101,62 +62,28 @@
/* then the calculation will give an incorrect value for alpha, see the mixer */
/* documentation for further details. */
/* ********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTarget( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain);
-#else
-void LVC_Mixer_SetTarget( LVMixer3_st *pStream,
- LVM_INT32 TargetGain);
-#endif
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream);
-#else
-LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream);
-#endif
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream);
-#else
-LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain,
LVM_FLOAT CurrentGain);
-#else
-void LVC_Mixer_Init( LVMixer3_st *pStream,
- LVM_INT32 TargetGain,
- LVM_INT32 CurrentGain);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
-#else
-void LVC_Mixer_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
-#else
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
-#endif
/*** 16 bit functions *************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -169,14 +96,6 @@
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-
-#ifdef BUILD_FLOAT
void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -189,14 +108,6 @@
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *pInstance,
- LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-
-#ifdef BUILD_FLOAT
void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -210,20 +121,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *pInstance,
- const LVM_INT16 *src1,
- LVM_INT16 *src2,
- LVM_INT16 *dst, /* dst cannot be equal to src2 */
- LVM_INT16 n);
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
/* MixerStream[0] applies to Left channel */
/* MixerStream[1] applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
@@ -236,15 +139,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst, /* dst can be equal to src */
LVM_INT16 n); /* Number of stereo samples */
-#else
-void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
index 5990412..d0b50e6 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
@@ -19,7 +19,6 @@
#include "LVM_Macros.h"
#include "LVC_Mixer_Private.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVMixer3_GetCurrent */
@@ -31,7 +30,6 @@
/* CurrentGain - CurrentGain value in Q 16.15 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream)
{
LVM_FLOAT CurrentGain;
@@ -39,12 +37,3 @@
CurrentGain = pInstance->Current; // CurrentGain
return CurrentGain;
}
-#else
-LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream)
-{
- LVM_INT32 CurrentGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- CurrentGain=pInstance->Current>>(16-pInstance->Shift); // CurrentGain in Q16.15 format
- return CurrentGain;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
index 507eefa..3ae5ba4 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
@@ -30,7 +30,6 @@
/* TargetGain - TargetGain value in Q 16.15 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream)
{
LVM_FLOAT TargetGain;
@@ -39,14 +38,3 @@
TargetGain = pInstance->Target; // TargetGain
return TargetGain;
}
-#else
-LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream)
-{
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
-
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
-
- return TargetGain;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
similarity index 76%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
index 737e26b..c9fd344 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
@@ -44,7 +44,6 @@
/* void */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain,
LVM_FLOAT CurrentGain)
@@ -56,24 +55,3 @@
pInstance->Target = TargetGain; // Update fractional gain Target
pInstance->Current = CurrentGain; // Update fractional gain Current
}
-#else
-void LVC_Mixer_Init( LVMixer3_st *pStream,
- LVM_INT32 TargetGain,
- LVM_INT32 CurrentGain)
-{
- LVM_INT16 Shift=0;
- LVM_INT32 MaxGain=TargetGain; // MaxGain is in Q16.15 format
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- if(CurrentGain>MaxGain)
- MaxGain=CurrentGain; // MaxGain=max(CurrentGain,TargetGain)
-
- MaxGain=MaxGain>>15; // MaxGain in Q31.0 format i.e Integer part only
- while(MaxGain>0){ // Update Shift required to provide integer gain
- Shift++;
- MaxGain=MaxGain>>1;
- }
- pInstance->Target=TargetGain<<(16-Shift); // Update fractional gain Target
- pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
- pInstance->Shift=Shift; // Update Shift
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
index 453a6a5..123d22b 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
@@ -26,7 +26,6 @@
#include "VectorArithmetic.h"
/* Instance parameter structure */
-#ifdef BUILD_FLOAT
typedef struct
{
/* General */
@@ -34,16 +33,6 @@
LVM_FLOAT Current; /*number specifying value of Current Gain */
LVM_FLOAT Delta; /*number specifying value of Delta Gain */
} Mix_Private_FLOAT_st;
-#else
-typedef struct
-{
- /* General */
- LVM_INT32 Target; /* 32 bit number specifying fractional value of Target Gain */
- LVM_INT32 Current; /* 32 bit number specifying fractional valude of Current Gain */
- LVM_INT32 Shift; /* Left Shift for Integer part of Gain */
- LVM_INT32 Delta; /* 32 bit number specifying the fractional value of Delta Gain */
-} Mix_Private_st;
-#endif
/**********************************************************************************
DEFINITIONS
@@ -57,7 +46,6 @@
***********************************************************************************/
/*** 16 bit functions *************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -69,13 +57,6 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -87,27 +68,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *pInstance1,
LVMixer3_FLOAT_st *pInstance2,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *pInstance1,
- LVMixer3_st *pInstance2,
- const LVM_INT16 *src1,
- const LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -115,7 +81,6 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st **ptrInstance,
const LVM_FLOAT *src,
@@ -128,13 +93,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -142,7 +100,6 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Private_FLOAT_st **ptrInstance,
const LVM_FLOAT *src,
@@ -155,43 +112,9 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
/*** 32 bit functions *************************************************************/
-#ifndef BUILD_FLOAT
-void LVC_Core_MixInSoft_D32C31_SAT( LVMixer3_st *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void LVC_Core_MixSoft_1St_D32C31_WRA( LVMixer3_st *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void LVC_Core_MixHard_2St_D32C31_SAT( LVMixer3_st *pInstance1,
- LVMixer3_st *pInstance2,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************/
#endif //#ifndef __LVC_MIXER_PRIVATE_H__
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
similarity index 71%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
index 577179d..47b0cec 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
@@ -43,32 +43,9 @@
/* void */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTarget(LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain)
{
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
pInstance->Target = TargetGain; // Update gain Target
}
-#else
-void LVC_Mixer_SetTarget(LVMixer3_st *pStream,
- LVM_INT32 TargetGain)
-{
- LVM_INT32 Shift=0;
- LVM_INT32 CurrentGain;
- LVM_INT32 MaxGain=TargetGain; // MaxGain is in Q16.15 format
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- CurrentGain=pInstance->Current>>(16-pInstance->Shift); // CurrentGain in Q16.15 format
- if(CurrentGain>MaxGain)
- MaxGain=CurrentGain; // MaxGain=max(CurrentGain,TargetGain)
-
- MaxGain=MaxGain>>15; // MaxGain in Q31.0 format i.e Integer part only
- while(MaxGain>0){ // Update Shift required to provide integer gain
- Shift++;
- MaxGain=MaxGain>>1;
- }
- pInstance->Target=TargetGain<<(16-Shift); // Update fractional gain Target
- pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
- pInstance->Shift=Shift; // Update Shift
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
similarity index 71%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
index 9d3ee88..1a8da7a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
@@ -44,13 +44,11 @@
/* RETURNS: */
/* void */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels)
{
-#ifdef HIGHER_FS
LVM_FLOAT DeltaTable[13] = {0.500000f,/*8000*/
0.362812f,/*11025*/
0.333333f,/*12000*/
@@ -64,17 +62,6 @@
0.041667f,/*96000*/
0.022676f,/*176400*/
0.020833f};/*192000*/
-#else
- LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
- 0.362812f,/*11025*/
- 0.333333f,/*12000*/
- 0.250000f,/*16000*/
- 0.181406f,/*22050*/
- 0.166666f,/*24000*/
- 0.125000f,/*32000*/
- 0.090703f,/*44100*/
- 0.083333f};/*48000*/
-#endif
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
@@ -90,33 +77,3 @@
assign minimum value to Delta */
pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
}
-#else
-void LVC_Mixer_SetTimeConstant(LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_INT32 DeltaTable[9]={1073741824,
- 779132389,
- 715827882,
- 536870912,
- 389566194,
- 357913941,
- 268435456,
- 194783097,
- 178956971};
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- LVM_INT32 Delta=DeltaTable[Fs];
- Delta=Delta>>(NumChannels-1);
-
- if(Tc_millisec==0)
- Delta=0x7FFFFFFF;
- else
- Delta=Delta/Tc_millisec;
-
- if(Delta==0)
- Delta=1; // If Time Constant is so large that Delta is 0, assign minimum value to Delta
-
- pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
rename to media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
index 0e0acf1..f335a1e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
@@ -19,7 +19,6 @@
#include "LVM_Macros.h"
#include "LVC_Mixer_Private.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVMixer3_VarSlope_SetTimeConstant */
@@ -45,13 +44,11 @@
/* RETURNS: */
/* void */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels)
{
-#ifdef HIGHER_FS
LVM_FLOAT DeltaTable[13] = {0.500000f,/*8000*/
0.362812f,/*11025*/
0.333333f,/*12000*/
@@ -65,17 +62,6 @@
0.041666f,/*96000*/
0.022676f,/*176400*/
0.020833f};/*192000*/
-#else
- LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
- 0.362812f,/*11025*/
- 0.333333f,/*12000*/
- 0.250000f,/*16000*/
- 0.181406f,/*22050*/
- 0.166666f,/*24000*/
- 0.125000f,/*32000*/
- 0.090703f,/*44100*/
- 0.083333f};/*48000*/
-#endif
LVM_FLOAT Tc_millisec_float;
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
@@ -112,52 +98,3 @@
pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
}
-#else
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_INT32 DeltaTable[9]={1073741824,
- 779132389,
- 715827882,
- 536870912,
- 389566194,
- 357913941,
- 268435456,
- 194783097,
- 178956971};
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- LVM_INT32 Delta=DeltaTable[Fs];
-
- LVM_INT32 Current;
- LVM_INT32 Target;
-
- Delta=Delta>>(NumChannels-1);
-
- /* Get gain values */
- Current = LVC_Mixer_GetCurrent( pStream );
- Target = LVC_Mixer_GetTarget( pStream );
-
- if (Current != Target)
- {
- Tc_millisec = Tc_millisec * 32767 / (Current - Target);
- if (Tc_millisec<0) Tc_millisec = -Tc_millisec;
-
- if(Tc_millisec==0)
- Delta=0x7FFFFFFF;
- else
- Delta=Delta/Tc_millisec;
-
- if(Delta==0)
- Delta=1; // If Time Constant is so large that Delta is 0, assign minimum value to Delta
- }
- else
- {
- Delta =1; // Minimum value for proper call-backs (setting it to zero has some problems, to be corrected)
- }
-
-
- pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
similarity index 81%
rename from media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
rename to media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
index 9094622..2497d29 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
@@ -21,7 +21,6 @@
#include "BIQUAD.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* void LVM_FO_LPF( LVM_INT32 w , */
@@ -68,7 +67,6 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs)
{
@@ -97,33 +95,3 @@
return 1;
}
-#else
-LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs)
-{
- LVM_INT32 Y,Coefficients[13]={ -8388571,
- 33547744,
- -66816791,
- 173375308,
- -388437573,
- 752975383,
- -1103016663,
- 1121848567,
- -688078159,
- 194669577,
- 8,
- 0,
- 0};
- Y=LVM_Polynomial( (LVM_UINT16)9,
- Coefficients,
- w);
- pCoeffs->B1=-Y; /* Store -B1 in filter structure instead of B1!*/
- /* A0=(1-B1)/2= B1/2 - 0.5*/
- Y=Y>>1; /* A0=Y=B1/2*/
- Y=Y-0x40000000; /* A0=Y=(B1/2 - 0.5)*/
- MUL32x16INTO32(Y, FILTER_LOSS ,pCoeffs->A0 ,15) /* Apply loss to avoid overflow*/
- pCoeffs->A1=-pCoeffs->A0; /* Store A1=-A0*/
-
- return 1;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
rename to media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
index 9fe67f8..7bc6046 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
@@ -21,7 +21,6 @@
#include "BIQUAD.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* void LVM_FO_LPF( LVM_INT32 w , */
@@ -68,7 +67,6 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs)
{
@@ -94,30 +92,3 @@
return 1;
}
-#else
-LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs)
-{
- LVM_INT32 Y,Coefficients[13]={ -8388571,
- 33547744,
- -66816791,
- 173375308,
- -388437573,
- 752975383,
- -1103016663,
- 1121848567,
- -688078159,
- 194669577,
- 8};
- Y=LVM_Polynomial( (LVM_UINT16)9,
- Coefficients,
- w);
- pCoeffs->B1=-Y; // Store -B1 in filter structure instead of B1!
- // A0=(1+B1)/2= B1/2 + 0.5
- Y=Y>>1; // A0=Y=B1/2
- Y=Y+0x40000000; // A0=Y=(B1/2 + 0.5)
- MUL32x16INTO32(Y, FILTER_LOSS ,pCoeffs->A0 ,15) // Apply loss to avoid overflow
- pCoeffs->A1=pCoeffs->A0;
- return 1;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
similarity index 79%
rename from media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
rename to media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
index 6307e68..2a7cca2 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
@@ -32,16 +32,6 @@
#define LVVDL_2PiByFs_SHIFT1 12 /* Qformat shift for 8kHz, 11.025kHz and 12kHz i.e. 12=41-29 */
#define LVVDL_2PiByFs_SHIFT2 13 /* Qformat shift for 16kHz, 22.050kHz and 24kHz i.e. 13=42-29 */
#define LVVDL_2PiByFs_SHIFT3 14 /* Qformat shift for 32kHz, 44.1kHz and 48kHz i.e. 14=43-29 */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000 , /* 8kHz in Q41, 16kHz in Q42, 32kHz in Q43 */
- LVVDL_2PiBy_11025, /* 11025 Hz in Q41, 22050Hz in Q42, 44100 Hz in Q43*/
- LVVDL_2PiBy_12000}; /* 12kHz in Q41, 24kHz in Q42, 48kHz in Q43 */
-#endif
-
-const LVM_INT32 LVVDL_2PiOnFsShiftTable[]={LVVDL_2PiByFs_SHIFT1 , /* 8kHz, 11025Hz, 12kHz */
- LVVDL_2PiByFs_SHIFT2, /* 16kHz, 22050Hz, 24kHz*/
- LVVDL_2PiByFs_SHIFT3}; /* 32kHz, 44100Hz, 48kHz */
-#ifdef BUILD_FLOAT
#define LVVDL_2PiBy_8000_f 0.000785398f
#define LVVDL_2PiBy_11025_f 0.000569903f
#define LVVDL_2PiBy_12000_f 0.000523599f
@@ -52,12 +42,10 @@
#define LVVDL_2PiBy_44100_f 0.000142476f
#define LVVDL_2PiBy_48000_f 0.000130900f
-#ifdef HIGHER_FS
#define LVVDL_2PiBy_88200_f 0.000071238f
#define LVVDL_2PiBy_96000_f 0.000065450f
#define LVVDL_2PiBy_176400_f 0.000035619f
#define LVVDL_2PiBy_192000_f 0.000032725f
-#endif
const LVM_FLOAT LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000_f,
LVVDL_2PiBy_11025_f,
LVVDL_2PiBy_12000_f,
@@ -67,14 +55,11 @@
LVVDL_2PiBy_32000_f,
LVVDL_2PiBy_44100_f,
LVVDL_2PiBy_48000_f
-#ifdef HIGHER_FS
,LVVDL_2PiBy_88200_f
,LVVDL_2PiBy_96000_f
,LVVDL_2PiBy_176400_f
,LVVDL_2PiBy_192000_f
-#endif
};
-#endif
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_GetOmega */
@@ -92,25 +77,10 @@
/* RETURNS: */
/* w=2*pi*Fc/Fs in Q2.29 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
-#ifdef HIGHER_FS
LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
LVM_Fs_en Fs)
-#else
-LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en Fs)
-#endif
{
LVM_FLOAT w;
w = (LVM_FLOAT)Fc * LVVDL_2PiOnFsTable[Fs];
return w;
}
-#else
-LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en Fs)
-{
- LVM_INT32 w;
- MUL32x32INTO32((LVM_INT32)Fc,LVVDL_2PiOnFsTable[Fs%3],w,LVVDL_2PiOnFsShiftTable[Fs/3])
- return w;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
index f1e45fa..244f09d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
@@ -27,7 +27,6 @@
#ifndef __LVM_MIXER_FILTER_COEFFS_H__
#define __LVM_MIXER_FILTER_COEFFS_H__
-
/************************************************************************************/
/* */
/* Alpha Time Constant table */
@@ -87,7 +86,6 @@
#define ALPHA_49 0 /* Floating point Alpha = 0.000000 */
#define ALPHA_50 0 /* Floating point Alpha = 0.000000 */
-#ifdef BUILD_FLOAT /* BUILD_FLOAT */
#define ALPHA_Float_0 0.999999f
#define ALPHA_Float_1 0.999998f
#define ALPHA_Float_2 0.999997f
@@ -139,6 +137,5 @@
#define ALPHA_Float_48 0.000000f
#define ALPHA_Float_49 0.000000f
#define ALPHA_Float_50 0.000000f
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
rename to media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
index 18b2782..73da2cf 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
@@ -20,7 +20,6 @@
#include "Mixer.h"
#include "LVM_Mixer_FilterCoeffs.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVM_Mix_GetTimeConstant */
@@ -57,13 +56,8 @@
/* Alpha - the filter coefficient Q31 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
-#ifdef HIGHER_FS
LVM_UINT32 Fs,
-#else
- LVM_UINT16 Fs,
-#endif
LVM_UINT16 NumChannels)
{
@@ -160,101 +154,3 @@
return ProductFloat;
}
-#else
-LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT16 Fs,
- LVM_UINT16 NumChannels)
-{
-
- LVM_UINT32 Product;
- LVM_INT16 Interpolate;
- LVM_UINT16 Shift;
- LVM_INT32 Diff;
- LVM_UINT32 Table[] = {ALPHA_0, /* Log spaced look-up table */
- ALPHA_1,
- ALPHA_2,
- ALPHA_3,
- ALPHA_4,
- ALPHA_5,
- ALPHA_6,
- ALPHA_7,
- ALPHA_8,
- ALPHA_9,
- ALPHA_10,
- ALPHA_11,
- ALPHA_12,
- ALPHA_13,
- ALPHA_14,
- ALPHA_15,
- ALPHA_16,
- ALPHA_17,
- ALPHA_18,
- ALPHA_19,
- ALPHA_20,
- ALPHA_21,
- ALPHA_22,
- ALPHA_23,
- ALPHA_24,
- ALPHA_25,
- ALPHA_26,
- ALPHA_27,
- ALPHA_28,
- ALPHA_29,
- ALPHA_30,
- ALPHA_31,
- ALPHA_32,
- ALPHA_33,
- ALPHA_34,
- ALPHA_35,
- ALPHA_36,
- ALPHA_37,
- ALPHA_38,
- ALPHA_39,
- ALPHA_40,
- ALPHA_41,
- ALPHA_42,
- ALPHA_43,
- ALPHA_44,
- ALPHA_45,
- ALPHA_46,
- ALPHA_47,
- ALPHA_48,
- ALPHA_49,
- ALPHA_50};
-
-
- /* Calculate the product of the time constant and the sample rate */
- Product = ((tc >> 16) * (LVM_UINT32)Fs) << 13; /* Stereo value */
- Product = Product + (((tc & 0x0000FFFF) * (LVM_UINT32)Fs) >> 3);
-
- if (NumChannels == 1)
- {
- Product = Product >> 1; /* Mono value */
- }
-
- /* Normalize to get the table index and interpolation factor */
- for (Shift=0; Shift<((Alpha_TableSize-1)/2); Shift++)
- {
- if ((Product & 0x80000000)!=0)
- {
- break;
- }
-
- Product = Product << 1;
- }
- Shift = (LVM_UINT16)((Shift << 1));
-
- if ((Product & 0x40000000)==0)
- {
- Shift++;
- }
-
- Interpolate = (LVM_INT16)((Product >> 15) & 0x00007FFF);
-
- Diff = (LVM_INT32)(Table[Shift] - Table[Shift+1]);
- MUL32x16INTO32(Diff,Interpolate,Diff,15)
- Product = Table[Shift+1] + (LVM_UINT32)Diff;
-
- return Product;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
similarity index 76%
rename from media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
rename to media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
index cd57767..2c3e9ec 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
@@ -40,7 +40,6 @@
/* RETURNS: */
/* The result of the polynomial expansion in Q1.31 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
LVM_FLOAT *pCoefficients,
LVM_FLOAT X)
@@ -62,7 +61,6 @@
sign *= Temp;
}
-
}
else
{
@@ -81,57 +79,3 @@
}
return Y;
}
-#else
-LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
- LVM_INT32 *pCoefficients,
- LVM_INT32 X)
-{
- LVM_INT32 i;
- LVM_INT32 Y,A,XTemp,Temp,sign;
-
- Y=*pCoefficients; /* Y=A0*/
- pCoefficients++;
-
- if((LVM_UINT32)X==0x80000000)
- {
- Temp=-1;
- sign=Temp;
- for(i=1;i<=N;i++)
- {
- Y+=((*pCoefficients)*sign);
- pCoefficients++;
- sign*=Temp;
- }
-
-
- }
- else
- {
- XTemp=X;
- for(i=N-1;i>=0;i--)
- {
- A=*pCoefficients;
- pCoefficients++;
-
- MUL32x32INTO32(A,XTemp,Temp,31)
- Y+=Temp;
-
- MUL32x32INTO32(XTemp,X,Temp,31)
- XTemp=Temp;
- }
- }
- A=*pCoefficients;
- pCoefficients++;
-
- if(A<0)
- {
- A=Abs_32(A);
- Y=Y>>A;
- }
- else
- {
- Y = Y<<A;
- }
- return Y;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
similarity index 82%
rename from media/libeffects/lvm/lib/Common/src/LVM_Power10.c
rename to media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
index 8785594..ae8e9d1 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
@@ -20,7 +20,6 @@
#include "ScalarArithmetic.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_Power10 */
@@ -54,7 +53,6 @@
/* RETURNS: */
/* The result of the 10x expansion in Q8.24 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Power10(LVM_FLOAT X)
{
LVM_FLOAT Y,Coefficients[13]={0.999906f,
@@ -75,25 +73,3 @@
X);
return Y;
}
-#else
-LVM_INT32 LVM_Power10(LVM_INT32 X)
-{
- LVM_INT32 Y,Coefficients[13]={ 16775636,
- 77258249,
- 178024032,
- 273199333,
- 312906284,
- 288662365,
- 228913700,
- 149470921,
- 71094558,
- 37565524,
- 31223618,
- 12619311,
- 0};
- Y=LVM_Polynomial((LVM_UINT16)11,
- Coefficients,
- X);
- return Y;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Timer.c b/media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/LVM_Timer.c
rename to media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.c b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
similarity index 96%
rename from media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.c
rename to media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
index a935cfe..3015057 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
@@ -40,7 +40,7 @@
pInstancePr = (LVM_Timer_Instance_Private_t *)pInstance;
pInstancePr->CallBackParam = pParams->CallBackParam;
- pInstancePr->pCallBackParams = pParams->pCallBackParams;
+ pInstancePr->pCallBackParams = (LVM_INT32 *)pParams->pCallBackParams;
pInstancePr->pCallbackInstance = pParams->pCallbackInstance;
pInstancePr->pCallBack = pParams->pCallBack;
pInstancePr->TimerArmed = 1;
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 480944f..a372b82 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
@@ -18,12 +18,6 @@
#ifndef LVM_TIMER_PRIVATE_H
#define LVM_TIMER_PRIVATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
#include "LVM_Types.h"
/****************************************************************************************/
@@ -45,8 +39,4 @@
/* END OF HEADER */
/****************************************************************************************/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* LVM_TIMER_PRIVATE_H */
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_16.c b/media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/LoadConst_16.c
rename to media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
similarity index 83%
rename from media/libeffects/lvm/lib/Common/src/LoadConst_32.c
rename to media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
index 9e14c3b..c789756 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
@@ -24,7 +24,6 @@
/**********************************************************************************
FUNCTION LoadConst_32
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LoadConst_Float(const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -39,21 +38,5 @@
return;
}
-#else
-void LoadConst_32(const LVM_INT32 val,
- LVM_INT32 *dst,
- LVM_INT16 n )
-{
- LVM_INT16 ii;
-
- for (ii = n; ii != 0; ii--)
- {
- *dst = val;
- dst++;
- }
-
- return;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
rename to media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
index 02c906a..1ea765a 100644
--- a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
@@ -33,7 +33,6 @@
LVM_INT32 temp,mVal,sVal;
LVM_INT16 ii;
-
for (ii = n; ii != 0; ii--)
{
mVal=(LVM_INT32)*srcM;
@@ -77,7 +76,6 @@
return;
}
-#ifdef BUILD_FLOAT
void MSTo2i_Sat_Float(const LVM_FLOAT *srcM,
const LVM_FLOAT *srcS,
LVM_FLOAT *dst,
@@ -86,7 +84,6 @@
LVM_FLOAT temp,mVal,sVal;
LVM_INT16 ii;
-
for (ii = n; ii != 0; ii--)
{
mVal = (LVM_FLOAT)*srcM;
@@ -130,5 +127,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.c b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.c
rename to media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
index ef04ae8..6584251 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
@@ -44,7 +44,6 @@
LVM_INT16 srcval;
LVM_INT32 Temp,dInVal;
-
for (ii = n; ii != 0; ii--)
{
srcval=*src;
@@ -77,5 +76,3 @@
/**********************************************************************************/
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
rename to media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
index 17fd833..5d5564f 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
@@ -34,7 +34,6 @@
LVM_INT16 ii;
LVM_INT32 srcval,temp, dInVal, dOutVal;
-
for (ii = n; ii != 0; ii--)
{
srcval=*src;
@@ -45,7 +44,6 @@
dInVal = *dst;
dOutVal = temp + dInVal;
-
if ((((dOutVal ^ temp) & (dOutVal ^ dInVal)) >> 31)!=0) /* overflow / underflow */
{
if(temp<0)
@@ -64,7 +62,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Mac3s_Sat_Float(const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
@@ -101,8 +98,5 @@
return;
}
-#endif
/**********************************************************************************/
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
similarity index 62%
rename from media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
index 16e367b..7c7b36f 100644
--- a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
@@ -32,7 +32,6 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -96,64 +95,4 @@
}
}
}
-#else
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
- pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- Core_MixInSoft_D32C31_SAT( pInstance, src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
- if ((pInstance->Target>>16) == 0x7FFF)
- Add2_Sat_32x32( src, dst, n );
- else{
- Core_MixInSoft_D32C31_SAT( pInstance, src, dst, n);
- pInstance->Current = pInstance->Target; /* In case the core function would have changed the Current value */
- }
- }
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
- /* Call back before the hard mixing, because in this case, hard mixing makes
- use of the core soft mix function which can change the Current value! */
-
- if (pInstance->CallbackSet){
- if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- pInstance->CallbackSet = FALSE;
- if (pInstance->pCallBack != 0){
- (*pInstance->pCallBack) ( pInstance->pCallbackHandle, pInstance->pGeneralPurpose,pInstance->CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
similarity index 62%
rename from media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
rename to media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
index 869293b..d3325ec 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
@@ -29,12 +29,9 @@
#define TRUE 1
#define FALSE 0
-
-
/**********************************************************************************
FUNCTION MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -95,62 +92,4 @@
}
}
}
-#else
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
- pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- Core_MixSoft_1St_D32C31_WRA( pInstance, src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target == 0)
- LoadConst_32(0, dst, n);
- else if ((pInstance->Target>>16) == 0x7FFF){
- if (src != dst)
- Copy_16((LVM_INT16*)src, (LVM_INT16*)dst, (LVM_INT16)(n * 2));
- }
- else
- Mult3s_32x16( src, (LVM_INT16)(pInstance->Current>>16), dst, n );
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (pInstance->CallbackSet){
- if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- pInstance->CallbackSet = FALSE;
- if (pInstance->pCallBack != 0){
- (*pInstance->pCallBack) ( pInstance->pCallbackHandle, pInstance->pGeneralPurpose,pInstance->CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
similarity index 62%
rename from media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
rename to media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
index 6fc1b92..b002738 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
@@ -22,11 +22,9 @@
#include "Mixer_private.h"
#include "VectorArithmetic.h"
-
/**********************************************************************************
FUNCTION MIXSOFT_2ST_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -42,7 +40,7 @@
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((void *)&pInstance->Alpha2, /* Cast to void: \
+ MixInSoft_D32C31_SAT((Mix_1St_Cll_FLOAT_t *)&pInstance->Alpha2, /* Cast to void: \
no dereferencing in function*/
src2, dst, n);
}
@@ -54,7 +52,8 @@
else
{
if (pInstance->Current1 == 0)
- MixSoft_1St_D32C31_WRA((void *) &pInstance->Alpha2, /* Cast to void: no \
+ MixSoft_1St_D32C31_WRA(
+ (Mix_1St_Cll_FLOAT_t *) &pInstance->Alpha2, /* Cast to void: no \
dereferencing in function*/
src2, dst, n);
else if (pInstance->Current2 == 0)
@@ -63,41 +62,5 @@
Core_MixHard_2St_D32C31_SAT(pInstance, src1, src2, dst, n);
}
}
-#else
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance->Current1 != pInstance->Target1) || (pInstance->Current2 != pInstance->Target2))
- {
- MixSoft_1St_D32C31_WRA( (Mix_1St_Cll_t*) pInstance, src1, dst, n);
- MixInSoft_D32C31_SAT( (void *) &pInstance->Alpha2, /* Cast to void: no dereferencing in function*/
- src2, dst, n);
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- else
- {
- if (pInstance->Current1 == 0)
- MixSoft_1St_D32C31_WRA( (void *) &pInstance->Alpha2, /* Cast to void: no dereferencing in function*/
- src2, dst, n);
- else if (pInstance->Current2 == 0)
- MixSoft_1St_D32C31_WRA( (Mix_1St_Cll_t*) pInstance, src1, dst, n);
- else
- Core_MixHard_2St_D32C31_SAT( pInstance, src1, src2, dst, n);
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mixer_private.h b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
index 00d55ed..1d653bb 100644
--- a/media/libeffects/lvm/lib/Common/src/Mixer_private.h
+++ b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
@@ -26,10 +26,8 @@
#define POINT_ZERO_ONE_DB 2473805 /* 0.01 dB on a full scale signal = (10^(0.01/20) -1) * 2^31 */
-#ifdef BUILD_FLOAT
#define POINT_ZERO_ONE_DB_FLOAT 0.001152 /* 0.01 dB on a full scale \
signal = (10^(0.01/20) -1) * 2^31 */
-#endif
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.c b/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/MonoTo2I_16.c
rename to media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
rename to media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
index 796a15c..603d1fc 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
@@ -45,7 +45,6 @@
return;
}
-#ifdef BUILD_FLOAT
void MonoTo2I_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n)
@@ -66,5 +65,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
rename to media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
index c758560..370c39a 100644
--- a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
@@ -47,7 +47,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Mult3s_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
@@ -65,5 +64,4 @@
}
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
rename to media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
index 5156edc..36d1149 100644
--- a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
+++ b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
@@ -71,7 +71,6 @@
LVM_INT32 SampleNo; /* Sample index */
LVM_INT16 Temp;
-
/*
* Process a block of samples
*/
@@ -84,7 +83,6 @@
Sample = *pDataIn;
pDataIn++;
-
/*
* Apply the compander, this compresses the signal at the expense of
* harmonic distortion. The amount of compression is control by the
@@ -103,18 +101,15 @@
}
}
-
/*
* Save the output
*/
*pDataOut = Sample;
pDataOut++;
-
}
}
-#ifdef BUILD_FLOAT
void NonLinComp_Float(LVM_FLOAT Gain,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -125,7 +120,6 @@
LVM_INT32 SampleNo; /* Sample index */
LVM_FLOAT Temp;
-
/*
* Process a block of samples
*/
@@ -137,7 +131,6 @@
Sample = *pDataIn;
pDataIn++;
-
/*
* Apply the compander, this compresses the signal at the expense of
* harmonic distortion. The amount of compression is control by the
@@ -156,7 +149,6 @@
}
}
-
/*
* Save the output
*/
@@ -164,4 +156,3 @@
pDataOut++;
}
}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c
rename to media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
index 6c8b2db..3f62f99 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
@@ -27,7 +27,6 @@
pBiquadState->coefs[2] is -B1, these are in Q14 format
pBiquadState->coefs[3] is Gain, in Q11 format
-
DELAYS-
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
@@ -38,7 +37,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -51,7 +49,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -193,85 +190,3 @@
}
#endif
-#else
-void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,ynLO,ynRO,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= (A0 (Q14) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>14) in Q0*/
- templ=(*pDataIn)-pBiquadState->pDelays[2];
- MUL32x16INTO32(templ,pBiquadState->coefs[0],ynL,14)
-
- /* ynL+= ((-B2 (Q14) * y(n-2)L (Q0) ) >>14) in Q0*/
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[1],templ,14)
- ynL+=templ;
-
- /* ynL+= ((-B1 (Q14) * y(n-1)L (Q0) ) >>14) in Q0 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[2],templ,14)
- ynL+=templ;
-
- /* ynLO= ((Gain (Q11) * ynL (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynL,pBiquadState->coefs[3],ynLO,11)
-
- /* ynLO=( ynLO(Q0) + x(n)L (Q0) ) in Q0*/
- ynLO+= (*pDataIn);
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= (A0 (Q14) * (x(n)R (Q0) - x(n-2)R (Q0) ) >>14) in Q0*/
- templ=(*(pDataIn+1))-pBiquadState->pDelays[3];
- MUL32x16INTO32(templ,pBiquadState->coefs[0],ynR,14)
-
- /* ynR+= ((-B2 (Q14) * y(n-2)R (Q0) ) >>14) in Q0*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[1],templ,14)
- ynR+=templ;
-
- /* ynR+= ((-B1 (Q14) * y(n-1)R (Q0) ) >>14) in Q0 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[2],templ,14)
- ynR+=templ;
-
- /* ynRO= ((Gain (Q11) * ynR (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynR,pBiquadState->coefs[3],ynRO,11)
-
- /* ynRO=( ynRO(Q0) + x(n)R (Q0) ) in Q0*/
- ynRO+= (*(pDataIn+1));
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=ynLO; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=ynRO; /* Write Right ouput in Q0*/
- pDataOut++;
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c
deleted file mode 100644
index f705cbf..0000000
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
-#include "LVM_Macros.h"
-
-/**************************************************************************
- ASSUMPTIONS:
- COEFS-
- pBiquadState->coefs[0] is A0,
- pBiquadState->coefs[1] is -B2,
- pBiquadState->coefs[2] is -B1, these are in Q30 format
- pBiquadState->coefs[3] is Gain, in Q11 format
-
-
- DELAYS-
- pBiquadState->pDelays[0] is x(n-1)L in Q0 format
- pBiquadState->pDelays[1] is x(n-1)R in Q0 format
- pBiquadState->pDelays[2] is x(n-2)L in Q0 format
- pBiquadState->pDelays[3] is x(n-2)R in Q0 format
- pBiquadState->pDelays[4] is y(n-1)L in Q0 format
- pBiquadState->pDelays[5] is y(n-1)R in Q0 format
- pBiquadState->pDelays[6] is y(n-2)L in Q0 format
- pBiquadState->pDelays[7] is y(n-2)R in Q0 format
-***************************************************************************/
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,ynLO,ynRO,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>30) in Q0*/
- templ=(*pDataIn)-pBiquadState->pDelays[2];
- MUL32x32INTO32(templ,pBiquadState->coefs[0],ynL,30)
-
- /* ynL+= ((-B2 (Q30) * y(n-2)L (Q0) ) >>30) in Q0*/
- MUL32x32INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[1],templ,30)
- ynL+=templ;
-
- /* ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) >>30) in Q0 */
- MUL32x32INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[2],templ,30)
- ynL+=templ;
-
- /* ynLO= ((Gain (Q11) * ynL (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynL,pBiquadState->coefs[3],ynLO,11)
- /* ynLO=( ynLO(Q0) + x(n)L (Q0) ) in Q0*/
- ynLO+= (*pDataIn);
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= (A0 (Q30) * (x(n)R (Q0) - x(n-2)R (Q0) ) >>30) in Q0*/
- templ=(*(pDataIn+1))-pBiquadState->pDelays[3];
- MUL32x32INTO32(templ,pBiquadState->coefs[0],ynR,30)
-
- /* ynR+= ((-B2 (Q30) * y(n-2)R (Q0) ) >>30) in Q0*/
- MUL32x32INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[1],templ,30)
- ynR+=templ;
-
- /* ynR+= ((-B1 (Q30) * y(n-1)R (Q0) ) >>30) in Q0 */
- MUL32x32INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[2],templ,30)
- ynR+=templ;
-
- /* ynRO= ((Gain (Q11) * ynR (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynR,pBiquadState->coefs[3],ynRO,11)
-
- /* ynRO=( ynRO(Q0) + x(n)R (Q0) ) in Q0*/
- ynRO+= (*(pDataIn+1));
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=ynLO; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=ynRO; /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp
new file mode 100644
index 0000000..41de1de
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
+#include "LVM_Macros.h"
+
+/**************************************************************************
+ ASSUMPTIONS:
+ COEFS-
+ pBiquadState->coefs[0] is A0,
+ pBiquadState->coefs[1] is -B2,
+ pBiquadState->coefs[2] is -B1, these are in Q30 format
+ pBiquadState->coefs[3] is Gain, in Q11 format
+
+ DELAYS-
+ pBiquadState->pDelays[0] is x(n-1)L in Q0 format
+ pBiquadState->pDelays[1] is x(n-1)R in Q0 format
+ pBiquadState->pDelays[2] is x(n-2)L in Q0 format
+ pBiquadState->pDelays[3] is x(n-2)R in Q0 format
+ pBiquadState->pDelays[4] is y(n-1)L in Q0 format
+ pBiquadState->pDelays[5] is y(n-1)R in Q0 format
+ pBiquadState->pDelays[6] is y(n-2)L in Q0 format
+ pBiquadState->pDelays[7] is y(n-2)R in Q0 format
+***************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c
deleted file mode 100644
index 65475a3..0000000
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BIQUAD.h"
-#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
-
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32CllGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-
- pBiquadState->coefs[3]=pCoef->G;
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp
new file mode 100644
index 0000000..714aa52
--- /dev/null
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BIQUAD.h"
+#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
+
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
similarity index 70%
rename from media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c
rename to media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
index a36330e..f6c05da 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
@@ -17,7 +17,6 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CssGss_TRC_WRA_01_Private.h"
-#ifdef BUILD_FLOAT
void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
PK_FLOAT_Coefs_t *pCoef)
@@ -33,21 +32,3 @@
pBiquadState->coefs[3] = pCoef->G;
}
-#else
-void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C16_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-
- pBiquadState->coefs[3]=pCoef->G;
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
index 1e32062..cc924c4 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
@@ -18,11 +18,9 @@
#ifndef _PK_2I_D32F32CSSGSS_TRC_WRA_01_PRIVATE_H_
#define _PK_2I_D32F32CSSGSS_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_Float_
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -30,7 +28,6 @@
}Filter_State_Float;
typedef Filter_State_Float * PFilter_State_Float ;
-#endif
typedef struct _Filter_State_
{
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
similarity index 68%
copy from media/libeffects/lvm/lib/Common/src/LoadConst_32.c
copy to media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
index 9e14c3b..668a4b6 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
@@ -22,38 +22,6 @@
#include "VectorArithmetic.h"
/**********************************************************************************
- FUNCTION LoadConst_32
+ FUNCTION Shift_Sat_v16xv16
***********************************************************************************/
-#ifdef BUILD_FLOAT
-void LoadConst_Float(const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
- LVM_INT16 ii;
-
- for (ii = n; ii != 0; ii--)
- {
- *dst = val;
- dst++;
- }
-
- return;
-}
-#else
-void LoadConst_32(const LVM_INT32 val,
- LVM_INT32 *dst,
- LVM_INT16 n )
-{
- LVM_INT16 ii;
-
- for (ii = n; ii != 0; ii--)
- {
- *dst = val;
- dst++;
- }
-
- return;
-}
-#endif
-
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
deleted file mode 100644
index fac9de7..0000000
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**********************************************************************************
- INCLUDE FILES
-***********************************************************************************/
-
-#include "VectorArithmetic.h"
-
-/**********************************************************************************
- FUNCTION Shift_Sat_v32xv32
-***********************************************************************************/
-#ifdef BUILD_FLOAT
-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--)
- {
- temp = (LVM_FLOAT)*src;
- src++;
- for(ij = 0; ij < val; ij++)
- {
- temp = temp * 2;
- }
-
- 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);
-
- for (ii = n; ii != 0; ii--)
- {
- temp = (LVM_FLOAT)*src;
- src++;
- for(ij = 0; ij < RShift; ij++)
- {
- temp = temp / 2;
- }
- *dst = (LVM_FLOAT)temp;
- dst++;
- }
- }
- else
- {
- if(src != dst)
- {
- Copy_Float(src, dst, n);
- }
- }
- return;
-}
-#else
-void Shift_Sat_v32xv32 (const LVM_INT16 val,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 ii;
- LVM_INT16 RShift;
-
- if(val>0)
- {
- LVM_INT32 a,b;
-
- for (ii = n; ii != 0; ii--)
- {
- a=*src;
- src++;
-
- b=(a<<val);
-
- if( (b>>val) != a ) /* if overflow occured, right shift will show difference*/
- {
- if(a<0)
- {
- b=0x80000000l;
- }
- else
- {
- b=0x7FFFFFFFl;
- }
- }
-
- *dst = b;
- dst++;
- }
- }
- else if(val<0)
- {
- RShift=(LVM_INT16)(-val);
- for (ii = n; ii != 0; ii--)
- {
- *dst = (*src >> RShift);
- dst++;
- src++;
- }
- }
- else
- {
- if(src!=dst)
- {
- Copy_16((LVM_INT16 *)src,(LVM_INT16 *)dst,(LVM_INT16)(n<<1));
- }
- }
- return;
-}
-#endif
-/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
similarity index 66%
rename from media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
rename to media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
index 28fea65..97a04c1 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
@@ -22,60 +22,60 @@
#include "VectorArithmetic.h"
/**********************************************************************************
- FUNCTION Shift_Sat_v16xv16
+ FUNCTION Shift_Sat_v32xv32
***********************************************************************************/
-#ifndef BUILD_FLOAT
-void Shift_Sat_v16xv16 (const LVM_INT16 val,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
+void Shift_Sat_Float (const LVM_INT16 val,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
{
- LVM_INT32 temp;
- LVM_INT32 ii;
+ LVM_FLOAT temp;
+ LVM_INT32 ii,ij;
LVM_INT16 RShift;
- if(val>0)
+
+ if(val > 0)
{
for (ii = n; ii != 0; ii--)
{
- temp = (LVM_INT32)*src;
+ temp = (LVM_FLOAT)*src;
src++;
+ for(ij = 0; ij < val; ij++)
+ {
+ temp = temp * 2;
+ }
- temp = temp << val;
+ if(temp > 1.0)
+ temp = 1.0;
+ if(temp < -1.0)
+ temp = -1.0;
- if (temp > 0x00007FFF)
- {
- *dst = 0x7FFF;
- }
- else if (temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
- *dst = (LVM_INT16)temp;
- }
+ *dst = (LVM_FLOAT)temp;
dst++;
}
}
- else if(val<0)
+ else if(val < 0)
{
RShift=(LVM_INT16)(-val);
for (ii = n; ii != 0; ii--)
{
- *dst = (LVM_INT16)(*src >> RShift);
- dst++;
+ temp = (LVM_FLOAT)*src;
src++;
+ for(ij = 0; ij < RShift; ij++)
+ {
+ temp = temp / 2;
+ }
+ *dst = (LVM_FLOAT)temp;
+ dst++;
}
}
else
{
- if(src!=dst)
+ if(src != dst)
{
- Copy_16(src,dst,n);
+ Copy_Float(src, dst, n);
}
}
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
similarity index 71%
rename from media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
rename to media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
index 9a726f2..4da2013 100644
--- a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
+++ b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
@@ -29,10 +29,7 @@
/*######################################################################################*/
#include "ScalarArithmetic.h"
-#ifdef BUILD_FLOAT
#include <math.h>
-#endif
-
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -67,7 +64,6 @@
#define SECOND_COEF 38836
#define MAX_VALUE 1536 /* 96 * 16 */
-#ifdef BUILD_FLOAT
LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix)
{
LVM_FLOAT dB_Float;
@@ -78,47 +74,3 @@
return LinFloat;
}
-#else
-LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix)
-{
- LVM_INT32 Lin_val_32;
- LVM_INT16 Shift;
- LVM_INT32 Remain;
-
-
- /*
- * Check sign of the input
- */
- if (db_fix<0)
- {
- if (db_fix > -MAX_VALUE)
- {
- Shift = (LVM_INT16)((((LVM_UINT32)(-db_fix) >> 4) * FOUR_OVER_SIX) >> 17); /* Number of 6dB steps in Q11.4 format */
- Remain = -db_fix - (Shift * SIX_DB);
- Remain = (0x7FFFFFFF - (Remain * FIRST_COEF_NEG)) + (Remain * Remain * SECOND_COEF);
- Lin_val_32 = (LVM_INT32)((LVM_UINT32)Remain >> (16 + Shift));
- }
- else
- {
- Lin_val_32 = 0;
- }
- }
- else
- {
- if (db_fix < MAX_VALUE)
- {
- Shift = (LVM_INT16)((((LVM_UINT32)db_fix >> 4) * FOUR_OVER_SIX) >> 17); /* Number of 6dB steps in Q11.4 format */
- Remain = db_fix - (Shift * SIX_DB);
- Remain = 0x3FFFFFFF + (Remain * FIRST_COEF_POS) + (Remain * Remain * SECOND_COEF);
- Lin_val_32 = (LVM_INT32)((LVM_UINT32)Remain >> (15 - Shift));
- }
- else
- {
- Lin_val_32 = 0x7FFFFFFF;
- }
- }
-
-
- return Lin_val_32; /* format 1.16.15 */
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/mult3s_16x16.c b/media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp
similarity index 100%
rename from media/libeffects/lvm/lib/Common/src/mult3s_16x16.c
rename to media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp
diff --git a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
index 804f1bf..c5ddf77 100644
--- a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
+++ b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
@@ -68,15 +68,9 @@
/* */
/****************************************************************************************/
-
#ifndef __LVEQNB_H__
#define __LVEQNB_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -112,7 +106,6 @@
/* Instance handle */
typedef void *LVEQNB_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -121,7 +114,6 @@
LVEQNB_MODE_MAX = LVM_MAXINT_32
} LVEQNB_Mode_en;
-
/* Filter mode control */
typedef enum
{
@@ -130,7 +122,6 @@
LVEQNB_FILTER_DUMMY = LVM_MAXINT_32
} LVEQNB_FilterMode_en;
-
/* Memory Types */
typedef enum
{
@@ -141,7 +132,6 @@
LVEQNB_MEMORY_MAX = LVM_MAXINT_32
} LVEQNB_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -152,7 +142,6 @@
LVEQNB_STATUS_MAX = LVM_MAXINT_32
} LVEQNB_ReturnStatus_en;
-
/****************************************************************************************/
/* */
/* Linked enumerated type and capability definitions */
@@ -190,7 +179,6 @@
LVEQNB_SOURCE_MAX = LVM_MAXINT_32
} LVEQNB_SourceFormat_en;
-
/*
* Supported sample rates in samples per second
*/
@@ -203,12 +191,10 @@
#define LVEQNB_CAP_FS_32000 64
#define LVEQNB_CAP_FS_44100 128
#define LVEQNB_CAP_FS_48000 256
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVEQNB_CAP_FS_88200 512
#define LVEQNB_CAP_FS_96000 1024
#define LVEQNB_CAP_FS_176400 2048
#define LVEQNB_CAP_FS_192000 4096
-#endif
typedef enum
{
@@ -221,16 +207,13 @@
LVEQNB_FS_32000 = 6,
LVEQNB_FS_44100 = 7,
LVEQNB_FS_48000 = 8,
-#ifdef HIGHER_FS
LVEQNB_FS_88200 = 9,
LVEQNB_FS_96000 = 10,
LVEQNB_FS_176400 = 11,
LVEQNB_FS_192000 = 12,
-#endif
LVEQNB_FS_MAX = LVM_MAXINT_32
} LVEQNB_Fs_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -246,14 +229,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVEQNB_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVEQNB_MemoryRegion_t Region[LVEQNB_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVEQNB_MemTab_t;
-
/* Equaliser band definition */
typedef struct
{
@@ -262,7 +243,6 @@
LVM_UINT16 QFactor; /* Band quality factor */
} LVEQNB_BandDef_t;
-
/* Parameter structure */
typedef struct
{
@@ -279,7 +259,6 @@
#endif
} LVEQNB_Params_t;
-
/* Capability structure */
typedef struct
{
@@ -296,7 +275,6 @@
} LVEQNB_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -339,7 +317,6 @@
LVEQNB_MemTab_t *pMemoryTable,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Init */
@@ -379,7 +356,6 @@
LVEQNB_MemTab_t *pMemoryTable,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetParameters */
@@ -404,7 +380,6 @@
LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance,
LVEQNB_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetCapabilities */
@@ -429,7 +404,6 @@
LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -455,7 +429,6 @@
LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance,
LVEQNB_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Process */
@@ -478,23 +451,10 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* __LVEQNB__ */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
similarity index 62%
rename from media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
rename to media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
index ff52b7f..c3c0fad 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
@@ -22,9 +22,7 @@
/****************************************************************************************/
#include "LVEQNB_Private.h"
-#ifdef BUILD_FLOAT
#include <math.h>
-#endif
/****************************************************************************************/
/* */
@@ -78,101 +76,6 @@
/* */
/****************************************************************************************/
-
-#ifndef BUILD_FLOAT
-LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C32_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVEQNB_GainTable[];
- extern LVM_INT16 LVEQNB_TwoPiOnFsTable[];
- extern LVM_INT16 LVEQNB_DTable[];
- extern LVM_INT16 LVEQNB_DPCosCoef[];
-
- /*
- * Get the filter definition
- */
- LVM_INT16 Gain = pFilterDefinition->Gain;
- LVM_UINT16 Frequency = pFilterDefinition->Frequency;
- LVM_UINT16 QFactor = pFilterDefinition->QFactor;
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 CosErr;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- if (Gain >= 0)
- {
- D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
- }
- else
- {
- D = LVEQNB_DTable[Gain+15]; /* D = 1 / (1 + G) if GaindB < 0 */
- }
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = ((LVM_INT32)QFactor << 19) + (Dt0 >> 2);
- B2_Num = (Dt0 >> 3) - ((LVM_INT32)QFactor << 18);
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine error by a polynomial expansion using the equation:
- *
- * CosErr += coef(n) * t0^n For n = 0 to 4
- */
- T0 = (T0 >> 6) * 0x7f53; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- CosErr = 0; /* Initialise the error to zero */
- for (i=1; i<5; i++)
- {
- coef = LVEQNB_DPCosCoef[i]; /* Get the nth coefficient */
- CosErr += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- CosErr = CosErr << (LVEQNB_DPCosCoef[0]); /* Correct the scaling */
-
- /*
- * Calculate the B1 and A0 coefficients
- */
- B1 = (0x40000000 - B2); /* B1 = (0.5 - b2/2) */
- A0 = ((B1 >> 16) * (CosErr >> 10)) >> 6; /* Temporary storage for (0.5 - b2/2) * coserr(t0) */
- B1 -= A0; /* B1 = (0.5 - b2/2) * (1 - coserr(t0)) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = A0;
- pCoefficients->B1 = B1;
- pCoefficients->B2 = B2;
- pCoefficients->G = LVEQNB_GainTable[Gain+15];
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SinglePrecCoefs */
@@ -208,7 +111,6 @@
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_FLOAT_Coefs_t *pCoefficients)
@@ -218,7 +120,6 @@
extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
extern LVM_FLOAT LVEQNB_DTable[];
-
/*
* Get the filter definition
*/
@@ -227,7 +128,6 @@
/* As mentioned in effectbundle.h */
LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
-
/*
* Intermediate variables and temporary values
*/
@@ -268,95 +168,3 @@
return(LVEQNB_SUCCESS);
}
-#else
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C16_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVEQNB_GainTable[];
- extern LVM_INT16 LVEQNB_TwoPiOnFsTable[];
- extern LVM_INT16 LVEQNB_DTable[];
- extern LVM_INT16 LVEQNB_CosCoef[];
-
-
- /*
- * Get the filter definition
- */
- LVM_INT16 Gain = pFilterDefinition->Gain;
- LVM_UINT16 Frequency = pFilterDefinition->Frequency;
- LVM_UINT16 QFactor = pFilterDefinition->QFactor;
-
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 COS_T0;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- if (Gain >= 0)
- {
- D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
- }
- else
- {
- D = LVEQNB_DTable[Gain+15]; /* D = 1 / (1 + G) if GaindB < 0 */
- }
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = ((LVM_INT32)QFactor << 19) + (Dt0 >> 2);
- B2_Num = (Dt0 >> 3) - ((LVM_INT32)QFactor << 18);
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine by a polynomial expansion using the equation:
- *
- * Cos += coef(n) * t0^n For n = 0 to 6
- */
- T0 = (T0 >> 10) * 20859; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- COS_T0 = 0; /* Initialise the error to zero */
- for (i=1; i<7; i++)
- {
- coef = LVEQNB_CosCoef[i]; /* Get the nth coefficient */
- COS_T0 += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- COS_T0 = COS_T0 << (LVEQNB_CosCoef[0]+6); /* Correct the scaling */
-
-
- B1 = ((0x40000000 - B2) >> 16) * (COS_T0 >> 16); /* B1 = (0.5 - b2/2) * cos(t0) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2/2) */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = (LVM_INT16)(A0>>16);
- pCoefficients->B1 = (LVM_INT16)(B1>>15);
- pCoefficients->B2 = (LVM_INT16)(B2>>16);
- pCoefficients->G = LVEQNB_GainTable[Gain+15];
-
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 755141e..6329181 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -15,17 +15,14 @@
* limitations under the License.
*/
-
#ifndef __LVEQNB_COEFFS_H__
#define __LVEQNB_COEFFS_H__
-
/************************************************************************************/
/* */
/* Gain table for (10^(Gain/20) - 1) */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_Gain_Neg15_dB (-0.822172f)
#define LVEQNB_Gain_Neg14_dB (-0.800474f)
#define LVEQNB_Gain_Neg13_dB (-0.776128f)
@@ -57,47 +54,12 @@
#define LVEQNB_Gain_13_dB 3.466836f
#define LVEQNB_Gain_14_dB 4.011872f
#define LVEQNB_Gain_15_dB 4.623413f
-#else
-#define LVEQNB_GAINSHIFT 11 /* As a power of 2 */
-#define LVEQNB_Gain_Neg15_dB (-1684) /* Floating point value -0.822172 */
-#define LVEQNB_Gain_Neg14_dB (-1639) /* Floating point value -0.800474 */
-#define LVEQNB_Gain_Neg13_dB (-1590) /* Floating point value -0.776128 */
-#define LVEQNB_Gain_Neg12_dB (-1534) /* Floating point value -0.748811 */
-#define LVEQNB_Gain_Neg11_dB (-1471) /* Floating point value -0.718162 */
-#define LVEQNB_Gain_Neg10_dB (-1400) /* Floating point value -0.683772 */
-#define LVEQNB_Gain_Neg9_dB (-1321) /* Floating point value -0.645187 */
-#define LVEQNB_Gain_Neg8_dB (-1233) /* Floating point value -0.601893 */
-#define LVEQNB_Gain_Neg7_dB (-1133) /* Floating point value -0.553316 */
-#define LVEQNB_Gain_Neg6_dB (-1022) /* Floating point value -0.498813 */
-#define LVEQNB_Gain_Neg5_dB (-896) /* Floating point value -0.437659 */
-#define LVEQNB_Gain_Neg4_dB (-756) /* Floating point value -0.369043 */
-#define LVEQNB_Gain_Neg3_dB (-598) /* Floating point value -0.292054 */
-#define LVEQNB_Gain_Neg2_dB (-421) /* Floating point value -0.205672 */
-#define LVEQNB_Gain_Neg1_dB (-223) /* Floating point value -0.108749 */
-#define LVEQNB_Gain_0_dB 0 /* Floating point value 0.000000 */
-#define LVEQNB_Gain_1_dB 250 /* Floating point value 0.122018 */
-#define LVEQNB_Gain_2_dB 530 /* Floating point value 0.258925 */
-#define LVEQNB_Gain_3_dB 845 /* Floating point value 0.412538 */
-#define LVEQNB_Gain_4_dB 1198 /* Floating point value 0.584893 */
-#define LVEQNB_Gain_5_dB 1594 /* Floating point value 0.778279 */
-#define LVEQNB_Gain_6_dB 2038 /* Floating point value 0.995262 */
-#define LVEQNB_Gain_7_dB 2537 /* Floating point value 1.238721 */
-#define LVEQNB_Gain_8_dB 3096 /* Floating point value 1.511886 */
-#define LVEQNB_Gain_9_dB 3724 /* Floating point value 1.818383 */
-#define LVEQNB_Gain_10_dB 4428 /* Floating point value 2.162278 */
-#define LVEQNB_Gain_11_dB 5219 /* Floating point value 2.548134 */
-#define LVEQNB_Gain_12_dB 6105 /* Floating point value 2.981072 */
-#define LVEQNB_Gain_13_dB 7100 /* Floating point value 3.466836 */
-#define LVEQNB_Gain_14_dB 8216 /* Floating point value 4.011872 */
-#define LVEQNB_Gain_15_dB 9469 /* Floating point value 4.623413 */
-#endif
/************************************************************************************/
/* */
/* Frequency table for 2*Pi/Fs */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_2PiOn_8000 0.000785f
#define LVEQNB_2PiOn_11025 0.000570f
#define LVEQNB_2PiOn_12000 0.000524f
@@ -108,32 +70,16 @@
#define LVEQNB_2PiOn_44100 0.000142f
#define LVEQNB_2PiOn_48000 0.000131f
-#ifdef HIGHER_FS
#define LVEQNB_2PiOn_88200 0.000071f
#define LVEQNB_2PiOn_96000 0.000065f
#define LVEQNB_2PiOn_176400 0.000036f
#define LVEQNB_2PiOn_192000 0.000033f
-#endif
-
-#else
-#define LVEQNB_FREQSHIFT 25 /* As a power of 2 */
-#define LVEQNB_2PiOn_8000 26354 /* Floating point value 0.000785 */
-#define LVEQNB_2PiOn_11025 19123 /* Floating point value 0.000570 */
-#define LVEQNB_2PiOn_12000 17569 /* Floating point value 0.000524 */
-#define LVEQNB_2PiOn_16000 13177 /* Floating point value 0.000393 */
-#define LVEQNB_2PiOn_22050 9561 /* Floating point value 0.000285 */
-#define LVEQNB_2PiOn_24000 8785 /* Floating point value 0.000262 */
-#define LVEQNB_2PiOn_32000 6588 /* Floating point value 0.000196 */
-#define LVEQNB_2PiOn_44100 4781 /* Floating point value 0.000142 */
-#define LVEQNB_2PiOn_48000 4392 /* Floating point value 0.000131 */
-#endif
/************************************************************************************/
/* */
/* 50D table for 50 / ( 1 + Gain ) */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_100D_Neg15_dB 5.623413f
#define LVEQNB_100D_Neg14_dB 5.011872f
#define LVEQNB_100D_Neg13_dB 4.466836f
@@ -150,24 +96,5 @@
#define LVEQNB_100D_Neg2_dB 1.258925f
#define LVEQNB_100D_Neg1_dB 1.122018f
#define LVEQNB_100D_0_dB 1.000000f
-#else
-#define LVEQNB_100DSHIFT 5 /* As a power of 2 */
-#define LVEQNB_100D_Neg15_dB 17995 /* Floating point value 5.623413 */
-#define LVEQNB_100D_Neg14_dB 16038 /* Floating point value 5.011872 */
-#define LVEQNB_100D_Neg13_dB 14294 /* Floating point value 4.466836 */
-#define LVEQNB_100D_Neg12_dB 12739 /* Floating point value 3.981072 */
-#define LVEQNB_100D_Neg11_dB 11354 /* Floating point value 3.548134 */
-#define LVEQNB_100D_Neg10_dB 10119 /* Floating point value 3.162278 */
-#define LVEQNB_100D_Neg9_dB 9019 /* Floating point value 2.818383 */
-#define LVEQNB_100D_Neg8_dB 8038 /* Floating point value 2.511886 */
-#define LVEQNB_100D_Neg7_dB 7164 /* Floating point value 2.238721 */
-#define LVEQNB_100D_Neg6_dB 6385 /* Floating point value 1.995262 */
-#define LVEQNB_100D_Neg5_dB 5690 /* Floating point value 1.778279 */
-#define LVEQNB_100D_Neg4_dB 5072 /* Floating point value 1.584893 */
-#define LVEQNB_100D_Neg3_dB 4520 /* Floating point value 1.412538 */
-#define LVEQNB_100D_Neg2_dB 4029 /* Floating point value 1.258925 */
-#define LVEQNB_100D_Neg1_dB 3590 /* Floating point value 1.122018 */
-#define LVEQNB_100D_0_dB 3200 /* Floating point value 1.000000 */
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
rename to media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
index 7b0f341..6bb4a7e 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
@@ -26,7 +26,6 @@
#include "VectorArithmetic.h"
#include "BIQUAD.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -76,7 +75,6 @@
return(LVEQNB_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetCapabilities */
@@ -114,7 +112,6 @@
return(LVEQNB_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SetFilters */
@@ -140,18 +137,13 @@
void LVEQNB_SetFilters(LVEQNB_Instance_t *pInstance,
LVEQNB_Params_t *pParams)
{
-#ifdef HIGHER_FS
extern const LVM_UINT32 LVEQNB_SampleRateTab[]; /* Sample rate table */
-#else
- extern const LVM_UINT16 LVEQNB_SampleRateTab[]; /* Sample rate table */
-#endif
LVM_UINT16 i; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVEQNB_SampleRateTab[(LVM_UINT16)pParams->SampleRate]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
LVM_INT16 QFactor; /* Filter Q factor */
-
pInstance->NBands = pParams->NBands;
for (i=0; i<pParams->NBands; i++)
@@ -162,30 +154,7 @@
fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency; /* Get the band centre frequency */
QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor; /* Get the band Q factor */
-#ifdef BUILD_FLOAT
pInstance->pBiquadType[i] = LVEQNB_SinglePrecision_Float; /* Default to single precision */
-#else
- /*
- * For each filter set the type of biquad required
- */
- pInstance->pBiquadType[i] = LVEQNB_SinglePrecision; /* Default to single precision */
-#endif
-#ifndef BUILD_FLOAT
- if ((fc << 15) <= (LOW_FREQ * fs))
- {
- /*
- * fc <= fs/110
- */
- pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
- }
- else if (((fc << 15) <= (HIGH_FREQ * fs)) && (QFactor > 300))
- {
- /*
- * (fs/110 < fc < fs/85) & (Q>3)
- */
- pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
- }
-#endif
/*
* Check for out of range frequencies
@@ -195,7 +164,6 @@
pInstance->pBiquadType[i] = LVEQNB_OutOfRange;
}
-
/*
* Copy the filter definition to persistant memory
*/
@@ -204,7 +172,6 @@
}
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SetCoefficients */
@@ -225,7 +192,6 @@
LVM_UINT16 i; /* Filter band index */
LVEQNB_BiquadType_en BiquadType; /* Filter biquad type */
-
/*
* Set the coefficients for each band by the init function
*/
@@ -238,7 +204,6 @@
BiquadType = pInstance->pBiquadType[i];
switch (BiquadType)
{
-#ifdef BUILD_FLOAT
case LVEQNB_SinglePrecision_Float:
{
PK_FLOAT_Coefs_t Coefficients;
@@ -256,47 +221,6 @@
&Coefficients);
break;
}
-#else
- case LVEQNB_DoublePrecision:
- {
- PK_C32_Coefs_t Coefficients;
-
- /*
- * Calculate the double precision coefficients
- */
- LVEQNB_DoublePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
- &pInstance->pBandDefinitions[i],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- PK_2I_D32F32CllGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
- &pInstance->pEQNB_Taps[i],
- &Coefficients);
- break;
- }
-
- case LVEQNB_SinglePrecision:
- {
- PK_C16_Coefs_t Coefficients;
-
- /*
- * Calculate the single precision coefficients
- */
- LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
- &pInstance->pBandDefinitions[i],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
- &pInstance->pEQNB_Taps[i],
- &Coefficients);
- break;
- }
-#endif
default:
break;
}
@@ -304,7 +228,6 @@
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_ClearFilterHistory */
@@ -316,24 +239,6 @@
/* pInstance Pointer to the instance */
/* */
/************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
-{
- LVM_INT16 *pTapAddress;
- LVM_INT16 NumTaps;
-
-
- pTapAddress = (LVM_INT16 *)pInstance->pEQNB_Taps;
- NumTaps = (LVM_INT16)((pInstance->Capabilities.MaxBands * sizeof(Biquad_2I_Order2_Taps_t))/sizeof(LVM_INT16));
-
- if (NumTaps != 0)
- {
- LoadConst_16(0, /* Clear the history, value 0 */
- pTapAddress, /* Destination */
- NumTaps); /* Number of words */
- }
-}
-#else
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
{
LVM_FLOAT *pTapAddress;
@@ -350,7 +255,6 @@
NumTaps); /* Number of words */
}
}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -404,7 +308,6 @@
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
}
-
if( (pInstance->Params.NBands != pParams->NBands ) ||
(pInstance->Params.OperatingMode != pParams->OperatingMode ) ||
(pInstance->Params.pBandDefinition != pParams->pBandDefinition ) ||
@@ -429,7 +332,6 @@
}
}
-
// During operating mode transition, there is a race condition where the mode
// is still LVEQNB_ON, but the effect is considered disabled in the upper layers.
// modeChange handles this special race condition.
@@ -453,7 +355,6 @@
*/
pInstance->Params = *pParams;
-
/*
* Reset the filters except if the algo is switched off
*/
@@ -473,13 +374,8 @@
if (modeChange) {
if(pParams->OperatingMode == LVEQNB_ON)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 0.0f);
-#else
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],LVM_MAXINT_16);
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],0);
-#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
@@ -489,13 +385,8 @@
// This may introduce a state race condition if the effect is enabled again
// while in transition. This is fixed in the modeChange logic.
pInstance->Params.OperatingMode = LVEQNB_ON;
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 0.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 1.0f);
-#else
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],0);
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],LVM_MAXINT_16);
-#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
@@ -508,7 +399,6 @@
return(LVEQNB_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_BypassMixerCallBack */
@@ -530,13 +420,8 @@
/*
* Send an ALGOFF event if the ON->OFF switch transition is finished
*/
-#ifdef BUILD_FLOAT
if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0) &&
(CallbackParam == 0)){
-#else
- if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0x00000000) &&
- (CallbackParam == 0)){
-#endif
pInstance->Params.OperatingMode = LVEQNB_BYPASS;
if (CallBack != LVM_NULL){
CallBack(pInstance->Capabilities.pBundleInstance, LVM_NULL, ALGORITHM_EQNB_ID|LVEQNB_EVENT_ALGOFF);
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
similarity index 85%
rename from media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
rename to media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
index de1bbb7..271a914 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -67,13 +66,11 @@
INST_ALLOC AllocMem;
LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
-
if((pMemoryTable == LVM_NULL)|| (pCapabilities == LVM_NULL))
{
return LVEQNB_NULLADDRESS;
}
-
/*
* Fill in the memory table
*/
@@ -91,13 +88,11 @@
pMemoryTable->Region[LVEQNB_MEMREGION_INSTANCE].Type = LVEQNB_PERSISTENT;
pMemoryTable->Region[LVEQNB_MEMREGION_INSTANCE].pBaseAddress = LVM_NULL;
-
/*
* Persistant data memory
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
@@ -111,18 +106,6 @@
/* Biquad types */
InstAlloc_AddMember(&AllocMem,
(pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en)));
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- sizeof(Biquad_2I_Order2_Taps_t));
- InstAlloc_AddMember(&AllocMem, /* High pass filter */
- sizeof(Biquad_2I_Order2_Taps_t));
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_Taps_t))); /* Equaliser Biquad Taps */
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t))); /* Filter definitions */
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en))); /* Biquad types */
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Alignment = LVEQNB_DATA_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Type = LVEQNB_PERSISTENT_DATA;
@@ -133,7 +116,6 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_FLOAT_Instance_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
@@ -141,14 +123,6 @@
/* Equaliser Biquad Instance */
InstAlloc_AddMember(&AllocMem,
pCapabilities->MaxBands * sizeof(Biquad_FLOAT_Instance_t));
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- sizeof(Biquad_Instance_t));
- InstAlloc_AddMember(&AllocMem, /* High pass filter */
- sizeof(Biquad_Instance_t));
- InstAlloc_AddMember(&AllocMem,
- pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Alignment = LVEQNB_COEF_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Type = LVEQNB_PERSISTENT_COEF;
@@ -159,14 +133,9 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
LVEQNB_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * \
pCapabilities->MaxBlockSize);
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- LVEQNB_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Alignment = LVEQNB_SCRATCH_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Type = LVEQNB_SCRATCH;
@@ -181,7 +150,6 @@
return(LVEQNB_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Init */
@@ -260,14 +228,11 @@
}
pInstance =(LVEQNB_Instance_t *)*phInstance;
-
-
/*
* Save the memory table in the instance structure
*/
pInstance->Capabilities = *pCapabilities;
-
/*
* Save the memory table in the instance structure and
* set the structure pointers
@@ -280,17 +245,10 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].pBaseAddress);
-#ifdef BUILD_FLOAT
/* Equaliser Biquad Instance */
- pInstance->pEQNB_FilterState_Float = InstAlloc_AddMember(&AllocMem,
- pCapabilities->MaxBands * \
- sizeof(Biquad_FLOAT_Instance_t));
-#else
- pInstance->pEQNB_FilterState = InstAlloc_AddMember(&AllocMem,
- pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
-#endif
-
-
+ pInstance->pEQNB_FilterState_Float = (Biquad_FLOAT_Instance_t *)
+ InstAlloc_AddMember(&AllocMem, pCapabilities->MaxBands * \
+ sizeof(Biquad_FLOAT_Instance_t));
/*
* Allocate data memory
@@ -298,15 +256,9 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].pBaseAddress);
-#ifdef BUILD_FLOAT
MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
pInstance->pEQNB_Taps_Float = (Biquad_2I_Order2_FLOAT_Taps_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
-#else
- MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_Taps_t));
- pInstance->pEQNB_Taps = (Biquad_2I_Order2_Taps_t *)InstAlloc_AddMember(&AllocMem,
- MemSize);
-#endif
MemSize = (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t));
pInstance->pBandDefinitions = (LVEQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
@@ -317,20 +269,14 @@
pInstance->pBiquadType = (LVEQNB_BiquadType_en *)InstAlloc_AddMember(&AllocMem,
MemSize);
-
/*
* Internally map, structure and allign scratch memory
*/
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].pBaseAddress);
-#ifdef BUILD_FLOAT
pInstance->pFastTemporary = (LVM_FLOAT *)InstAlloc_AddMember(&AllocMem,
sizeof(LVM_FLOAT));
-#else
- pInstance->pFastTemporary = (LVM_INT16 *)InstAlloc_AddMember(&AllocMem,
- sizeof(LVM_INT16));
-#endif
/*
* Update the instance parameters
@@ -362,18 +308,12 @@
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],0,LVM_FS_8000,2);
-
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackParam = 0;
pInstance->BypassMixer.MixerStream[1].pCallbackHandle = LVM_NULL;
pInstance->BypassMixer.MixerStream[1].pCallBack = LVM_NULL;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1], 0, 1.0f);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1], 0, LVM_FS_8000, 2);
-#else
- LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1],0,LVM_MAXINT_16);
- LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],0,LVM_FS_8000,2);
-#endif
pInstance->bInOperatingModeTransition = LVM_FALSE;
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
index a9cd5fd..40facfb 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
@@ -18,11 +18,6 @@
#ifndef __LVEQNB_PRIVATE_H__
#define __LVEQNB_PRIVATE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -65,24 +60,19 @@
/* Filter biquad types */
typedef enum
{
-#ifdef BUILD_FLOAT
LVEQNB_SinglePrecision_Float = -1,
-#endif
LVEQNB_SinglePrecision = 0,
LVEQNB_DoublePrecision = 1,
LVEQNB_OutOfRange = 2,
LVEQNB_BIQUADTYPE_MAX = LVM_MAXINT_32
} LVEQNB_BiquadType_en;
-
/****************************************************************************************/
/* */
/* Structures */
/* */
/****************************************************************************************/
-
-
/* Instance structure */
typedef struct
{
@@ -92,20 +82,10 @@
LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */
/* Aligned memory pointers */
-#ifdef BUILD_FLOAT
LVM_FLOAT *pFastTemporary; /* Fast temporary data base address */
-#else
- LVM_INT16 *pFastTemporary; /* Fast temporary data base address */
-#endif
-#ifdef BUILD_FLOAT
Biquad_2I_Order2_FLOAT_Taps_t *pEQNB_Taps_Float; /* Equaliser Taps */
Biquad_FLOAT_Instance_t *pEQNB_FilterState_Float; /* State for each filter band */
-#else
- /* Process variables */
- Biquad_2I_Order2_Taps_t *pEQNB_Taps; /* Equaliser Taps */
- Biquad_Instance_t *pEQNB_FilterState; /* State for each filter band */
-#endif
/* Filter definitions and call back */
LVM_UINT16 NBands; /* Number of bands */
@@ -113,17 +93,12 @@
LVEQNB_BiquadType_en *pBiquadType; /* Filter biquad types */
/* Bypass variable */
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st BypassMixer;
-#else
- LVMixer3_2St_st BypassMixer; /* Bypass mixer used in transitions */
-#endif
LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
} LVEQNB_Instance_t;
-
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -136,25 +111,11 @@
void LVEQNB_SetCoefficients(LVEQNB_Instance_t *pInstance);
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_FLOAT_Coefs_t *pCoefficients);
-#else
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C16_Coefs_t *pCoefficients);
-
-LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C32_Coefs_t *pCoefficients);
-#endif
LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVEQNB_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
similarity index 61%
rename from media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
rename to media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
index d188c0e..65eff53 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
@@ -58,7 +58,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -123,7 +122,6 @@
*/
Biquad_FLOAT_Instance_t *pBiquad = &pInstance->pEQNB_FilterState_Float[i];
-
/*
* Select single or double precision as required
*/
@@ -152,7 +150,6 @@
}
}
-
if(pInstance->bInOperatingModeTransition == LVM_TRUE){
#ifdef SUPPORT_MC
LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->BypassMixer,
@@ -194,145 +191,3 @@
return LVEQNB_SUCCESS;
}
-#else
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVM_UINT16 i;
- Biquad_Instance_t *pBiquad;
- LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
- LVM_INT32 *pScratch;
-
-
- /* Check for NULL pointers */
- if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
- return LVEQNB_NULLADDRESS;
- }
-
- /* Check if the input and output data buffers are 32-bit aligned */
- if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
- {
- return LVEQNB_ALIGNMENTERROR;
- }
-
- pScratch = (LVM_INT32 *)pInstance->pFastTemporary;
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
- {
- return(LVEQNB_TOOMANYSAMPLES);
- }
-
- if (pInstance->Params.OperatingMode == LVEQNB_ON)
- {
- /*
- * Convert from 16-bit to 32-bit
- */
- Int16LShiftToInt32_16x32((LVM_INT16 *)pInData, /* Source */
- pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
-
- /*
- * For each section execte the filter unless the gain is 0dB
- */
- if (pInstance->NBands != 0)
- {
- for (i=0; i<pInstance->NBands; i++)
- {
- /*
- * Check if band is non-zero dB gain
- */
- if (pInstance->pBandDefinitions[i].Gain != 0)
- {
- /*
- * Get the address of the biquad instance
- */
- pBiquad = &pInstance->pEQNB_FilterState[i];
-
-
- /*
- * Select single or double precision as required
- */
- switch (pInstance->pBiquadType[i])
- {
- case LVEQNB_SinglePrecision:
- {
- PK_2I_D32F32C14G11_TRC_WRA_01(pBiquad,
- (LVM_INT32 *)pScratch,
- (LVM_INT32 *)pScratch,
- (LVM_INT16)NumSamples);
- break;
- }
-
- case LVEQNB_DoublePrecision:
- {
- PK_2I_D32F32C30G11_TRC_WRA_01(pBiquad,
- (LVM_INT32 *)pScratch,
- (LVM_INT32 *)pScratch,
- (LVM_INT16)NumSamples);
- break;
- }
- default:
- break;
- }
- }
- }
- }
-
-
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
- /*
- * Convert from 32-bit to 16- bit and saturate
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source */
- (LVM_INT16 *)pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
-
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->BypassMixer,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pInData,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)(2*NumSamples));
-
- Copy_16((LVM_INT16*)pScratch, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and Right samples */
- }
- else{
-
- /*
- * Convert from 32-bit to 16- bit and saturate
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source */
- pOutData, /* Destination */
- (LVM_INT16 )(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
- }
- }
- else
- {
- /*
- * Mode is OFF so copy the data if necessary
- */
- if (pInData != pOutData)
- {
- Copy_16(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and Right samples */
- }
- }
-
-
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
similarity index 67%
rename from media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
rename to media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
index 453c42d..0628114 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -24,7 +23,7 @@
#include "LVEQNB.h"
#include "LVEQNB_Coeffs.h"
-
+#include "LVEQNB_Tables.h"
/************************************************************************************/
/* */
@@ -36,7 +35,6 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_UINT32 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
11025,
12000,
@@ -51,18 +49,6 @@
176400,
192000
};
-#else
-const LVM_UINT16 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#endif
/************************************************************************************/
/* */
@@ -73,7 +59,6 @@
/*
* Table for 2 * Pi / Fs
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
LVEQNB_2PiOn_11025,
LVEQNB_2PiOn_12000,
@@ -83,29 +68,15 @@
LVEQNB_2PiOn_32000,
LVEQNB_2PiOn_44100,
LVEQNB_2PiOn_48000
-#ifdef HIGHER_FS
,LVEQNB_2PiOn_88200
,LVEQNB_2PiOn_96000
,LVEQNB_2PiOn_176400
,LVEQNB_2PiOn_192000
-#endif
};
-#else
-const LVM_INT16 LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
- LVEQNB_2PiOn_11025,
- LVEQNB_2PiOn_12000,
- LVEQNB_2PiOn_16000,
- LVEQNB_2PiOn_22050,
- LVEQNB_2PiOn_24000,
- LVEQNB_2PiOn_32000,
- LVEQNB_2PiOn_44100,
- LVEQNB_2PiOn_48000}; /* 48kS/s */
-#endif
/*
* Gain table
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
LVEQNB_Gain_Neg14_dB,
LVEQNB_Gain_Neg13_dB,
@@ -137,44 +108,9 @@
LVEQNB_Gain_13_dB,
LVEQNB_Gain_14_dB,
LVEQNB_Gain_15_dB}; /* +15dB gain */
-#else
-const LVM_INT16 LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
- LVEQNB_Gain_Neg14_dB,
- LVEQNB_Gain_Neg13_dB,
- LVEQNB_Gain_Neg12_dB,
- LVEQNB_Gain_Neg11_dB,
- LVEQNB_Gain_Neg10_dB,
- LVEQNB_Gain_Neg9_dB,
- LVEQNB_Gain_Neg8_dB,
- LVEQNB_Gain_Neg7_dB,
- LVEQNB_Gain_Neg6_dB,
- LVEQNB_Gain_Neg5_dB,
- LVEQNB_Gain_Neg4_dB,
- LVEQNB_Gain_Neg3_dB,
- LVEQNB_Gain_Neg2_dB,
- LVEQNB_Gain_Neg1_dB,
- LVEQNB_Gain_0_dB, /* 0dB gain */
- LVEQNB_Gain_1_dB,
- LVEQNB_Gain_2_dB,
- LVEQNB_Gain_3_dB,
- LVEQNB_Gain_4_dB,
- LVEQNB_Gain_5_dB,
- LVEQNB_Gain_6_dB,
- LVEQNB_Gain_7_dB,
- LVEQNB_Gain_8_dB,
- LVEQNB_Gain_9_dB,
- LVEQNB_Gain_10_dB,
- LVEQNB_Gain_11_dB,
- LVEQNB_Gain_12_dB,
- LVEQNB_Gain_13_dB,
- LVEQNB_Gain_14_dB,
- LVEQNB_Gain_15_dB}; /* +15dB gain */
-
-#endif
/*
* D table for 100 / (Gain + 1)
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
LVEQNB_100D_Neg14_dB,
LVEQNB_100D_Neg13_dB,
@@ -191,25 +127,6 @@
LVEQNB_100D_Neg2_dB,
LVEQNB_100D_Neg1_dB,
LVEQNB_100D_0_dB}; /* 0dB gain */
-#else
-const LVM_INT16 LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
- LVEQNB_100D_Neg14_dB,
- LVEQNB_100D_Neg13_dB,
- LVEQNB_100D_Neg12_dB,
- LVEQNB_100D_Neg11_dB,
- LVEQNB_100D_Neg10_dB,
- LVEQNB_100D_Neg9_dB,
- LVEQNB_100D_Neg8_dB,
- LVEQNB_100D_Neg7_dB,
- LVEQNB_100D_Neg6_dB,
- LVEQNB_100D_Neg5_dB,
- LVEQNB_100D_Neg4_dB,
- LVEQNB_100D_Neg3_dB,
- LVEQNB_100D_Neg2_dB,
- LVEQNB_100D_Neg1_dB,
- LVEQNB_100D_0_dB}; /* 0dB gain */
-
-#endif
/************************************************************************************/
/* */
/* Filter polynomial coefficients */
@@ -253,4 +170,3 @@
16586, /* a2 */
-44}; /* a3 */
-
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
new file mode 100644
index 0000000..a71eeb9
--- /dev/null
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#ifndef __LVEQNB_TABLES_H__
+#define __LVEQNB_TABLES_H__
+
+/************************************************************************************/
+/* */
+/* Sample rate table */
+/* */
+/************************************************************************************/
+
+/*
+ * Sample rate table for converting between the enumerated type and the actual
+ * frequency
+ */
+extern const LVM_UINT32 LVEQNB_SampleRateTab[];
+
+/************************************************************************************/
+/* */
+/* Coefficient calculation tables */
+/* */
+/************************************************************************************/
+
+/*
+ * Table for 2 * Pi / Fs
+ */
+extern const LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
+
+/*
+ * Gain table
+ */
+extern const LVM_FLOAT LVEQNB_GainTable[];
+
+/*
+ * D table for 100 / (Gain + 1)
+ */
+extern const LVM_FLOAT LVEQNB_DTable[];
+
+/************************************************************************************/
+/* */
+/* Filter polynomial coefficients */
+/* */
+/************************************************************************************/
+
+/*
+ * Coefficients for calculating the cosine with the equation:
+ *
+ * Cos(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5)
+ *
+ * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
+ * 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[];
+
+/*
+ * Coefficients for calculating the cosine error with the equation:
+ *
+ * CosErr(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3)
+ *
+ * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
+ * a range of 0 to Pi/25. The output is in the range 0 to 32767 representing the range
+ * 0.0 to 0.0078852986
+ *
+ * This is used to give a double precision cosine over the range 0 to Pi/25 using the
+ * the equation:
+ *
+ * Cos(x) = 1.0 - CosErr(x)
+ */
+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 9c2e297..8c91ea9 100644
--- a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -28,11 +28,6 @@
#ifndef __LVREV_H__
#define __LVREV_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -40,7 +35,6 @@
/****************************************************************************************/
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -53,7 +47,6 @@
/* Memory table*/
#define LVREV_NR_MEMORY_REGIONS 4 /* Number of memory regions */
-
/****************************************************************************************/
/* */
/* Types */
@@ -62,7 +55,6 @@
/* Instance handle */
typedef void *LVREV_Handle_t;
-
/* Status return values */
typedef enum
{
@@ -73,7 +65,6 @@
LVREV_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVREV_ReturnStatus_en;
-
/* Reverb delay lines */
typedef enum
{
@@ -83,7 +74,6 @@
LVREV_DELAYLINES_DUMMY = LVM_MAXENUM
} LVREV_NumDelayLines_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -96,7 +86,6 @@
LVM_MemoryRegion_st Region[LVREV_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVREV_MemoryTable_st;
-
/* Control Parameter structure */
typedef struct
{
@@ -107,13 +96,8 @@
/* Parameters for REV */
LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
-#ifndef HIGHER_FS
- LVM_UINT16 LPF; /* Low pass filter, in Hz */
- LVM_UINT16 HPF; /* High pass filter, in Hz */
-#else
LVM_UINT32 LPF; /* Low pass filter, in Hz */
LVM_UINT32 HPF; /* High pass filter, in Hz */
-#endif
LVM_UINT16 T60; /* Decay time constant, in ms */
LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
@@ -122,7 +106,6 @@
} LVREV_ControlParams_st;
-
/* Instance Parameter structure */
typedef struct
{
@@ -135,7 +118,6 @@
} LVREV_InstanceParams_st;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -182,7 +164,6 @@
LVREV_MemoryTable_st *pMemoryTable,
LVREV_InstanceParams_st *pInstanceParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetInstanceHandle */
@@ -213,7 +194,6 @@
LVREV_MemoryTable_st *pMemoryTable,
LVREV_InstanceParams_st *pInstanceParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVXX_GetControlParameters */
@@ -237,7 +217,6 @@
LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
LVREV_ControlParams_st *pControlParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_SetControlParameters */
@@ -260,7 +239,6 @@
LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
LVREV_ControlParams_st *pNewParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_ClearAudioBuffers */
@@ -281,7 +259,6 @@
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_Process */
@@ -303,21 +280,10 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
const LVM_UINT16 NumSamples);
-#else
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_INT32 *pInData,
- LVM_INT32 *pOutData,
- const LVM_UINT16 NumSamples);
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* __LVREV_H__ */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
deleted file mode 100644
index e710844..0000000
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/*
- * Copyright (C) 2004-2010 NXP Software
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************************/
-/* */
-/* Includes */
-/* */
-/****************************************************************************************/
-#include "LVREV_Private.h"
-#include "Filter.h"
-
-/****************************************************************************************/
-/* */
-/* FUNCTION: LVREV_ApplyNewSettings */
-/* */
-/* DESCRIPTION: */
-/* Applies the new control parameters */
-/* */
-/* PARAMETERS: */
-/* pPrivate Pointer to the instance private parameters */
-/* */
-/* RETURNS: */
-/* LVREV_Success Succeeded */
-/* LVREV_NULLADDRESS When pPrivate is NULL */
-/* */
-/* NOTES: */
-/* */
-/****************************************************************************************/
-
-#ifndef BUILD_FLOAT
-LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
-{
-
- LVM_Mode_en OperatingMode;
- LVM_INT32 NumberOfDelayLines;
-
-
- /* Check for NULL pointer */
- if(pPrivate == LVM_NULL)
- {
- return LVREV_NULLADDRESS;
- }
-
- OperatingMode = pPrivate->NewParams.OperatingMode;
-
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
- NumberOfDelayLines = 2;
- }
- else
- {
- NumberOfDelayLines = 1;
- }
-
- /*
- * Update the high pass filter coefficients
- */
- if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
-
- Omega = LVM_GetOmega(pPrivate->NewParams.HPF, pPrivate->NewParams.SampleRate);
- LVM_FO_HPF(Omega, &Coeffs);
- FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->HPCoefs, &pPrivate->pFastData->HPTaps, &Coeffs);
- LoadConst_32(0,
- (void *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
- sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
- }
-
-
- /*
- * Update the low pass filter coefficients
- */
- if((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
-
-
- Coeffs.A0 = 0x7FFFFFFF;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
-
- /*
- * Do not apply filter if w =2*pi*fc/fs >= 2.9
- */
- if(Omega<=LVREV_2_9_INQ29)
- {
- LVM_FO_LPF(Omega, &Coeffs);
- }
- }
- FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs, &pPrivate->pFastData->LPTaps, &Coeffs);
- LoadConst_32(0,
- (void *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
- sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
- }
-
-
- /*
- * Calculate the room size parameter
- */
- if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
- {
- /* Room size range is 10ms to 200ms
- * 0% -- 10ms
- * 50% -- 65ms
- * 100% -- 120ms
- */
- pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5)/10);
- }
-
-
- /*
- * Update the T delay number of samples and the all pass delay number of samples
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_UINT32 Temp;
- LVM_INT32 APDelaySize;
- LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
- LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
- LVM_INT16 i;
- LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
- LVM_INT16 MaxT_Delay[] = {LVREV_MAX_T0_DELAY, LVREV_MAX_T1_DELAY, LVREV_MAX_T2_DELAY, LVREV_MAX_T3_DELAY};
- LVM_INT16 MaxAP_Delay[] = {LVREV_MAX_AP0_DELAY, LVREV_MAX_AP1_DELAY, LVREV_MAX_AP2_DELAY, LVREV_MAX_AP3_DELAY};
-
-
- /*
- * For each delay line
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- if (i != 0)
- {
- LVM_INT32 Temp1; /* to avoid QAC warning on type conversion */
- LVM_INT32 Temp2; /* to avoid QAC warning on type conversion */
-
- Temp2=(LVM_INT32)DelayLengthSamples;
- MUL32x16INTO32(Temp2, ScaleTable[i], Temp1, 15)
- Temp=(LVM_UINT32)Temp1;
- }
- else
- {
- Temp = DelayLengthSamples;
- }
- APDelaySize = Temp / 1500;
-
-
- /*
- * Set the fixed delay
- */
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
- pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
-
-
- /*
- * Set the tap selection
- */
- if (pPrivate->AB_Selection)
- {
- /* Smooth from tap A to tap B */
- pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
- pPrivate->B_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target1 = 0;
- pPrivate->Mixer_APTaps[i].Target2 = 0x7fffffff;
- }
- else
- {
- /* Smooth from tap B to tap A */
- pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
- pPrivate->A_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target2 = 0;
- pPrivate->Mixer_APTaps[i].Target1 = 0x7fffffff;
- }
-
- /*
- * Set the maximum block size to the smallest delay size
- */
- pPrivate->MaxBlkLen = Temp;
- if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
- }
- if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
- }
- }
- if (pPrivate->AB_Selection)
- {
- pPrivate->AB_Selection = 0;
- }
- else
- {
- pPrivate->AB_Selection = 1;
- }
-
-
- /*
- * Limit the maximum block length
- */
- pPrivate->MaxBlkLen=pPrivate->MaxBlkLen-2; /* Just as a precausion, but no problem if we remove this line */
- if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
- {
- pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
- }
- }
-
-
- /*
- * Update the low pass filter coefficient
- */
- if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 Temp;
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
- LVM_INT16 i;
- LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
- LVM_INT32 ScaleTable[] = {LVREV_T_3_Power_0_on_4, LVREV_T_3_Power_1_on_4, LVREV_T_3_Power_2_on_4, LVREV_T_3_Power_3_on_4};
-
-
- /*
- * For each filter
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- if (i != 0)
- {
- MUL32x16INTO32(ScaleTable[i], Damping, Temp, 15)
- }
- else
- {
- Temp = Damping;
- }
- if(Temp <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega((LVM_UINT16)Temp, pPrivate->NewParams.SampleRate);
- LVM_FO_LPF(Omega, &Coeffs);
- }
- else
- {
- Coeffs.A0 = 0x7FF00000;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- }
- FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i], &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
- }
- }
-
-
- /*
- * Update All-pass filter mixer time constants
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
- {
- LVM_INT16 i;
- LVM_INT32 Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
- LVM_INT32 AlphaTap = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
-
- for (i=0; i<4; i++)
- {
- pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
- pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
- pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
- pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
- }
- }
-
-
- /*
- * Update the feed back gain
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 G[4]; /* Feedback gain (Q7.24) */
-
- if(pPrivate->NewParams.T60 == 0)
- {
- G[3] = 0;
- G[2] = 0;
- G[1] = 0;
- G[0] = 0;
- }
- else
- {
- LVM_INT32 Temp1;
- LVM_INT32 Temp2;
- LVM_INT16 i;
- LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
-
-
- /*
- * For each delay line
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
- if(Temp1 >= (4 << 15))
- {
- G[i] = 0;
- }
- else if((Temp1 >= (2 << 15)))
- {
- Temp2 = LVM_Power10(-(Temp1 << 14));
- Temp1 = LVM_Power10(-(Temp1 << 14));
- MUL32x32INTO32(Temp1,Temp2,Temp1,24)
- }
- else
- {
- Temp1 = LVM_Power10(-(Temp1 << 15));
- }
- if (NumberOfDelayLines == 1)
- {
- G[i] = Temp1;
- }
- else
- {
- LVM_INT32 TempG;
- MUL32x16INTO32(Temp1,ONE_OVER_SQRT_TWO,TempG,15)
- G[i]=TempG;
- }
- }
- }
-
- /* Set up the feedback mixers for four delay lines */
- pPrivate->FeedbackMixer[0].Target=G[0]<<7;
- pPrivate->FeedbackMixer[1].Target=G[1]<<7;
- pPrivate->FeedbackMixer[2].Target=G[2]<<7;
- pPrivate->FeedbackMixer[3].Target=G[3]<<7;
- }
-
-
- /*
- * Calculate the gain correction
- */
- if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
- {
- LVM_INT32 Index=0;
- LVM_INT32 i=0;
- LVM_INT32 Gain=0;
- LVM_INT32 RoomSize=0;
- LVM_INT32 T60;
- LVM_INT32 Coefs[5];
-
- if(pPrivate->NewParams.RoomSize==0)
- {
- RoomSize=1;
- }
- else
- {
- RoomSize=(LVM_INT32)pPrivate->NewParams.RoomSize;
- }
-
- if(pPrivate->NewParams.T60<100)
- {
- T60 = 100 * LVREV_T60_SCALE;
- }
- else
- {
- T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
- }
-
- /* Find the nearest room size in table */
- for(i=0;i<24;i++)
- {
- if(RoomSize<= LVREV_GainPolyTable[i][0])
- {
- Index=i;
- break;
- }
- }
-
-
- if(RoomSize==LVREV_GainPolyTable[Index][0])
- {
- /* Take table values if the room size is in table */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index][i];
- }
- Coefs[4]=0;
- Gain=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
- }
- else
- {
- /* Interpolate the gain between nearest room sizes */
-
- LVM_INT32 Gain1,Gain2;
- LVM_INT32 Tot_Dist,Dist;
-
- Tot_Dist=LVREV_GainPolyTable[Index][0]-LVREV_GainPolyTable[Index-1][0];
- Dist=RoomSize-LVREV_GainPolyTable[Index-1][0];
-
-
- /* Get gain for first */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index-1][i];
- }
- Coefs[4]=0;
-
- Gain1=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
-
- /* Get gain for second */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index][i];
- }
- Coefs[4]=0;
-
- Gain2=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
-
- /* Linear Interpolate the gain */
- Gain = Gain1+ (((Gain2-Gain1)*Dist)/(Tot_Dist));
- }
-
-
- /*
- * Get the inverse of gain: Q.15
- * Gain is mostly above one except few cases, take only gains above 1
- */
- if(Gain < 16777216L)
- {
- pPrivate->Gain= 32767;
- }
- else
- {
- pPrivate->Gain=(LVM_INT16)(LVM_MAXINT_32/(Gain>>8));
- }
-
-
- Index=((32767*100)/(100+pPrivate->NewParams.Level));
- pPrivate->Gain=(LVM_INT16)((pPrivate->Gain*Index)>>15);
- pPrivate->GainMixer.Target = pPrivate->Gain*Index;
- }
-
-
- /*
- * Update the all pass comb filter coefficient
- */
- if( (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT16 i;
- LVM_INT32 b = pPrivate->NewParams.Density * LVREV_B_8_on_1000;
-
- for (i=0;i<4; i++)
- {
- pPrivate->Mixer_SGFeedback[i].Target = b;
- pPrivate->Mixer_SGFeedforward[i].Target = b;
- }
- }
-
-
- /*
- * Update the bypass mixer time constant
- */
- if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_UINT16 NumChannels = 1; /* Assume MONO format */
- LVM_INT32 Alpha;
-
- Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
- pPrivate->FeedbackMixer[0].Alpha=Alpha;
- pPrivate->FeedbackMixer[1].Alpha=Alpha;
- pPrivate->FeedbackMixer[2].Alpha=Alpha;
- pPrivate->FeedbackMixer[3].Alpha=Alpha;
-
- NumChannels = 2; /* Always stereo output */
- pPrivate->BypassMixer.Alpha1 = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
- pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
- pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
- }
-
-
- /*
- * Update the bypass mixer targets
- */
- if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
- (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
- {
- pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
- {
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- }
- if (pPrivate->NewParams.Level != 0)
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
-
- if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
- {
- if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
- {
- pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
- pPrivate->BypassMixer.Target1 = 0x00000000;
-
- pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
- OperatingMode = LVM_MODE_ON;
- if (pPrivate->NewParams.Level == 0)
- {
- pPrivate->bDisableReverb = LVM_TRUE;
- }
- else
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
- else if (pPrivate->bFirstControl == LVM_FALSE)
- {
- pPrivate->BypassMixer.Target2 = 0x00000000;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- pPrivate->GainMixer.Target = 0x03FFFFFF;
- OperatingMode = LVM_MODE_ON;
- }
- else
- {
- OperatingMode = LVM_MODE_OFF;
- }
- }
-
-
- /*
- * If it is the first call to ApplyNew settings force the current to the target to begin immediate playback of the effect
- */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
- pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
- }
-
-
- /*
- * Copy the new parameters
- */
- pPrivate->CurrentParams = pPrivate->NewParams;
- pPrivate->CurrentParams.OperatingMode = OperatingMode;
-
-
- /*
- * Update flag
- */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->bFirstControl = LVM_FALSE;
- }
-
-
- return LVREV_SUCCESS;
-}
-#else /* BUILD_FLOAT*/
-LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
-{
-
- LVM_Mode_en OperatingMode;
- LVM_INT32 NumberOfDelayLines;
-
-
- /* Check for NULL pointer */
- if(pPrivate == LVM_NULL)
- {
- return LVREV_NULLADDRESS;
- }
-
- OperatingMode = pPrivate->NewParams.OperatingMode;
-
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
- NumberOfDelayLines = 2;
- }
- else
- {
- NumberOfDelayLines = 1;
- }
-
- /*
- * Update the high pass filter coefficients
- */
- if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_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,
- (void *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- 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;
-
- Coeffs.A0 = 1;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
-
- /*
- * Do not apply filter if w =2*pi*fc/fs >= 2.9
- */
- if(Omega <= (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,
- (void *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
- }
-
-
- /*
- * Calculate the room size parameter
- */
- if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
- {
- /* Room size range is 10ms to 200ms
- * 0% -- 10ms
- * 50% -- 65ms
- * 100% -- 120ms
- */
- pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5) / 10);
- }
-
-
- /*
- * Update the T delay number of samples and the all pass delay number of samples
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_UINT32 Temp;
- LVM_INT32 APDelaySize;
- LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
- LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
- LVM_INT16 i;
- LVM_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 */
-
- Temp1=(LVM_FLOAT)DelayLengthSamples;
- Temp = (LVM_UINT32)(Temp1 * ScaleTable[i]);
- }
- else
- {
- Temp = DelayLengthSamples;
- }
- APDelaySize = Temp / 1500;
-
-
- /*
- * Set the fixed delay
- */
-
-#ifdef HIGHER_FS
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 192000;
-#else
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
-#endif
- pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
-
-
- /*
- * Set the tap selection
- */
- if (pPrivate->AB_Selection)
- {
- /* Smooth from tap A to tap B */
- pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
- Temp - APDelaySize];
- pPrivate->B_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target1 = 0;
- pPrivate->Mixer_APTaps[i].Target2 = 1.0f;
- }
- else
- {
- /* Smooth from tap B to tap A */
- pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
- Temp - APDelaySize];
- pPrivate->A_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target2 = 0;
- pPrivate->Mixer_APTaps[i].Target1 = 1.0f;
- }
-
- /*
- * Set the maximum block size to the smallest delay size
- */
- pPrivate->MaxBlkLen = Temp;
- if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
- }
- if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
- }
- }
- if (pPrivate->AB_Selection)
- {
- pPrivate->AB_Selection = 0;
- }
- else
- {
- pPrivate->AB_Selection = 1;
- }
-
-
- /*
- * Limit the maximum block length
- */
- /* Just as a precausion, but no problem if we remove this line */
- pPrivate->MaxBlkLen = pPrivate->MaxBlkLen - 2;
- if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
- {
- pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
- }
- }
-
-
-
- /*
- * Update the low pass filter coefficient
- */
- if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 Temp;
- LVM_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)
- {
- Temp = (LVM_INT32)(ScaleTable[i] * Damping);
- }
- else
- {
- Temp = Damping;
- }
- if(Temp <= (LVM_INT32)(LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega(Temp, pPrivate->NewParams.SampleRate);
- LVM_FO_LPF(Omega, &Coeffs);
- }
- else
- {
- Coeffs.A0 = 1;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- }
- FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i],
- &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
- }
- }
-
-
- /*
- * Update All-pass filter mixer time constants
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
- {
- LVM_INT16 i;
- LVM_FLOAT Alpha;
- LVM_FLOAT AlphaTap;
-
- Alpha = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
- 1);
-
- AlphaTap = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
- 1);
-
- for (i = 0; i < 4; i++)
- {
- pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
- pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
- pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
- pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
- }
- }
-
-
- /*
- * Update the feed back gain
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_FLOAT G[4]; /* Feedback gain (Q7.24) */
-
- if(pPrivate->NewParams.T60 == 0)
- {
- G[3] = 0;
- G[2] = 0;
- G[1] = 0;
- G[0] = 0;
- }
- else
- {
- LVM_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++)
- {
- Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
- if(Temp1 >= (4))
- {
- G[i] = 0;
- }
- else if((Temp1 >= (2)))
- {
- Temp2 = LVM_Power10(-(Temp1 / 2.0f));
- Temp1 = LVM_Power10(-(Temp1 / 2.0f));
- Temp1 = Temp1 * Temp2;
- }
- else
- {
- Temp1 = LVM_Power10(-(Temp1));
- }
- if (NumberOfDelayLines == 1)
- {
- G[i] = Temp1;
- }
- else
- {
- LVM_FLOAT TempG;
- TempG = Temp1 * ONE_OVER_SQRT_TWO;
- 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];
- }
-
-
- /*
- * Calculate the gain correction
- */
- if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
- {
- LVM_INT32 Index=0;
- LVM_FLOAT Index_FLOAT;
- LVM_INT32 i=0;
- LVM_FLOAT Gain=0;
- LVM_INT32 RoomSize=0;
- LVM_FLOAT T60;
- LVM_FLOAT Coefs[5];
-
-
- if(pPrivate->NewParams.RoomSize == 0)
- {
- RoomSize = 1;
- }
- else
- {
- RoomSize = (LVM_INT32)pPrivate->NewParams.RoomSize;
- }
-
-
- if(pPrivate->NewParams.T60 < 100)
- {
- T60 = 100 * LVREV_T60_SCALE;
- }
- else
- {
- T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
- }
-
- /* Find the nearest room size in table */
- for(i = 0; i < 24; i++)
- {
- if(RoomSize <= LVREV_GainPolyTable[i][0])
- {
- Index = i;
- break;
- }
- }
-
-
- if(RoomSize == LVREV_GainPolyTable[Index][0])
- {
- /* Take table values if the room size is in table */
- for(i = 1; i < 5; i++)
- {
- Coefs[i-1] = LVREV_GainPolyTable[Index][i];
- }
- Coefs[4] = 0;
- Gain = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
- }
- else
- {
- /* Interpolate the gain between nearest room sizes */
-
- LVM_FLOAT Gain1,Gain2;
- LVM_INT32 Tot_Dist,Dist;
-
- 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];
- }
- Coefs[4] = 0;
-
- Gain1 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
-
- /* Get gain for second */
- for(i = 1; i < 5; i++)
- {
- Coefs[i-1] = LVREV_GainPolyTable[Index][i];
- }
- Coefs[4] = 0;
-
- Gain2 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
-
- /* Linear Interpolate the gain */
- Gain = Gain1 + (((Gain2 - Gain1) * Dist) / (Tot_Dist));
- }
-
-
- /*
- * Get the inverse of gain: Q.15
- * Gain is mostly above one except few cases, take only gains above 1
- */
- if(Gain < 1)
- {
- pPrivate->Gain = 1;
- }
- 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;
- }
-
-
- /*
- * 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;
-
- for (i = 0; i < 4; i++)
- {
- pPrivate->Mixer_SGFeedback[i].Target = b;
- pPrivate->Mixer_SGFeedforward[i].Target = b;
- }
- }
-
-
- /*
- * Update the bypass mixer time constant
- */
- if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_UINT16 NumChannels = 1; /* Assume MONO format */
- LVM_FLOAT Alpha;
-
- Alpha = LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
- NumChannels);
- pPrivate->FeedbackMixer[0].Alpha = Alpha;
- pPrivate->FeedbackMixer[1].Alpha = Alpha;
- pPrivate->FeedbackMixer[2].Alpha = Alpha;
- pPrivate->FeedbackMixer[3].Alpha = Alpha;
-
- NumChannels = 2; /* Always stereo output */
- pPrivate->BypassMixer.Alpha1 = LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
- pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
- pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
- }
-
-
- /*
- * Update the bypass mixer targets
- */
- if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
- (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
- {
- pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
- {
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- }
- if (pPrivate->NewParams.Level != 0)
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
-
- if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
- {
- if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
- {
- pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
- pPrivate->BypassMixer.Target1 = 0x00000000;
-
- pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
- OperatingMode = LVM_MODE_ON;
- if (pPrivate->NewParams.Level == 0)
- {
- pPrivate->bDisableReverb = LVM_TRUE;
- }
- else
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
- else if (pPrivate->bFirstControl == LVM_FALSE)
- {
- pPrivate->BypassMixer.Target2 = 0x00000000;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- pPrivate->GainMixer.Target = 0.03125f;
- OperatingMode = LVM_MODE_ON;
- }
- else
- {
- OperatingMode = LVM_MODE_OFF;
- }
- }
-
-
- /* If it is the first call to ApplyNew settings force the current to the target \
- to begin immediate playback of the effect */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
- pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
- }
-
-
- /*
- * Copy the new parameters
- */
- pPrivate->CurrentParams = pPrivate->NewParams;
- pPrivate->CurrentParams.OperatingMode = OperatingMode;
-
-
- /*
- * Update flag
- */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->bFirstControl = LVM_FALSE;
- }
-
-
- return LVREV_SUCCESS;
-}
-#endif /*BUILD_FLOAT*/
-/****************************************************************************************/
-/* */
-/* FUNCTION: BypassMixer_Callback */
-/* */
-/* DESCRIPTION: */
-/* Controls the On to Off operating mode transition */
-/* */
-/* PARAMETERS: */
-/* pPrivate Pointer to the instance private parameters */
-/* */
-/* RETURNS: */
-/* LVREV_Success Succeeded */
-/* LVREV_NULLADDRESS When pPrivate is NULL */
-/* */
-/* NOTES: */
-/* */
-/****************************************************************************************/
-LVM_INT32 BypassMixer_Callback (void *pCallbackData,
- void *pGeneralPurpose,
- LVM_INT16 GeneralPurpose )
-{
-
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)pCallbackData;
-
-
- /*
- * Avoid build warnings
- */
- (void)pGeneralPurpose;
- (void)GeneralPurpose;
-
-
- /*
- * Turn off
- */
- pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_OFF;
- 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_ApplyNewSettings.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
new file mode 100644
index 0000000..1f0d39b
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
@@ -0,0 +1,633 @@
+/*
+ * Copyright (C) 2004-2010 NXP Software
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "Filter.h"
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_ApplyNewSettings */
+/* */
+/* DESCRIPTION: */
+/* Applies the new control parameters */
+/* */
+/* PARAMETERS: */
+/* pPrivate Pointer to the instance private parameters */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When pPrivate is NULL */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
+{
+
+ LVM_Mode_en OperatingMode;
+ LVM_INT32 NumberOfDelayLines;
+
+ /* Check for NULL pointer */
+ if(pPrivate == LVM_NULL)
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ OperatingMode = pPrivate->NewParams.OperatingMode;
+
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ NumberOfDelayLines = 4;
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ NumberOfDelayLines = 2;
+ }
+ else
+ {
+ NumberOfDelayLines = 1;
+ }
+
+ /*
+ * Update the high pass filter coefficients
+ */
+ if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_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,
+ 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;
+
+ Coeffs.A0 = 1;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
+
+ /*
+ * Do not apply filter if w =2*pi*fc/fs >= 2.9
+ */
+ if(Omega <= (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,
+ sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
+ }
+
+ /*
+ * Calculate the room size parameter
+ */
+ if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
+ {
+ /* Room size range is 10ms to 200ms
+ * 0% -- 10ms
+ * 50% -- 65ms
+ * 100% -- 120ms
+ */
+ pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5) / 10);
+ }
+
+ /*
+ * Update the T delay number of samples and the all pass delay number of samples
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_UINT32 Temp;
+ LVM_INT32 APDelaySize;
+ LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
+ LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
+ LVM_INT16 i;
+ LVM_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 */
+
+ Temp1=(LVM_FLOAT)DelayLengthSamples;
+ Temp = (LVM_UINT32)(Temp1 * ScaleTable[i]);
+ }
+ else
+ {
+ Temp = DelayLengthSamples;
+ }
+ APDelaySize = Temp / 1500;
+
+ /*
+ * Set the fixed delay
+ */
+
+ 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)
+ {
+ /* Smooth from tap A to tap B */
+ pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
+ Temp - APDelaySize];
+ pPrivate->B_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target1 = 0;
+ pPrivate->Mixer_APTaps[i].Target2 = 1.0f;
+ }
+ else
+ {
+ /* Smooth from tap B to tap A */
+ pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - \
+ Temp - APDelaySize];
+ pPrivate->A_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target2 = 0;
+ pPrivate->Mixer_APTaps[i].Target1 = 1.0f;
+ }
+
+ /*
+ * Set the maximum block size to the smallest delay size
+ */
+ pPrivate->MaxBlkLen = Temp;
+ if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
+ }
+ if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
+ }
+ }
+ if (pPrivate->AB_Selection)
+ {
+ pPrivate->AB_Selection = 0;
+ }
+ else
+ {
+ pPrivate->AB_Selection = 1;
+ }
+
+ /*
+ * Limit the maximum block length
+ */
+ /* Just as a precausion, but no problem if we remove this line */
+ pPrivate->MaxBlkLen = pPrivate->MaxBlkLen - 2;
+ if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
+ {
+ pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
+ }
+ }
+
+ /*
+ * Update the low pass filter coefficient
+ */
+ if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_INT32 Temp;
+ LVM_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)
+ {
+ Temp = (LVM_INT32)(ScaleTable[i] * Damping);
+ }
+ else
+ {
+ Temp = Damping;
+ }
+ if(Temp <= (LVM_INT32)(LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega(Temp, pPrivate->NewParams.SampleRate);
+ LVM_FO_LPF(Omega, &Coeffs);
+ }
+ else
+ {
+ Coeffs.A0 = 1;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ }
+ FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i],
+ &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
+ }
+ }
+
+ /*
+ * Update All-pass filter mixer time constants
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
+ {
+ LVM_INT16 i;
+ LVM_FLOAT Alpha;
+ LVM_FLOAT AlphaTap;
+
+ Alpha = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ 1);
+
+ AlphaTap = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ 1);
+
+ for (i = 0; i < 4; i++)
+ {
+ pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
+ pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
+ pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
+ pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
+ }
+ }
+
+ /*
+ * Update the feed back gain
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_FLOAT G[4]; /* Feedback gain (Q7.24) */
+
+ if(pPrivate->NewParams.T60 == 0)
+ {
+ G[3] = 0;
+ G[2] = 0;
+ G[1] = 0;
+ G[0] = 0;
+ }
+ else
+ {
+ LVM_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++)
+ {
+ Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
+ if(Temp1 >= (4))
+ {
+ G[i] = 0;
+ }
+ else if((Temp1 >= (2)))
+ {
+ Temp2 = LVM_Power10(-(Temp1 / 2.0f));
+ Temp1 = LVM_Power10(-(Temp1 / 2.0f));
+ Temp1 = Temp1 * Temp2;
+ }
+ else
+ {
+ Temp1 = LVM_Power10(-(Temp1));
+ }
+ if (NumberOfDelayLines == 1)
+ {
+ G[i] = Temp1;
+ }
+ else
+ {
+ LVM_FLOAT TempG;
+ TempG = Temp1 * ONE_OVER_SQRT_TWO;
+ 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];
+ }
+
+ /*
+ * Calculate the gain correction
+ */
+ if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
+ {
+ LVM_INT32 Index=0;
+ LVM_FLOAT Index_FLOAT;
+ LVM_INT32 i=0;
+ LVM_FLOAT Gain=0;
+ LVM_INT32 RoomSize=0;
+ LVM_FLOAT T60;
+ LVM_FLOAT Coefs[5];
+
+ if(pPrivate->NewParams.RoomSize == 0)
+ {
+ RoomSize = 1;
+ }
+ else
+ {
+ RoomSize = (LVM_INT32)pPrivate->NewParams.RoomSize;
+ }
+
+ if(pPrivate->NewParams.T60 < 100)
+ {
+ T60 = 100 * LVREV_T60_SCALE;
+ }
+ else
+ {
+ T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
+ }
+
+ /* Find the nearest room size in table */
+ for(i = 0; i < 24; i++)
+ {
+ if(RoomSize <= LVREV_GainPolyTable[i][0])
+ {
+ Index = i;
+ break;
+ }
+ }
+
+ if(RoomSize == LVREV_GainPolyTable[Index][0])
+ {
+ /* Take table values if the room size is in table */
+ for(i = 1; i < 5; i++)
+ {
+ Coefs[i-1] = LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4] = 0;
+ Gain = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+ }
+ else
+ {
+ /* Interpolate the gain between nearest room sizes */
+
+ LVM_FLOAT Gain1,Gain2;
+ LVM_INT32 Tot_Dist,Dist;
+
+ 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];
+ }
+ Coefs[4] = 0;
+
+ Gain1 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+
+ /* Get gain for second */
+ for(i = 1; i < 5; i++)
+ {
+ Coefs[i-1] = LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4] = 0;
+
+ Gain2 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+
+ /* Linear Interpolate the gain */
+ Gain = Gain1 + (((Gain2 - Gain1) * Dist) / (Tot_Dist));
+ }
+
+ /*
+ * Get the inverse of gain: Q.15
+ * Gain is mostly above one except few cases, take only gains above 1
+ */
+ if(Gain < 1)
+ {
+ pPrivate->Gain = 1;
+ }
+ 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;
+ }
+
+ /*
+ * 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;
+
+ for (i = 0; i < 4; i++)
+ {
+ pPrivate->Mixer_SGFeedback[i].Target = b;
+ pPrivate->Mixer_SGFeedforward[i].Target = b;
+ }
+ }
+
+ /*
+ * Update the bypass mixer time constant
+ */
+ if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_UINT16 NumChannels = 1; /* Assume MONO format */
+ LVM_FLOAT Alpha;
+
+ Alpha = LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ NumChannels);
+ pPrivate->FeedbackMixer[0].Alpha = Alpha;
+ pPrivate->FeedbackMixer[1].Alpha = Alpha;
+ pPrivate->FeedbackMixer[2].Alpha = Alpha;
+ pPrivate->FeedbackMixer[3].Alpha = Alpha;
+
+ NumChannels = 2; /* Always stereo output */
+ pPrivate->BypassMixer.Alpha1 = LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC,
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
+ pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
+ pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
+ }
+
+ /*
+ * Update the bypass mixer targets
+ */
+ if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
+ (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
+ {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+ if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
+ {
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ }
+ if (pPrivate->NewParams.Level != 0)
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+
+ if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
+ {
+ if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
+ {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+
+ pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
+ OperatingMode = LVM_MODE_ON;
+ if (pPrivate->NewParams.Level == 0)
+ {
+ pPrivate->bDisableReverb = LVM_TRUE;
+ }
+ else
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+ else if (pPrivate->bFirstControl == LVM_FALSE)
+ {
+ pPrivate->BypassMixer.Target2 = 0x00000000;
+ pPrivate->BypassMixer.Target1 = 0x00000000;
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ pPrivate->GainMixer.Target = 0.03125f;
+ OperatingMode = LVM_MODE_ON;
+ }
+ else
+ {
+ OperatingMode = LVM_MODE_OFF;
+ }
+ }
+
+ /* If it is the first call to ApplyNew settings force the current to the target \
+ to begin immediate playback of the effect */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
+ pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
+ }
+
+ /*
+ * Copy the new parameters
+ */
+ pPrivate->CurrentParams = pPrivate->NewParams;
+ pPrivate->CurrentParams.OperatingMode = OperatingMode;
+
+ /*
+ * Update flag
+ */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->bFirstControl = LVM_FALSE;
+ }
+
+ return LVREV_SUCCESS;
+}
+/****************************************************************************************/
+/* */
+/* FUNCTION: BypassMixer_Callback */
+/* */
+/* DESCRIPTION: */
+/* Controls the On to Off operating mode transition */
+/* */
+/* PARAMETERS: */
+/* pPrivate Pointer to the instance private parameters */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When pPrivate is NULL */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+LVM_INT32 BypassMixer_Callback (void *pCallbackData,
+ void *pGeneralPurpose,
+ LVM_INT16 GeneralPurpose )
+{
+
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)pCallbackData;
+
+ /*
+ * Avoid build warnings
+ */
+ (void)pGeneralPurpose;
+ (void)GeneralPurpose;
+
+ /*
+ * Turn off
+ */
+ pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_OFF;
+ 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.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
similarity index 70%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
index 9491016..586539f 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "VectorArithmetic.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_ClearAudioBuffers */
@@ -47,7 +46,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
@@ -61,36 +59,14 @@
* Clear all filter tap data, delay-lines and other signal related data
*/
-#ifdef BUILD_FLOAT
LoadConst_Float(0,
- (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- 2);
+ (LVM_FLOAT *)&pLVREV_Private->pFastData->HPTaps,
+ 2);
LoadConst_Float(0,
- (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- 2);
-#else
- LoadConst_32(0,
- (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
+ (LVM_FLOAT *)&pLVREV_Private->pFastData->LPTaps,
2);
- LoadConst_32(0,
- (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
- 2);
-#endif
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[3], (LVM_INT16)LVREV_MAX_T3_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[2], (LVM_INT16)LVREV_MAX_T2_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
@@ -100,35 +76,21 @@
LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
return LVREV_SUCCESS;
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
index 7cee26d..e0b0142 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
@@ -22,7 +22,6 @@
/****************************************************************************************/
#include "LVREV_Private.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetControlParameters */
@@ -49,7 +48,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
similarity index 74%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
index 3366bcb..68f883a 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "InstAlloc.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetInstanceHandle */
@@ -59,7 +58,6 @@
LVM_INT16 i;
LVM_UINT16 MaxBlockSize;
-
/*
* Check for error conditions
*/
@@ -108,7 +106,6 @@
/*
* Zero all memory regions
*/
-#ifdef BUILD_FLOAT
LoadConst_Float(0,
(LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
(LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / \
@@ -125,12 +122,6 @@
(LVM_FLOAT *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
(LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / \
sizeof(LVM_FLOAT)));
-#else
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size)/sizeof(LVM_INT16)));
-#endif
/*
* Set the instance handle if not already initialised
*/
@@ -159,71 +150,31 @@
MaxBlockSize=pInstanceParams->MaxBlockSize;
}
-
/*
* Set the data, coefficient and temporary memory pointers
*/
- pLVREV_Private->pFastData = InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st)); /* Fast data memory base address */
-#ifndef BUILD_FLOAT
+ /* 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] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 4; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[3] ,(LVM_INT16)LVREV_MAX_T3_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[2] ,(LVM_INT16)LVREV_MAX_T2_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[1] ,(LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] ,(LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
- {
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 2; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[1] , (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
- {
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 1; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-#else
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
- {
- pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * \
+ pLVREV_Private->pDelay_T[3] =
+ (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * \
sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * \
+ pLVREV_Private->pDelay_T[2] =
+ (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * \
sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ pLVREV_Private->pDelay_T[1] =
+ (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
+ pLVREV_Private->pDelay_T[0] =
+ (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
sizeof(LVM_FLOAT));
for(i = 0; i < 4; i++)
{
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ pLVREV_Private->pScratchDelayLine[i] = (LVM_FLOAT *)InstAlloc_AddMember(&Temporary,
sizeof(LVM_FLOAT) * \
MaxBlockSize);
}
@@ -236,15 +187,17 @@
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
{
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ pLVREV_Private->pDelay_T[1] = (LVM_FLOAT *)
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
+ pLVREV_Private->pDelay_T[0] = (LVM_FLOAT *)
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
sizeof(LVM_FLOAT));
for(i = 0; i < 2; i++)
{
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ pLVREV_Private->pScratchDelayLine[i] = (LVM_FLOAT *)InstAlloc_AddMember(&Temporary,
sizeof(LVM_FLOAT) * \
MaxBlockSize);
}
@@ -255,20 +208,19 @@
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
{
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData,
+ pLVREV_Private->pDelay_T[0] = (LVM_FLOAT *)InstAlloc_AddMember(&FastData,
LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
for(i = 0; i < 1; i++)
{
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary,
+ 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);
}
-#endif
/* All-pass delay buffer addresses and sizes */
pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
@@ -276,28 +228,24 @@
pLVREV_Private->T[3] = LVREV_MAX_T3_DELAY;
pLVREV_Private->AB_Selection = 1; /* Select smoothing A to B */
-
- pLVREV_Private->pFastCoef = InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st)); /* Fast coefficient memory base address */
-#ifndef BUILD_FLOAT
- pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch */
- pLVREV_Private->pInputSave = InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input save for end mix */
- LoadConst_32(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize*2));
-#else
+ /* Fast coefficient memory base address */
+ pLVREV_Private->pFastCoef =
+ (LVREV_FastCoef_st *)InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
/* General purpose scratch */
- pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
+ pLVREV_Private->pScratch =
+ (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
MaxBlockSize);
/* Mono->stereo input save for end mix */
- pLVREV_Private->pInputSave = InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * \
+ pLVREV_Private->pInputSave =
+ (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * \
MaxBlockSize);
LoadConst_Float(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize * 2));
-#endif
/*
* Save the instance parameters in the instance structure
*/
pLVREV_Private->InstanceParams = *pInstanceParams;
-
/*
* Set the parameters to invalid
*/
@@ -309,7 +257,6 @@
pLVREV_Private->bFirstControl = LVM_TRUE;
pLVREV_Private->bDisableReverb = LVM_FALSE;
-
/*
* Set mixer parameters
*/
@@ -330,7 +277,6 @@
pLVREV_Private->RoomSizeInms = 100; // 100 msec
-
/*
* Set the output gain mixer parameters
*/
@@ -339,13 +285,8 @@
pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
-#ifndef BUILD_FLOAT
- pLVREV_Private->GainMixer.Current = 0x03ffffff;
- pLVREV_Private->GainMixer.Target = 0x03ffffff;
-#else
pLVREV_Private->GainMixer.Current = 0.03125f;//0x03ffffff;
pLVREV_Private->GainMixer.Target = 0.03125f;//0x03ffffff;
-#endif
/*
* Set the All-Pass Filter mixers
@@ -368,11 +309,7 @@
pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
-#ifndef BUILD_FLOAT
- pLVREV_Private->Mixer_APTaps[i].Target1 = 0x7fffffff;
-#else
pLVREV_Private->Mixer_APTaps[i].Target1 = 1;
-#endif
/* Feedforward mixer */
pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
pLVREV_Private->Mixer_SGFeedforward[i].pCallbackHandle = LVM_NULL;
@@ -408,7 +345,6 @@
pLVREV_Private->A_DelaySize[3] = LVREV_MAX_AP3_DELAY;
pLVREV_Private->B_DelaySize[3] = LVREV_MAX_AP3_DELAY;
-
LVREV_ClearAudioBuffers(*phInstance);
return LVREV_SUCCESS;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
similarity index 87%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
index f6d446b..f59933c 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
@@ -68,7 +68,6 @@
LVM_INT16 i;
LVM_UINT16 MaxBlockSize;
-
/*
* Check for error conditions
*/
@@ -109,7 +108,6 @@
InstAlloc_Init(&FastCoef, (void *)LVM_NULL);
InstAlloc_Init(&Temporary, (void *)LVM_NULL);
-
/*
* Fill in the memory table
*/
@@ -123,7 +121,6 @@
return(LVREV_NULLADDRESS);
}
-
/*
* Select the maximum internal block size
*/
@@ -145,7 +142,6 @@
MaxBlockSize=pInstanceParams->MaxBlockSize;
}
-
/*
* Slow data memory
*/
@@ -154,51 +150,33 @@
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = LVM_NULL;
-
/*
* Persistent fast data memory
*/
InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&FastData);
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = LVM_NULL;
-
/*
* Persistent fast coefficient memory
*/
@@ -207,29 +185,19 @@
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
-
/*
* Temporary fast memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch memory */
- InstAlloc_AddMember(&Temporary, 2*sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input saved for end mix */
-#else
/* General purpose scratch memory */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
/* Mono->stereo input saved for end mix */
InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
for(i=0; i<4; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -237,12 +205,8 @@
{
for(i=0; i<2; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -250,12 +214,8 @@
{
for(i=0; i<1; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -268,14 +228,12 @@
{
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Read back memory allocation table
*/
*pMemoryTable = pLVREV_Private->MemoryTable;
}
-
return(LVREV_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
index c915ac0..2c27c6e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -18,11 +18,6 @@
#ifndef __LVREV_PRIVATE_H__
#define __LVREV_PRIVATE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -36,43 +31,22 @@
#include "Mixer.h"
#include "LVM_Macros.h"
-
/****************************************************************************************/
/* */
/* Defines */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-/* General */
-#define ONE_OVER_SQRT_TWO 23170 /* 1/sqrt(2) * 2^15 */
-#define LVREV_B_8_on_1000 17179869 /* 0.8 * 2^31 */
-#define LVREV_HEADROOM 8192 /* -12dB * 2^15 */
-#define LVREV_2_9_INQ29 1583769190L /* 2.9 in Q29 format */
-#define LVREV_MIN3DB 0x5A82 /* -3dB in Q15 format */
-#else
/* General */
#define ONE_OVER_SQRT_TWO 0.707107f /* 1/sqrt(2) * 2^15 */
#define LVREV_B_8_on_1000 0.008f /* 0.8 * 2^31 */
#define LVREV_HEADROOM 0.25f /* -12dB * 2^15 */
#define LVREV_2_9_INQ29 2.9f /* 2.9 in Q29 format */
#define LVREV_MIN3DB 0.7079457f /* -3dB in Q15 format */
-#endif
/* Intenal constants */
#define LVREV_LP_Poly_Order 4
#define LVREV_LP_Poly_Shift 5
-#ifndef BUILD_FLOAT
-#define LVREV_T_3_Power_0_on_4 32768
-#define LVREV_T_3_Power_1_on_4 43125
-#define LVREV_T_3_Power_2_on_4 56755
-#define LVREV_T_3_Power_3_on_4 74694
-#define LVREV_T60_SCALE 306774 /*(32767/7000)<<16 */
-#define LVREV_T_3_Power_minus0_on_4 32767 /* 3^(-0/4) * 2^15 */
-#define LVREV_T_3_Power_minus1_on_4 24898 /* 3^(-1/4) * 2^15 */
-#define LVREV_T_3_Power_minus2_on_4 18919 /* 3^(-2/4) * 2^15 */
-#define LVREV_T_3_Power_minus3_on_4 14375 /* 3^(-3/4) * 2^15 */
-#else/*BUILD_FLOAT*/
#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
#define LVREV_T_3_Power_0_on_4 1.0f
@@ -83,18 +57,7 @@
#define LVREV_T_3_Power_minus1_on_4 0.759836f /* 3^(-1/4) * 2^15 */
#define LVREV_T_3_Power_minus2_on_4 0.577350f /* 3^(-2/4) * 2^15 */
#define LVREV_T_3_Power_minus3_on_4 0.438691f /* 3^(-3/4) * 2^15 */
-#endif
-#ifndef HIGHER_FS
-#define LVREV_MAX_T3_DELAY 2527 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T2_DELAY 3326 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T1_DELAY 4377 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T0_DELAY 5760 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
-#define LVREV_MAX_AP3_DELAY 1685 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP2_DELAY 2218 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP1_DELAY 2918 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP0_DELAY 3840 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
-#else
/* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
#define LVREV_MAX_T3_DELAY 10108
/* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
@@ -111,7 +74,6 @@
#define LVREV_MAX_AP1_DELAY 11672
/* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
#define LVREV_MAX_AP0_DELAY 15360
-#endif
#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
@@ -120,11 +82,7 @@
#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
/* Parameter limits */
-#ifndef HIGHER_FS
-#define LVREV_NUM_FS 9 /* Number of supported sample rates */
-#else
#define LVREV_NUM_FS 13 /* Number of supported sample rates */
-#endif
#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
@@ -137,81 +95,11 @@
#define LVREV_MAX_DAMPING 100 /* Maximum damping, 100% */
#define LVREV_MAX_ROOMSIZE 100 /* Maximum room size, 100% */
-
-
/****************************************************************************************/
/* */
/* Structures */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-/* Fast data structure */
-typedef struct
-{
-
- Biquad_1I_Order1_Taps_t HPTaps; /* High pass filter taps */
- Biquad_1I_Order1_Taps_t LPTaps; /* Low pass filter taps */
- Biquad_1I_Order1_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
-
-} LVREV_FastData_st;
-
-
-/* Fast coefficient structure */
-typedef struct
-{
-
- Biquad_Instance_t HPCoefs; /* High pass filter coefficients */
- Biquad_Instance_t LPCoefs; /* Low pass filter coefficients */
- Biquad_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
-
-} LVREV_FastCoef_st;
-
-
-/* Instance parameter structure */
-typedef struct
-{
- /* General */
- LVREV_InstanceParams_st InstanceParams; /* Initialisation time instance parameters */
- LVREV_MemoryTable_st MemoryTable; /* Memory table */
- LVREV_ControlParams_st CurrentParams; /* Parameters being used */
- LVREV_ControlParams_st NewParams; /* New parameters from the calling application */
- LVM_CHAR bControlPending; /* Flag to indicate new parameters are available */
- LVM_CHAR bFirstControl; /* Flag to indicate that the control function is called for the first time */
- LVM_CHAR bDisableReverb; /* Flag to indicate that the mix level is 0% and the reverb can be disabled */
- LVM_INT32 RoomSizeInms; /* Room size in msec */
- LVM_INT32 MaxBlkLen; /* Maximum block size for internal processing */
-
- /* Aligned memory pointers */
- LVREV_FastData_st *pFastData; /* Fast data memory base address */
- LVREV_FastCoef_st *pFastCoef; /* Fast coefficient memory base address */
- LVM_INT32 *pScratchDelayLine[4]; /* Delay line scratch memory */
- LVM_INT32 *pScratch; /* Multi ussge scratch */
- LVM_INT32 *pInputSave; /* Reverb block input save for dry/wet mixing*/
-
- /* Feedback matrix */
- Mix_1St_Cll_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression caused by feedback Gain */
-
- /* All-Pass Filter */
- LVM_INT32 T[4]; /* Maximum delay size of buffer */
- LVM_INT32 *pDelay_T[4]; /* Pointer to delay buffers */
- LVM_INT32 Delay_AP[4]; /* Offset to AP delay buffer start */
- LVM_INT16 AB_Selection; /* Smooth from tap A to B when 1 otherwise B to A */
- LVM_INT32 A_DelaySize[4]; /* A delay length in samples */
- LVM_INT32 B_DelaySize[4]; /* B delay length in samples */
- LVM_INT32 *pOffsetA[4]; /* Offset for the A delay tap */
- LVM_INT32 *pOffsetB[4]; /* Offset for the B delay tap */
- Mix_2St_Cll_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
- Mix_1St_Cll_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
- Mix_1St_Cll_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
-
- /* Output gain */
- Mix_2St_Cll_t BypassMixer; /* Dry/wet mixer */
- LVM_INT16 Gain; /* Gain applied to output to maintain average signal power */
- Mix_1St_Cll_t GainMixer; /* Gain smoothing */
-
-} LVREV_Instance_st;
-
-#else /* BUILD_FLOAT */
/* Fast data structure */
typedef struct
@@ -222,7 +110,6 @@
} LVREV_FastData_st;
-
/* Fast coefficient structure */
typedef struct
{
@@ -262,7 +149,6 @@
Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression \
caused by feedback Gain */
-
/* All-Pass Filter */
LVM_INT32 T[4]; /* Maximum delay size of buffer */
LVM_FLOAT *pDelay_T[4]; /* Pointer to delay buffers */
@@ -285,7 +171,6 @@
} LVREV_Instance_st;
-#endif
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -293,26 +178,14 @@
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st *pPrivate);
-#ifdef BUILD_FLOAT
void ReverbBlock(LVM_FLOAT *pInput,
LVM_FLOAT *pOutput,
LVREV_Instance_st *pPrivate,
LVM_UINT16 NumSamples);
-#else
-void ReverbBlock(LVM_INT32 *pInput,
- LVM_INT32 *pOutput,
- LVREV_Instance_st *pPrivate,
- LVM_UINT16 NumSamples);
-#endif
LVM_INT32 BypassMixer_Callback(void *pCallbackData,
void *pGeneralPurpose,
LVM_INT16 GeneralPurpose );
-
-#ifdef __cplusplus
-}
-#endif
-
#endif /** __LVREV_PRIVATE_H__ **/
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
similarity index 61%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
index 1d1283e..35f9ad8 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "VectorArithmetic.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_Process */
@@ -46,26 +45,14 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
const LVM_UINT16 NumSamples)
-#else
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_INT32 *pInData,
- LVM_INT32 *pOutData,
- const LVM_UINT16 NumSamples)
-#endif
{
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-#ifdef BUILD_FLOAT
LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
LVM_FLOAT *pOutput = pOutData;
-#else
- LVM_INT32 *pInput = (LVM_INT32 *)pInData;
- LVM_INT32 *pOutput = pOutData;
-#endif
LVM_INT32 SamplesToProcess, RemainingSamples;
LVM_INT32 format = 1;
@@ -117,15 +104,6 @@
/*
* Copy the data to the output buffer, convert to stereo is required
*/
-#ifndef BUILD_FLOAT
- if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
- MonoTo2I_32(pInput, pOutput, NumSamples);
- } else {
- Copy_16((LVM_INT16 *)pInput,
- (LVM_INT16 *)pOutput,
- (LVM_INT16)(NumSamples << 2)); // 32 bit data, stereo
- }
-#else
if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
MonoTo2I_Float(pInput, pOutput, NumSamples);
} else {
@@ -133,7 +111,6 @@
pOutput,
(LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
}
-#endif
}
return LVREV_SUCCESS;
@@ -164,20 +141,13 @@
}
ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
-#ifdef BUILD_FLOAT
pInput = (LVM_FLOAT *)(pInput + (SamplesToProcess * format));
pOutput = (LVM_FLOAT *)(pOutput + (SamplesToProcess * 2)); // Always stereo output
-#else
- pInput = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
- pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2));
-#endif
}
return LVREV_SUCCESS;
}
-
-
/****************************************************************************************/
/* */
/* FUNCTION: ReverbBlock */
@@ -200,311 +170,6 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
-{
- LVM_INT16 j, size;
- LVM_INT32 *pDelayLine;
- LVM_INT32 *pDelayLineInput = pPrivate->pScratch;
- LVM_INT32 *pScratch = pPrivate->pScratch;
- LVM_INT32 *pIn;
- LVM_INT32 *pTemp = pPrivate->pInputSave;
- LVM_INT32 NumberOfDelayLines;
-
- /******************************************************************************
- * All calculations will go into the buffer pointed to by pTemp, this will *
- * then be mixed with the original input to create the final output. *
- * *
- * When INPLACE processing is selected this must be a temporary buffer and *
- * hence this is the worst case, so for simplicity this will ALWAYS be so *
- * *
- * The input buffer will remain untouched until the output of the mixer if *
- * INPLACE processing is selected. *
- * *
- * The temp buffer will always be NumSamples in size regardless of MONO or *
- * STEREO input. In the case of stereo input all processing is done in MONO *
- * and the final output is converted to STEREO after the mixer *
- ******************************************************************************/
-
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4 )
- {
- NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2 )
- {
- NumberOfDelayLines = 2;
- }
- else
- {
- NumberOfDelayLines = 1;
- }
-
- if(pPrivate->CurrentParams.SourceFormat == LVM_MONO)
- {
- pIn = pInput;
- }
- else
- {
- /*
- * Stereo to mono conversion
- */
-
- From2iToMono_32( pInput,
- pTemp,
- (LVM_INT16)NumSamples);
-
- pIn = pTemp;
- }
-
- Mult3s_32x16(pIn,
- (LVM_INT16)LVREV_HEADROOM,
- pTemp,
- (LVM_INT16)NumSamples);
-
- /*
- * High pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->HPCoefs,
- pTemp,
- pTemp,
- (LVM_INT16)NumSamples);
- /*
- * Low pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->LPCoefs,
- pTemp,
- pTemp,
- (LVM_INT16)NumSamples);
-
- /*
- * Process all delay lines
- */
-
- for(j = 0; j < NumberOfDelayLines; j++)
- {
- pDelayLine = pPrivate->pScratchDelayLine[j];
-
- /*
- * All-pass filter with pop and click suppression
- */
- /* Get the smoothed, delayed output. Put it in the output buffer */
- MixSoft_2St_D32C31_SAT(&pPrivate->Mixer_APTaps[j],
- pPrivate->pOffsetA[j],
- pPrivate->pOffsetB[j],
- pDelayLine,
- (LVM_INT16)NumSamples);
- /* Re-align the all pass filter delay buffer and copying the fixed delay data to the AP delay in the process */
- Copy_16((LVM_INT16 *)&pPrivate->pDelay_T[j][NumSamples],
- (LVM_INT16 *)pPrivate->pDelay_T[j],
- (LVM_INT16)((pPrivate->T[j]-NumSamples) << 1)); /* 32-bit data */
- /* Apply the smoothed feedback and save to fixed delay input (currently empty) */
- MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
- pDelayLine,
- &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Sum into the AP delay line */
- Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- -0x7fff, /* Invert since the feedback coefficient is negative */
- &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Apply smoothed feedforward sand save to fixed delay input (currently empty) */
- MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedforward[j],
- &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
- &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Sum into the AP output */
- Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- 0x7fff,
- pDelayLine,
- (LVM_INT16)NumSamples);
-
- /*
- * Feedback gain
- */
- MixSoft_1St_D32C31_WRA(&pPrivate->FeedbackMixer[j], pDelayLine, pDelayLine, NumSamples);
-
- /*
- * Low pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->RevLPCoefs[j],
- pDelayLine,
- pDelayLine,
- (LVM_INT16)NumSamples);
- }
-
- /*
- * Apply rotation matrix and delay samples
- */
- for(j = 0; j < NumberOfDelayLines; j++)
- {
-
- Copy_16( (LVM_INT16*)(pTemp),
- (LVM_INT16*)(pDelayLineInput),
- (LVM_INT16)(NumSamples << 1));
-
- /*
- * Rotation matrix mix
- */
- switch(j)
- {
- case 3:
- /*
- * Add delay line 1 and 2 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[2], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- break;
- case 2:
-
- /*
- * Add delay line 0 and 3 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[3], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- break;
- case 1:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- /*
- * Add delay line 0 and 3 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[3], pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * Add delay line 0 and 1 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- break;
- case 0:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- /*
- * Add delay line 1 and 2 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[2], pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
- /*
- * Add delay line 0 and 1 contribution
- */
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * Add delay line 0 contribution
- */
-
- /* SOURCE DESTINATION*/
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
- }
- break;
- default:
- break;
- }
-
- /*
- * Delay samples
- */
- Copy_16((LVM_INT16 *)pDelayLineInput,
- (LVM_INT16 *)&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)(NumSamples << 1)); /* 32-bit data */
-
- }
-
-
- /*
- * Create stereo output
- */
- switch(pPrivate->InstanceParams.NumDelays)
- {
- case LVREV_DELAYLINES_4:
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[3],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[2],
- pPrivate->pScratchDelayLine[1],
- (LVM_INT16)NumSamples);
-
-
- JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
- pPrivate->pScratchDelayLine[1],
- pTemp,
- (LVM_INT16)NumSamples);
-
-
- break;
- case LVREV_DELAYLINES_2:
-
- Copy_16( (LVM_INT16*)pPrivate->pScratchDelayLine[1],
- (LVM_INT16*)pScratch,
- (LVM_INT16)(NumSamples << 1));
-
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0],
- -0x8000,
- pScratch,
- (LVM_INT16)NumSamples);
-
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
-
-
- JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
- pScratch,
- pTemp,
- (LVM_INT16)NumSamples);
- break;
- case LVREV_DELAYLINES_1:
- MonoTo2I_32(pPrivate->pScratchDelayLine[0],
- pTemp,
- (LVM_INT16)NumSamples);
- break;
- default:
- break;
- }
-
-
- /*
- * Dry/wet mixer
- */
-
- size = (LVM_INT16)(NumSamples << 1);
- MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
- pTemp,
- pTemp,
- pOutput,
- size);
-
- /* Apply Gain*/
-
- Shift_Sat_v32xv32 (LVREV_OUTPUTGAIN_SHIFT,
- pOutput,
- pOutput,
- size);
-
- MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
- pOutput,
- pOutput,
- size);
-
- return;
-}
-#else
void ReverbBlock(LVM_FLOAT *pInput, LVM_FLOAT *pOutput,
LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
{
@@ -742,7 +407,6 @@
(LVM_INT16)(NumSamples)); /* 32-bit data */
}
-
/*
* Create stereo output
*/
@@ -756,13 +420,11 @@
pPrivate->pScratchDelayLine[1],
(LVM_INT16)NumSamples);
-
JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
pPrivate->pScratchDelayLine[1],
pTemp,
(LVM_INT16)NumSamples);
-
break;
case LVREV_DELAYLINES_2:
@@ -779,7 +441,6 @@
pPrivate->pScratchDelayLine[0],
(LVM_INT16)NumSamples);
-
JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
pScratch,
pTemp,
@@ -794,7 +455,6 @@
break;
}
-
/*
* Dry/wet mixer
*/
@@ -820,6 +480,5 @@
return;
}
-#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
similarity index 99%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
index dfed28e..2a75559 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
@@ -48,7 +48,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
@@ -67,10 +66,8 @@
(pNewParams->SampleRate != LVM_FS_32000) &&
(pNewParams->SampleRate != LVM_FS_44100) &&
(pNewParams->SampleRate != LVM_FS_48000)
-#ifdef HIGHER_FS
&& (pNewParams->SampleRate != LVM_FS_88200) && (pNewParams->SampleRate != LVM_FS_96000)
&& (pNewParams->SampleRate != LVM_FS_176400) && (pNewParams->SampleRate != LVM_FS_192000)
-#endif
)
#ifdef SUPPORT_MC
|| ((pNewParams->SourceFormat != LVM_STEREO) &&
@@ -84,7 +81,6 @@
return (LVREV_OUTOFRANGE);
}
-
if (pNewParams->Level > LVREV_MAX_LEVEL)
{
return LVREV_OUTOFRANGE;
@@ -120,8 +116,6 @@
return LVREV_OUTOFRANGE;
}
-
-
/*
* Copy the new parameters and set the flag to indicate they are available
*/
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
similarity index 66%
rename from media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
rename to media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
index 1058740..5cd623e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
@@ -21,6 +21,7 @@
/* */
/****************************************************************************************/
#include "LVREV.h"
+#include "LVREV_Tables.h"
/****************************************************************************************/
/* */
@@ -29,19 +30,6 @@
/****************************************************************************************/
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-#ifndef HIGHER_FS
-const LVM_UINT16 LVM_FsTable[] = {
- 8000 ,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#else
const LVM_UINT32 LVM_FsTable[] = {
8000 ,
11025,
@@ -57,23 +45,13 @@
176400,
192000
};
-#endif
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-#ifndef HIGHER_FS
-LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
- if (FsIndex > LVM_FS_48000)
- return 0;
-
- return (LVM_FsTable[FsIndex]);
-}
-#else
LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
if (FsIndex > LVM_FS_192000)
return 0;
return (LVM_FsTable[FsIndex]);
}
-#endif
/* In order to maintain consistant input and out put signal strengths
output gain/attenuation is applied. This gain depends on T60 and Rooms
@@ -95,33 +73,6 @@
*/
/* Normalizing output including Reverb Level part (only shift up)*/
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVREV_GainPolyTable[24][5]={{1,17547434,128867434,-120988896,50761228,},
- {2,18256869,172666902,-193169292,88345744,},
- {3,16591311,139250151,-149667234,66770059,},
- {4,17379977,170835131,-173579321,76278163,},
- {5,18963512,210364934,-228623519,103435022,},
- {6,17796318,135756417,-144084053,64327698,},
- {7,17454695,174593214,-187513064,85146582,},
- {8,17229257,140715570,-145790588,65361740,},
- {9,17000547,163195946,-176733969,79562130,},
- {10,16711699,142476304,-133339887,58366547,},
- {13,18108419,149223697,-161762020,74397589,},
- {15,16682043,124844884,-134284487,60082180,},
- {17,16627346,120936430,-121766674,53146421,},
- {20,17338325,125432694,-126616983,56534237,},
- {25,16489146,99218217,-94597467,40616506,},
- {30,15582373,84479043,-75365006,30952348,},
- {40,16000669,84896611,-75031127,30696306,},
- {50,15087054,71695031,-59349268,23279669,},
- {60,15830714,68672971,-58211201,23671158,},
- {70,15536061,66657972,-55901437,22560153,},
- {75,15013145,48179917,-24138354,5232074,},
- {80,15688738,50195036,-34206760,11515792,},
- {90,16003322,48323661,-35607378,13153872,},
- {100,15955223,48558201,-33706865,11715792,},
- };
-#else
const LVM_FLOAT LVREV_GainPolyTable[24][5]={{1,1.045909f,7.681098f,-7.211500f,3.025605f,},
{2,1.088194f,10.291749f,-11.513787f,5.265817f,},
{3,0.988919f,8.299956f,-8.920862f,3.979806f,},
@@ -147,6 +98,5 @@
{90,0.953872f,2.880315f,-2.122365f,0.784032f,},
{100,0.951005f,2.894294f,-2.009086f,0.698316f,},
};
-#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
index 0658186..e100d8a 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -15,15 +15,9 @@
* limitations under the License.
*/
-
#ifndef _LVREV_TABLES_H_
#define _LVREV_TABLES_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -37,22 +31,10 @@
/* */
/****************************************************************************************/
-#ifndef HIGHER_FS
-extern const LVM_UINT16 LVM_FsTable[];
-extern LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-#else
extern const LVM_UINT32 LVM_FsTable[];
extern LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-#endif
-#ifndef BUILD_FLOAT
-extern LVM_INT32 LVREV_GainPolyTable[24][5];
-#else
-extern LVM_FLOAT LVREV_GainPolyTable[24][5];
-#endif
-#ifdef __cplusplus
-}
-#endif
+extern const LVM_FLOAT LVREV_GainPolyTable[24][5];
#endif /** _LVREV_TABLES_H_ **/
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
index 2038fbb..c9fa7ad 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
@@ -18,14 +18,8 @@
#ifndef _LVPSA_H_
#define _LVPSA_H_
-
#include "LVM_Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/****************************************************************************************/
/* */
/* CONSTANTS DEFINITIONS */
@@ -116,8 +110,6 @@
LVPSA_RETURN_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
} LVPSA_RETURN;
-
-
/*********************************************************************************************************************************
FUNCTIONS PROTOTYPE
**********************************************************************************************************************************/
@@ -216,17 +208,10 @@
/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_FLOAT *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
LVPSA_Time AudioTime );
-#else
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_INT16 *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime );
-#endif
/*********************************************************************************************************************************/
/* */
/* FUNCTION: LVPSA_GetSpectrum */
@@ -288,9 +273,4 @@
LVPSA_RETURN LVPSA_GetInitParams ( pLVPSA_Handle_t hInstance,
LVPSA_InitParams_t *pParams );
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* _LVPSA_H */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
similarity index 79%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
index f6c4ea7..deafaa7 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
@@ -28,7 +28,6 @@
LVPSA_RETURN LVPSA_SetQPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients);
@@ -36,27 +35,11 @@
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients);
-#else
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C16_Coefs_t *pCoefficients);
-
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients);
-
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients);
-#endif
LVPSA_RETURN LVPSA_SetBPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
LVPSA_RETURN LVPSA_ClearFilterHistory( LVPSA_InstancePr_t *pInst);
-
-
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_Control */
@@ -129,7 +112,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_GetInitParams */
@@ -163,7 +145,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ApplyNewSettings */
@@ -188,14 +169,9 @@
LVM_UINT16 Freq;
LVPSA_ControlParams_t Params;
extern LVM_INT16 LVPSA_nSamplesBufferUpdate[];
-#ifndef HIGHER_FS
- extern LVM_UINT16 LVPSA_SampleRateTab[];
-#else
extern LVM_UINT32 LVPSA_SampleRateTab[];
-#endif
extern LVM_UINT16 LVPSA_DownSamplingFactor[];
-
if(pInst == 0)
{
return(LVPSA_ERROR_NULLADDRESS);
@@ -280,11 +256,7 @@
LVPSA_RETURN LVPSA_SetBPFiltersType ( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams )
{
-#ifndef HIGHER_FS
- extern LVM_UINT16 LVPSA_SampleRateTab[]; /* Sample rate table */
-#else
extern LVM_UINT32 LVPSA_SampleRateTab[]; /* Sample rate table */
-#endif
LVM_UINT16 ii; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVPSA_SampleRateTab[(LVM_UINT16)pParams->Fs]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
@@ -298,7 +270,6 @@
fc = (LVM_UINT32)pInst->pFiltersParams[ii].CenterFrequency; /* Get the band centre frequency */
QFactor =(LVM_INT16) pInst->pFiltersParams[ii].QFactor; /* Get the band Q factor */
-
/*
* For each filter set the type of biquad required
*/
@@ -358,22 +329,6 @@
{
case LVPSA_DoublePrecisionFilter:
{
-#ifndef BUILD_FLOAT
- BP_C32_Coefs_t Coefficients;
-
- /*
- * Calculate the double precision coefficients
- */
- LVPSA_BPDoublePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
- &Coefficients);
- /*
- * Set the coefficients
- */
- BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
- &pInst->pBP_Taps[ii],
- &Coefficients);
-#else
BP_FLOAT_Coefs_t Coefficients;
/*
* Calculate the double precision coefficients
@@ -387,29 +342,11 @@
BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
-#endif
break;
}
case LVPSA_SimplePrecisionFilter:
{
-#ifndef BUILD_FLOAT
- BP_C16_Coefs_t Coefficients;
-
- /*
- * Calculate the single precision coefficients
- */
- LVPSA_BPSinglePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
- &pInst->pBP_Taps[ii],
- &Coefficients);
-#else
BP_FLOAT_Coefs_t Coefficients;
/*
@@ -425,7 +362,6 @@
BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
-#endif
break;
}
}
@@ -434,7 +370,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_SetQPFCoefficients */
@@ -458,31 +393,17 @@
{
LVM_UINT16 ii;
LVM_Fs_en Fs = pParams->Fs;
-#ifndef BUILD_FLOAT
- QPD_C32_Coefs *pCoefficients;
- extern QPD_C32_Coefs LVPSA_QPD_Coefs[];
-
- pCoefficients = &LVPSA_QPD_Coefs[(pParams->LevelDetectionSpeed * LVPSA_NR_SUPPORTED_RATE) + Fs];
-#else
QPD_FLOAT_Coefs *pCoefficients;
extern QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
pCoefficients = &LVPSA_QPD_Float_Coefs[(pParams->LevelDetectionSpeed * \
LVPSA_NR_SUPPORTED_RATE) + Fs];
-#endif
-
for (ii = 0; ii < pInst->nRelevantFilters; ii++)
{
-#ifndef BUILD_FLOAT
- LVPSA_QPD_Init (&pInst->pQPD_States[ii],
- &pInst->pQPD_Taps[ii],
- pCoefficients );
-#else
LVPSA_QPD_Init_Float (&pInst->pQPD_States[ii],
&pInst->pQPD_Taps[ii],
pCoefficients );
-#endif
}
return(LVPSA_OK);
@@ -522,7 +443,6 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients)
@@ -531,7 +451,6 @@
extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
extern LVM_FLOAT LVPSA_Float_CosCoef[];
-
/*
* Intermediate variables and temporary values
*/
@@ -549,7 +468,6 @@
LVM_FLOAT t0;
LVM_INT16 i;
-
/*
* Get the filter definition
*/
@@ -589,7 +507,6 @@
}
COS_T0 = COS_T0 * 8; /*LVPSA_CosCoef_float[0]*/ /* Correct the scaling */
-
B1 = ((LVM_FLOAT)0.5 - B2) * (COS_T0); /* B1 = (0.5 - b2) * cos(t0) */
A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
@@ -602,89 +519,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C16_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVPSA_TwoPiOnFsTable[];
- extern LVM_INT16 LVPSA_CosCoef[];
-
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 COS_T0;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
-
- /*
- * Get the filter definition
- */
- LVM_UINT16 Frequency = pFilterParams->CenterFrequency;
- LVM_UINT16 QFactor = pFilterParams->QFactor;
-
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVPSA_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
- /* Force D = 1 : the function was originally used for a peaking filter.
- The D parameter do not exist for a BandPass filter coefficients */
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = (LVM_INT32)(((LVM_UINT32)QFactor << 19) + (LVM_UINT32)(Dt0 >> 2));
- B2_Num = (LVM_INT32)((LVM_UINT32)(Dt0 >> 3) - ((LVM_UINT32)QFactor << 18));
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine by a polynomial expansion using the equation:
- *
- * Cos += coef(n) * t0^n For n = 0 to 6
- */
- T0 = (T0 >> 10) * 20859; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- COS_T0 = 0; /* Initialise the error to zero */
- for (i=1; i<7; i++)
- {
- coef = LVPSA_CosCoef[i]; /* Get the nth coefficient */
- COS_T0 += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- COS_T0 = COS_T0 << (LVPSA_CosCoef[0]+6); /* Correct the scaling */
-
-
- B1 = ((0x40000000 - B2) >> 16) * (COS_T0 >> 16); /* B1 = (0.5 - b2) * cos(t0) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) / 2 */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = (LVM_INT16)(A0>>16);
- pCoefficients->B1 = (LVM_INT16)(B1>>15);
- pCoefficients->B2 = (LVM_INT16)(B2>>16);
-
-
- return(LVPSA_OK);
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVPSA_BPDoublePrecCoefs */
@@ -727,7 +561,6 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients)
@@ -759,7 +592,6 @@
LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
-
/*
* Calculating the intermediate values
*/
@@ -810,90 +642,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVPSA_TwoPiOnFsTable[];
- extern LVM_INT16 LVPSA_DPCosCoef[];
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 CosErr;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Get the filter definition
- */
- LVM_UINT16 Frequency = pFilterParams->CenterFrequency;
- LVM_UINT16 QFactor = pFilterParams->QFactor;
-
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVPSA_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
- /* Force D = 1 : the function was originally used for a peaking filter.
- The D parameter do not exist for a BandPass filter coefficients */
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = (LVM_INT32)(((LVM_UINT32)QFactor << 19) + (LVM_UINT32)(Dt0 >> 2));
- B2_Num = (LVM_INT32)((LVM_UINT32)(Dt0 >> 3) - ((LVM_UINT32)QFactor << 18));
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine error by a polynomial expansion using the equation:
- *
- * CosErr += coef(n) * t0^n For n = 0 to 4
- */
- T0 = (T0 >> 6) * 0x7f53; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- CosErr = 0; /* Initialise the error to zero */
- for (i=1; i<5; i++)
- {
- coef = LVPSA_DPCosCoef[i]; /* Get the nth coefficient */
- CosErr += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- CosErr = CosErr << (LVPSA_DPCosCoef[0]); /* Correct the scaling */
-
- /*
- * Calculate the B1 and A0 coefficients
- */
- B1 = (0x40000000 - B2); /* B1 = (0.5 - b2) */
- A0 = ((B1 >> 16) * (CosErr >> 10)) >> 6; /* Temporary storage for (0.5 - b2) * coserr(t0) */
- B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) / 2 */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = A0;
- pCoefficients->B1 = B1;
- pCoefficients->B2 = B2;
-
- return(LVPSA_OK);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ClearFilterHistory */
@@ -917,17 +665,10 @@
/* Band Pass filters taps */
pTapAddress = (LVM_INT8 *)pInst->pBP_Taps;
-#ifdef BUILD_FLOAT
for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t); i++)
{
pTapAddress[i] = 0;
}
-#else
- for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_Taps_t); i++)
- {
- pTapAddress[i] = 0;
- }
-#endif
/* Quasi-peak filters taps */
pTapAddress = (LVM_INT8 *)pInst->pQPD_Taps;
for(i = 0; i < pInst->nBands * sizeof(QPD_Taps_t); i++)
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
similarity index 74%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
index 1c26860..9fcd82f 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
@@ -47,11 +47,7 @@
LVPSA_InstancePr_t *pLVPSA_Inst;
LVPSA_RETURN errorCode = LVPSA_OK;
LVM_UINT32 ii;
-#ifndef BUILD_FLOAT
- extern LVM_INT16 LVPSA_GainTable[];
-#else
extern LVM_FLOAT LVPSA_Float_GainTable[];
-#endif
LVM_UINT32 BufferLength = 0;
/* Ints_Alloc instances, needed for memory alignment management */
@@ -87,14 +83,12 @@
}
}
-
/*Inst_Alloc instances initialization */
InstAlloc_Init( &Instance , pMemoryTable->Region[LVPSA_MEMREGION_INSTANCE].pBaseAddress);
InstAlloc_Init( &Scratch , pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress);
InstAlloc_Init( &Data , pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].pBaseAddress);
InstAlloc_Init( &Coef , pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].pBaseAddress);
-
/* Set the instance handle if not already initialised */
if (*phInstance == LVM_NULL)
{
@@ -102,7 +96,6 @@
}
pLVPSA_Inst =(LVPSA_InstancePr_t*)*phInstance;
-
/* Check the memory table for NULL pointers */
for (ii = 0; ii < LVPSA_NR_MEMORY_REGIONS; ii++)
{
@@ -143,39 +136,32 @@
pLVPSA_Inst->SpectralDataBufferLength = BufferLength;
}
-
/* Assign the pointers */
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pPostGains = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
-#else
- pLVPSA_Inst->pPostGains = InstAlloc_AddMember( &Instance, pInitParams->nBands * \
- sizeof(LVM_FLOAT) );
-#endif
- pLVPSA_Inst->pFiltersParams = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t) );
- pLVPSA_Inst->pSpectralDataBufferStart = InstAlloc_AddMember( &Instance, pInitParams->nBands * pLVPSA_Inst->SpectralDataBufferLength * sizeof(LVM_UINT8) );
- pLVPSA_Inst->pPreviousPeaks = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT8) );
- pLVPSA_Inst->pBPFiltersPrecision = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_BPFilterPrecision_en) );
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pBP_Instances = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
- pLVPSA_Inst->pQPD_States = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
-#else
- pLVPSA_Inst->pBP_Instances = InstAlloc_AddMember( &Coef, pInitParams->nBands * \
- sizeof(Biquad_FLOAT_Instance_t) );
- pLVPSA_Inst->pQPD_States = InstAlloc_AddMember( &Coef, pInitParams->nBands * \
- sizeof(QPD_FLOAT_State_t) );
-#endif
+ pLVPSA_Inst->pPostGains =
+ (LVM_FLOAT *)InstAlloc_AddMember(&Instance, pInitParams->nBands * sizeof(LVM_FLOAT));
+ pLVPSA_Inst->pFiltersParams = (LVPSA_FilterParam_t *)
+ InstAlloc_AddMember(&Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t));
+ pLVPSA_Inst->pSpectralDataBufferStart = (LVM_UINT8 *)
+ InstAlloc_AddMember(&Instance, pInitParams->nBands * \
+ pLVPSA_Inst->SpectralDataBufferLength * sizeof(LVM_UINT8));
+ pLVPSA_Inst->pPreviousPeaks = (LVM_UINT8 *)
+ InstAlloc_AddMember(&Instance, pInitParams->nBands * sizeof(LVM_UINT8));
+ pLVPSA_Inst->pBPFiltersPrecision = (LVPSA_BPFilterPrecision_en *)
+ InstAlloc_AddMember(&Instance, pInitParams->nBands * \
+ sizeof(LVPSA_BPFilterPrecision_en));
+ pLVPSA_Inst->pBP_Instances = (Biquad_FLOAT_Instance_t *)
+ InstAlloc_AddMember(&Coef, pInitParams->nBands * \
+ sizeof(Biquad_FLOAT_Instance_t));
+ pLVPSA_Inst->pQPD_States = (QPD_FLOAT_State_t *)
+ InstAlloc_AddMember(&Coef, pInitParams->nBands * \
+ sizeof(QPD_FLOAT_State_t));
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pBP_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
- pLVPSA_Inst->pQPD_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
-
-#else
- pLVPSA_Inst->pBP_Taps = InstAlloc_AddMember( &Data,
- pInitParams->nBands * \
- sizeof(Biquad_1I_Order2_FLOAT_Taps_t));
- pLVPSA_Inst->pQPD_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * \
- sizeof(QPD_FLOAT_Taps_t) );
-#endif
+ pLVPSA_Inst->pBP_Taps = (Biquad_1I_Order2_FLOAT_Taps_t *)
+ InstAlloc_AddMember(&Data, pInitParams->nBands * \
+ sizeof(Biquad_1I_Order2_FLOAT_Taps_t));
+ pLVPSA_Inst->pQPD_Taps = (QPD_FLOAT_Taps_t *)
+ InstAlloc_AddMember(&Data, pInitParams->nBands * \
+ sizeof(QPD_FLOAT_Taps_t));
/* Copy filters parameters in the private instance */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
@@ -186,16 +172,11 @@
/* Set Post filters gains*/
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
{
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pPostGains[ii] =(LVM_UINT16) LVPSA_GainTable[pInitParams->pFiltersParams[ii].PostGain + 15];
-#else
pLVPSA_Inst->pPostGains[ii] = LVPSA_Float_GainTable[15 + \
pInitParams->pFiltersParams[ii].PostGain];
-#endif
}
pLVPSA_Inst->pSpectralDataBufferWritePointer = pLVPSA_Inst->pSpectralDataBufferStart;
-
/* Initialize control dependant internal parameters */
errorCode = LVPSA_Control (*phInstance, pControlParams);
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
similarity index 92%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
index 06a8f9d..eafcbe6 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
@@ -59,19 +59,16 @@
INST_ALLOC Coef;
LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
-
InstAlloc_Init( &Instance , LVM_NULL);
InstAlloc_Init( &Scratch , LVM_NULL);
InstAlloc_Init( &Data , LVM_NULL);
InstAlloc_Init( &Coef , LVM_NULL);
-
if((pMemoryTable == LVM_NULL) || (pInitParams == LVM_NULL))
{
return(LVPSA_ERROR_NULLADDRESS);
}
-
/*
* Fill in the memory table
*/
@@ -106,11 +103,7 @@
*/
InstAlloc_AddMember( &Instance, sizeof(LVPSA_InstancePr_t) );
-#ifdef BUILD_FLOAT
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_FLOAT) );
-#else
- InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
-#endif
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t) );
{
@@ -123,7 +116,6 @@
BufferLength=(LVM_UINT32)BL;
}
-
if((BufferLength * LVPSA_InternalRefreshTime) != pInitParams->SpectralDataBufferDuration)
{
BufferLength++;
@@ -138,11 +130,7 @@
/*
* Scratch memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_INT16) );
-#else
InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_FLOAT) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&Scratch);
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Type = LVPSA_SCRATCH;
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL;
@@ -150,13 +138,8 @@
/*
* Persistent coefficients memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
- InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
-#else
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_FLOAT_Instance_t) );
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_FLOAT_State_t) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&Coef);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Type = LVPSA_PERSISTENT_COEF;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -164,13 +147,8 @@
/*
* Persistent data memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
- InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
-#else
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t) );
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_FLOAT_Taps_t) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&Data);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Type = LVPSA_PERSISTENT_DATA;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
index ee07e2e..61987b5 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -23,12 +23,6 @@
#include "LVPSA_QPD.h"
#include "LVM_Macros.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/**********************************************************************************
CONSTANT DEFINITIONS
***********************************************************************************/
@@ -43,11 +37,7 @@
#define LVPSA_MEMREGION_PERSISTENT_COEF 1 /* Offset to persistent coefficients memory region in memory table */
#define LVPSA_MEMREGION_PERSISTENT_DATA 2 /* Offset to persistent taps memory region in memory table */
#define LVPSA_MEMREGION_SCRATCH 3 /* Offset to scratch memory region in memory table */
-#ifndef HIGHER_FS
-#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz*/
-#else
#define LVPSA_NR_SUPPORTED_RATE 13 /* From 8000Hz to 192000Hz*/
-#endif
#define LVPSA_NR_SUPPORTED_SPEED 3 /* LOW, MEDIUM, HIGH */
#define LVPSA_MAXBUFFERDURATION 4000 /* Maximum length in ms of the levels buffer */
@@ -77,7 +67,6 @@
#define LVPSA_InternalRefreshTimeInv 0x0666 /* 1/20ms left shifted by 15 */
#define LVPSA_InternalRefreshTimeShift 15
-
/* Precision of the filter */
typedef enum
{
@@ -96,12 +85,6 @@
LVPSA_MemTab_t MemoryTable;
LVPSA_BPFilterPrecision_en *pBPFiltersPrecision; /* Points a nBands elements array that contains the filter precision for each band */
-#ifndef BUILD_FLOAT
- Biquad_Instance_t *pBP_Instances; /* Points a nBands elements array that contains the band pass filter instance for each band */
- Biquad_1I_Order2_Taps_t *pBP_Taps; /* Points a nBands elements array that contains the band pass filter taps for each band */
- QPD_State_t *pQPD_States; /* Points a nBands elements array that contains the QPD filter instance for each band */
- QPD_Taps_t *pQPD_Taps; /* Points a nBands elements array that contains the QPD filter taps for each band */
-#else
Biquad_FLOAT_Instance_t *pBP_Instances;
/* Points a nBands elements array that contains the band pass filter taps for each band */
Biquad_1I_Order2_FLOAT_Taps_t *pBP_Taps;
@@ -109,17 +92,11 @@
QPD_FLOAT_State_t *pQPD_States;
/* Points a nBands elements array that contains the QPD filter taps for each band */
QPD_FLOAT_Taps_t *pQPD_Taps;
-#endif
-#ifndef BUILD_FLOAT
- LVM_UINT16 *pPostGains; /* Points a nBands elements array that contains the post-filter gains for each band */
-#else
/* Points a nBands elements array that contains the post-filter gains for each band */
LVM_FLOAT *pPostGains;
-#endif
LVPSA_FilterParam_t *pFiltersParams; /* Copy of the filters parameters from the input parameters */
-
LVM_UINT16 nSamplesBufferUpdate; /* Number of samples to make 20ms */
LVM_INT32 BufferUpdateSamplesCount; /* Counter used to know when to put a new value in the buffer */
LVM_UINT16 nRelevantFilters; /* Number of relevent filters depending on sampling frequency and bands center frequency */
@@ -140,8 +117,6 @@
}LVPSA_InstancePr_t, *pLVPSA_InstancePr_t;
-
-
/**********************************************************************************
FUNCTIONS PROTOTYPE
***********************************************************************************/
@@ -162,8 +137,4 @@
/************************************************************************************/
LVPSA_RETURN LVPSA_ApplyNewSettings (LVPSA_InstancePr_t *pInst);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* _LVPSA_PRIVATE_H */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
similarity index 76%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
index 61899fe..81a88c5 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
@@ -54,7 +54,6 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_FLOAT *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
@@ -121,7 +120,6 @@
break;
}
-
LVPSA_QPD_Process_Float ( pLVPSA_Inst,
pScratch + InputBlockSize,
(LVM_INT16)InputBlockSize,
@@ -143,95 +141,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_INT16 *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime )
-
-{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- LVM_INT16 *pScratch;
- LVM_INT16 ii;
- LVM_INT32 AudioTimeInc;
- extern LVM_UINT32 LVPSA_SampleRateInvTab[];
- LVM_UINT8 *pWrite_Save; /* Position of the write pointer at the beginning of the process */
-
- /******************************************************************************
- CHECK PARAMETERS
- *******************************************************************************/
- if(hInstance == LVM_NULL || pLVPSA_InputSamples == LVM_NULL)
- {
- return(LVPSA_ERROR_NULLADDRESS);
- }
- if(InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize)
- {
- return(LVPSA_ERROR_INVALIDPARAM);
- }
-
- pScratch = (LVM_INT16*)pLVPSA_Inst->MemoryTable.Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress;
- pWrite_Save = pLVPSA_Inst->pSpectralDataBufferWritePointer;
-
- /******************************************************************************
- APPLY NEW SETTINGS IF NEEDED
- *******************************************************************************/
- if (pLVPSA_Inst->bControlPending == LVM_TRUE)
- {
- pLVPSA_Inst->bControlPending = 0;
- LVPSA_ApplyNewSettings( pLVPSA_Inst);
- }
-
- /******************************************************************************
- PROCESS SAMPLES
- *******************************************************************************/
- /* Put samples in range [-0.5;0.5[ for BP filters (see Biquads documentation) */
- Copy_16( pLVPSA_InputSamples,pScratch,(LVM_INT16)InputBlockSize);
- Shift_Sat_v16xv16(-1,pScratch,pScratch,(LVM_INT16)InputBlockSize);
-
- for (ii = 0; ii < pLVPSA_Inst->nRelevantFilters; ii++)
- {
- switch(pLVPSA_Inst->pBPFiltersPrecision[ii])
- {
- case LVPSA_SimplePrecisionFilter:
- BP_1I_D16F16C14_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
- pScratch,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize);
- break;
-
- case LVPSA_DoublePrecisionFilter:
- BP_1I_D16F32C30_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
- pScratch,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize);
- break;
- default:
- break;
- }
-
-
- LVPSA_QPD_Process ( pLVPSA_Inst,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize,
- ii);
- }
-
- /******************************************************************************
- UPDATE SpectralDataBufferAudioTime
- *******************************************************************************/
-
- if(pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite_Save)
- {
- MUL32x32INTO32((AudioTime + (LVM_INT32)((LVM_INT32)pLVPSA_Inst->LocalSamplesCount*1000)),
- (LVM_INT32)LVPSA_SampleRateInvTab[pLVPSA_Inst->CurrentParams.Fs],
- AudioTimeInc,
- LVPSA_FsInvertShift)
- pLVPSA_Inst->SpectralDataBufferAudioTime = AudioTime + AudioTimeInc;
- }
-
- return(LVPSA_OK);
-}
-#endif
/************************************************************************************/
/* */
@@ -269,7 +178,6 @@
return(LVPSA_ERROR_NULLADDRESS);
}
-
/* First find the place where to look in the status buffer */
if(GetSpectrumAudioTime <= pLVPSA_Inst->SpectralDataBufferAudioTime)
{
@@ -320,7 +228,6 @@
pRead = pLVPSA_Inst->pSpectralDataBufferWritePointer - StatusDelta * pLVPSA_Inst->nBands;
}
-
/* Read the status buffer and fill the output buffers */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
{
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
index 99d844b..609a485 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
@@ -20,25 +20,18 @@
#include "LVM_Types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
typedef struct
{
LVM_INT32 *pDelay; /* pointer to the delayed samples (data of 32 bits) */
LVM_INT32 Coefs[2]; /* pointer to the filter coefficients */
}QPD_State_t, *pQPD_State_t;
-#ifdef BUILD_FLOAT
typedef struct
{
/* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT *pDelay;
LVM_FLOAT Coefs[2]; /* pointer to the filter coefficients */
}QPD_FLOAT_State_t, *pQPD_FLOAT_State_t;
-#endif
typedef struct
{
@@ -47,15 +40,12 @@
} QPD_C32_Coefs, *PQPD_C32_Coefs;
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT KP; /*should store a0*/
LVM_FLOAT KM; /*should store b2*/
} QPD_FLOAT_Coefs, *PQPD_FLOAT_Coefs;
-#endif
-
typedef struct
{
@@ -63,14 +53,12 @@
} QPD_Taps_t, *pQPD_Taps_t;
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[1];
} QPD_FLOAT_Taps_t, *pQPD_FLOAT_Taps_t;
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -89,12 +77,10 @@
LVM_INT16 numSamples,
LVM_INT16 BandIndex);
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Process_Float ( void *hInstance,
LVM_FLOAT *pInSamps,
LVM_INT16 numSamples,
LVM_INT16 BandIndex);
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Init */
@@ -113,15 +99,10 @@
void LVPSA_QPD_Init ( QPD_State_t *pInstance,
QPD_Taps_t *pTaps,
QPD_C32_Coefs *pCoef );
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Init_Float ( QPD_FLOAT_State_t *pInstance,
QPD_FLOAT_Taps_t *pTaps,
QPD_FLOAT_Coefs *pCoef );
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
index 2cc32ab..2dbf694 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
@@ -41,7 +41,6 @@
pQPD_State->Coefs[1] = pCoef->KM;
}
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Init_Float ( pQPD_FLOAT_State_t pQPD_State,
QPD_FLOAT_Taps_t *pTaps,
QPD_FLOAT_Coefs *pCoef )
@@ -50,4 +49,3 @@
pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
}
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
similarity index 71%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
index e233172..8805420 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
@@ -39,12 +39,10 @@
LVM_INT16 BandIndex,
LVM_INT16 Value );
-#ifdef BUILD_FLOAT
void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
LVM_UINT8 **ppWrite,
LVM_INT16 BandIndex,
LVM_FLOAT Value );
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -58,127 +56,6 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVPSA_QPD_Process ( void *hInstance,
- LVM_INT16 *pInSamps,
- LVM_INT16 numSamples,
- LVM_INT16 BandIndex)
-{
-
- /******************************************************************************
- PARAMETERS
- *******************************************************************************/
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- QPD_State_t *pQPDState = (QPD_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
-
- /* Pointer to taps */
- LVM_INT32* pDelay = pQPDState->pDelay;
-
- /* Parameters needed during quasi peak calculations */
- LVM_INT32 X0;
- LVM_INT32 temp,temp2;
- LVM_INT32 accu;
- LVM_INT16 Xg0;
- LVM_INT16 D0;
- LVM_INT16 V0 = (LVM_INT16)(*pDelay);
-
- /* Filter's coef */
- LVM_INT32 Kp = pQPDState->Coefs[0];
- LVM_INT32 Km = pQPDState->Coefs[1];
-
- LVM_INT16 ii = numSamples;
-
- LVM_UINT8 *pWrite = pLVPSA_Inst->pSpectralDataBufferWritePointer;
- LVM_INT32 BufferUpdateSamplesCount = pLVPSA_Inst->BufferUpdateSamplesCount;
- LVM_UINT16 DownSamplingFactor = pLVPSA_Inst->DownSamplingFactor;
-
- /******************************************************************************
- INITIALIZATION
- *******************************************************************************/
- /* Correct the pointer to take the first down sampled signal sample */
- pInSamps += pLVPSA_Inst->DownSamplingCount;
- /* Correct also the number of samples */
- ii = (LVM_INT16)(ii - (LVM_INT16)pLVPSA_Inst->DownSamplingCount);
-
- while (ii > 0)
- {
- /* Apply post gain */
- X0 = ((*pInSamps) * pLVPSA_Inst->pPostGains[BandIndex]) >> (LVPSA_GAINSHIFT-1); /* - 1 to compensate scaling in process function*/
- pInSamps = pInSamps + DownSamplingFactor;
-
- /* Saturate and take absolute value */
- if(X0 < 0)
- X0 = -X0;
- if (X0 > 0x7FFF)
- Xg0 = 0x7FFF;
- else
- Xg0 = (LVM_INT16)(X0);
-
-
- /* Quasi peak filter calculation */
- D0 = (LVM_INT16)(Xg0 - V0);
-
- temp2 = (LVM_INT32)D0;
- MUL32x32INTO32(temp2,Kp,accu,31);
-
- D0 = (LVM_INT16)(D0>>1);
- if (D0 < 0){
- D0 = (LVM_INT16)(-D0);
- }
-
- temp2 = (LVM_INT32)D0;
- MUL32x32INTO32((LVM_INT32)D0,Km,temp,31);
- accu +=temp + Xg0;
-
- if (accu > 0x7FFF)
- accu = 0x7FFF;
- else if(accu < 0)
- accu = 0x0000;
-
- V0 = (LVM_INT16)accu;
-
- if(((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor))
- {
- LVPSA_QPD_WritePeak( pLVPSA_Inst,
- &pWrite,
- BandIndex,
- V0);
- BufferUpdateSamplesCount -= pLVPSA_Inst->nSamplesBufferUpdate;
- pLVPSA_Inst->LocalSamplesCount = (LVM_UINT16)(numSamples - ii);
- }
- BufferUpdateSamplesCount+=DownSamplingFactor;
-
- ii = (LVM_INT16)(ii-DownSamplingFactor);
-
- }
-
- /* Store last taps in memory */
- *pDelay = (LVM_INT32)(V0);
-
- /* If this is the last call to the function after last band processing,
- update the parameters. */
- if(BandIndex == (pLVPSA_Inst->nRelevantFilters-1))
- {
- pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
- /* Adjustment for 11025Hz input, 220,5 is normally
- the exact number of samples for 20ms.*/
- if((pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite)&&(pLVPSA_Inst->CurrentParams.Fs == LVM_FS_11025))
- {
- if(pLVPSA_Inst->nSamplesBufferUpdate == 220)
- {
- pLVPSA_Inst->nSamplesBufferUpdate = 221;
- }
- else
- {
- pLVPSA_Inst->nSamplesBufferUpdate = 220;
- }
- }
- pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
- pLVPSA_Inst->BufferUpdateSamplesCount = BufferUpdateSamplesCount;
- pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
- }
-}
-#else
void LVPSA_QPD_Process_Float ( void *hInstance,
LVM_FLOAT *pInSamps,
LVM_INT16 numSamples,
@@ -235,7 +112,6 @@
else
Xg0 =X0;
-
/* Quasi peak filter calculation */
D0 = Xg0 - V0;
@@ -302,7 +178,6 @@
pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
}
}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_WritePeak */
@@ -326,7 +201,6 @@
{
LVM_UINT8 *pWrite = *ppWrite;
-
/* Write the value and update the write pointer */
*(pWrite + BandIndex) = (LVM_UINT8)(Value>>7);
pWrite += pLVPSA_Inst->nBands;
@@ -338,7 +212,6 @@
*ppWrite = pWrite;
}
-#ifdef BUILD_FLOAT
void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
LVM_UINT8 **ppWrite,
LVM_INT16 BandIndex,
@@ -357,4 +230,3 @@
*ppWrite = pWrite;
}
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
similarity index 87%
rename from media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
rename to media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
index f8af496..9f0aa02 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -24,6 +23,7 @@
#include "LVPSA.h"
#include "LVPSA_QPD.h"
+#include "LVPSA_Tables.h"
/************************************************************************************/
/* */
/* Sample rate table */
@@ -34,17 +34,6 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#ifndef HIGHER_FS
-const LVM_UINT16 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000}; /* 48kS/s */
-#else
const LVM_UINT32 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
11025,
12000,
@@ -58,7 +47,6 @@
96000,
176400,
192000}; /* 192kS/s */
-#endif
/************************************************************************************/
/* */
@@ -79,16 +67,12 @@
67109,
48696,
44739
-#ifdef HIGHER_FS
,24348
,22369
,12174
,11185 /* 192kS/s */
-#endif
};
-
-
/************************************************************************************/
/* */
/* Number of samples in 20ms */
@@ -108,12 +92,10 @@
640,
882,
960
-#ifdef HIGHER_FS
,1764
,1920
,3528
,3840 /* 192kS/s */
-#endif
};
/************************************************************************************/
/* */
@@ -133,15 +115,12 @@
21, /* 32000 S/s */
30, /* 44100 S/s */
32 /* 48000 S/s */
-#ifdef HIGHER_FS
,60 /* 88200 S/s */
,64 /* 96000 S/s */
,120 /* 176400 S/s */
,128 /*192000 S/s */
-#endif
};
-
/************************************************************************************/
/* */
/* Coefficient calculation tables */
@@ -160,15 +139,12 @@
6588,
4781,
4392
-#ifdef HIGHER_FS
,2390
,2196
,1195
,1098 /* 192kS/s */
-#endif
};
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = { 0.8042847f, /* 8kS/s */
0.5836054f,
0.5361796f,
@@ -178,15 +154,12 @@
0.2010559f,
0.1459089f,
0.1340372f
-#ifdef HIGHER_FS
,0.0729476f
,0.0670186f
,0.0364738f
,0.0335093f /* 192kS/s */
-#endif
};
-#endif
/*
* Gain table
*/
@@ -222,7 +195,6 @@
10264,
11576}; /* +15dB gain */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_GainTable[]={ 0.177734375f, /* -15dB gain */
0.199218750f,
0.223632812f,
@@ -254,7 +226,6 @@
4.466796875f,
5.011718750f,
5.652343750f}; /* +15dB gain */
-#endif
/************************************************************************************/
/* */
/* Cosone polynomial coefficients */
@@ -277,7 +248,6 @@
-2671, /* a3 */
23730, /* a4 */
-9490}; /* a5 */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_CosCoef[] = { 3, /* Shifts */
0.1250038f, /* a0 */
-0.0010986f, /* a1 */
@@ -285,7 +255,6 @@
-0.0815149f, /* a3 */
0.7242042f, /* a4 */
-0.2896206f}; /* a5 */
-#endif
/*
* Coefficients for calculating the cosine error with the equation:
*
@@ -305,51 +274,50 @@
-6, /* a1 */
16586, /* a2 */
-44}; /* a3 */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_DPCosCoef[] = {1.0f, /* Shifts */
0.0f, /* a0 */
-0.00008311f, /* a1 */
0.50617999f, /* a2 */
-0.00134281f}; /* a3 */
-#endif
/************************************************************************************/
/* */
/* Quasi peak filter coefficients table */
/* */
/************************************************************************************/
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 */
- {0x80CEFD2B,0x00CB9B17}, /* 8kS/s */ /* LVPSA_SPEED_LOW */
- {0x80D242E7,0x00CED11D},
- {0x80DCBAF5,0x00D91679},
- {0x80CEFD2B,0x00CB9B17},
- {0x80E13739,0x00DD7CD3},
- {0x80DCBAF5,0x00D91679},
- {0x80D94BAF,0x00D5B7E7},
- {0x80E13739,0x00DD7CD3},
- {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 */
- {0x8587513D,0x055C22CF}, /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
- {0x859D2967,0x0570F007},
- {0x85E2EFAC,0x05B34D79},
- {0x8587513D,0x055C22CF},
- {0x8600C7B9,0x05CFA6CF},
- {0x85E2EFAC,0x05B34D79},
- {0x85CC1018,0x059D8F69},
- {0x8600C7B9,0x05CFA6CF},//{0x8600C7B9,0x05CFA6CF},
- {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 */
- {0xA115EA7A,0x1CDB3F5C}, /* 8kS/s */ /* LVPSA_SPEED_HIGH */
- {0xA18475F0,0x1D2C83A2},
- {0xA2E1E950,0x1E2A532E},
- {0xA115EA7A,0x1CDB3F5C},
- {0xA375B2C6,0x1E943BBC},
- {0xA2E1E950,0x1E2A532E},
- {0xA26FF6BD,0x1DD81530},
- {0xA375B2C6,0x1E943BBC},
- {0xA2E1E950,0x1E2A532E}}; /* 48kS/s */
-
-#ifdef BUILD_FLOAT
const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
/* 8kS/s */ /* LVPSA_SPEED_LOW */
@@ -363,12 +331,10 @@
{-0.9931269618682563f,0.0067592649720609f},
/* 48kS/s */
{-0.9932638457976282f,0.0066249934025109f},
-#ifdef HIGHER_FS
{-0.9931269618682563f,0.0067592649720609f},
{-0.9932638457976282f,0.0066249934025109f},
{-0.9931269618682563f,0.0067592649720609f},
{-0.9932638457976282f,0.0066249934025109f},
-#endif
/* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
{-0.9568079425953329f,0.0418742666952312f},
{-0.9561413046903908f,0.0425090822391212f},
@@ -381,12 +347,10 @@
{-0.9531011912040412f,0.0453995238058269f},
/* 48kS/s */
{-0.9540119562298059f,0.0445343819446862f},
-#ifdef HIGHER_FS
{-0.9531011912040412f,0.0453995238058269f},
{-0.9540119562298059f,0.0445343819446862f},
{-0.9531011912040412f,0.0453995238058269f},
{-0.9540119562298059f,0.0445343819446862f},
-#endif
/* 8kS/s */ /* LVPSA_SPEED_HIGH */
{-0.7415186790749431f,0.2254409026354551f},
{-0.7381451204419136f,0.2279209652915597f},
@@ -398,11 +362,8 @@
{-0.7229706319049001f,0.2388987224549055f},
/* 48kS/s */
{-0.7274807319045067f,0.2356666540727019f}
-#ifdef HIGHER_FS
,{-0.7229706319049001f,0.2388987224549055f}
,{-0.7274807319045067f,0.2356666540727019f}
,{-0.7229706319049001f,0.2388987224549055f}
,{-0.7274807319045067f,0.2356666540727019f}
-#endif
};
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
new file mode 100644
index 0000000..65872fe
--- /dev/null
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#ifndef __LVPSA_TABLES_H__
+#define __LVPSA_TABLES_H__
+
+/************************************************************************************/
+/* */
+/* Sample rate table */
+/* */
+/************************************************************************************/
+
+/*
+ * Sample rate table for converting between the enumerated type and the actual
+ * frequency
+ */
+extern const LVM_UINT32 LVPSA_SampleRateTab[];
+
+/************************************************************************************/
+/* */
+/* Sample rate inverse table */
+/* */
+/************************************************************************************/
+
+/*
+ * Sample rate table for converting between the enumerated type and the actual
+ * frequency
+ */
+extern const LVM_UINT32 LVPSA_SampleRateInvTab[];
+
+/************************************************************************************/
+/* */
+/* Number of samples in 20ms */
+/* */
+/************************************************************************************/
+
+/*
+ * Table for converting between the enumerated type and the number of samples
+ * during 20ms
+ */
+extern const LVM_UINT16 LVPSA_nSamplesBufferUpdate[];
+
+/************************************************************************************/
+/* */
+/* Down sampling factors */
+/* */
+/************************************************************************************/
+
+/*
+ * Table for converting between the enumerated type and the down sampling factor
+ */
+extern const LVM_UINT16 LVPSA_DownSamplingFactor[];
+
+/************************************************************************************/
+/* */
+/* Coefficient calculation tables */
+/* */
+/************************************************************************************/
+
+/*
+ * Table for 2 * Pi / Fs
+ */
+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[];
+
+/************************************************************************************/
+/* */
+/* Cosone polynomial coefficients */
+/* */
+/************************************************************************************/
+
+/*
+ * Coefficients for calculating the cosine with the equation:
+ *
+ * Cos(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5)
+ *
+ * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
+ * 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[];
+
+/*
+ * Coefficients for calculating the cosine error with the equation:
+ *
+ * CosErr(x) = (2^Shifts)*(a0 + a1*x + a2*x^2 + a3*x^3)
+ *
+ * These coefficients expect the input, x, to be in the range 0 to 32768 respresenting
+ * a range of 0 to Pi/25. The output is in the range 0 to 32767 representing the range
+ * 0.0 to 0.0078852986
+ *
+ * This is used to give a double precision cosine over the range 0 to Pi/25 using the
+ * the equation:
+ *
+ * Cos(x) = 1.0 - CosErr(x)
+ */
+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[];
+
+#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 e507a7c..0adfd1b 100644
--- a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
+++ b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
@@ -56,11 +56,6 @@
#ifndef LVCS_H
#define LVCS_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -70,7 +65,6 @@
#include "LVM_Types.h"
#include "LVM_Common.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -93,7 +87,6 @@
#define LVCS_EVENT_NONE 0x0000 /* Not a valid event */
#define LVCS_EVENT_ALGOFF 0x0001 /* CS has completed switch off */
-
/****************************************************************************************/
/* */
/* Types */
@@ -103,7 +96,6 @@
/* Instance handle */
typedef void *LVCS_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -112,7 +104,6 @@
LVCS_MAX = LVM_MAXENUM
} LVCS_Modes_en;
-
/* Memory Types */
typedef enum
{
@@ -123,7 +114,6 @@
LVCS_MEMORYTYPE_MAX = LVM_MAXENUM
} LVCS_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -135,7 +125,6 @@
LVCS_STATUSMAX = LVM_MAXENUM
} LVCS_ReturnStatus_en;
-
/*
* Source data formats
*/
@@ -146,7 +135,6 @@
LVCS_SOURCEMAX = LVM_MAXENUM
} LVCS_SourceFormat_en;
-
/*
* Supported output devices
*/
@@ -172,7 +160,6 @@
void *pTable8;
} LVCS_CSMS_Coef_Tables_t;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -187,14 +174,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVCS_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVCS_MemoryRegion_t Region[LVCS_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVCS_MemTab_t;
-
/* Concert Sound parameter structure */
typedef struct
{
@@ -210,7 +195,6 @@
#endif
} LVCS_Params_t;
-
/* Concert Sound Capability structure */
typedef struct
{
@@ -223,7 +207,6 @@
} LVCS_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -270,7 +253,6 @@
LVCS_MemTab_t *pMemoryTable,
LVCS_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Init */
@@ -308,7 +290,6 @@
LVCS_MemTab_t *pMemoryTable,
LVCS_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_GetParameters */
@@ -332,7 +313,6 @@
LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Control */
@@ -355,7 +335,6 @@
LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -377,20 +356,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* LVCS_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
similarity index 79%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
index 29e3c9e..ba152c0 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
@@ -70,19 +70,12 @@
{
LVM_UINT16 Offset;
-#ifndef BUILD_FLOAT
- LVM_UINT32 Gain;
- LVM_INT32 Current;
-#else
LVM_FLOAT Gain;
LVM_FLOAT Current;
-#endif
LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
LVCS_BypassMix_t *pConfig = (LVCS_BypassMix_t *)&pInstance->BypassMix;
const Gain_t *pOutputGainTable;
-
-
/*
* Set the transition gain
*/
@@ -91,11 +84,7 @@
&& (pInstance->MSTarget1 != 0x7FFF) /* this indicates an off->on transtion */
)
{
-#ifndef BUILD_FLOAT
- pInstance->TransitionGain = pParams->EffectLevel;
-#else
pInstance->TransitionGain = ((LVM_FLOAT)pParams->EffectLevel / 32767);
-#endif
}
else
{
@@ -112,38 +101,21 @@
/*
* Setup the mixer gain for the processed path
*/
-#ifndef BUILD_FLOAT
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
-#else
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
-#endif
pConfig->Mixer_Instance.MixerStream[0].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[0].pCallbackHandle = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].pCallBack = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].CallbackSet=1;
-#ifndef BUILD_FLOAT
- Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
- LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0],(LVM_INT32)(Gain >> 15),Current);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0], (LVM_FLOAT)(Gain), Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
/*
* Setup the mixer gain for the unprocessed path
*/
-#ifndef BUILD_FLOAT
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * (0x7FFF - pInstance->TransitionGain));
- Gain = (LVM_UINT32)pOutputGainTable[Offset].UnprocLoss * (Gain >> 15);
- Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
- LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1],(LVM_INT32)(Gain >> 15),Current);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * (1.0 - \
(LVM_FLOAT)pInstance->TransitionGain));
Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * Gain;
@@ -151,7 +123,6 @@
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1], (LVM_FLOAT)(Gain), Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
pConfig->Mixer_Instance.MixerStream[1].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[1].pCallbackHandle = hInstance;
pConfig->Mixer_Instance.MixerStream[1].CallbackSet=1;
@@ -162,50 +133,10 @@
*/
pConfig->Output_Shift = pOutputGainTable[Offset].Shift;
-
/*
* Correct gain for the effect level
*/
{
-#ifndef BUILD_FLOAT
- LVM_INT16 GainCorrect;
- LVM_INT32 Gain1;
- LVM_INT32 Gain2;
-
- Gain1 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[0]);
- Gain2 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[1]);
- /*
- * Calculate the gain correction
- */
- if (pInstance->Params.CompressorMode == LVM_MODE_ON)
- {
- GainCorrect = (LVM_INT16)( pInstance->VolCorrect.GainMin
- - (((LVM_INT32)pInstance->VolCorrect.GainMin * (LVM_INT32)pInstance->TransitionGain) >> 15)
- + (((LVM_INT32)pInstance->VolCorrect.GainFull * (LVM_INT32)pInstance->TransitionGain) >> 15) );
-
- /*
- * Apply the gain correction and shift, note the result is in Q3.13 format
- */
- Gain1 = (Gain1 * GainCorrect) << 4;
- Gain2 = (Gain2 * GainCorrect) << 4;
- }
- else
- {
- Gain1 = Gain1 << 16;
- Gain2 = Gain2 << 16;
- }
-
-
-
- /*
- * Set the gain values
- */
- pConfig->Output_Shift = pConfig->Output_Shift;
- LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0],Gain1>>16);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
- LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2>>16);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
LVM_FLOAT GainCorrect;
LVM_FLOAT Gain1;
LVM_FLOAT Gain2;
@@ -241,7 +172,6 @@
LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
}
return(LVCS_SUCCESS);
@@ -276,15 +206,9 @@
/************************************************************************************/
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
-#ifndef BUILD_FLOAT
- const LVM_INT16 *pProcessed,
- const LVM_INT16 *pUnprocessed,
- LVM_INT16 *pOutData,
-#else
const LVM_FLOAT *pProcessed,
const LVM_FLOAT *pUnprocessed,
LVM_FLOAT *pOutData,
-#endif
LVM_UINT16 NumSamples)
{
@@ -299,21 +223,6 @@
/*
* Apply the bypass mix
*/
-#ifndef BUILD_FLOAT
- LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
- pProcessed,
- (LVM_INT16 *) pUnprocessed,
- pOutData,
- (LVM_INT16)(2*NumSamples));
-
- /*
- * Apply output gain correction shift
- */
- Shift_Sat_v16xv16 ((LVM_INT16)pConfig->Output_Shift,
- (LVM_INT16*)pOutData,
- (LVM_INT16*)pOutData,
- (LVM_INT16)(2*NumSamples)); /* Left and right*/
-#else
LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
pProcessed,
(LVM_FLOAT *) pUnprocessed,
@@ -326,13 +235,11 @@
(LVM_FLOAT*)pOutData,
(LVM_FLOAT*)pOutData,
(LVM_INT16)(2 * NumSamples)); /* Left and right*/
-#endif
}
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_MixerCallback */
@@ -368,7 +275,6 @@
}
}
-
if ((pInstance->OutputDevice == LVCS_HEADPHONE) &&
(pInstance->MSTarget0 == 1) &&
(pInstance->bTimerDone == LVM_TRUE)){
@@ -380,5 +286,3 @@
return 1;
}
-
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
index f69ba38..fcd8ee3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
@@ -18,11 +18,6 @@
#ifndef __LVCS_BYPASSMIX_H__
#define __LVCS_BYPASSMIX_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -31,7 +26,6 @@
#include "LVC_Mixer.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -42,25 +36,11 @@
typedef struct
{
/* Mixer settings */
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st Mixer_Instance; /* Mixer instance */
-#else
- LVMixer3_2St_st Mixer_Instance; /* Mixer instance */
-#endif
LVM_UINT16 Output_Shift; /* Correcting gain output shift */
} LVCS_BypassMix_t;
-#ifndef BUILD_FLOAT
-/* Output gain type */
-typedef struct
-{
- /* Output gain settings, Gain = (Loss/32768) * 2^Shift */
- LVM_UINT16 Shift; /* Left shifts required */
- LVM_UINT16 Loss; /* Loss required */
- LVM_UINT16 UnprocLoss; /* Unprocessed path loss */
-} Gain_t;
-#else
typedef struct
{
/* Output gain settings, Gain = (Loss/32768) * 2^Shift */
@@ -68,7 +48,6 @@
LVM_FLOAT Loss; /* Loss required */
LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
} Gain_t;
-#endif
/************************************************************************************/
/* */
/* Function prototypes */
@@ -78,21 +57,10 @@
LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pProcessed,
- const LVM_INT16 *unProcessed,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pProcessed,
const LVM_FLOAT *unProcessed,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* BYPASSMIX_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
similarity index 90%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
index 3bf6ec6..50db03d 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
@@ -56,7 +56,6 @@
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Control */
@@ -120,29 +119,8 @@
pInstance->VolCorrect = pLVCS_VolCorrectTable[Offset];
pInstance->CompressGain = pInstance->VolCorrect.CompMin;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0], 0, 0);
-#else
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
-#endif
{
-#ifndef BUILD_FLOAT
- LVM_UINT32 Gain;
- const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * LVM_MAXINT_16);
- Gain = (LVM_UINT32)pOutputGainTable[Offset].UnprocLoss * (Gain >> 15);
- Gain=Gain>>15;
- /*
- * Apply the gain correction and shift, note the result is in Q3.13 format
- */
- Gain = (Gain * pInstance->VolCorrect.GainMin) >>12;
-
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],0,Gain);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],
- LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
- LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
LVM_FLOAT Gain;
const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss);
@@ -158,10 +136,8 @@
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
}
-
err=LVCS_SEnhancerInit(hInstance,
pParams);
@@ -176,7 +152,6 @@
}
-
/*
* Check if the effect level or source format has changed
*/
@@ -243,7 +218,6 @@
pInstance->MSTarget0=0;
}
-
/* Set transition flag */
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
@@ -272,7 +246,6 @@
pInstance->bTimerDone = LVM_TRUE;
-
return;
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
index ec5312e..431b7e3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
@@ -53,7 +53,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -92,8 +91,7 @@
Coeffs.B2 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B2;
LoadConst_Float((LVM_INT16)0, /* Value */
- (void *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->EqualiserBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps) / sizeof(LVM_FLOAT)));
@@ -118,66 +116,6 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- BQ_C16_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pEqualiserCoefTable;
-
- /*
- * If the sample rate changes re-initialise the filters
- */
- if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
- /*
- * Setup the filter coefficients and clear the history
- */
- Offset = (LVM_UINT16)(pParams->SampleRate + (pParams->SpeakerType * (1+LVM_FS_48000)));
- pEqualiserCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_EqualiserCoefTable[0];
-
- /* Left and right filters */
- /* Convert incoming coefficients to the required format/ordering */
- Coeffs.A0 = (LVM_INT16) pEqualiserCoefTable[Offset].A0;
- Coeffs.A1 = (LVM_INT16) pEqualiserCoefTable[Offset].A1;
- Coeffs.A2 = (LVM_INT16) pEqualiserCoefTable[Offset].A2;
- Coeffs.B1 = (LVM_INT16)-pEqualiserCoefTable[Offset].B1;
- Coeffs.B2 = (LVM_INT16)-pEqualiserCoefTable[Offset].B2;
-
- LoadConst_16((LVM_INT16)0, /* Value */
- (void *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps)/sizeof(LVM_INT16))); /* Number of words */
-
- BQ_2I_D16F32Css_TRC_WRA_01_Init(&pCoefficients->EqualiserBiquadInstance,
- &pData->EqualiserBiquadTaps,
- &Coeffs);
-
- /* Callbacks */
- switch(pEqualiserCoefTable[Offset].Scale)
- {
- case 13:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C13_TRC_WRA_01;
- break;
- case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C14_TRC_WRA_01;
- break;
- case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C15_TRC_WRA_01;
- break;
- }
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Equaliser */
@@ -197,7 +135,6 @@
/* 1. Always processes in place. */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_FLOAT *pInputOutput,
LVM_UINT16 NumSamples)
@@ -207,11 +144,9 @@
LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
LVCS_Coefficient_t *pCoefficients;
-
pCoefficients = (LVCS_Coefficient_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
-
/*
* Check if the equaliser is required
*/
@@ -227,29 +162,3 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_INT16 *pInputOutput,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
-
-
- /*
- * Check if the equaliser is required
- */
- if ((pInstance->Params.OperatingMode & LVCS_EQUALISERSWITCH) != 0)
- {
- /* Apply filter to the left and right channels */
- (pConfig->pBiquadCallBack)((Biquad_Instance_t*)&pCoefficients->EqualiserBiquadInstance,
- (LVM_INT16 *)pInputOutput,
- (LVM_INT16 *)pInputOutput,
- (LVM_INT16)NumSamples);
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
index 0e756e7..918d931 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
@@ -18,11 +18,6 @@
#ifndef __LVCS_EQUALISER_H__
#define __LVCS_EQUALISER_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Structures */
@@ -32,14 +27,9 @@
/* Equaliser structure */
typedef struct
{
-#ifndef BUILD_FLOAT
- void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-#else
void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
-#endif
} LVCS_Equaliser_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -48,17 +38,8 @@
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_INT16 *pInputOutput,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_FLOAT *pInputOutput,
LVM_UINT16 NumSamples);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* EQUALISER_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
index ba05577..c7ee232 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -18,13 +18,11 @@
#ifndef __LVCS_HEADPHONE_COEFFS_H__
#define __LVCS_HEADPHONE_COEFFS_H__
-
/************************************************************************************/
/* */
/* The Stereo Enhancer */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
#define CS_MIDDLE_8000_A0 0.227720
#define CS_MIDDLE_8000_A1 (-0.215125)
@@ -151,7 +149,6 @@
#define CS_SIDE_48000_B2 0.630405
#define CS_SIDE_48000_SCALE 14
-#ifdef HIGHER_FS
/* Coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
@@ -222,7 +219,6 @@
#define CS_SIDE_192000_B1 (-1.891380f)
#define CS_SIDE_192000_B2 0.8923460f
#define CS_SIDE_192000_SCALE 14
-#endif
/************************************************************************************/
/* */
@@ -286,7 +282,6 @@
#define CS_REVERB_22050_B2 (-0.290990)
#define CS_REVERB_22050_SCALE 15
-
/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_24000_A0 0.479565
#define CS_REVERB_24000_A1 0.000000
@@ -319,7 +314,6 @@
#define CS_REVERB_48000_B2 0.303347
#define CS_REVERB_48000_SCALE 14
-#ifdef HIGHER_FS
/* Reverb coefficients for 88200Hz sample rate, scaled with 0.8 */
/* Band pass filter with fc1=500 and fc2=8000 */
#define CS_REVERB_88200_A0 0.171901f
@@ -354,9 +348,6 @@
#define CS_REVERB_192000_B2 0.7804076
#define CS_REVERB_192000_SCALE 14
-#endif
-
-
/* Reverb Gain Settings */
#define LVCS_HEADPHONE_DELAYGAIN 0.800000 /* Algorithm delay path gain */
#define LVCS_HEADPHONE_OUTPUTGAIN 1.000000 /* Algorithm output gain */
@@ -505,8 +496,6 @@
#define CSEX_EQUALISER_48000_B2 (-0.347332)
#define CSEX_EQUALISER_48000_SCALE 13
-
-#ifdef HIGHER_FS
/* Equaliser coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
@@ -567,8 +556,6 @@
#define CSEX_EQUALISER_192000_B1 (-1.31074)
#define CSEX_EQUALISER_192000_B2 0.31312
#define CSEX_EQUALISER_192000_SCALE 13
-#endif
-
#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
@@ -576,376 +563,5 @@
#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
#define LVCS_EX_HEADPHONE_SHIFTLOSS 0.569225 /* EX Output Shift loss */
#define LVCS_EX_HEADPHONE_GAIN 0.07794425 /* EX Unprocessed path gain */
-#else
-/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
-#define CS_MIDDLE_8000_A0 7462 /* Floating point value 0.227720 */
-#define CS_MIDDLE_8000_A1 (-7049) /* Floating point value -0.215125 */
-#define CS_MIDDLE_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_B1 (-30209) /* Floating point value -0.921899 */
-#define CS_MIDDLE_8000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_SCALE 15
-#define CS_SIDE_8000_A0 20036 /* Floating point value 0.611441 */
-#define CS_SIDE_8000_A1 (-12463) /* Floating point value -0.380344 */
-#define CS_SIDE_8000_A2 (-7573) /* Floating point value -0.231097 */
-#define CS_SIDE_8000_B1 (-20397) /* Floating point value -0.622470 */
-#define CS_SIDE_8000_B2 (-4285) /* Floating point value -0.130759 */
-#define CS_SIDE_8000_SCALE 15
-
-/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
-#define CS_MIDDLE_11025_A0 7564 /* Floating point value 0.230838 */
-#define CS_MIDDLE_11025_A1 (-7260) /* Floating point value -0.221559 */
-#define CS_MIDDLE_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_B1 (-30902) /* Floating point value -0.943056 */
-#define CS_MIDDLE_11025_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_SCALE 15
-#define CS_SIDE_11025_A0 18264 /* Floating point value 0.557372 */
-#define CS_SIDE_11025_A1 (-12828) /* Floating point value -0.391490 */
-#define CS_SIDE_11025_A2 (-5436) /* Floating point value -0.165881 */
-#define CS_SIDE_11025_B1 (-28856) /* Floating point value -0.880608 */
-#define CS_SIDE_11025_B2 1062 /* Floating point value 0.032397 */
-#define CS_SIDE_11025_SCALE 15
-
-/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
-#define CS_MIDDLE_12000_A0 7534 /* Floating point value 0.229932 */
-#define CS_MIDDLE_12000_A1 (-7256) /* Floating point value -0.221436 */
-#define CS_MIDDLE_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_B1 (-31051) /* Floating point value -0.947616 */
-#define CS_MIDDLE_12000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_SCALE 15
-#define CS_SIDE_12000_A0 18298 /* Floating point value 0.558398 */
-#define CS_SIDE_12000_A1 (-12852) /* Floating point value -0.392211 */
-#define CS_SIDE_12000_A2 (-5446) /* Floating point value -0.166187 */
-#define CS_SIDE_12000_B1 (-29247) /* Floating point value -0.892550 */
-#define CS_SIDE_12000_B2 1077 /* Floating point value 0.032856 */
-#define CS_SIDE_12000_SCALE 15
-
-/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
-#define CS_MIDDLE_16000_A0 7558 /* Floating point value 0.230638 */
-#define CS_MIDDLE_16000_A1 (-7348) /* Floating point value -0.224232 */
-#define CS_MIDDLE_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_B1 (-31475) /* Floating point value -0.960550 */
-#define CS_MIDDLE_16000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_SCALE 15
-#define CS_SIDE_16000_A0 8187 /* Floating point value 0.499695 */
-#define CS_SIDE_16000_A1 (-5825) /* Floating point value -0.355543 */
-#define CS_SIDE_16000_A2 (-2362) /* Floating point value -0.144152 */
-#define CS_SIDE_16000_B1 (-17216) /* Floating point value -1.050788 */
-#define CS_SIDE_16000_B2 2361 /* Floating point value 0.144104 */
-#define CS_SIDE_16000_SCALE 14
-
-/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
-#define CS_MIDDLE_22050_A0 7496 /* Floating point value 0.228749 */
-#define CS_MIDDLE_22050_A1 (-7344) /* Floating point value -0.224128 */
-#define CS_MIDDLE_22050_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_B1 (-31826) /* Floating point value -0.971262 */
-#define CS_MIDDLE_22050_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_SCALE 15
-#define CS_SIDE_22050_A0 7211 /* Floating point value 0.440112 */
-#define CS_SIDE_22050_A1 (-4278) /* Floating point value -0.261096 */
-#define CS_SIDE_22050_A2 (-2933) /* Floating point value -0.179016 */
-#define CS_SIDE_22050_B1 (-18297) /* Floating point value -1.116786 */
-#define CS_SIDE_22050_B2 2990 /* Floating point value 0.182507 */
-#define CS_SIDE_22050_SCALE 14
-
-/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
-#define CS_MIDDLE_24000_A0 7550 /* Floating point value 0.230395 */
-#define CS_MIDDLE_24000_A1 (-7409) /* Floating point value -0.226117 */
-#define CS_MIDDLE_24000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_B1 (-31902) /* Floating point value -0.973573 */
-#define CS_MIDDLE_24000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_SCALE 15
-#define CS_SIDE_24000_A0 6796 /* Floating point value 0.414770 */
-#define CS_SIDE_24000_A1 (-4705) /* Floating point value -0.287182 */
-#define CS_SIDE_24000_A2 (-2090) /* Floating point value -0.127588 */
-#define CS_SIDE_24000_B1 (-20147) /* Floating point value -1.229648 */
-#define CS_SIDE_24000_B2 4623 /* Floating point value 0.282177 */
-#define CS_SIDE_24000_SCALE 14
-
-/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
-#define CS_MIDDLE_32000_A0 7484 /* Floating point value 0.228400 */
-#define CS_MIDDLE_32000_A1 (-7380) /* Floating point value -0.225214 */
-#define CS_MIDDLE_32000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_B1 (-32117) /* Floating point value -0.980126 */
-#define CS_MIDDLE_32000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_SCALE 15
-#define CS_SIDE_32000_A0 5973 /* Floating point value 0.364579 */
-#define CS_SIDE_32000_A1 (-3397) /* Floating point value -0.207355 */
-#define CS_SIDE_32000_A2 (-2576) /* Floating point value -0.157224 */
-#define CS_SIDE_32000_B1 (-20877) /* Floating point value -1.274231 */
-#define CS_SIDE_32000_B2 5120 /* Floating point value 0.312495 */
-#define CS_SIDE_32000_SCALE 14
-
-/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
-#define CS_MIDDLE_44100_A0 7654 /* Floating point value 0.233593 */
-#define CS_MIDDLE_44100_A1 (-7577) /* Floating point value -0.231225 */
-#define CS_MIDDLE_44100_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_B1 (-32294) /* Floating point value -0.985545 */
-#define CS_MIDDLE_44100_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_SCALE 15
-#define CS_SIDE_44100_A0 4662 /* Floating point value 0.284573 */
-#define CS_SIDE_44100_A1 (-4242) /* Floating point value -0.258910 */
-#define CS_SIDE_44100_A2 (-420) /* Floating point value -0.025662 */
-#define CS_SIDE_44100_B1 (-25760) /* Floating point value -1.572248 */
-#define CS_SIDE_44100_B2 9640 /* Floating point value 0.588399 */
-#define CS_SIDE_44100_SCALE 14
-
-/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
-#define CS_MIDDLE_48000_A0 7682 /* Floating point value 0.234445 */
-#define CS_MIDDLE_48000_A1 (-7611) /* Floating point value -0.232261 */
-#define CS_MIDDLE_48000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_B1 (-32333) /* Floating point value -0.986713 */
-#define CS_MIDDLE_48000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_SCALE 15
-#define CS_SIDE_48000_A0 4466 /* Floating point value 0.272606 */
-#define CS_SIDE_48000_A1 (-4374) /* Floating point value -0.266952 */
-#define CS_SIDE_48000_A2 (-93) /* Floating point value -0.005654 */
-#define CS_SIDE_48000_B1 (-26495) /* Floating point value -1.617141 */
-#define CS_SIDE_48000_B2 10329 /* Floating point value 0.630405 */
-#define CS_SIDE_48000_SCALE 14
-
-
-/************************************************************************************/
-/* */
-/* The Reverb Unit */
-/* */
-/************************************************************************************/
-
-/* Reverb delay settings in samples */
-#define LVCS_STEREODELAY_CS_8KHZ 93 /* Sample rate 8kS/s */
-#define LVCS_STEREODELAY_CS_11KHZ 128 /* Sample rate 11kS/s */
-#define LVCS_STEREODELAY_CS_12KHZ 139 /* Sample rate 12kS/s */
-#define LVCS_STEREODELAY_CS_16KHZ 186 /* Sample rate 16kS/s */
-#define LVCS_STEREODELAY_CS_22KHZ 256 /* Sample rate 22kS/s */
-#define LVCS_STEREODELAY_CS_24KHZ 279 /* Sample rate 24kS/s */
-#define LVCS_STEREODELAY_CS_32KHZ 372 /* Sample rate 32kS/s */
-#define LVCS_STEREODELAY_CS_44KHZ 512 /* Sample rate 44kS/s */
-#define LVCS_STEREODELAY_CS_48KHZ 512 /* Sample rate 48kS/s */
-
-/* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_8000_A0 21865 /* Floating point value 0.667271 */
-#define CS_REVERB_8000_A1 (-21865) /* Floating point value -0.667271 */
-#define CS_REVERB_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_8000_B1 (-21895) /* Floating point value -0.668179 */
-#define CS_REVERB_8000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_8000_SCALE 15
-
-/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_11025_A0 22926 /* Floating point value 0.699638 */
-#define CS_REVERB_11025_A1 (-22926) /* Floating point value -0.699638 */
-#define CS_REVERB_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_11025_B1 (-24546) /* Floating point value -0.749096 */
-#define CS_REVERB_11025_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_11025_SCALE 15
-
-/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_12000_A0 23165 /* Floating point value 0.706931 */
-#define CS_REVERB_12000_A1 (-23165) /* Floating point value -0.706931 */
-#define CS_REVERB_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_12000_B1 (-25144) /* Floating point value -0.767327 */
-#define CS_REVERB_12000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_12000_SCALE 15
-
-/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_16000_A0 23864 /* Floating point value 0.728272 */
-#define CS_REVERB_16000_A1 (-23864) /* Floating point value -0.728272 */
-#define CS_REVERB_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_16000_B1 (-26892) /* Floating point value -0.820679 */
-#define CS_REVERB_16000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_16000_SCALE 15
-
-/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_22050_A0 16921 /* Floating point value 0.516396 */
-#define CS_REVERB_22050_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_22050_A2 (-16921) /* Floating point value -0.516396 */
-#define CS_REVERB_22050_B1 (-16991) /* Floating point value -0.518512 */
-#define CS_REVERB_22050_B2 (-9535) /* Floating point value -0.290990 */
-#define CS_REVERB_22050_SCALE 15
-
-/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_24000_A0 15714 /* Floating point value 0.479565 */
-#define CS_REVERB_24000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_24000_A2 (-15714) /* Floating point value -0.479565 */
-#define CS_REVERB_24000_B1 (-20898) /* Floating point value -0.637745 */
-#define CS_REVERB_24000_B2 (-6518) /* Floating point value -0.198912 */
-#define CS_REVERB_24000_SCALE 15
-
-/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_32000_A0 12463 /* Floating point value 0.380349 */
-#define CS_REVERB_32000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_32000_A2 (-12463) /* Floating point value -0.380349 */
-#define CS_REVERB_32000_B1 (-31158) /* Floating point value -0.950873 */
-#define CS_REVERB_32000_B2 1610 /* Floating point value 0.049127 */
-#define CS_REVERB_32000_SCALE 15
-
-/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_44100_A0 4872 /* Floating point value 0.297389 */
-#define CS_REVERB_44100_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_44100_A2 (-4872) /* Floating point value -0.297389 */
-#define CS_REVERB_44100_B1 (-19668) /* Floating point value -1.200423 */
-#define CS_REVERB_44100_B2 4203 /* Floating point value 0.256529 */
-#define CS_REVERB_44100_SCALE 14
-
-/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_48000_A0 4566 /* Floating point value 0.278661 */
-#define CS_REVERB_48000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_48000_A2 (-4566) /* Floating point value -0.278661 */
-#define CS_REVERB_48000_B1 (-20562) /* Floating point value -1.254993 */
-#define CS_REVERB_48000_B2 4970 /* Floating point value 0.303347 */
-#define CS_REVERB_48000_SCALE 14
-
-/* Reverb Gain Settings */
-#define LVCS_HEADPHONE_DELAYGAIN 0.800000 /* Algorithm delay path gain */
-#define LVCS_HEADPHONE_OUTPUTGAIN 1.000000 /* Algorithm output gain */
-#define LVCS_HEADPHONE_PROCGAIN 18403 /* Processed path gain */
-#define LVCS_HEADPHONE_UNPROCGAIN 18403 /* Unprocessed path gain */
-#define LVCS_HEADPHONE_GAINCORRECT 1.009343 /* Delay mixer gain correction */
-
-
-/************************************************************************************/
-/* */
-/* The Equaliser */
-/* */
-/************************************************************************************/
-
-/* Equaliser coefficients for 8000 Hz sample rate, CS scaled with 1.038497 and CSEX scaled with 0.775480 */
-#define CS_EQUALISER_8000_A0 20698 /* Floating point value 1.263312 */
-#define CS_EQUALISER_8000_A1 (-9859) /* Floating point value -0.601748 */
-#define CS_EQUALISER_8000_A2 (-4599) /* Floating point value -0.280681 */
-#define CS_EQUALISER_8000_B1 (-7797) /* Floating point value -0.475865 */
-#define CS_EQUALISER_8000_B2 (-6687) /* Floating point value -0.408154 */
-#define CS_EQUALISER_8000_SCALE 14
-#define CSEX_EQUALISER_8000_A0 30912 /* Floating point value 0.943357 */
-#define CSEX_EQUALISER_8000_A1 (-14724) /* Floating point value -0.449345 */
-#define CSEX_EQUALISER_8000_A2 (-6868) /* Floating point value -0.209594 */
-#define CSEX_EQUALISER_8000_B1 (-15593) /* Floating point value -0.475865 */
-#define CSEX_EQUALISER_8000_B2 (-13374) /* Floating point value -0.408154 */
-#define CSEX_EQUALISER_8000_SCALE 15
-
-/* Equaliser coefficients for 11025Hz sample rate, CS scaled with 1.027761 and CSEX scaled with 0.767463 */
-#define CS_EQUALISER_11025_A0 18041 /* Floating point value 1.101145 */
-#define CS_EQUALISER_11025_A1 2278 /* Floating point value 0.139020 */
-#define CS_EQUALISER_11025_A2 (-14163) /* Floating point value -0.864423 */
-#define CS_EQUALISER_11025_B1 402 /* Floating point value 0.024541 */
-#define CS_EQUALISER_11025_B2 (-14892) /* Floating point value -0.908930 */
-#define CS_EQUALISER_11025_SCALE 14
-#define CSEX_EQUALISER_11025_A0 31983 /* Floating point value 0.976058 */
-#define CSEX_EQUALISER_11025_A1 (-22784) /* Floating point value -0.695326 */
-#define CSEX_EQUALISER_11025_A2 (-2976) /* Floating point value -0.090809 */
-#define CSEX_EQUALISER_11025_B1 (-20008) /* Floating point value -0.610594 */
-#define CSEX_EQUALISER_11025_B2 (-10196) /* Floating point value -0.311149 */
-#define CSEX_EQUALISER_11025_SCALE 15
-
-/* Equaliser coefficients for 12000Hz sample rate, CS scaled with 1.032521 and CSEX scaled with 0.771017 */
-#define CS_EQUALISER_12000_A0 20917 /* Floating point value 1.276661 */
-#define CS_EQUALISER_12000_A1 (-16671) /* Floating point value -1.017519 */
-#define CS_EQUALISER_12000_A2 (-723) /* Floating point value -0.044128 */
-#define CS_EQUALISER_12000_B1 (-11954) /* Floating point value -0.729616 */
-#define CS_EQUALISER_12000_B2 (-3351) /* Floating point value -0.204532 */
-#define CS_EQUALISER_12000_SCALE 14
-#define CSEX_EQUALISER_12000_A0 16500 /* Floating point value 1.007095 */
-#define CSEX_EQUALISER_12000_A1 (-14285) /* Floating point value -0.871912 */
-#define CSEX_EQUALISER_12000_A2 381 /* Floating point value 0.023232 */
-#define CSEX_EQUALISER_12000_B1 (-12220) /* Floating point value -0.745857 */
-#define CSEX_EQUALISER_12000_B2 (-3099) /* Floating point value -0.189171 */
-#define CSEX_EQUALISER_12000_SCALE 14
-
-/* Equaliser coefficients for 16000Hz sample rate, CS scaled with 1.031378 and CSEX scaled with 0.770164 */
-#define CS_EQUALISER_16000_A0 20998 /* Floating point value 1.281629 */
-#define CS_EQUALISER_16000_A1 (-17627) /* Floating point value -1.075872 */
-#define CS_EQUALISER_16000_A2 (-678) /* Floating point value -0.041365 */
-#define CS_EQUALISER_16000_B1 (-11882) /* Floating point value -0.725239 */
-#define CS_EQUALISER_16000_B2 (-3676) /* Floating point value -0.224358 */
-#define CS_EQUALISER_16000_SCALE 14
-#define CSEX_EQUALISER_16000_A0 17713 /* Floating point value 1.081091 */
-#define CSEX_EQUALISER_16000_A1 (-14208) /* Floating point value -0.867183 */
-#define CSEX_EQUALISER_16000_A2 (-1151) /* Floating point value -0.070247 */
-#define CSEX_EQUALISER_16000_B1 (-8440) /* Floating point value -0.515121 */
-#define CSEX_EQUALISER_16000_B2 (-6978) /* Floating point value -0.425893 */
-#define CSEX_EQUALISER_16000_SCALE 14
-
-/* Equaliser coefficients for 22050Hz sample rate, CS scaled with 1.041576 and CSEX scaled with 0.777779 */
-#define CS_EQUALISER_22050_A0 22751 /* Floating point value 1.388605 */
-#define CS_EQUALISER_22050_A1 (-21394) /* Floating point value -1.305799 */
-#define CS_EQUALISER_22050_A2 654 /* Floating point value 0.039922 */
-#define CS_EQUALISER_22050_B1 (-11788) /* Floating point value -0.719494 */
-#define CS_EQUALISER_22050_B2 (-3985) /* Floating point value -0.243245 */
-#define CS_EQUALISER_22050_SCALE 14
-#define CSEX_EQUALISER_22050_A0 20855 /* Floating point value 1.272910 */
-#define CSEX_EQUALISER_22050_A1 (-21971) /* Floating point value -1.341014 */
-#define CSEX_EQUALISER_22050_A2 2744 /* Floating point value 0.167462 */
-#define CSEX_EQUALISER_22050_B1 (-10063) /* Floating point value -0.614219 */
-#define CSEX_EQUALISER_22050_B2 (-5659) /* Floating point value -0.345384 */
-#define CSEX_EQUALISER_22050_SCALE 14
-
-/* Equaliser coefficients for 24000Hz sample rate, CS scaled with 1.034495 and CSEX scaled with 0.772491 */
-#define CS_EQUALISER_24000_A0 23099 /* Floating point value 1.409832 */
-#define CS_EQUALISER_24000_A1 (-23863) /* Floating point value -1.456506 */
-#define CS_EQUALISER_24000_A2 2481 /* Floating point value 0.151410 */
-#define CS_EQUALISER_24000_B1 (-13176) /* Floating point value -0.804201 */
-#define CS_EQUALISER_24000_B2 (-2683) /* Floating point value -0.163783 */
-#define CS_EQUALISER_24000_SCALE 14
-#define CSEX_EQUALISER_24000_A0 21286 /* Floating point value 1.299198 */
-#define CSEX_EQUALISER_24000_A1 (-23797) /* Floating point value -1.452447 */
-#define CSEX_EQUALISER_24000_A2 3940 /* Floating point value 0.240489 */
-#define CSEX_EQUALISER_24000_B1 (-10966) /* Floating point value -0.669303 */
-#define CSEX_EQUALISER_24000_B2 (-4833) /* Floating point value -0.294984 */
-#define CSEX_EQUALISER_24000_SCALE 14
-
-/* Equaliser coefficients for 32000Hz sample rate, CS scaled with 1.044559 and CSEX scaled with 0.780006 */
-#define CS_EQUALISER_32000_A0 25575 /* Floating point value 1.560988 */
-#define CS_EQUALISER_32000_A1 (-30765) /* Floating point value -1.877724 */
-#define CS_EQUALISER_32000_A2 6386 /* Floating point value 0.389741 */
-#define CS_EQUALISER_32000_B1 (-14867) /* Floating point value -0.907410 */
-#define CS_EQUALISER_32000_B2 (-1155) /* Floating point value -0.070489 */
-#define CS_EQUALISER_32000_SCALE 14
-#define CSEX_EQUALISER_32000_A0 14623 /* Floating point value 1.785049 */
-#define CSEX_EQUALISER_32000_A1 (-18297) /* Floating point value -2.233497 */
-#define CSEX_EQUALISER_32000_A2 4313 /* Floating point value 0.526431 */
-#define CSEX_EQUALISER_32000_B1 (-3653) /* Floating point value -0.445939 */
-#define CSEX_EQUALISER_32000_B2 (-4280) /* Floating point value -0.522446 */
-#define CSEX_EQUALISER_32000_SCALE 13
-
-/* Equaliser coefficients for 44100Hz sample rate, CS scaled with 1.022170 and CSEX scaled with 0.763288 */
-#define CS_EQUALISER_44100_A0 13304 /* Floating point value 1.623993 */
-#define CS_EQUALISER_44100_A1 (-18602) /* Floating point value -2.270743 */
-#define CS_EQUALISER_44100_A2 5643 /* Floating point value 0.688829 */
-#define CS_EQUALISER_44100_B1 (-9152) /* Floating point value -1.117190 */
-#define CS_EQUALISER_44100_B2 1067 /* Floating point value 0.130208 */
-#define CS_EQUALISER_44100_SCALE 13
-#define CSEX_EQUALISER_44100_A0 16616 /* Floating point value 2.028315 */
-#define CSEX_EQUALISER_44100_A1 (-23613) /* Floating point value -2.882459 */
-#define CSEX_EQUALISER_44100_A2 7410 /* Floating point value 0.904535 */
-#define CSEX_EQUALISER_44100_B1 (-4860) /* Floating point value -0.593308 */
-#define CSEX_EQUALISER_44100_B2 (-3161) /* Floating point value -0.385816 */
-#define CSEX_EQUALISER_44100_SCALE 13
-
-/* Equaliser coefficients for 48000Hz sample rate, CS scaled with 1.018635 and CSEX scaled with 0.760648 */
-#define CS_EQUALISER_48000_A0 13445 /* Floating point value 1.641177 */
-#define CS_EQUALISER_48000_A1 (-19372) /* Floating point value -2.364687 */
-#define CS_EQUALISER_48000_A2 6225 /* Floating point value 0.759910 */
-#define CS_EQUALISER_48000_B1 (-9558) /* Floating point value -1.166774 */
-#define CS_EQUALISER_48000_B2 1459 /* Floating point value 0.178074 */
-#define CS_EQUALISER_48000_SCALE 13
-#define CSEX_EQUALISER_48000_A0 17200 /* Floating point value 2.099655 */
-#define CSEX_EQUALISER_48000_A1 (-25110) /* Floating point value -3.065220 */
-#define CSEX_EQUALISER_48000_A2 8277 /* Floating point value 1.010417 */
-#define CSEX_EQUALISER_48000_B1 (-5194) /* Floating point value -0.634021 */
-#define CSEX_EQUALISER_48000_B2 (-2845) /* Floating point value -0.347332 */
-#define CSEX_EQUALISER_48000_SCALE 13
-
-
-/************************************************************************************/
-/* */
-/* The Output Gain Correction */
-/* */
-/************************************************************************************/
-
-#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
-#define LVCS_HEADPHONE_SHIFTLOSS 27779 /* Output Shift loss */
-#define LVCS_HEADPHONE_GAIN 6840 /* Unprocessed path gain */
-#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
-#define LVCS_EX_HEADPHONE_SHIFTLOSS 18600 /* EX Output Shift loss */
-#define LVCS_EX_HEADPHONE_GAIN 5108 /* EX Unprocessed path gain */
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
similarity index 98%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
index d4c7627..630ecf7 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
@@ -68,7 +68,6 @@
LVM_UINT32 ScratchSize;
LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
-
/*
* Fill in the memory table
*/
@@ -98,13 +97,9 @@
/*
* Scratch memory
*/
-#ifdef BUILD_FLOAT
/* Inplace processing */
ScratchSize = (LVM_UINT32) \
(LVCS_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * pCapabilities->MaxBlockSize);
-#else
- ScratchSize = (LVM_UINT32)(LVCS_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize); /* Inplace processing */
-#endif
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Size = ScratchSize;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Type = LVCS_SCRATCH;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
@@ -118,7 +113,6 @@
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Init */
@@ -160,7 +154,6 @@
LVCS_Instance_t *pInstance;
LVCS_VolCorrect_t *pLVCS_VolCorrectTable;
-
/*
* Set the instance handle if not already initialised
*/
@@ -170,7 +163,6 @@
}
pInstance =(LVCS_Instance_t *)*phInstance;
-
/*
* Save the capabilities in the instance structure
*/
@@ -181,7 +173,6 @@
*/
pInstance->MemoryTable = *pMemoryTable;
-
/*
* Set all initial parameters to invalid to force a full initialisation
*/
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
index ab8ccd1..620b341 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
@@ -27,11 +27,6 @@
#ifndef __LVCS_PRIVATE_H__
#define __LVCS_PRIVATE_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -45,7 +40,6 @@
#include "LVCS_BypassMix.h" /* Bypass Mixer module definitions */
#include "LVM_Timer.h"
-
/************************************************************************************/
/* */
/* Defines */
@@ -79,7 +73,6 @@
#define LVCS_NR_OF_FS 9
#define LVCS_NR_OF_CHAN_CFG 2
-
/************************************************************************************/
/* */
/* Types */
@@ -94,7 +87,6 @@
LVCS_DEVICE_MAX = LVM_MAXENUM
} LVCS_OutputDevice_en;
-
/************************************************************************************/
/* */
/* Structures */
@@ -104,17 +96,10 @@
/* Volume correction structure */
typedef struct
{
-#ifdef BUILD_FLOAT
LVM_FLOAT CompFull; /* Post CS compression 100% effect */
LVM_FLOAT CompMin; /* Post CS compression 0% effect */
LVM_FLOAT GainFull; /* CS gain correct 100% effect */
LVM_FLOAT GainMin; /* CS gain correct 0% effect */
-#else
- LVM_INT16 CompFull; /* Post CS compression 100% effect */
- LVM_INT16 CompMin; /* Post CS compression 0% effect */
- LVM_INT16 GainFull; /* CS gain correct 100% effect */
- LVM_INT16 GainMin; /* CS gain correct 0% effect */
-#endif
} LVCS_VolCorrect_t;
/* Instance structure */
@@ -128,13 +113,8 @@
/* Private parameters */
LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */
-#ifndef BUILD_FLOAT
- LVM_INT16 TransitionGain; /* Transition gain */
- LVM_INT16 CompressGain; /* Last used compressor gain*/
-#else
LVM_FLOAT TransitionGain; /* Transition gain */
LVM_FLOAT CompressGain; /* Last used compressor gain*/
-#endif
/* Sub-block configurations */
LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
@@ -155,44 +135,24 @@
/* Coefficient Structure */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t EqualiserBiquadInstance;
Biquad_FLOAT_Instance_t ReverbBiquadInstance;
Biquad_FLOAT_Instance_t SEBiquadInstanceMid;
Biquad_FLOAT_Instance_t SEBiquadInstanceSide;
-#else
- Biquad_Instance_t EqualiserBiquadInstance;
- Biquad_Instance_t ReverbBiquadInstance;
- Biquad_Instance_t SEBiquadInstanceMid;
- Biquad_Instance_t SEBiquadInstanceSide;
-#endif
} LVCS_Coefficient_t;
/* Data Structure */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_2I_Order2_FLOAT_Taps_t EqualiserBiquadTaps;
Biquad_2I_Order2_FLOAT_Taps_t ReverbBiquadTaps;
Biquad_1I_Order1_FLOAT_Taps_t SEBiquadTapsMid;
Biquad_1I_Order2_FLOAT_Taps_t SEBiquadTapsSide;
-#else
- Biquad_2I_Order2_Taps_t EqualiserBiquadTaps;
- Biquad_2I_Order2_Taps_t ReverbBiquadTaps;
- Biquad_1I_Order1_Taps_t SEBiquadTapsMid;
- Biquad_1I_Order2_Taps_t SEBiquadTapsSide;
-#endif
} LVCS_Data_t;
void LVCS_TimerCallBack ( void* hInstance,
void* pCallBackParams,
LVM_INT32 CallbackParam);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* PRIVATE_H */
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
similarity index 68%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
index ef1d9eb..ded3bfa 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -66,7 +65,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -178,74 +176,6 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
- const LVM_INT16 *pInput;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
- LVCS_ReturnStatus_en err;
-
- /*
- * Check if the processing is inplace
- */
- if (pInData == pOutData)
- {
- /* Processing inplace */
- pInput = pScratch + (2*NumSamples);
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pInput, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
- else
- {
- /* Processing outplace */
- pInput = pInData;
- }
-
- /*
- * Call the stereo enhancer
- */
- err=LVCS_StereoEnhancer(hInstance, /* Instance handle */
- pInData, /* Pointer to the input data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the reverb generator
- */
- err=LVCS_ReverbGenerator(hInstance, /* Instance handle */
- pOutData, /* Pointer to the input data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the equaliser
- */
- err=LVCS_Equaliser(hInstance, /* Instance handle */
- pOutData, /* Pointer to the input data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the bypass mixer
- */
- err=LVCS_BypassMixer(hInstance, /* Instance handle */
- pOutData, /* Pointer to the processed data */
- pInput, /* Pointer to the input (unprocessed) data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- if(err !=LVCS_SUCCESS)
- {
- return err;
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -272,7 +202,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -311,7 +240,6 @@
pOutData,
NumSamples);
-
/*
* Compress to reduce expansion effect of Concert Sound and correct volume
* differences for difference settings. Not applied in test modes
@@ -403,7 +331,6 @@
pInstance->CompressGain = Gain;
}
-
if(pInstance->bInOperatingModeTransition == LVM_TRUE){
/*
@@ -455,168 +382,5 @@
}
}
-
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance =(LVCS_Instance_t *)hInstance;
- LVCS_ReturnStatus_en err;
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
- {
- return(LVCS_TOOMANYSAMPLES);
- }
-
- /*
- * Check if the algorithm is enabled
- */
- if (pInstance->Params.OperatingMode != LVCS_OFF)
- {
- /*
- * Call CS process function
- */
- err=LVCS_Process_CS(hInstance,
- pInData,
- pOutData,
- NumSamples);
-
- /*
- * Compress to reduce expansion effect of Concert Sound and correct volume
- * differences for difference settings. Not applied in test modes
- */
- if ((pInstance->Params.OperatingMode == LVCS_ON)&&(pInstance->Params.CompressorMode == LVM_MODE_ON))
- {
- LVM_INT16 Gain = pInstance->VolCorrect.CompMin;
- LVM_INT32 Current1;
-
- Current1 = LVC_Mixer_GetCurrent(&pInstance->BypassMix.Mixer_Instance.MixerStream[0]);
- Gain = (LVM_INT16)( pInstance->VolCorrect.CompMin
- - (((LVM_INT32)pInstance->VolCorrect.CompMin * (Current1)) >> 15)
- + (((LVM_INT32)pInstance->VolCorrect.CompFull * (Current1)) >> 15) );
-
- if(NumSamples < LVCS_COMPGAINFRAME)
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutData,
- pOutData,
- (LVM_INT32)(2*NumSamples));
- }
- else
- {
- LVM_INT16 GainStep;
- LVM_INT16 FinalGain;
- LVM_INT16 SampleToProcess = NumSamples;
- LVM_INT16 *pOutPtr;
-
- /* Large changes in Gain can cause clicks in output
- Split data into small blocks and use interpolated gain values */
-
- GainStep = (LVM_INT16)(((Gain-pInstance->CompressGain) * LVCS_COMPGAINFRAME)/NumSamples);
-
- if((GainStep ==0)&&(pInstance->CompressGain < Gain))
- {
- GainStep=1;
- }
- else
- {
- if((GainStep ==0)&&(pInstance->CompressGain > Gain))
- {
- GainStep=-1;
- }
- }
-
- FinalGain = Gain;
- Gain = pInstance->CompressGain;
- pOutPtr = pOutData;
-
- while(SampleToProcess > 0)
- {
- Gain = (LVM_INT16)(Gain + GainStep);
- if((GainStep > 0)&& (FinalGain <= Gain))
- {
- Gain = FinalGain;
- GainStep =0;
- }
-
- if((GainStep < 0)&& (FinalGain > Gain))
- {
- Gain = FinalGain;
- GainStep =0;
- }
-
- if(SampleToProcess > LVCS_COMPGAINFRAME)
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2*LVCS_COMPGAINFRAME));
- pOutPtr +=(2*LVCS_COMPGAINFRAME);
- SampleToProcess = (LVM_INT16)(SampleToProcess-LVCS_COMPGAINFRAME);
- }
- else
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2*SampleToProcess));
-
- SampleToProcess = 0;
- }
-
- }
- }
-
- /* Store gain value*/
- pInstance->CompressGain = Gain;
- }
-
-
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
-
- /*
- * Re-init bypass mix when timer has completed
- */
- if ((pInstance->bTimerDone == LVM_TRUE) &&
- (pInstance->BypassMix.Mixer_Instance.MixerStream[1].CallbackSet == 0))
- {
- err=LVCS_BypassMixInit(hInstance,
- &pInstance->Params);
-
- if(err != LVCS_SUCCESS)
- {
- return err;
- }
-
- }
- else{
- LVM_Timer ( &pInstance->TimerInstance,
- (LVM_INT16)NumSamples);
- }
- }
- }
- else
- {
- if (pInData != pOutData)
- {
- /*
- * The algorithm is disabled so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
- }
-
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
similarity index 65%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
index 1085101..d0e6e09 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
@@ -57,7 +57,6 @@
/* 2. The numerator coefficients of the filter are negated to cause an inversion. */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -71,7 +70,6 @@
BQ_FLOAT_Coefs_t Coeffs;
const BiquadA012B12CoefsSP_t *pReverbCoefTable;
-
pData = (LVCS_Data_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
@@ -91,7 +89,6 @@
*/
Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
-
pConfig->DelaySize = (LVM_INT16)(2 * Delay);
pConfig->DelayOffset = 0;
LoadConst_Float(0, /* Value */
@@ -112,8 +109,7 @@
Coeffs.B2 = (LVM_FLOAT)-pReverbCoefTable[Offset].B2;
LoadConst_Float(0, /* Value */
- (void *)&pData->ReverbBiquadTaps, /* Destination Cast to void:
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->ReverbBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->ReverbBiquadTaps) / sizeof(LVM_FLOAT)));
@@ -132,7 +128,6 @@
break;
}
-
/*
* Setup the mixer
*/
@@ -148,90 +143,6 @@
}
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Delay;
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- BQ_C16_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pReverbCoefTable;
-
- /*
- * Initialise the delay and filters if:
- * - the sample rate has changed
- * - the speaker type has changed to or from the mobile speaker
- */
- if(pInstance->Params.SampleRate != pParams->SampleRate ) /* Sample rate change test */
-
- {
- /*
- * Setup the delay
- */
- Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
-
-
- pConfig->DelaySize = (LVM_INT16)(2 * Delay);
- pConfig->DelayOffset = 0;
- LoadConst_16(0, /* Value */
- (LVM_INT16 *)&pConfig->StereoSamples[0], /* Destination */
- (LVM_UINT16)(sizeof(pConfig->StereoSamples)/sizeof(LVM_INT16))); /* Number of words */
-
- /*
- * Setup the filters
- */
- Offset = (LVM_UINT16)pParams->SampleRate;
- pReverbCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_ReverbCoefTable[0];
-
- /* Convert incoming coefficients to the required format/ordering */
- Coeffs.A0 = (LVM_INT16)pReverbCoefTable[Offset].A0;
- Coeffs.A1 = (LVM_INT16)pReverbCoefTable[Offset].A1;
- Coeffs.A2 = (LVM_INT16)pReverbCoefTable[Offset].A2;
- Coeffs.B1 = (LVM_INT16)-pReverbCoefTable[Offset].B1;
- Coeffs.B2 = (LVM_INT16)-pReverbCoefTable[Offset].B2;
-
- LoadConst_16(0, /* Value */
- (void *)&pData->ReverbBiquadTaps, /* Destination Cast to void: no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->ReverbBiquadTaps)/sizeof(LVM_INT16))); /* Number of words */
-
- BQ_2I_D16F16Css_TRC_WRA_01_Init(&pCoefficients->ReverbBiquadInstance,
- &pData->ReverbBiquadTaps,
- &Coeffs);
-
- /* Callbacks */
- switch(pReverbCoefTable[Offset].Scale)
- {
- case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C14_TRC_WRA_01;
- break;
- case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C15_TRC_WRA_01;
- break;
- }
-
-
- /*
- * Setup the mixer
- */
- pConfig->ProcGain = (LVM_UINT16)(HEADPHONEGAINPROC);
- pConfig->UnprocGain = (LVM_UINT16)(HEADPHONEGAINUNPROC);
- }
-
- if(pInstance->Params.ReverbLevel != pParams->ReverbLevel)
- {
- LVM_INT32 ReverbPercentage=83886; // 1 Percent Reverb i.e 1/100 in Q 23 format
- ReverbPercentage*=pParams->ReverbLevel; // Actual Reverb Level in Q 23 format
- pConfig->ReverbLevel=(LVM_INT16)(ReverbPercentage>>8); // Reverb Level in Q 15 format
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Reverb */
@@ -270,7 +181,6 @@
/* 2. The Gain is combined with the LPF and incorporated in to the coefficients */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -301,12 +211,11 @@
(LVM_INT16)(2 * NumSamples)); /* Left and right */
}
-
/*
* Check if the reverb is required
*/
/* Disable when CS4MS in stereo mode */
- if (((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 */
@@ -338,7 +247,6 @@
(LVM_FLOAT *)pScratch,
(LVM_INT16)(2 * NumSamples));
-
/*
* Apply the delay mix
*/
@@ -349,87 +257,7 @@
&pConfig->DelayOffset,
(LVM_INT16)NumSamples);
-
}
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
-
-
- /*
- * Copy the data to the output in outplace processing
- */
- if (pInData != pOutData)
- {
- /*
- * Reverb not required so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
-
-
- /*
- * Check if the reverb is required
- */
- if (((pInstance->Params.SpeakerType == LVCS_HEADPHONE) || /* Disable when CS4MS in stereo mode */
- (pInstance->Params.SpeakerType == LVCS_EX_HEADPHONES) ||
- (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
- ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) !=0)) /* For validation testing */
- {
- /********************************************************************************/
- /* */
- /* Copy the input data to scratch memory and filter it */
- /* */
- /********************************************************************************/
-
- /*
- * Copy the input data to the scratch memory
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
-
-
- /*
- * Filter the data
- */
- (pConfig->pBiquadCallBack)((Biquad_Instance_t*)&pCoefficients->ReverbBiquadInstance,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)NumSamples);
-
- Mult3s_16x16( (LVM_INT16 *)pScratch,
- pConfig->ReverbLevel,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)(2*NumSamples));
-
-
- /*
- * Apply the delay mix
- */
- DelayMix_16x16((LVM_INT16 *)pScratch,
- &pConfig->StereoSamples[0],
- pConfig->DelaySize,
- pOutData,
- &pConfig->DelayOffset,
- (LVM_INT16)NumSamples);
-
-
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
index f94d4e4..1bc4338 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
@@ -18,11 +18,6 @@
#ifndef __LVCS_REVERBGENERATOR_H__
#define __LVCS_REVERBGENERATOR_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -31,7 +26,6 @@
#include "LVC_Mixer.h"
-
/************************************************************************************/
/* */
/* Defines */
@@ -41,14 +35,12 @@
#define HEADPHONEGAINPROC LVCS_HEADPHONE_PROCGAIN
#define HEADPHONEGAINUNPROC LVCS_HEADPHONE_UNPROCGAIN
-
/************************************************************************************/
/* */
/* Structures */
/* */
/************************************************************************************/
-
/* Reverberation module structure */
typedef struct
{
@@ -58,23 +50,14 @@
LVM_INT16 DelayOffset;
LVM_INT16 ProcGain;
LVM_INT16 UnprocGain;
-#ifndef BUILD_FLOAT
- LVM_INT16 StereoSamples[2*LVCS_STEREODELAY_CS_48KHZ];
- /* Reverb Level */
- LVM_INT16 ReverbLevel;
- /* Filter */
- void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-#else
LVM_FLOAT StereoSamples[2 * LVCS_STEREODELAY_CS_MAX_VAL];
/* Reverb Level */
LVM_FLOAT ReverbLevel;
/* Filter */
void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*,
LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
-#endif
} LVCS_ReverbGenerator_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -83,19 +66,9 @@
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInput,
LVM_FLOAT *pOutput,
LVM_UINT16 NumSamples);
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInput,
- LVM_INT16 *pOutput,
- LVM_UINT16 NumSamples);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* REVERB_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
similarity index 64%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
index 2992c35..7fd8444 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
@@ -49,7 +49,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -63,7 +62,6 @@
BQ_FLOAT_Coefs_t CoeffsSide;
const BiquadA012B12CoefsSP_t *pSESideCoefs;
-
pData = (LVCS_Data_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
@@ -89,8 +87,7 @@
/* Clear the taps */
LoadConst_Float(0, /* Value */
- (void *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->SEBiquadTapsMid, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsMid) / sizeof(LVM_FLOAT)));
@@ -117,8 +114,7 @@
/* Clear the taps */
LoadConst_Float(0, /* Value */
- (void *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->SEBiquadTapsSide, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsSide) / sizeof(LVM_FLOAT)));
/* Callbacks */
@@ -142,99 +138,8 @@
}
-
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficient = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- FO_C16_Coefs_t CoeffsMid;
- BQ_C16_Coefs_t CoeffsSide;
- const BiquadA012B12CoefsSP_t *pSESideCoefs;
-
- /*
- * If the sample rate or speaker type has changed update the filters
- */
- if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
- /*
- * Set the filter coefficients based on the sample rate
- */
- /* Mid filter */
- Offset = (LVM_UINT16)pParams->SampleRate;
-
- /* Convert incoming coefficients to the required format/ordering */
- CoeffsMid.A0 = (LVM_INT16) LVCS_SEMidCoefTable[Offset].A0;
- CoeffsMid.A1 = (LVM_INT16) LVCS_SEMidCoefTable[Offset].A1;
- CoeffsMid.B1 = (LVM_INT16)-LVCS_SEMidCoefTable[Offset].B1;
-
- /* Clear the taps */
- LoadConst_16(0, /* Value */
- (void *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->SEBiquadTapsMid)/sizeof(LVM_UINT16))); /* Number of words */
-
- FO_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceMid,
- &pData->SEBiquadTapsMid,
- &CoeffsMid);
-
- /* Callbacks */
- if(LVCS_SEMidCoefTable[Offset].Scale==15)
- {
- pConfig->pBiquadCallBack_Mid = FO_1I_D16F16C15_TRC_WRA_01;
- }
-
- Offset = (LVM_UINT16)(pParams->SampleRate);
- pSESideCoefs = (BiquadA012B12CoefsSP_t*)&LVCS_SESideCoefTable[0];
-
- /* Side filter */
- /* Convert incoming coefficients to the required format/ordering */
- CoeffsSide.A0 = (LVM_INT16) pSESideCoefs[Offset].A0;
- CoeffsSide.A1 = (LVM_INT16) pSESideCoefs[Offset].A1;
- CoeffsSide.A2 = (LVM_INT16) pSESideCoefs[Offset].A2;
- CoeffsSide.B1 = (LVM_INT16)-pSESideCoefs[Offset].B1;
- CoeffsSide.B2 = (LVM_INT16)-pSESideCoefs[Offset].B2;
-
- /* Clear the taps */
- LoadConst_16(0, /* Value */
- (void *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->SEBiquadTapsSide)/sizeof(LVM_UINT16))); /* Number of words */
-
-
- /* Callbacks */
- switch(pSESideCoefs[Offset].Scale)
- {
- case 14:
- BQ_1I_D16F32Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
-
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F32C14_TRC_WRA_01;
- break;
- case 15:
- BQ_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
-
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F16C15_TRC_WRA_01;
- break;
- }
-
- }
-
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_StereoEnhance */
@@ -273,7 +178,6 @@
/* 1. The side filter is not used in Mobile Speaker mode */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -356,81 +260,3 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
- LVCS_Coefficient_t *pCoefficient = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
-
- /*
- * Check if the Stereo Enhancer is enabled
- */
- if ((pInstance->Params.OperatingMode & LVCS_STEREOENHANCESWITCH) != 0)
- {
- /*
- * Convert from stereo to middle and side
- */
- From2iToMS_16x16(pInData,
- pScratch,
- pScratch+NumSamples,
- (LVM_INT16)NumSamples);
-
- /*
- * Apply filter to the middle signal
- */
- if (pInstance->OutputDevice == LVCS_HEADPHONE)
- {
- (pConfig->pBiquadCallBack_Mid)((Biquad_Instance_t*)&pCoefficient->SEBiquadInstanceMid,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)NumSamples);
- }
- else
- {
- Mult3s_16x16(pScratch, /* Source */
- (LVM_INT16)pConfig->MidGain, /* Gain */
- pScratch, /* Destination */
- (LVM_INT16)NumSamples); /* Number of samples */
- }
-
- /*
- * Apply the filter the side signal only in stereo mode for headphones
- * and in all modes for mobile speakers
- */
- if (pInstance->Params.SourceFormat == LVCS_STEREO)
- {
- (pConfig->pBiquadCallBack_Side)((Biquad_Instance_t*)&pCoefficient->SEBiquadInstanceSide,
- (LVM_INT16 *)(pScratch + NumSamples),
- (LVM_INT16 *)(pScratch + NumSamples),
- (LVM_INT16)NumSamples);
- }
-
- /*
- * Convert from middle and side to stereo
- */
- MSTo2i_Sat_16x16(pScratch,
- pScratch+NumSamples,
- pOutData,
- (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * The stereo enhancer is disabled so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
-
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
index 4125f24..12a5982 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
@@ -18,11 +18,6 @@
#ifndef __LVCS_STEREOENHANCER_H__
#define __LVCS_STEREOENHANCER_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -33,7 +28,6 @@
#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
#include "BIQUAD.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -44,17 +38,6 @@
typedef struct
{
-#ifndef BUILD_FLOAT
- /*
- * Middle filter
- */
- void (*pBiquadCallBack_Mid)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
- /*
- * Side filter
- */
- void (*pBiquadCallBack_Side)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
- LVM_UINT16 MidGain; /* Middle gain in mobile speaker mode */
-#else
/*
* Middle filter
*/
@@ -67,10 +50,8 @@
void (*pBiquadCallBack_Side)(Biquad_FLOAT_Instance_t*,
LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
LVM_FLOAT MidGain; /* Middle gain in mobile speaker mode */
-#endif
} LVCS_StereoEnhancer_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -80,19 +61,9 @@
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#endif
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* STEREOENHANCE_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
similarity index 93%
rename from media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
rename to media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
index a1fb48f..d79db61 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -23,11 +22,11 @@
/************************************************************************************/
#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 */
-
/************************************************************************************/
/* */
/* Stereo Enhancer coefficient constant tables */
@@ -72,7 +71,6 @@
CS_MIDDLE_48000_A1,
CS_MIDDLE_48000_B1,
(LVM_UINT16 )CS_MIDDLE_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_MIDDLE_88200_A0, /* 88kS/s coefficients */
CS_MIDDLE_88200_A1,
@@ -90,7 +88,6 @@
CS_MIDDLE_192000_A1,
CS_MIDDLE_192000_B1,
(LVM_UINT16 )CS_MIDDLE_192000_SCALE}
-#endif
};
/* Coefficient table for the side filter */
@@ -150,7 +147,6 @@
CS_SIDE_48000_B1,
CS_SIDE_48000_B2,
(LVM_UINT16 )CS_SIDE_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_SIDE_88200_A0, /* 88kS/s coefficients */
CS_SIDE_88200_A1,
@@ -176,10 +172,8 @@
CS_SIDE_192000_B1,
CS_SIDE_192000_B2,
(LVM_UINT16 )CS_SIDE_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Equaliser coefficient constant tables */
@@ -242,7 +236,6 @@
CS_EQUALISER_48000_B1,
CS_EQUALISER_48000_B2,
(LVM_UINT16 )CS_EQUALISER_48000_SCALE},
-#ifdef HIGHER_FS
{CS_EQUALISER_88200_A0, /* 88kS/s coeffieients */
CS_EQUALISER_88200_A1,
CS_EQUALISER_88200_A2,
@@ -267,7 +260,6 @@
CS_EQUALISER_192000_B1,
CS_EQUALISER_192000_B2,
(LVM_UINT16 )CS_EQUALISER_192000_SCALE},
-#endif
/* Concert Sound EX Headphone coefficients */
{CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
@@ -324,7 +316,6 @@
CSEX_EQUALISER_48000_B1,
CSEX_EQUALISER_48000_B2,
(LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
-#ifdef HIGHER_FS
,
{CSEX_EQUALISER_88200_A0, /* 88kS/s coefficients */
CSEX_EQUALISER_88200_A1,
@@ -350,10 +341,8 @@
CSEX_EQUALISER_192000_B1,
CSEX_EQUALISER_192000_B2,
(LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Reverb delay constant tables */
@@ -439,7 +428,6 @@
CS_REVERB_48000_B1,
CS_REVERB_48000_B2,
(LVM_UINT16 )CS_REVERB_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_REVERB_88200_A0, /* 88kS/s coefficients */
CS_REVERB_88200_A1,
@@ -465,10 +453,8 @@
CS_REVERB_192000_B1,
CS_REVERB_192000_B2,
(LVM_UINT16 )CS_REVERB_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Bypass mixer constant tables */
@@ -490,7 +476,6 @@
LVCS_EX_HEADPHONE_GAIN}
};
-
/************************************************************************************/
/* */
/* Volume correction table */
@@ -517,7 +502,6 @@
/* */
/************************************************************************************/
const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
-#ifdef BUILD_FLOAT
{0.433362f, /* Headphone, stereo mode */
0.000000f,
1.000024f,
@@ -534,24 +518,6 @@
0.000000f,
1.000024f,
1.412640f}
-#else
- {14200, /* Headphone, stereo mode */
- 0,
- 4096,
- 5786},
- {14200, /* EX Headphone, stereo mode */
- 0,
- 4096,
- 5786},
- {32767, /* Headphone, mono mode */
- 0,
- 4096,
- 5786},
- {32767, /* EX Headphone, mono mode */
- 0,
- 4096,
- 5786}
-#endif
};
/************************************************************************************/
@@ -569,14 +535,11 @@
#define LVCS_VOL_TC_Fs32000 32721 /* Floating point value 0.998565674 */
#define LVCS_VOL_TC_Fs44100 32734 /* Floating point value 0.998962402 */
#define LVCS_VOL_TC_Fs48000 32737 /* Floating point value 0.999053955 */
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVCS_VOL_TC_Fs88200 32751 /* Floating point value 0.999481066 */
#define LVCS_VOL_TC_Fs96000 32751 /* Floating point value 0.999511703 */ /* Todo @ need to re check this value*/
#define LVCS_VOL_TC_Fs176400 32759 /* Floating point value 0.999740499 */
#define LVCS_VOL_TC_Fs192000 32763 /* Floating point value 0.999877925 */ /* Todo @ need to re check this value*/
-#endif
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_INT16 LVCS_VolumeTCTable[13] = {LVCS_VOL_TC_Fs8000,
LVCS_VOL_TC_Fs11025,
LVCS_VOL_TC_Fs12000,
@@ -591,25 +554,12 @@
LVCS_VOL_TC_Fs176400,
LVCS_VOL_TC_Fs192000
};
-#else
-const LVM_INT16 LVCS_VolumeTCTable[9] = {LVCS_VOL_TC_Fs8000,
- LVCS_VOL_TC_Fs11025,
- LVCS_VOL_TC_Fs12000,
- LVCS_VOL_TC_Fs16000,
- LVCS_VOL_TC_Fs22050,
- LVCS_VOL_TC_Fs24000,
- LVCS_VOL_TC_Fs32000,
- LVCS_VOL_TC_Fs44100,
- LVCS_VOL_TC_Fs48000
-};
-#endif
/************************************************************************************/
/* */
/* Sample rate table */
/* */
/************************************************************************************/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_INT32 LVCS_SampleRateTable[13] = {8000,
11025,
12000,
@@ -624,15 +574,3 @@
176400,
192000
};
-#else
-const LVM_INT16 LVCS_SampleRateTable[9] = {8000,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
index 3f6c4c8..5490699 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
@@ -18,10 +18,6 @@
#ifndef __LVCS_TABLES_H__
#define __LVCS_TABLES_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
/************************************************************************************/
/* */
/* Includes */
@@ -104,15 +100,13 @@
extern const LVCS_VolCorrect_t LVCS_VolCorrectTable[];
extern const LVM_INT16 LVCS_VolumeTCTable[];
-
/************************************************************************************/
/* */
/* Sample rates */
/* */
/************************************************************************************/
-extern LVM_INT32 LVCS_SampleRateTable[];
-
+extern const LVM_INT32 LVCS_SampleRateTable[];
/*Speaker coeffient tables*/
extern LVM_UINT16 LVCS_MS_Small_SEMiddleGainTable[];
@@ -142,11 +136,5 @@
extern LVCS_VolCorrect_t LVCS_MS_Large_VolCorrectTable[];
extern LVM_UINT16 LVCS_MS_Large_ReverbGainTable[];
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* __LVCS_TABLES_H__ */
diff --git a/media/libeffects/lvm/tests/Android.bp b/media/libeffects/lvm/tests/Android.bp
index 003ce9e..674c246 100644
--- a/media/libeffects/lvm/tests/Android.bp
+++ b/media/libeffects/lvm/tests/Android.bp
@@ -35,8 +35,6 @@
srcs: ["lvmtest.cpp"],
cflags: [
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
diff --git a/media/libeffects/lvm/tests/lvmtest.cpp b/media/libeffects/lvm/tests/lvmtest.cpp
index 5b58dd1..a4ace6c 100644
--- a/media/libeffects/lvm/tests/lvmtest.cpp
+++ b/media/libeffects/lvm/tests/lvmtest.cpp
@@ -482,10 +482,6 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- pContext->pBundledContext->pInputBuffer = NULL;
- pContext->pBundledContext->pOutputBuffer = NULL;
-#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
diff --git a/media/libeffects/lvm/wrapper/Android.bp b/media/libeffects/lvm/wrapper/Android.bp
index 16fa126..afc4220 100644
--- a/media/libeffects/lvm/wrapper/Android.bp
+++ b/media/libeffects/lvm/wrapper/Android.bp
@@ -1,6 +1,3 @@
-// The wrapper -DBUILD_FLOAT needs to match
-// the lvm library -DBUILD_FLOAT.
-
// music bundle wrapper
cc_library_shared {
name: "libbundlewrapper",
@@ -14,10 +11,8 @@
vendor: true,
srcs: ["Bundle/EffectBundle.cpp"],
- cflags: [
+ cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
@@ -56,10 +51,8 @@
vendor: true,
srcs: ["Reverb/EffectReverb.cpp"],
- cflags: [
+ cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-Wall",
"-Werror",
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 10dda19..d569c6a 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -81,7 +81,6 @@
} \
}
-
// NXP SW BassBoost UUID
const effect_descriptor_t gBassBoostDescriptor = {
{0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
@@ -258,26 +257,6 @@
pContext->pBundledContext->firstVolume = LVM_TRUE;
pContext->pBundledContext->volume = 0;
- #ifdef LVM_PCM
- char fileName[256];
- snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
- pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
- if (pContext->pBundledContext->PcmInPtr == NULL) {
- ALOGV("cannot open %s", fileName);
- ret = -EINVAL;
- goto exit;
- }
-
- snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
- pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
- if (pContext->pBundledContext->PcmOutPtr == NULL) {
- ALOGV("cannot open %s", fileName);
- fclose(pContext->pBundledContext->PcmInPtr);
- pContext->pBundledContext->PcmInPtr = NULL;
- ret = -EINVAL;
- goto exit;
- }
- #endif
/* Saved strength is used to return the exact strength that was used in the set to the get
* because we map the original strength range of 0:1000 to 1:15, and this will avoid
@@ -295,10 +274,6 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- pContext->pBundledContext->pInputBuffer = NULL;
- pContext->pBundledContext->pOutputBuffer = NULL;
-#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
@@ -443,17 +418,6 @@
(pSessionContext->bEqualizerInstantiated ==LVM_FALSE) &&
(pSessionContext->bVirtualizerInstantiated==LVM_FALSE))
{
-#ifdef LVM_PCM
- if (pContext->pBundledContext->PcmInPtr != NULL) {
- fclose(pContext->pBundledContext->PcmInPtr);
- pContext->pBundledContext->PcmInPtr = NULL;
- }
- if (pContext->pBundledContext->PcmOutPtr != NULL) {
- fclose(pContext->pBundledContext->PcmOutPtr);
- pContext->pBundledContext->PcmOutPtr = NULL;
- }
-#endif
-
// Clear the SessionIndex
for(int i=0; i<LVM_MAX_SESSIONS; i++){
@@ -474,10 +438,6 @@
if (pContext->pBundledContext->workBuffer != NULL) {
free(pContext->pBundledContext->workBuffer);
}
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- free(pContext->pBundledContext->pInputBuffer);
- free(pContext->pBundledContext->pOutputBuffer);
-#endif
delete pContext->pBundledContext;
pContext->pBundledContext = LVM_NULL;
}
@@ -759,7 +719,6 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
-#ifdef BUILD_FLOAT
int LvmBundle_process(effect_buffer_t *pIn,
effect_buffer_t *pOut,
int frameCount,
@@ -769,30 +728,6 @@
effect_buffer_t *pOutTmp;
const LVM_INT32 NrChannels =
audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
-#ifndef NATIVE_FLOAT_BUFFER
- if (pContext->pBundledContext->pInputBuffer == nullptr ||
- pContext->pBundledContext->frameCount < frameCount) {
- free(pContext->pBundledContext->pInputBuffer);
- pContext->pBundledContext->pInputBuffer =
- (LVM_FLOAT *)calloc(frameCount, sizeof(LVM_FLOAT) * NrChannels);
- }
-
- if (pContext->pBundledContext->pOutputBuffer == nullptr ||
- pContext->pBundledContext->frameCount < frameCount) {
- free(pContext->pBundledContext->pOutputBuffer);
- pContext->pBundledContext->pOutputBuffer =
- (LVM_FLOAT *)calloc(frameCount, sizeof(LVM_FLOAT) * NrChannels);
- }
-
- if (pContext->pBundledContext->pInputBuffer == nullptr ||
- pContext->pBundledContext->pOutputBuffer == nullptr) {
- ALOGE("LVM_ERROR : LvmBundle_process memory allocation for float buffer's failed");
- return -EINVAL;
- }
-
- LVM_FLOAT * const pInputBuff = pContext->pBundledContext->pInputBuffer;
- LVM_FLOAT * const pOutputBuff = pContext->pBundledContext->pOutputBuffer;
-#endif
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
pOutTmp = pOut;
@@ -814,123 +749,25 @@
return -EINVAL;
}
-#ifdef LVM_PCM
- fwrite(pIn,
- frameCount * sizeof(effect_buffer_t) * NrChannels,
- 1,
- pContext->pBundledContext->PcmInPtr);
- fflush(pContext->pBundledContext->PcmInPtr);
-#endif
-#ifndef NATIVE_FLOAT_BUFFER
- /* Converting input data from fixed point to float point */
- memcpy_to_float_from_i16(pInputBuff, pIn, frameCount * NrChannels);
-
- /* Process the samples */
- LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
- pInputBuff, /* Input buffer */
- pOutputBuff, /* Output buffer */
- (LVM_UINT16)frameCount, /* Number of samples to read */
- 0); /* Audio Time */
-
- /* Converting output data from float point to fixed point */
- memcpy_to_i16_from_float(pOutTmp, pOutputBuff, frameCount * NrChannels);
-
-#else
/* Process the samples */
LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
pIn, /* Input buffer */
pOutTmp, /* Output buffer */
(LVM_UINT16)frameCount, /* Number of samples to read */
0); /* Audio Time */
-#endif
LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-#ifdef LVM_PCM
- fwrite(pOutTmp,
- frameCount * sizeof(effect_buffer_t) * NrChannels,
- 1,
- pContext->pBundledContext->PcmOutPtr);
- fflush(pContext->pBundledContext->PcmOutPtr);
-#endif
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
for (int i = 0; i < frameCount * NrChannels; i++) {
-#ifndef NATIVE_FLOAT_BUFFER
- pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]);
-#else
pOut[i] = pOut[i] + pOutTmp[i];
-#endif
}
}
return 0;
} /* end LvmBundle_process */
-#else // BUILD_FLOAT
-
-int LvmBundle_process(LVM_INT16 *pIn,
- LVM_INT16 *pOut,
- int frameCount,
- EffectContext *pContext) {
-
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- LVM_INT16 *pOutTmp;
-
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
- pOutTmp = pOut;
- } else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
- if (pContext->pBundledContext->frameCount != frameCount) {
- if (pContext->pBundledContext->workBuffer != NULL) {
- free(pContext->pBundledContext->workBuffer);
- }
- pContext->pBundledContext->workBuffer =
- (effect_buffer_t *)calloc(frameCount, sizeof(effect_buffer_t) * FCC_2);
- if (pContext->pBundledContext->workBuffer == NULL) {
- return -ENOMEM;
- }
- pContext->pBundledContext->frameCount = frameCount;
- }
- pOutTmp = pContext->pBundledContext->workBuffer;
- } else {
- ALOGV("LVM_ERROR : LvmBundle_process invalid access mode");
- return -EINVAL;
- }
-
-#ifdef LVM_PCM
- fwrite(pIn, frameCount * sizeof(*pIn) * FCC_2,
- 1 /* nmemb */, pContext->pBundledContext->PcmInPtr);
- fflush(pContext->pBundledContext->PcmInPtr);
-#endif
-
- //ALOGV("Calling LVM_Process");
-
- /* Process the samples */
- LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
- pIn, /* Input buffer */
- pOutTmp, /* Output buffer */
- (LVM_UINT16)frameCount, /* Number of samples to read */
- 0); /* Audio Time */
-
- LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-
-#ifdef LVM_PCM
- fwrite(pOutTmp, frameCount * sizeof(*pOutTmp) * FCC_2,
- 1 /* nmemb */, pContext->pBundledContext->PcmOutPtr);
- fflush(pContext->pBundledContext->PcmOutPtr);
-#endif
-
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
- for (int i=0; i<frameCount*2; i++){
- pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]);
- }
- }
- return 0;
-} /* end LvmBundle_process */
-
-#endif // BUILD_FLOAT
-
//----------------------------------------------------------------------------
// EqualizerUpdateActiveParams()
//----------------------------------------------------------------------------
@@ -953,7 +790,6 @@
//ALOGV("\tEqualizerUpdateActiveParams just Got -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
-
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
ActiveParams.pEQNB_BandDefinition[i].Frequency = EQNB_5BandPresetsFrequencies[i];
ActiveParams.pEQNB_BandDefinition[i].QFactor = EQNB_5BandPresetsQFactors[i];
@@ -1290,7 +1126,6 @@
SampleRate = LVM_FS_48000;
pContext->pBundledContext->SamplesPerSecond = 48000 * NrChannels;
break;
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
case 88200:
SampleRate = LVM_FS_88200;
pContext->pBundledContext->SamplesPerSecond = 88200 * NrChannels;
@@ -1307,7 +1142,6 @@
SampleRate = LVM_FS_192000;
pContext->pBundledContext->SamplesPerSecond = 192000 * NrChannels;
break;
-#endif
default:
ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -2051,8 +1885,6 @@
LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
LVM_INT16 Balance = 0;
-
-
pContext->pBundledContext->positionSaved = position;
Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
@@ -2097,7 +1929,6 @@
return 0;
} /* end VolumeSetStereoPosition */
-
//----------------------------------------------------------------------------
// VolumeGetStereoPosition()
//----------------------------------------------------------------------------
@@ -2970,7 +2801,6 @@
return status;
} /* end Volume_getParameter */
-
//----------------------------------------------------------------------------
// Volume_setParameter()
//----------------------------------------------------------------------------
@@ -3422,17 +3252,10 @@
pContext->pBundledContext->NumberEffectsCalled = 0;
/* Process all the available frames, block processing is
handled internalLY by the LVM bundle */
-#ifdef NATIVE_FLOAT_BUFFER
processStatus = android::LvmBundle_process(inBuffer->f32,
outBuffer->f32,
outBuffer->frameCount,
pContext);
-#else
- processStatus = android::LvmBundle_process(inBuffer->s16,
- outBuffer->s16,
- outBuffer->frameCount,
- pContext);
-#endif
if (processStatus != 0){
ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", processStatus);
if (status == 0) {
@@ -3447,11 +3270,7 @@
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
for (size_t i = 0; i < outBuffer->frameCount * NrChannels; ++i) {
-#ifdef NATIVE_FLOAT_BUFFER
outBuffer->f32[i] += inBuffer->f32[i];
-#else
- outBuffer->s16[i] = clamp16((LVM_INT32)outBuffer->s16[i] + inBuffer->s16[i]);
-#endif
}
} else if (outBuffer->raw != inBuffer->raw) {
memcpy(outBuffer->raw,
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index e4aacd0..524e103 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -23,10 +23,6 @@
#include <LVM.h>
#include <limits.h>
-#if __cplusplus
-extern "C" {
-#endif
-
#define FIVEBAND_NUMBANDS 5
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
@@ -37,7 +33,6 @@
#define EQUALIZER_CUP_LOAD_ARM9E 220 // Expressed in 0.1 MIPS
#define VOLUME_CUP_LOAD_ARM9E 0 // Expressed in 0.1 MIPS
#define BUNDLE_MEM_USAGE 25 // Expressed in kB
-//#define LVM_PCM
#ifndef OPENSL_ES_H_
static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6,
@@ -99,14 +94,6 @@
int frameCount;
int32_t bandGaindB[FIVEBAND_NUMBANDS];
int volume;
- #ifdef LVM_PCM
- FILE *PcmInPtr;
- FILE *PcmOutPtr;
- #endif
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- LVM_FLOAT *pInputBuffer;
- LVM_FLOAT *pOutputBuffer;
-#endif
#ifdef SUPPORT_MC
LVM_INT32 ChMask;
#endif
@@ -137,7 +124,6 @@
BundledEffectContext *pBundledContext;
};
-
/* enumerated parameter settings for Volume effect */
typedef enum
{
@@ -228,9 +214,4 @@
static const float LimitLevel_virtualizerContribution = 1.9;
-#if __cplusplus
-} // extern "C"
-#endif
-
-
#endif /*ANDROID_EFFECTBUNDLE_H_*/
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 602f607..1cb81a6 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -79,7 +79,6 @@
{-400, -200, 1300, 900, 0, 2, 0, 10, 1000, 750},
};
-
// NXP SW auxiliary environmental reverb
const effect_descriptor_t gAuxEnvReverbDescriptor = {
{ 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
@@ -136,11 +135,7 @@
&gInsertPresetReverbDescriptor
};
-#ifdef BUILD_FLOAT
typedef float process_buffer_t; // process in float
-#else
-typedef int32_t process_buffer_t; // process in Q4_27
-#endif // BUILD_FLOAT
struct ReverbContext{
const struct effect_interface_s *itfe;
@@ -154,10 +149,6 @@
int16_t SavedDiffusion;
int16_t SavedDensity;
bool bEnabled;
- #ifdef LVM_PCM
- FILE *PcmInPtr;
- FILE *PcmOutPtr;
- #endif
LVM_Fs_en SampleRate;
process_buffer_t *InFrames;
process_buffer_t *OutFrames;
@@ -183,11 +174,7 @@
#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
-#ifdef BUILD_FLOAT
#define REVERB_SEND_LEVEL 0.75f // 0.75 in 4.12 format
-#else
-#define REVERB_SEND_LEVEL (0x0C00) // 0.75 in 4.12 format
-#endif
#define REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
//--- local function prototypes
@@ -269,18 +256,6 @@
*pHandle = (effect_handle_t)pContext;
-#ifdef LVM_PCM
- pContext->PcmInPtr = NULL;
- pContext->PcmOutPtr = NULL;
-
- pContext->PcmInPtr = fopen("/data/tmp/reverb_pcm_in.pcm", "w");
- pContext->PcmOutPtr = fopen("/data/tmp/reverb_pcm_out.pcm", "w");
-
- if((pContext->PcmInPtr == NULL)||
- (pContext->PcmOutPtr == NULL)){
- return -EINVAL;
- }
-#endif
int channels = audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
@@ -304,10 +279,6 @@
return -EINVAL;
}
- #ifdef LVM_PCM
- fclose(pContext->PcmInPtr);
- fclose(pContext->PcmOutPtr);
- #endif
free(pContext->InFrames);
free(pContext->OutFrames);
pContext->bufferSizeIn = 0;
@@ -378,7 +349,6 @@
return -EINVAL;
}
-#ifdef BUILD_FLOAT
size_t inSize = frameCount * sizeof(process_buffer_t) * channels;
size_t outSize = frameCount * sizeof(process_buffer_t) * FCC_2;
if (pContext->InFrames == NULL ||
@@ -394,10 +364,6 @@
pContext->OutFrames = (process_buffer_t *)calloc(1, pContext->bufferSizeOut);
}
-#ifndef NATIVE_FLOAT_BUFFER
- effect_buffer_t * const OutFrames16 = (effect_buffer_t *)pContext->OutFrames;
-#endif
-#endif
// Check for NULL pointers
if ((pContext->InFrames == NULL) || (pContext->OutFrames == NULL)) {
@@ -405,47 +371,20 @@
return -EINVAL;
}
-#ifdef LVM_PCM
- fwrite(pIn, frameCount * sizeof(*pIn) * channels, 1 /* nmemb */, pContext->PcmInPtr);
- fflush(pContext->PcmInPtr);
-#endif
if (pContext->preset && pContext->nextPreset != pContext->curPreset) {
Reverb_LoadPreset(pContext);
}
if (pContext->auxiliary) {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
static_assert(std::is_same<decltype(*pIn), decltype(*pContext->InFrames)>::value,
"pIn and InFrames must be same type");
memcpy(pContext->InFrames, pIn, frameCount * channels * sizeof(*pIn));
-#else
- memcpy_to_float_from_i16(
- pContext->InFrames, pIn, frameCount * channels);
-#endif
-#else //no BUILD_FLOAT
- for (int i = 0; i < frameCount * channels; i++) {
- pContext->InFrames[i] = (process_buffer_t)pIn[i]<<8;
- }
-#endif
} else {
// insert reverb input is always stereo
for (int i = 0; i < frameCount; i++) {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
pContext->InFrames[2 * i] = (process_buffer_t)pIn[2 * i] * REVERB_SEND_LEVEL;
pContext->InFrames[2 * i + 1] = (process_buffer_t)pIn[2 * i + 1] * REVERB_SEND_LEVEL;
-#else
- pContext->InFrames[2 * i] =
- (process_buffer_t)pIn[2 * i] * REVERB_SEND_LEVEL / 32768.0f;
- pContext->InFrames[2 * i + 1] =
- (process_buffer_t)pIn[2 * i + 1] * REVERB_SEND_LEVEL / 32768.0f;
-#endif
-#else
- pContext->InFrames[2*i] = (pIn[2*i] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
- pContext->InFrames[2*i+1] = (pIn[2*i+1] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
-#endif
}
}
@@ -471,43 +410,16 @@
// Convert to 16 bits
if (pContext->auxiliary) {
-#ifdef BUILD_FLOAT
// nothing to do here
-#ifndef NATIVE_FLOAT_BUFFER
- // pContext->OutFrames and OutFrames16 point to the same buffer
- // make sure the float to int conversion happens in the right order.
- memcpy_to_i16_from_float(OutFrames16, pContext->OutFrames,
- (size_t)frameCount * FCC_2);
-#endif
-#else
- memcpy_to_i16_from_q4_27(OutFrames16, pContext->OutFrames, (size_t)frameCount * FCC_2);
-#endif
} else {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
// Mix with dry input
pContext->OutFrames[i] += pIn[i];
}
-#else
- for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
- // pOutputBuff and OutFrames16 point to the same buffer
- // make sure the float to int conversion happens in the right order.
- pContext->OutFrames[i] += (process_buffer_t)pIn[i] / 32768.0f;
- }
- memcpy_to_i16_from_float(OutFrames16, pContext->OutFrames,
- (size_t)frameCount * FCC_2);
-#endif
-#else
- for (int i=0; i < frameCount * FCC_2; i++) { // always stereo here
- OutFrames16[i] = clamp16((pContext->OutFrames[i]>>8) + (process_buffer_t)pIn[i]);
- }
-#endif
// apply volume with ramp if needed
if ((pContext->leftVolume != pContext->prevLeftVolume ||
pContext->rightVolume != pContext->prevRightVolume) &&
pContext->volumeMode == REVERB_VOLUME_RAMP) {
-#if defined (BUILD_FLOAT) && defined (NATIVE_FLOAT_BUFFER)
// FIXME: still using int16 volumes.
// For reference: REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
float vl = (float)pContext->prevLeftVolume / 4096;
@@ -522,37 +434,14 @@
vl += incl;
vr += incr;
}
-#else
- LVM_INT32 vl = (LVM_INT32)pContext->prevLeftVolume << 16;
- LVM_INT32 incl = (((LVM_INT32)pContext->leftVolume << 16) - vl) / frameCount;
- LVM_INT32 vr = (LVM_INT32)pContext->prevRightVolume << 16;
- LVM_INT32 incr = (((LVM_INT32)pContext->rightVolume << 16) - vr) / frameCount;
-
- for (int i = 0; i < frameCount; i++) {
- OutFrames16[FCC_2 * i] =
- clamp16((LVM_INT32)((vl >> 16) * OutFrames16[2*i]) >> 12);
- OutFrames16[FCC_2 * i + 1] =
- clamp16((LVM_INT32)((vr >> 16) * OutFrames16[2*i+1]) >> 12);
-
- vl += incl;
- vr += incr;
- }
-#endif
pContext->prevLeftVolume = pContext->leftVolume;
pContext->prevRightVolume = pContext->rightVolume;
} else if (pContext->volumeMode != REVERB_VOLUME_OFF) {
if (pContext->leftVolume != REVERB_UNIT_VOLUME ||
pContext->rightVolume != REVERB_UNIT_VOLUME) {
for (int i = 0; i < frameCount; i++) {
-#if defined(BUILD_FLOAT) && defined(NATIVE_FLOAT_BUFFER)
pContext->OutFrames[FCC_2 * i] *= ((float)pContext->leftVolume / 4096);
pContext->OutFrames[FCC_2 * i + 1] *= ((float)pContext->rightVolume / 4096);
-#else
- OutFrames16[FCC_2 * i] =
- clamp16((LVM_INT32)(pContext->leftVolume * OutFrames16[2*i]) >> 12);
- OutFrames16[FCC_2 * i + 1] =
- clamp16((LVM_INT32)(pContext->rightVolume * OutFrames16[2*i+1]) >> 12);
-#endif
}
}
pContext->prevLeftVolume = pContext->leftVolume;
@@ -561,21 +450,12 @@
}
}
-#ifdef LVM_PCM
- fwrite(pContext->OutFrames, frameCount * sizeof(*pContext->OutFrames) * FCC_2,
- 1 /* nmemb */, pContext->PcmOutPtr);
- fflush(pContext->PcmOutPtr);
-#endif
// Accumulate if required
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
//ALOGV("\tBuffer access is ACCUMULATE");
for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
-#ifndef NATIVE_FLOAT_BUFFER
- pOut[i] = clamp16((int32_t)pOut[i] + (int32_t)OutFrames16[i]);
-#else
pOut[i] += pContext->OutFrames[i];
-#endif
}
}else{
//ALOGV("\tBuffer access is WRITE");
@@ -654,7 +534,6 @@
//ALOGV("\tReverb_setConfig calling memcpy");
pContext->config = *pConfig;
-
switch (pConfig->inputCfg.samplingRate) {
case 8000:
SampleRate = LVM_FS_8000;
@@ -674,7 +553,6 @@
case 48000:
SampleRate = LVM_FS_48000;
break;
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
case 88200:
SampleRate = LVM_FS_88200;
break;
@@ -687,7 +565,6 @@
case 192000:
SampleRate = LVM_FS_192000;
break;
-#endif
default:
ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -1509,7 +1386,6 @@
//ALOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
//ALOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
-
Temp = (LVM_INT16)(((pContext->SavedDensity * 99) / 1000) + 1);
if(Temp != ActiveParams.RoomSize){
@@ -1557,7 +1433,6 @@
return 0;
}
-
//----------------------------------------------------------------------------
// Reverb_getParameter()
//----------------------------------------------------------------------------
@@ -1903,7 +1778,6 @@
return status;
} /* end Reverb_setParameter */
-
/**
* returns the size in bytes of the value of each environmental reverb parameter
*/
@@ -1951,17 +1825,10 @@
}
//ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
/* Process all the available frames, block processing is handled internalLY by the LVM bundle */
-#if defined (BUILD_FLOAT) && defined (NATIVE_FLOAT_BUFFER)
status = process( inBuffer->f32,
outBuffer->f32,
outBuffer->frameCount,
pContext);
-#else
- status = process( inBuffer->s16,
- outBuffer->s16,
- outBuffer->frameCount,
- pContext);
-#endif
if (pContext->bEnabled == LVM_FALSE) {
if (pContext->SamplesToExitCount > 0) {
@@ -1986,7 +1853,6 @@
LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
-
if (pContext == NULL){
ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
return -EINVAL;
@@ -2161,7 +2027,6 @@
return -EINVAL;
}
-
if (pReplyData != NULL) { // we have volume control
pContext->leftVolume = (LVM_INT16)((*(uint32_t *)pCmdData + (1 << 11)) >> 12);
pContext->rightVolume = (LVM_INT16)((*((uint32_t *)pCmdData + 1) + (1 << 11)) >> 12);
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index 8165f5a..96223a8 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -20,10 +20,6 @@
#include <audio_effects/effect_environmentalreverb.h>
#include <audio_effects/effect_presetreverb.h>
-#if __cplusplus
-extern "C" {
-#endif
-
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
#define LVREV_MAX_T60 7000
@@ -31,16 +27,11 @@
#define LVREV_MAX_FRAME_SIZE 2560
#define LVREV_CUP_LOAD_ARM9E 470 // Expressed in 0.1 MIPS
#define LVREV_MEM_USAGE (71+(LVREV_MAX_FRAME_SIZE>>7)) // Expressed in kB
-//#define LVM_PCM
typedef struct _LPFPair_t
{
int16_t Room_HF;
int16_t LPF;
} LPFPair_t;
-#if __cplusplus
-} // extern "C"
-#endif
-
#endif /*ANDROID_EFFECTREVERB_H_*/
diff --git a/media/libmedia/MidiIoWrapper.cpp b/media/libmedia/MidiIoWrapper.cpp
index 6d46363..e71ea2c 100644
--- a/media/libmedia/MidiIoWrapper.cpp
+++ b/media/libmedia/MidiIoWrapper.cpp
@@ -49,7 +49,7 @@
mDataSource = nullptr;
}
-class DataSourceUnwrapper {
+class MidiIoWrapper::DataSourceUnwrapper {
public:
explicit DataSourceUnwrapper(CDataSource *csource) {
diff --git a/media/libmedia/include/media/MidiIoWrapper.h b/media/libmedia/include/media/MidiIoWrapper.h
index b19d49e..d29949e 100644
--- a/media/libmedia/include/media/MidiIoWrapper.h
+++ b/media/libmedia/include/media/MidiIoWrapper.h
@@ -24,7 +24,6 @@
namespace android {
struct CDataSource;
-class DataSourceUnwrapper;
class MidiIoWrapper {
public:
@@ -43,6 +42,7 @@
int mFd;
off64_t mBase;
int64_t mLength;
+ class DataSourceUnwrapper;
DataSourceUnwrapper *mDataSource;
EAS_FILE mEasFile;
};
diff --git a/media/libmediahelper/TypeConverter.cpp b/media/libmediahelper/TypeConverter.cpp
index f862018..c103236 100644
--- a/media/libmediahelper/TypeConverter.cpp
+++ b/media/libmediahelper/TypeConverter.cpp
@@ -394,6 +394,7 @@
MAKE_STRING_FROM_ENUM(AUDIO_FLAG_LOW_LATENCY),
MAKE_STRING_FROM_ENUM(AUDIO_FLAG_DEEP_BUFFER),
MAKE_STRING_FROM_ENUM(AUDIO_FLAG_NO_MEDIA_PROJECTION),
+ MAKE_STRING_FROM_ENUM(AUDIO_FLAG_MUTE_HAPTIC),
MAKE_STRING_FROM_ENUM(AUDIO_FLAG_NO_SYSTEM_CAPTURE),
TERMINATOR
};
diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
index afdcd37..f21d2b3 100644
--- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp
@@ -130,29 +130,32 @@
} else if (n < 0) {
break;
} else {
- if (buffer[0] == 0x00) {
+ if (buffer[0] == 0x00) { // OK to access buffer[0] since n must be > 0 here
// XXX legacy
if (extra == NULL) {
extra = new AMessage;
}
- uint8_t type = buffer[1];
+ uint8_t type = 0;
+ if (n > 1) {
+ type = buffer[1];
- if (type & 2) {
- int64_t mediaTimeUs;
- memcpy(&mediaTimeUs, &buffer[2], sizeof(mediaTimeUs));
+ if ((type & 2) && (n >= 2 + sizeof(int64_t))) {
+ int64_t mediaTimeUs;
+ memcpy(&mediaTimeUs, &buffer[2], sizeof(mediaTimeUs));
- extra->setInt64(kATSParserKeyMediaTimeUs, mediaTimeUs);
+ extra->setInt64(kATSParserKeyMediaTimeUs, mediaTimeUs);
+ }
}
mTSParser->signalDiscontinuity(
((type & 1) == 0)
- ? ATSParser::DISCONTINUITY_TIME
- : ATSParser::DISCONTINUITY_FORMATCHANGE,
+ ? ATSParser::DISCONTINUITY_TIME
+ : ATSParser::DISCONTINUITY_FORMATCHANGE,
extra);
} else {
- status_t err = mTSParser->feedTSPacket(buffer, sizeof(buffer));
+ status_t err = mTSParser->feedTSPacket(buffer, n);
if (err != OK) {
ALOGE("TS Parser returned error %d", err);
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index cfefe11..eacaea8 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -6902,7 +6902,7 @@
}
}
- if (mCodec->mMaxPtsGapUs != 0LL) {
+ if (mCodec->mIsVideo && mCodec->mMaxPtsGapUs != 0LL) {
OMX_PARAM_U32TYPE maxPtsGapParams;
InitOMXParams(&maxPtsGapParams);
maxPtsGapParams.nPortIndex = kPortIndexInput;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index f130c9b..258bed8 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -613,8 +613,9 @@
CHECK(source.get() != NULL);
- const char *mime;
- source->getFormat()->findCString(kKeyMIMEType, &mime);
+ const char *mime = NULL;
+ sp<MetaData> meta = source->getFormat();
+ meta->findCString(kKeyMIMEType, &mime);
if (Track::getFourCCForMime(mime) == NULL) {
ALOGE("Unsupported mime '%s'", mime);
diff --git a/media/libstagefright/MediaExtractorFactory.cpp b/media/libstagefright/MediaExtractorFactory.cpp
index 120f354..9e85475 100644
--- a/media/libstagefright/MediaExtractorFactory.cpp
+++ b/media/libstagefright/MediaExtractorFactory.cpp
@@ -276,7 +276,7 @@
std::shared_ptr<std::list<sp<ExtractorPlugin>>> newList(new std::list<sp<ExtractorPlugin>>());
- android_namespace_t *mediaNs = android_get_exported_namespace("media");
+ android_namespace_t *mediaNs = android_get_exported_namespace("com_android_media");
if (mediaNs != NULL) {
const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE,
diff --git a/media/libstagefright/codecs/amrnb/common/Android.bp b/media/libstagefright/codecs/amrnb/common/Android.bp
index ea8b073..bcf63d5 100644
--- a/media/libstagefright/codecs/amrnb/common/Android.bp
+++ b/media/libstagefright/codecs/amrnb/common/Android.bp
@@ -1,6 +1,7 @@
cc_library {
name: "libstagefright_amrnb_common",
vendor_available: true,
+ host_supported: true,
srcs: [
"src/add.cpp",
@@ -73,6 +74,12 @@
"-Werror",
],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+
//addressing b/25409744
//sanitize: {
// misc_undefined: [
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.bp b/media/libstagefright/codecs/amrnb/dec/Android.bp
index e18117e..3381d2e 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.bp
+++ b/media/libstagefright/codecs/amrnb/dec/Android.bp
@@ -1,6 +1,7 @@
cc_library_static {
name: "libstagefright_amrnbdec",
vendor_available: true,
+ host_supported: true,
srcs: [
"src/a_refl.cpp",
@@ -61,6 +62,12 @@
"libstagefright_amrnb_common",
"liblog",
],
+
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
//###############################################################################
@@ -100,6 +107,7 @@
cc_test {
name: "libstagefright_amrnbdec_test",
gtest: false,
+ host_supported: true,
srcs: ["test/amrnbdec_test.cpp"],
@@ -118,6 +126,12 @@
"liblog",
],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+
//sanitize: {
// misc_undefined: [
// "signed-integer-overflow",
diff --git a/media/libstagefright/codecs/amrnb/dec/test/AndroidTest.xml b/media/libstagefright/codecs/amrnb/dec/test/AndroidTest.xml
new file mode 100644
index 0000000..1a9e678
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/dec/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Amr-nb Decoder unit test">
+ <option name="test-suite-tag" value="AmrnbDecoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="AmrnbDecoderTest->/data/local/tmp/AmrnbDecoderTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrnb/dec/test/AmrnbDecoderTest.zip?unzip=true"
+ value="/data/local/tmp/AmrnbDecoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="AmrnbDecoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/AmrnbDecoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/amrnb/dec/test/README.md b/media/libstagefright/codecs/amrnb/dec/test/README.md
index 62e13ae..e9073e4 100644
--- a/media/libstagefright/codecs/amrnb/dec/test/README.md
+++ b/media/libstagefright/codecs/amrnb/dec/test/README.md
@@ -22,13 +22,18 @@
adb push ${OUT}/data/nativetest/AmrnbDecoderTest/AmrnbDecoderTest /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://drive.google.com/drive/folders/13cM4tAaVFrmr-zGFqaAzFBbKs75pnm9b). Push these files into device for testing.
-Download amr-nb folder and push all the files in this folder to /data/local/tmp/ on the device.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrnb/dec/test/AmrnbDecoderTest.zip). Download, unzip and push these files into device for testing.
+
```
-adb push amr-nb/. /data/local/tmp/
+adb push AmrnbDecoderTestRes/. /data/local/tmp/
```
usage: AmrnbDecoderTest -P \<path_to_folder\>
```
-adb shell /data/local/tmp/AmrnbDecoderTest -P /data/local/tmp/
+adb shell /data/local/tmp/AmrnbDecoderTest -P /data/local/tmp/AmrnbDecoderTestRes/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest AmrnbDecoderTest -- --enable-module-dynamic-download=true
```
diff --git a/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncTestEnvironment.h b/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncTestEnvironment.h
new file mode 100644
index 0000000..5a2fcd1
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncTestEnvironment.h
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef __AMRNBENC_TEST_ENVIRONMENT_H__
+#define __AMRNBENC_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class AmrnbEncTestEnvironment : public ::testing::Environment {
+ public:
+ AmrnbEncTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int AmrnbEncTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P':
+ setRes(optarg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __AMRNBENC_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncoderTest.cpp b/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncoderTest.cpp
new file mode 100644
index 0000000..fb72998
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncoderTest.cpp
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "AmrnbEncoderTest"
+
+#include <utils/Log.h>
+
+#include <audio_utils/sndfile.h>
+#include <stdio.h>
+
+#include "gsmamr_enc.h"
+
+#include "AmrnbEncTestEnvironment.h"
+
+#define OUTPUT_FILE "/data/local/tmp/amrnbEncode.out"
+
+constexpr int32_t kInputBufferSize = L_FRAME * 2; // 160 samples * 16-bit per sample.
+constexpr int32_t kOutputBufferSize = 1024;
+constexpr int32_t kNumFrameReset = 200;
+constexpr int32_t kMaxCount = 10;
+struct AmrNbEncState {
+ void *encCtx;
+ void *pidSyncCtx;
+};
+
+static AmrnbEncTestEnvironment *gEnv = nullptr;
+
+class AmrnbEncoderTest : public ::testing::TestWithParam<pair<string, int32_t>> {
+ public:
+ AmrnbEncoderTest() : mAmrEncHandle(nullptr) {}
+
+ ~AmrnbEncoderTest() {
+ if (mAmrEncHandle) {
+ free(mAmrEncHandle);
+ mAmrEncHandle = nullptr;
+ }
+ }
+
+ AmrNbEncState *mAmrEncHandle;
+ int32_t EncodeFrames(int32_t mode, FILE *fpInput, FILE *mFpOutput,
+ int32_t frameCount = INT32_MAX);
+};
+
+int32_t AmrnbEncoderTest::EncodeFrames(int32_t mode, FILE *fpInput, FILE *mFpOutput,
+ int32_t frameCount) {
+ int32_t frameNum = 0;
+ uint16_t inputBuf[kInputBufferSize];
+ uint8_t outputBuf[kOutputBufferSize];
+ while (frameNum < frameCount) {
+ int32_t bytesRead = fread(inputBuf, 1, kInputBufferSize, fpInput);
+ if (bytesRead != kInputBufferSize && !feof(fpInput)) {
+ ALOGE("Unable to read data from input file");
+ return -1;
+ } else if (feof(fpInput) && bytesRead == 0) {
+ break;
+ }
+ Frame_Type_3GPP frame_type = (Frame_Type_3GPP)mode;
+ int32_t bytesGenerated =
+ AMREncode(mAmrEncHandle->encCtx, mAmrEncHandle->pidSyncCtx, (Mode)mode,
+ (Word16 *)inputBuf, outputBuf, &frame_type, AMR_TX_WMF);
+ frameNum++;
+ if (bytesGenerated < 0) {
+ ALOGE("Error in encoging the file: Invalid output format");
+ return -1;
+ }
+
+ // Convert from WMF to RFC 3267 format.
+ if (bytesGenerated > 0) {
+ outputBuf[0] = ((outputBuf[0] << 3) | 4) & 0x7c;
+ }
+ fwrite(outputBuf, 1, bytesGenerated, mFpOutput);
+ }
+ return 0;
+}
+
+TEST_F(AmrnbEncoderTest, CreateAmrnbEncoderTest) {
+ mAmrEncHandle = (AmrNbEncState *)malloc(sizeof(AmrNbEncState));
+ ASSERT_NE(mAmrEncHandle, nullptr) << "Error in allocating memory to Codec handle";
+ for (int count = 0; count < kMaxCount; count++) {
+ int32_t status = AMREncodeInit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx, 0);
+ ASSERT_EQ(status, 0) << "Error creating AMR-NB encoder";
+ ALOGV("Successfully created encoder");
+ }
+ if (mAmrEncHandle) {
+ AMREncodeExit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx);
+ ASSERT_EQ(mAmrEncHandle->encCtx, nullptr) << "Error deleting AMR-NB encoder";
+ ASSERT_EQ(mAmrEncHandle->pidSyncCtx, nullptr) << "Error deleting AMR-NB encoder";
+ free(mAmrEncHandle);
+ mAmrEncHandle = nullptr;
+ ALOGV("Successfully deleted encoder");
+ }
+}
+
+TEST_P(AmrnbEncoderTest, EncodeTest) {
+ mAmrEncHandle = (AmrNbEncState *)malloc(sizeof(AmrNbEncState));
+ ASSERT_NE(mAmrEncHandle, nullptr) << "Error in allocating memory to Codec handle";
+ int32_t status = AMREncodeInit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx, 0);
+ ASSERT_EQ(status, 0) << "Error creating AMR-NB encoder";
+
+ string inputFile = gEnv->getRes() + GetParam().first;
+ FILE *fpInput = fopen(inputFile.c_str(), "rb");
+ ASSERT_NE(fpInput, nullptr) << "Error opening input file " << inputFile;
+
+ FILE *fpOutput = fopen(OUTPUT_FILE, "wb");
+ ASSERT_NE(fpOutput, nullptr) << "Error opening output file " << OUTPUT_FILE;
+
+ // Write file header.
+ fwrite("#!AMR\n", 1, 6, fpOutput);
+
+ int32_t mode = GetParam().second;
+ int32_t encodeErr = EncodeFrames(mode, fpInput, fpOutput);
+ ASSERT_EQ(encodeErr, 0) << "EncodeFrames returned error for Codec mode: " << mode;
+
+ fclose(fpOutput);
+ fclose(fpInput);
+
+ AMREncodeExit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx);
+ ASSERT_EQ(mAmrEncHandle->encCtx, nullptr) << "Error deleting AMR-NB encoder";
+ ASSERT_EQ(mAmrEncHandle->pidSyncCtx, nullptr) << "Error deleting AMR-NB encoder";
+ free(mAmrEncHandle);
+ mAmrEncHandle = nullptr;
+ ALOGV("Successfully deleted encoder");
+}
+
+TEST_P(AmrnbEncoderTest, ResetEncoderTest) {
+ mAmrEncHandle = (AmrNbEncState *)malloc(sizeof(AmrNbEncState));
+ ASSERT_NE(mAmrEncHandle, nullptr) << "Error in allocating memory to Codec handle";
+ int32_t status = AMREncodeInit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx, 0);
+ ASSERT_EQ(status, 0) << "Error creating AMR-NB encoder";
+
+ string inputFile = gEnv->getRes() + GetParam().first;
+ FILE *fpInput = fopen(inputFile.c_str(), "rb");
+ ASSERT_NE(fpInput, nullptr) << "Error opening input file " << inputFile;
+
+ FILE *fpOutput = fopen(OUTPUT_FILE, "wb");
+ ASSERT_NE(fpOutput, nullptr) << "Error opening output file " << OUTPUT_FILE;
+
+ // Write file header.
+ fwrite("#!AMR\n", 1, 6, fpOutput);
+
+ int32_t mode = GetParam().second;
+ // Encode kNumFrameReset first
+ int32_t encodeErr = EncodeFrames(mode, fpInput, fpOutput, kNumFrameReset);
+ ASSERT_EQ(encodeErr, 0) << "EncodeFrames returned error for Codec mode: " << mode;
+
+ status = AMREncodeReset(mAmrEncHandle->encCtx, mAmrEncHandle->pidSyncCtx);
+ ASSERT_EQ(status, 0) << "Error resting AMR-NB encoder";
+
+ // Start encoding again
+ encodeErr = EncodeFrames(mode, fpInput, fpOutput);
+ ASSERT_EQ(encodeErr, 0) << "EncodeFrames returned error for Codec mode: " << mode;
+
+ fclose(fpOutput);
+ fclose(fpInput);
+
+ AMREncodeExit(&mAmrEncHandle->encCtx, &mAmrEncHandle->pidSyncCtx);
+ ASSERT_EQ(mAmrEncHandle->encCtx, nullptr) << "Error deleting AMR-NB encoder";
+ ASSERT_EQ(mAmrEncHandle->pidSyncCtx, nullptr) << "Error deleting AMR-NB encoder";
+ free(mAmrEncHandle);
+ mAmrEncHandle = nullptr;
+ ALOGV("Successfully deleted encoder");
+}
+
+// TODO: Add more test vectors
+INSTANTIATE_TEST_SUITE_P(AmrnbEncoderTestAll, AmrnbEncoderTest,
+ ::testing::Values(make_pair("bbb_raw_1ch_8khz_s16le.raw", MR475),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR515),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR59),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR67),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR74),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR795),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR102),
+ make_pair("bbb_raw_1ch_8khz_s16le.raw", MR122),
+ make_pair("sinesweepraw.raw", MR475),
+ make_pair("sinesweepraw.raw", MR515),
+ make_pair("sinesweepraw.raw", MR59),
+ make_pair("sinesweepraw.raw", MR67),
+ make_pair("sinesweepraw.raw", MR74),
+ make_pair("sinesweepraw.raw", MR795),
+ make_pair("sinesweepraw.raw", MR102),
+ make_pair("sinesweepraw.raw", MR122)));
+
+int main(int argc, char **argv) {
+ gEnv = new AmrnbEncTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/codecs/amrnb/enc/test/Android.bp b/media/libstagefright/codecs/amrnb/enc/test/Android.bp
new file mode 100644
index 0000000..e8982fe
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/test/Android.bp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+cc_test {
+ name: "AmrnbEncoderTest",
+ gtest: true,
+
+ srcs: [
+ "AmrnbEncoderTest.cpp",
+ ],
+
+ static_libs: [
+ "libstagefright_amrnb_common",
+ "libstagefright_amrnbenc",
+ "libaudioutils",
+ "libsndfile",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/codecs/amrnb/enc/test/AndroidTest.xml b/media/libstagefright/codecs/amrnb/enc/test/AndroidTest.xml
new file mode 100644
index 0000000..9fe61b1
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Amr-nb Encoder unit test">
+ <option name="test-suite-tag" value="AmrnbEncoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="AmrnbEncoderTest->/data/local/tmp/AmrnbEncoderTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncoderTest.zip?unzip=true"
+ value="/data/local/tmp/AmrnbEncoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="AmrnbEncoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/AmrnbEncoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/amrnb/enc/test/README.md b/media/libstagefright/codecs/amrnb/enc/test/README.md
new file mode 100644
index 0000000..e9d2c95
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/test/README.md
@@ -0,0 +1,39 @@
+## Media Testing ##
+---
+#### AMR-NB Encoder :
+The Amr-Nb Encoder Test Suite validates the amrnb encoder available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m AmrnbEncoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/AmrnbEncoderTest/AmrnbEncoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/AmrnbEncoderTest/AmrnbEncoderTest /data/local/tmp/
+```
+
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrnb/enc/test/AmrnbEncoderTest.zip). Download, unzip and push these files into device for testing.
+
+```
+adb push AmrnbEncoderTestRes/. /data/local/tmp/
+```
+
+usage: AmrnbEncoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/AmrnbEncoderTest -P /data/local/tmp/AmrnbEncoderTestRes/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest AmrnbEncoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/codecs/amrnb/fuzzer/Android.bp b/media/libstagefright/codecs/amrnb/fuzzer/Android.bp
new file mode 100644
index 0000000..54de1cc
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/fuzzer/Android.bp
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * 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_dec_fuzzer",
+ host_supported: true,
+ srcs: [
+ "amrnb_dec_fuzzer.cpp",
+ ],
+ static_libs: [
+ "libstagefright_amrnbdec",
+ "libstagefright_amrnb_common",
+ "liblog",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/media/libstagefright/codecs/amrnb/fuzzer/README.md b/media/libstagefright/codecs/amrnb/fuzzer/README.md
new file mode 100644
index 0000000..7791b83
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/fuzzer/README.md
@@ -0,0 +1,62 @@
+# Fuzzer for libstagefright_amrnbdec decoder
+
+## 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-NB supports the following parameters:
+1. Stream format (parameter name: `input_format`)
+2. 3GPP frame type (parameter name: `frame_type`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `input_format` | 0. `MIME_IETF` 1. `IF2` | Bit 0 (LSB) of 1st byte of data. |
+| `frame_type` | 0. `AMR_475` 1. `AMR_515` 2. `AMR_59` 3. `AMR_67` 4. `AMR_74` 5. `AMR_795` 6. `AMR_102` 7. `AMR_122` | Bits 3, 4 and 5 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 decode operation was successful, the input is advanced by the frame size
+which is based on `input_format` and `frame_type` selected.
+If the decode 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_dec_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) amrnb_dec_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some amrnb files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/amrnb_dec_fuzzer/amrnb_dec_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/amrnb_dec_fuzzer/amrnb_dec_fuzzer CORPUS_DIR
+```
+
+## References:
+ * http://llvm.org/docs/LibFuzzer.html
+ * https://github.com/google/oss-fuzz
diff --git a/media/libstagefright/codecs/amrnb/fuzzer/amrnb_dec_fuzzer.cpp b/media/libstagefright/codecs/amrnb/fuzzer/amrnb_dec_fuzzer.cpp
new file mode 100644
index 0000000..d4e7e5c
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/fuzzer/amrnb_dec_fuzzer.cpp
@@ -0,0 +1,94 @@
+/******************************************************************************
+ *
+ * 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 <algorithm>
+#include "gsmamr_dec.h"
+
+// Constants for AMR-NB
+constexpr int32_t kSamplesPerFrame = L_FRAME;
+constexpr int32_t kBitsPerSample = 16;
+constexpr int32_t kOutputBufferSize = kSamplesPerFrame * kBitsPerSample / 8;
+const bitstream_format kBitStreamFormats[2] = {MIME_IETF, IF2};
+const int32_t kLocalWmfDecBytesPerFrame[8] = {12, 13, 15, 17, 19, 20, 26, 31};
+const int32_t kLocalIf2DecBytesPerFrame[8] = {13, 14, 16, 18, 19, 21, 26, 31};
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitDecoder(); }
+ int16_t initDecoder();
+ void deInitDecoder();
+ void decodeFrames(const uint8_t *data, size_t size);
+
+ private:
+ void *mAmrHandle = nullptr;
+};
+
+int16_t Codec::initDecoder() { return GSMInitDecode(&mAmrHandle, (Word8 *)"AMRNBDecoder"); }
+
+void Codec::deInitDecoder() { GSMDecodeFrameExit(&mAmrHandle); }
+
+void Codec::decodeFrames(const uint8_t *data, size_t size) {
+ while (size > 0) {
+ uint8_t mode = *data;
+ bool bit = mode & 0x01;
+ bitstream_format bitsreamFormat = kBitStreamFormats[bit];
+ int32_t frameSize = 0;
+ /* Find frame type */
+ Frame_Type_3GPP frameType = static_cast<Frame_Type_3GPP>((mode >> 3) & 0x07);
+ ++data;
+ --size;
+ if (bit) {
+ frameSize = kLocalIf2DecBytesPerFrame[frameType];
+ } else {
+ frameSize = kLocalWmfDecBytesPerFrame[frameType];
+ }
+ int16_t outputBuf[kOutputBufferSize];
+ uint8_t *inputBuf = new uint8_t[frameSize];
+ if (!inputBuf) {
+ return;
+ }
+ int32_t minSize = std::min((int32_t)size, frameSize);
+ memcpy(inputBuf, data, minSize);
+ AMRDecode(mAmrHandle, frameType, inputBuf, outputBuf, bitsreamFormat);
+ /* AMRDecode() decodes minSize number of bytes if decode is successful.
+ * AMRDecode() returns -1 if decode fails.
+ * Even if no bytes are decoded, increment by minSize to ensure fuzzer proceeds
+ * to feed next data */
+ data += minSize;
+ size -= minSize;
+ delete[] inputBuf;
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < 2) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initDecoder() == 0) {
+ codec->decodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/amrwb/Android.bp b/media/libstagefright/codecs/amrwb/Android.bp
index 88cf7f2..d8cb568 100644
--- a/media/libstagefright/codecs/amrwb/Android.bp
+++ b/media/libstagefright/codecs/amrwb/Android.bp
@@ -1,6 +1,7 @@
cc_library_static {
name: "libstagefright_amrwbdec",
vendor_available: true,
+ host_supported: true,
srcs: [
"src/agc2_amr_wb.cpp",
@@ -44,8 +45,6 @@
"src/weight_amrwb_lpc.cpp",
],
- header_libs: ["libstagefright_headers"],
-
export_include_dirs: [
"src",
"include",
@@ -63,12 +62,19 @@
"signed-integer-overflow",
],
},
+
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
//###############################################################################
cc_test {
name: "libstagefright_amrwbdec_test",
gtest: false,
+ host_supported: true,
srcs: ["test/amrwbdec_test.cpp"],
@@ -88,4 +94,10 @@
"signed-integer-overflow",
],
},
+
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
diff --git a/media/libstagefright/codecs/amrwb/fuzzer/Android.bp b/media/libstagefright/codecs/amrwb/fuzzer/Android.bp
new file mode 100644
index 0000000..46f77e3
--- /dev/null
+++ b/media/libstagefright/codecs/amrwb/fuzzer/Android.bp
@@ -0,0 +1,35 @@
+/******************************************************************************
+ *
+ * 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_dec_fuzzer",
+ host_supported: true,
+ srcs: [
+ "amrwb_dec_fuzzer.cpp",
+ ],
+ static_libs: [
+ "libstagefright_amrwbdec",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/media/libstagefright/codecs/amrwb/fuzzer/README.md b/media/libstagefright/codecs/amrwb/fuzzer/README.md
new file mode 100644
index 0000000..de45784
--- /dev/null
+++ b/media/libstagefright/codecs/amrwb/fuzzer/README.md
@@ -0,0 +1,61 @@
+# Fuzzer for libstagefright_amrwbdec decoder
+
+## 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. Quality (parameter name: `quality`)
+2. Mode (parameter name: `mode`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `quality` | 0. `Bad Quality` 1. `Good quality` | Bit 0 (LSB) of 1st byte of data. |
+| `mode` | 0. `MODE_7k` 1. `MODE_9k` 2. `MODE_12k` 3. `MODE_14k` 4. `MODE_16k ` 5. `MODE_18k` 6. `MODE_20k` 7. `MODE_23k` 8. `MODE_24k` 9. `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 decode operation was successful, the input is advanced by the frame size
+which is based on `mode` and `quality` selected.
+If the decode 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_dec_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) amrwb_dec_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some amrwb files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/amrwb_dec_fuzzer/amrwb_dec_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/amrwb_dec_fuzzer/amrwb_dec_fuzzer CORPUS_DIR
+```
+
+## References:
+ * http://llvm.org/docs/LibFuzzer.html
+ * https://github.com/google/oss-fuzz
diff --git a/media/libstagefright/codecs/amrwb/fuzzer/amrwb_dec_fuzzer.cpp b/media/libstagefright/codecs/amrwb/fuzzer/amrwb_dec_fuzzer.cpp
new file mode 100644
index 0000000..6dc0270
--- /dev/null
+++ b/media/libstagefright/codecs/amrwb/fuzzer/amrwb_dec_fuzzer.cpp
@@ -0,0 +1,110 @@
+/******************************************************************************
+ *
+ * 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 <malloc.h>
+#include <string.h>
+#include <algorithm>
+#include "pvamrwbdecoder.h"
+#include "pvamrwbdecoder_api.h"
+
+// Constants for AMR-WB.
+constexpr int32_t kSamplesPerFrame = 320;
+constexpr int32_t kBitsPerSample = 16;
+constexpr int32_t kMaxSourceDataUnitSize = KAMRWB_NB_BITS_MAX * sizeof(int16_t);
+constexpr int32_t kOutputBufferSize = kSamplesPerFrame * kBitsPerSample / 8;
+constexpr int32_t kFrameSizes[16] = {17, 23, 32, 36, 40, 46, 50, 58,
+ 60, 17, 23, 32, 36, 40, 46, 50};
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitDecoder(); }
+ bool initDecoder();
+ void decodeFrames(const uint8_t *data, size_t size);
+ void deInitDecoder();
+
+ private:
+ void *mAmrHandle = nullptr;
+ int16_t *mDecoderCookie = nullptr;
+ void *mDecoderBuffer = nullptr;
+};
+
+bool Codec::initDecoder() {
+ mDecoderBuffer = malloc(pvDecoder_AmrWbMemRequirements());
+ if (mDecoderBuffer) {
+ pvDecoder_AmrWb_Init(&mAmrHandle, mDecoderBuffer, &mDecoderCookie);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void Codec::deInitDecoder() {
+ if (mDecoderBuffer) {
+ free(mDecoderBuffer);
+ mDecoderBuffer = nullptr;
+ }
+ mAmrHandle = nullptr;
+ mDecoderCookie = nullptr;
+}
+
+void Codec::decodeFrames(const uint8_t *data, size_t size) {
+ while (size > 0) {
+ uint8_t modeByte = *data;
+ bool quality = modeByte & 0x01;
+ int16 mode = ((modeByte >> 3) & 0x0f);
+ ++data;
+ --size;
+ int32_t frameSize = kFrameSizes[mode];
+ int16_t inputSampleBuf[kMaxSourceDataUnitSize];
+ uint8_t *inputBuf = new uint8_t[frameSize];
+ if (!inputBuf) {
+ return;
+ }
+ int32_t minSize = std::min((int32_t)size, frameSize);
+ memcpy(inputBuf, data, minSize);
+ int16 frameMode = mode;
+ int16 frameType;
+ RX_State_wb rx_state;
+ mime_unsorting(inputBuf, inputSampleBuf, &frameType, &frameMode, quality, &rx_state);
+
+ int16_t numSamplesOutput;
+ int16_t outputBuf[kOutputBufferSize];
+ pvDecoder_AmrWb(frameMode, inputSampleBuf, outputBuf, &numSamplesOutput, mDecoderBuffer,
+ frameType, mDecoderCookie);
+ data += minSize;
+ size -= minSize;
+ delete[] inputBuf;
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < 2) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initDecoder()) {
+ codec->decodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/amrwb/test/AndroidTest.xml b/media/libstagefright/codecs/amrwb/test/AndroidTest.xml
new file mode 100644
index 0000000..e211a1f
--- /dev/null
+++ b/media/libstagefright/codecs/amrwb/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Amr-wb Decoder unit test">
+ <option name="test-suite-tag" value="AmrwbDecoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="AmrwbDecoderTest->/data/local/tmp/AmrwbDecoderTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrwb/test/AmrwbDecoderTest.zip?unzip=true"
+ value="/data/local/tmp/AmrwbDecoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="AmrwbDecoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/AmrwbDecoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/amrwb/test/README.md b/media/libstagefright/codecs/amrwb/test/README.md
index 502a20d..a9d5c06 100644
--- a/media/libstagefright/codecs/amrwb/test/README.md
+++ b/media/libstagefright/codecs/amrwb/test/README.md
@@ -22,13 +22,18 @@
adb push ${OUT}/data/nativetest/AmrwbDecoderTest/AmrwbDecoderTest /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://drive.google.com/drive/folders/13cM4tAaVFrmr-zGFqaAzFBbKs75pnm9b). Push these files into device for testing.
-Download amr-wb folder and push all the files in this folder to /data/local/tmp/ on the device.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrwb/test/AmrwbDecoderTest.zip). Download, unzip and push these files into device for testing.
+
```
-adb push amr-wb/. /data/local/tmp/
+adb push AmrwbDecoderTestRes/. /data/local/tmp/
```
usage: AmrwbDecoderTest -P \<path_to_folder\>
```
-adb shell /data/local/tmp/AmrwbDecoderTest -P /data/local/tmp/
+adb shell /data/local/tmp/AmrwbDecoderTest -P /data/local/tmp/AmrwbDecoderTestRes/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest AmrwbDecoderTest -- --enable-module-dynamic-download=true
```
diff --git a/media/libstagefright/codecs/amrwbenc/test/AmrwbEncTestEnvironment.h b/media/libstagefright/codecs/amrwbenc/test/AmrwbEncTestEnvironment.h
new file mode 100644
index 0000000..08ada66
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/test/AmrwbEncTestEnvironment.h
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef __AMRWBENC_TEST_ENVIRONMENT_H__
+#define __AMRWBENC_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class AmrwbEncTestEnvironment : public ::testing::Environment {
+ public:
+ AmrwbEncTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int AmrwbEncTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P':
+ setRes(optarg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __AMRWBENC_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/codecs/amrwbenc/test/AmrwbEncoderTest.cpp b/media/libstagefright/codecs/amrwbenc/test/AmrwbEncoderTest.cpp
new file mode 100644
index 0000000..1a6ee27
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/test/AmrwbEncoderTest.cpp
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "AmrwbEncoderTest"
+
+#include <utils/Log.h>
+
+#include <stdio.h>
+
+#include "cmnMemory.h"
+#include "voAMRWB.h"
+
+#include "AmrwbEncTestEnvironment.h"
+
+#define OUTPUT_FILE "/data/local/tmp/amrwbEncode.out"
+#define VOAMRWB_RFC3267_HEADER_INFO "#!AMR-WB\n"
+
+constexpr int32_t kInputBufferSize = 640;
+constexpr int32_t kOutputBufferSize = 1024;
+
+static AmrwbEncTestEnvironment *gEnv = nullptr;
+
+class AmrwbEncoderTest : public ::testing::TestWithParam<tuple<string, int32_t, VOAMRWBFRAMETYPE>> {
+ public:
+ AmrwbEncoderTest() : mEncoderHandle(nullptr) {
+ tuple<string, int32_t, VOAMRWBFRAMETYPE> params = GetParam();
+ mInputFile = gEnv->getRes() + get<0>(params);
+ mMode = get<1>(params);
+ mFrameType = get<2>(params);
+ mMemOperator.Alloc = cmnMemAlloc;
+ mMemOperator.Copy = cmnMemCopy;
+ mMemOperator.Free = cmnMemFree;
+ mMemOperator.Set = cmnMemSet;
+ mMemOperator.Check = cmnMemCheck;
+
+ mUserData.memflag = VO_IMF_USERMEMOPERATOR;
+ mUserData.memData = (VO_PTR)(&mMemOperator);
+ }
+
+ ~AmrwbEncoderTest() {
+ if (mEncoderHandle) {
+ mEncoderHandle = nullptr;
+ }
+ }
+
+ string mInputFile;
+ unsigned char mOutputBuf[kOutputBufferSize];
+ unsigned char mInputBuf[kInputBufferSize];
+ VOAMRWBFRAMETYPE mFrameType;
+ VO_AUDIO_CODECAPI mApiHandle;
+ VO_MEM_OPERATOR mMemOperator;
+ VO_CODEC_INIT_USERDATA mUserData;
+ VO_HANDLE mEncoderHandle;
+ int32_t mMode;
+};
+
+TEST_P(AmrwbEncoderTest, CreateAmrwbEncoderTest) {
+ int32_t status = voGetAMRWBEncAPI(&mApiHandle);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to get api handle";
+
+ status = mApiHandle.Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &mUserData);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to init AMRWB encoder";
+
+ status = mApiHandle.SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &mFrameType);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to set AMRWB encoder frame type to " << mFrameType;
+
+ status = mApiHandle.SetParam(mEncoderHandle, VO_PID_AMRWB_MODE, &mMode);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to set AMRWB encoder mode to %d" << mMode;
+ ALOGV("AMR-WB encoder created successfully");
+
+ status = mApiHandle.Uninit(mEncoderHandle);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to delete AMRWB encoder";
+ ALOGV("AMR-WB encoder deleted successfully");
+}
+
+TEST_P(AmrwbEncoderTest, AmrwbEncodeTest) {
+ VO_CODECBUFFER inData;
+ VO_CODECBUFFER outData;
+ VO_AUDIO_OUTPUTINFO outFormat;
+
+ FILE *fpInput = fopen(mInputFile.c_str(), "rb");
+ ASSERT_NE(fpInput, nullptr) << "Error opening input file " << mInputFile;
+
+ FILE *fpOutput = fopen(OUTPUT_FILE, "wb");
+ ASSERT_NE(fpOutput, nullptr) << "Error opening output file " << OUTPUT_FILE;
+
+ uint32_t status = voGetAMRWBEncAPI(&mApiHandle);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to get api handle";
+
+ status = mApiHandle.Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &mUserData);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to init AMRWB encoder";
+
+ status = mApiHandle.SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &mFrameType);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to set AMRWB encoder frame type to " << mFrameType;
+
+ status = mApiHandle.SetParam(mEncoderHandle, VO_PID_AMRWB_MODE, &mMode);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to set AMRWB encoder mode to " << mMode;
+
+ if (mFrameType == VOAMRWB_RFC3267) {
+ /* write RFC3267 Header info to indicate single channel AMR file storage format */
+ int32_t size = strlen(VOAMRWB_RFC3267_HEADER_INFO);
+ memcpy(mOutputBuf, VOAMRWB_RFC3267_HEADER_INFO, size);
+ fwrite(mOutputBuf, 1, size, fpOutput);
+ }
+
+ int32_t frameNum = 0;
+ while (1) {
+ int32_t buffLength =
+ (int32_t)fread(mInputBuf, sizeof(signed char), kInputBufferSize, fpInput);
+
+ if (buffLength == 0 || feof(fpInput)) break;
+ ASSERT_EQ(buffLength, kInputBufferSize) << "Error in reading input file";
+
+ inData.Buffer = (unsigned char *)mInputBuf;
+ inData.Length = buffLength;
+ outData.Buffer = mOutputBuf;
+ status = mApiHandle.SetInputData(mEncoderHandle, &inData);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to setup Input data";
+
+ do {
+ status = mApiHandle.GetOutputData(mEncoderHandle, &outData, &outFormat);
+ ASSERT_NE(status, VO_ERR_LICENSE_ERROR) << "Failed to encode the file";
+ if (status == 0) {
+ frameNum++;
+ fwrite(outData.Buffer, 1, outData.Length, fpOutput);
+ fflush(fpOutput);
+ }
+ } while (status != VO_ERR_INPUT_BUFFER_SMALL);
+ }
+
+ ALOGV("Number of frames processed: %d", frameNum);
+ status = mApiHandle.Uninit(mEncoderHandle);
+ ASSERT_EQ(status, VO_ERR_NONE) << "Failed to delete AMRWB encoder";
+
+ if (fpInput) {
+ fclose(fpInput);
+ }
+ if (fpOutput) {
+ fclose(fpOutput);
+ }
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ AmrwbEncoderTestAll, AmrwbEncoderTest,
+ ::testing::Values(
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD66, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD885, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1265, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1425, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1585, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1825, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1985, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2305, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2385, VOAMRWB_DEFAULT),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD66, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD885, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1265, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1425, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1585, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1825, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1985, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2305, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2385, VOAMRWB_ITU),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD66, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD885, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1265, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1425, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1585, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1825, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD1985, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2305, VOAMRWB_RFC3267),
+ make_tuple("bbb_raw_1ch_16khz_s16le.raw", VOAMRWB_MD2385, VOAMRWB_RFC3267)));
+
+int main(int argc, char **argv) {
+ gEnv = new AmrwbEncTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/codecs/amrwbenc/test/Android.bp b/media/libstagefright/codecs/amrwbenc/test/Android.bp
new file mode 100644
index 0000000..7042bc5
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/test/Android.bp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+cc_test {
+ name: "AmrwbEncoderTest",
+ gtest: true,
+
+ srcs: [
+ "AmrwbEncoderTest.cpp",
+ ],
+
+ static_libs: [
+ "libstagefright_enc_common",
+ "libstagefright_amrwbenc",
+ "libaudioutils",
+ "libsndfile",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/codecs/amrwbenc/test/AndroidTest.xml b/media/libstagefright/codecs/amrwbenc/test/AndroidTest.xml
new file mode 100644
index 0000000..46f147c
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Amr-wb Encoder unit test">
+ <option name="test-suite-tag" value="AmrwbEncoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="AmrwbEncoderTest->/data/local/tmp/AmrwbEncoderTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrwbenc/test/AmrwbEncoderTest.zip?unzip=true"
+ value="/data/local/tmp/AmrwbEncoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="AmrwbEncoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/AmrwbEncoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/amrwbenc/test/README.md b/media/libstagefright/codecs/amrwbenc/test/README.md
new file mode 100644
index 0000000..78762cb
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/test/README.md
@@ -0,0 +1,39 @@
+## Media Testing ##
+---
+#### AMR-WB Encoder :
+The Amr-Wb Encoder Test Suite validates the amrwb encoder available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m AmrwbEncoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/AmrwbEncoderTest/AmrwbEncoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/AmrwbEncoderTest/AmrwbEncoderTest /data/local/tmp/
+```
+
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/amrwbenc/test/AmrwbEncoderTest.zip). Download, unzip and push these files into device for testing.
+
+```
+adb push AmrwbEncoderTestRes/. /data/local/tmp/
+```
+
+usage: AmrwbEncoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/AmrwbEncoderTest -P /data/local/tmp/AmrwbEncoderTestRes/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest AmrwbEncoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/codecs/m4v_h263/dec/Android.bp b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
index 6b45ea2..b8b83d5 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
@@ -1,6 +1,7 @@
cc_library_static {
name: "libstagefright_m4vh263dec",
vendor_available: true,
+ host_supported: true,
shared_libs: ["liblog"],
srcs: [
@@ -38,11 +39,6 @@
"src/zigzag_tab.cpp",
],
- header_libs: [
- "media_plugin_headers",
- "libstagefright_headers"
- ],
-
local_include_dirs: ["src"],
export_include_dirs: ["include"],
@@ -61,6 +57,12 @@
],
cfi: true,
},
+
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
//###############################################################################
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp b/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp
new file mode 100644
index 0000000..e335c9b
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/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: "Mpeg4H263DecoderTest",
+ gtest: true,
+
+ srcs: [
+ "Mpeg4H263DecoderTest.cpp",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ static_libs: [
+ "libstagefright_m4vh263dec",
+ "libstagefright_foundation",
+ ],
+
+ cflags: [
+ "-DOSCL_IMPORT_REF=",
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ cfi: true,
+ },
+}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml b/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml
new file mode 100755
index 0000000..47e10ca
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Mpeg4H263 Decoder unit tests">
+ <option name="test-suite-tag" value="Mpeg4H263DecoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <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"
+ value="/data/local/tmp/Mpeg4H263DecoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="Mpeg4H263DecoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/Mpeg4H263DecoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp
new file mode 100644
index 0000000..967c1ea
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp
@@ -0,0 +1,423 @@
+/*
+ * 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 "Mpeg4H263DecoderTest"
+#include <utils/Log.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <utils/String8.h>
+#include <fstream>
+
+#include <media/stagefright/foundation/AUtils.h>
+#include "mp4dec_api.h"
+
+#include "Mpeg4H263DecoderTestEnvironment.h"
+
+using namespace android;
+
+#define OUTPUT_FILE_NAME "/data/local/tmp/Output.yuv"
+#define CODEC_CONFIG_FLAG 32
+#define SYNC_FRAME 1
+#define MPEG4_MAX_WIDTH 1920
+#define MPEG4_MAX_HEIGHT 1080
+#define H263_MAX_WIDTH 352
+#define H263_MAX_HEIGHT 288
+
+constexpr uint32_t kNumOutputBuffers = 2;
+
+struct FrameInfo {
+ int32_t bytesCount;
+ uint32_t flags;
+ int64_t timestamp;
+};
+
+struct tagvideoDecControls;
+
+static Mpeg4H263DecoderTestEnvironment *gEnv = nullptr;
+
+class Mpeg4H263DecoderTest : public ::testing::TestWithParam<tuple<string, string, bool>> {
+ public:
+ Mpeg4H263DecoderTest()
+ : mDecHandle(nullptr),
+ mInputBuffer(nullptr),
+ mInitialized(false),
+ mFramesConfigured(false),
+ mNumSamplesOutput(0),
+ mWidth(352),
+ mHeight(288) {
+ memset(mOutputBuffer, 0x0, sizeof(mOutputBuffer));
+ }
+
+ ~Mpeg4H263DecoderTest() {
+ if (mEleStream.is_open()) mEleStream.close();
+ if (mDecHandle) {
+ delete mDecHandle;
+ mDecHandle = nullptr;
+ }
+ if (mInputBuffer) {
+ free(mInputBuffer);
+ mInputBuffer = nullptr;
+ }
+ freeOutputBuffer();
+ }
+
+ status_t initDecoder();
+ void allocOutputBuffer(size_t outputBufferSize);
+ void dumpOutput(ofstream &ostrm);
+ void freeOutputBuffer();
+ void processMpeg4H263Decoder(vector<FrameInfo> Info, int32_t offset, int32_t range,
+ ifstream &mEleStream, ofstream &ostrm, MP4DecodingMode inputMode);
+ void deInitDecoder();
+
+ ifstream mEleStream;
+ tagvideoDecControls *mDecHandle;
+ char *mInputBuffer;
+ uint8_t *mOutputBuffer[kNumOutputBuffers];
+ bool mInitialized;
+ bool mFramesConfigured;
+ uint32_t mNumSamplesOutput;
+ uint32_t mWidth;
+ uint32_t mHeight;
+};
+
+status_t Mpeg4H263DecoderTest::initDecoder() {
+ if (!mDecHandle) {
+ mDecHandle = new tagvideoDecControls;
+ }
+ if (!mDecHandle) {
+ return NO_MEMORY;
+ }
+ memset(mDecHandle, 0, sizeof(tagvideoDecControls));
+
+ return OK;
+}
+
+void Mpeg4H263DecoderTest::allocOutputBuffer(size_t outputBufferSize) {
+ for (int32_t i = 0; i < kNumOutputBuffers; ++i) {
+ if (!mOutputBuffer[i]) {
+ mOutputBuffer[i] = (uint8_t *)malloc(outputBufferSize);
+ ASSERT_NE(mOutputBuffer[i], nullptr) << "Output buffer allocation failed";
+ }
+ }
+}
+
+void Mpeg4H263DecoderTest::dumpOutput(ofstream &ostrm) {
+ uint8_t *src = mOutputBuffer[mNumSamplesOutput & 1];
+ size_t vStride = align(mHeight, 16);
+ size_t srcYStride = align(mWidth, 16);
+ size_t srcUVStride = srcYStride / 2;
+ uint8_t *srcStart = src;
+
+ /* Y buffer */
+ for (size_t i = 0; i < mHeight; ++i) {
+ ostrm.write(reinterpret_cast<char *>(src), mWidth);
+ src += srcYStride;
+ }
+ /* U buffer */
+ src = srcStart + vStride * srcYStride;
+ for (size_t i = 0; i < mHeight / 2; ++i) {
+ ostrm.write(reinterpret_cast<char *>(src), mWidth / 2);
+ src += srcUVStride;
+ }
+ /* V buffer */
+ src = srcStart + vStride * srcYStride * 5 / 4;
+ for (size_t i = 0; i < mHeight / 2; ++i) {
+ ostrm.write(reinterpret_cast<char *>(src), mWidth / 2);
+ src += srcUVStride;
+ }
+}
+
+void Mpeg4H263DecoderTest::freeOutputBuffer() {
+ for (int32_t i = 0; i < kNumOutputBuffers; ++i) {
+ if (mOutputBuffer[i]) {
+ free(mOutputBuffer[i]);
+ mOutputBuffer[i] = nullptr;
+ }
+ }
+}
+
+void Mpeg4H263DecoderTest::processMpeg4H263Decoder(vector<FrameInfo> Info, int32_t offset,
+ int32_t range, ifstream &mEleStream,
+ ofstream &ostrm, MP4DecodingMode inputMode) {
+ size_t maxWidth = (inputMode == MPEG4_MODE) ? MPEG4_MAX_WIDTH : H263_MAX_WIDTH;
+ size_t maxHeight = (inputMode == MPEG4_MODE) ? MPEG4_MAX_HEIGHT : H263_MAX_HEIGHT;
+ size_t outputBufferSize = align(maxWidth, 16) * align(maxHeight, 16) * 3 / 2;
+ uint32_t frameIndex = offset;
+ bool status = true;
+ ASSERT_GE(range, 0) << "Invalid range";
+ ASSERT_TRUE(offset >= 0 && offset <= Info.size() - 1) << "Invalid offset";
+ ASSERT_LE(range + offset, Info.size()) << "range+offset can't be greater than the no of frames";
+
+ while (1) {
+ if (frameIndex == Info.size() || frameIndex == (offset + range)) break;
+
+ int32_t bytesCount = Info[frameIndex].bytesCount;
+ ASSERT_GT(bytesCount, 0) << "Size for the memory allocation is negative";
+ mInputBuffer = (char *)malloc(bytesCount);
+ ASSERT_NE(mInputBuffer, nullptr) << "Insufficient memory to read frame";
+ mEleStream.read(mInputBuffer, bytesCount);
+ ASSERT_EQ(mEleStream.gcount(), bytesCount) << "mEleStream.gcount() != bytesCount";
+ static const uint8_t volInfo[] = {0x00, 0x00, 0x01, 0xB0};
+ bool volHeader = memcmp(mInputBuffer, volInfo, 4) == 0;
+ if (volHeader) {
+ PVCleanUpVideoDecoder(mDecHandle);
+ mInitialized = false;
+ }
+
+ if (!mInitialized) {
+ uint8_t *volData[1]{};
+ int32_t volSize = 0;
+
+ uint32_t flags = Info[frameIndex].flags;
+ bool codecConfig = flags == CODEC_CONFIG_FLAG;
+ if (codecConfig || volHeader) {
+ volData[0] = reinterpret_cast<uint8_t *>(mInputBuffer);
+ volSize = bytesCount;
+ }
+
+ status = PVInitVideoDecoder(mDecHandle, volData, &volSize, 1, maxWidth, maxHeight,
+ inputMode);
+ ASSERT_TRUE(status) << "PVInitVideoDecoder failed. Unsupported content";
+
+ mInitialized = true;
+ MP4DecodingMode actualMode = PVGetDecBitstreamMode(mDecHandle);
+ ASSERT_EQ(inputMode, actualMode)
+ << "Decoded mode not same as actual mode of the decoder";
+
+ PVSetPostProcType(mDecHandle, 0);
+
+ int32_t dispWidth, dispHeight;
+ PVGetVideoDimensions(mDecHandle, &dispWidth, &dispHeight);
+
+ int32_t bufWidth, bufHeight;
+ PVGetBufferDimensions(mDecHandle, &bufWidth, &bufHeight);
+
+ ASSERT_LE(dispWidth, bufWidth) << "Display width is greater than buffer width";
+ ASSERT_LE(dispHeight, bufHeight) << "Display height is greater than buffer height";
+
+ if (dispWidth != mWidth || dispHeight != mHeight) {
+ mWidth = dispWidth;
+ mHeight = dispHeight;
+ freeOutputBuffer();
+ if (inputMode == H263_MODE) {
+ PVCleanUpVideoDecoder(mDecHandle);
+
+ uint8_t *volData[1]{};
+ int32_t volSize = 0;
+
+ status = PVInitVideoDecoder(mDecHandle, volData, &volSize, 1, maxWidth,
+ maxHeight, H263_MODE);
+ ASSERT_TRUE(status) << "PVInitVideoDecoder failed for H263";
+ }
+ mFramesConfigured = false;
+ }
+
+ if (codecConfig) {
+ frameIndex++;
+ continue;
+ }
+ }
+
+ uint32_t yFrameSize = sizeof(uint8) * mDecHandle->size;
+ ASSERT_GE(outputBufferSize, yFrameSize * 3 / 2)
+ << "Too small output buffer: " << outputBufferSize << " bytes";
+ ASSERT_NO_FATAL_FAILURE(allocOutputBuffer(outputBufferSize));
+
+ if (!mFramesConfigured) {
+ PVSetReferenceYUV(mDecHandle, mOutputBuffer[1]);
+ mFramesConfigured = true;
+ }
+
+ // Need to check if header contains new info, e.g., width/height, etc.
+ VopHeaderInfo headerInfo;
+ uint32_t useExtTimestamp = 1;
+ int32_t inputSize = (Info)[frameIndex].bytesCount;
+ uint32_t timestamp = frameIndex;
+
+ uint8_t *bitstreamTmp = reinterpret_cast<uint8_t *>(mInputBuffer);
+
+ status = PVDecodeVopHeader(mDecHandle, &bitstreamTmp, ×tamp, &inputSize, &headerInfo,
+ &useExtTimestamp, mOutputBuffer[mNumSamplesOutput & 1]);
+ ASSERT_EQ(status, PV_TRUE) << "failed to decode vop header";
+
+ // H263 doesn't have VOL header, the frame size information is in short header, i.e. the
+ // decoder may detect size change after PVDecodeVopHeader.
+ int32_t dispWidth, dispHeight;
+ PVGetVideoDimensions(mDecHandle, &dispWidth, &dispHeight);
+
+ int32_t bufWidth, bufHeight;
+ PVGetBufferDimensions(mDecHandle, &bufWidth, &bufHeight);
+
+ ASSERT_LE(dispWidth, bufWidth) << "Display width is greater than buffer width";
+ ASSERT_LE(dispHeight, bufHeight) << "Display height is greater than buffer height";
+ if (dispWidth != mWidth || dispHeight != mHeight) {
+ mWidth = dispWidth;
+ mHeight = dispHeight;
+ }
+
+ status = PVDecodeVopBody(mDecHandle, &inputSize);
+ ASSERT_EQ(status, PV_TRUE) << "failed to decode video frame No = %d" << frameIndex;
+
+ dumpOutput(ostrm);
+
+ ++mNumSamplesOutput;
+ ++frameIndex;
+ }
+ freeOutputBuffer();
+}
+
+void Mpeg4H263DecoderTest::deInitDecoder() {
+ if (mInitialized) {
+ if (mDecHandle) {
+ PVCleanUpVideoDecoder(mDecHandle);
+ delete mDecHandle;
+ mDecHandle = nullptr;
+ }
+ mInitialized = false;
+ }
+ freeOutputBuffer();
+}
+
+void getInfo(string infoFileName, vector<FrameInfo> &Info) {
+ ifstream eleInfo;
+ eleInfo.open(infoFileName);
+ ASSERT_EQ(eleInfo.is_open(), true) << "Failed to open " << infoFileName;
+ int32_t bytesCount = 0;
+ uint32_t flags = 0;
+ uint32_t timestamp = 0;
+ while (1) {
+ if (!(eleInfo >> bytesCount)) {
+ break;
+ }
+ eleInfo >> flags;
+ eleInfo >> timestamp;
+ Info.push_back({bytesCount, flags, timestamp});
+ }
+ if (eleInfo.is_open()) eleInfo.close();
+}
+
+TEST_P(Mpeg4H263DecoderTest, DecodeTest) {
+ tuple<string /* InputFileName */, string /* InfoFileName */, bool /* mode */> params =
+ GetParam();
+
+ string inputFileName = gEnv->getRes() + get<0>(params);
+ mEleStream.open(inputFileName, ifstream::binary);
+ ASSERT_EQ(mEleStream.is_open(), true) << "Failed to open " << get<0>(params);
+
+ string infoFileName = gEnv->getRes() + get<1>(params);
+ vector<FrameInfo> Info;
+ ASSERT_NO_FATAL_FAILURE(getInfo(infoFileName, Info));
+ ASSERT_NE(Info.empty(), true) << "Invalid Info file";
+
+ ofstream ostrm;
+ ostrm.open(OUTPUT_FILE_NAME, std::ofstream::binary);
+ ASSERT_EQ(ostrm.is_open(), true) << "Failed to open output stream for " << get<0>(params);
+
+ status_t err = initDecoder();
+ ASSERT_EQ(err, OK) << "initDecoder: failed to create decoder " << err;
+
+ bool isMpeg4 = get<2>(params);
+ MP4DecodingMode inputMode = isMpeg4 ? MPEG4_MODE : H263_MODE;
+ ASSERT_NO_FATAL_FAILURE(
+ processMpeg4H263Decoder(Info, 0, Info.size(), mEleStream, ostrm, inputMode));
+ deInitDecoder();
+ ostrm.close();
+ Info.clear();
+}
+
+TEST_P(Mpeg4H263DecoderTest, FlushTest) {
+ tuple<string /* InputFileName */, string /* InfoFileName */, bool /* mode */> params =
+ GetParam();
+
+ string inputFileName = gEnv->getRes() + get<0>(params);
+ mEleStream.open(inputFileName, ifstream::binary);
+ ASSERT_EQ(mEleStream.is_open(), true) << "Failed to open " << get<0>(params);
+
+ string infoFileName = gEnv->getRes() + get<1>(params);
+ vector<FrameInfo> Info;
+ ASSERT_NO_FATAL_FAILURE(getInfo(infoFileName, Info));
+ ASSERT_NE(Info.empty(), true) << "Invalid Info file";
+
+ ofstream ostrm;
+ ostrm.open(OUTPUT_FILE_NAME, std::ofstream::binary);
+ ASSERT_EQ(ostrm.is_open(), true) << "Failed to open output stream for " << get<0>(params);
+
+ status_t err = initDecoder();
+ ASSERT_EQ(err, OK) << "initDecoder: failed to create decoder " << err;
+
+ bool isMpeg4 = get<2>(params);
+ MP4DecodingMode inputMode = isMpeg4 ? MPEG4_MODE : H263_MODE;
+ // Number of frames to be decoded before flush
+ int32_t numFrames = Info.size() / 3;
+ ASSERT_NO_FATAL_FAILURE(
+ processMpeg4H263Decoder(Info, 0, numFrames, mEleStream, ostrm, inputMode));
+
+ if (mInitialized) {
+ int32_t status = PVResetVideoDecoder(mDecHandle);
+ ASSERT_EQ(status, PV_TRUE);
+ }
+
+ // Seek to next key frame and start decoding till the end
+ int32_t index = numFrames;
+ bool keyFrame = false;
+ uint32_t flags = 0;
+ while (index < (int32_t)Info.size()) {
+ if (Info[index].flags) flags = 1u << (Info[index].flags - 1);
+ if ((flags & SYNC_FRAME) == SYNC_FRAME) {
+ keyFrame = true;
+ break;
+ }
+ flags = 0;
+ mEleStream.ignore(Info[index].bytesCount);
+ index++;
+ }
+ ALOGV("Index= %d", index);
+ if (keyFrame) {
+ mNumSamplesOutput = 0;
+ ASSERT_NO_FATAL_FAILURE(processMpeg4H263Decoder(Info, index, (int32_t)Info.size() - index,
+ mEleStream, ostrm, inputMode));
+ }
+ deInitDecoder();
+ ostrm.close();
+ Info.clear();
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ Mpeg4H263DecoderTestAll, Mpeg4H263DecoderTest,
+ ::testing::Values(make_tuple("swirl_128x96_h263.h263", "swirl_128x96_h263.info", false),
+ make_tuple("swirl_176x144_h263.h263", "swirl_176x144_h263.info", false),
+ 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("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),
+ make_tuple("swirl_136x144_mpeg4.m4v", "swirl_136x144_mpeg4.info", true),
+ make_tuple("swirl_144x136_mpeg4.m4v", "swirl_144x136_mpeg4.info", true)));
+
+int main(int argc, char **argv) {
+ gEnv = new Mpeg4H263DecoderTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGD("Decoder Test Result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTestEnvironment.h b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTestEnvironment.h
new file mode 100644
index 0000000..f085845
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTestEnvironment.h
@@ -0,0 +1,73 @@
+/*
+ * 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 __MPEG4_H263_DECODER_TEST_ENVIRONMENT_H__
+#define __MPEG4_H263_DECODER_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class Mpeg4H263DecoderTestEnvironment : public ::testing::Environment {
+ public:
+ Mpeg4H263DecoderTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int Mpeg4H263DecoderTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"path", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P': {
+ setRes(optarg);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __MPEG4_H263_DECODER_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/README.md b/media/libstagefright/codecs/m4v_h263/dec/test/README.md
new file mode 100644
index 0000000..7e4aea1
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/README.md
@@ -0,0 +1,39 @@
+## Media Testing ##
+---
+#### Mpeg4H263Decoder :
+The Mpeg4H263Decoder Test Suite validates the Mpeg4 and H263 decoder available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m Mpeg4H263DecoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/Mpeg4H263DecoderTest/Mpeg4H263DecoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+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.
+
+```
+adb push Mpeg4H263Decoder /data/local/tmp/
+```
+
+usage: Mpeg4H263DecoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/Mpeg4H263DecoderTest -P /data/local/tmp/Mpeg4H263Decoder/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest Mpeg4H263DecoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/codecs/m4v_h263/enc/test/Android.bp b/media/libstagefright/codecs/m4v_h263/enc/test/Android.bp
new file mode 100644
index 0000000..b9a8117
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/enc/test/Android.bp
@@ -0,0 +1,45 @@
+/*
+ * 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: "Mpeg4H263EncoderTest",
+ gtest: true,
+
+ srcs : [ "Mpeg4H263EncoderTest.cpp" ],
+
+ shared_libs: [
+ "libutils",
+ "liblog",
+ ],
+
+ static_libs: [
+ "libstagefright_m4vh263enc",
+ ],
+
+ cflags: [
+ "-DOSCL_IMPORT_REF=",
+ "-Wall",
+ "-Werror",
+ ],
+
+ sanitize: {
+ misc_undefined: [
+ "signed-integer-overflow",
+ "unsigned-integer-overflow",
+ ],
+ cfi: true,
+ },
+}
diff --git a/media/libstagefright/codecs/m4v_h263/enc/test/AndroidTest.xml b/media/libstagefright/codecs/m4v_h263/enc/test/AndroidTest.xml
new file mode 100644
index 0000000..5218932
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/enc/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for MPEG4H263 encoder unit tests">
+ <option name="test-suite-tag" value="Mpeg4H263EncoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="Mpeg4H263EncoderTest->/data/local/tmp/Mpeg4H263EncoderTest/" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263Encoder.zip?unzip=true"
+ value="/data/local/tmp/Mpeg4H263EncoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="Mpeg4H263EncoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/Mpeg4H263EncoderTestRes/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTest.cpp b/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTest.cpp
new file mode 100644
index 0000000..78c705a
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTest.cpp
@@ -0,0 +1,250 @@
+/*
+ * 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 "Mpeg4H263EncoderTest"
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#include "mp4enc_api.h"
+
+#include "Mpeg4H263EncoderTestEnvironment.h"
+
+#define ENCODED_FILE "/data/local/tmp/Mpeg4H263Output"
+
+// assuming a worst case compression of 2X
+constexpr int16_t kCompressionRatio = 2;
+constexpr int8_t kIDRFrameRefreshIntervalInSec = 1;
+
+static Mpeg4H263EncoderTestEnvironment *gEnv = nullptr;
+
+class Mpeg4H263EncoderTest
+ : public ::testing::TestWithParam<tuple<string, bool, int32_t, int32_t, float, int32_t>> {
+ private:
+ void initEncoderParams();
+
+ public:
+ Mpeg4H263EncoderTest()
+ : mInputBuffer(nullptr),
+ mOutputBuffer(nullptr),
+ mFpInput(nullptr),
+ mFpOutput(nullptr),
+ mEncodeHandle(nullptr),
+ mEncodeControl(nullptr) {}
+
+ ~Mpeg4H263EncoderTest() {
+ if(mFpInput) {
+ fclose(mFpInput);
+ }
+ if(mFpOutput) {
+ fclose(mFpOutput);
+ }
+ if(mInputBuffer) free(mInputBuffer);
+ if(mOutputBuffer) free(mOutputBuffer);
+ if(mEncodeHandle) free(mEncodeHandle);
+ if(mEncodeControl) free(mEncodeControl);
+ }
+
+ void SetUp() override {
+ tuple<string /* fileName */, bool /* isMpeg4 */, int32_t /* frameWidth */,
+ int32_t /* frameHeight */, float /* frameRate */, int32_t /* bitRate */>
+ params = GetParam();
+ mFileName = gEnv->getRes() + get<0>(params);
+ mIsMpeg4 = get<1>(params);
+ mFrameWidth = get<2>(params);
+ mFrameHeight = get<3>(params);
+ mFrameRate = get<4>(params);
+ mBitRate = get<5>(params);
+
+ ASSERT_TRUE(mFrameWidth % 16 == 0) << "Frame Width should be multiple of 16";
+ ASSERT_TRUE(mFrameHeight % 16 == 0) << "Frame Height should be multiple of 16";
+ ASSERT_LE(mFrameWidth, (mIsMpeg4 ? 720 : 352))
+ << "Frame Width <= 720 for Mpeg4 and <= 352 for H263";
+ ASSERT_LE(mFrameHeight, (mIsMpeg4 ? 480 : 288))
+ << "Frame Height <= 480 for Mpeg4 and <= 288 for H263";
+ ASSERT_LE(mFrameRate, 30) << "Frame rate less than or equal to 30";
+ ASSERT_LE(mBitRate, 2048) << "Bit rate less than or equal to 2048 kbps";
+
+ mOutputBufferSize = ( mFrameWidth * mFrameHeight * 3/2 ) / kCompressionRatio;
+ mEncodeHandle = new VideoEncOptions;
+ ASSERT_NE(mEncodeHandle, nullptr) << "Failed to get Video Encoding options object";
+ memset(mEncodeHandle, 0, sizeof(VideoEncOptions));
+ mEncodeControl = new VideoEncControls;
+ ASSERT_NE(mEncodeControl, nullptr) << "Failed to get Video Encoding control object";
+ memset(mEncodeControl, 0, sizeof(VideoEncControls));
+ ASSERT_NO_FATAL_FAILURE(initEncoderParams())
+ << "Failed to get the default Encoding parameters!";
+ }
+
+ int64_t getTotalFrames();
+ void processEncoder(int32_t);
+ bool mIsMpeg4;
+ int32_t mFrameWidth, mFrameHeight, mBitRate;
+ int64_t mOutputBufferSize;
+ float mFrameRate;
+ string mFileName;
+ uint8_t *mInputBuffer, *mOutputBuffer;
+ FILE *mFpInput, *mFpOutput;
+ VideoEncOptions *mEncodeHandle;
+ VideoEncControls *mEncodeControl;
+};
+
+void Mpeg4H263EncoderTest::initEncoderParams() {
+ bool status = PVGetDefaultEncOption(mEncodeHandle, 0);
+ ASSERT_TRUE(status);
+
+ mEncodeHandle->rcType = VBR_1;
+ mEncodeHandle->vbvDelay = 5.0f;
+ mEncodeHandle->profile_level = CORE_PROFILE_LEVEL2;
+ mEncodeHandle->packetSize = 32;
+ mEncodeHandle->rvlcEnable = PV_OFF;
+ mEncodeHandle->numLayers = 1;
+ mEncodeHandle->timeIncRes = 1000;
+ mEncodeHandle->iQuant[0] = 15;
+ mEncodeHandle->pQuant[0] = 12;
+ mEncodeHandle->quantType[0] = 0;
+ mEncodeHandle->noFrameSkipped = PV_OFF;
+ mEncodeHandle->numIntraMB = 0;
+ mEncodeHandle->sceneDetect = PV_ON;
+ mEncodeHandle->searchRange = 16;
+ mEncodeHandle->mv8x8Enable = PV_OFF;
+ mEncodeHandle->gobHeaderInterval = 0;
+ mEncodeHandle->useACPred = PV_ON;
+ mEncodeHandle->intraDCVlcTh = 0;
+ if(!mIsMpeg4) {
+ mEncodeHandle->encMode = H263_MODE;
+ } else {
+ mEncodeHandle->encMode = COMBINE_MODE_WITH_ERR_RES;
+ }
+ mEncodeHandle->encWidth[0] = mFrameWidth;
+ mEncodeHandle->encHeight[0] = mFrameHeight;
+ mEncodeHandle->encFrameRate[0] = mFrameRate;
+ mEncodeHandle->bitRate[0] = mBitRate * 1024;
+ mEncodeHandle->tickPerSrc = mEncodeHandle->timeIncRes / mFrameRate;
+ if (kIDRFrameRefreshIntervalInSec == 0) {
+ // All I frames.
+ mEncodeHandle->intraPeriod = 1;
+ } else {
+ mEncodeHandle->intraPeriod = (kIDRFrameRefreshIntervalInSec * mFrameRate);
+ }
+}
+
+int64_t Mpeg4H263EncoderTest::getTotalFrames() {
+ int32_t frameSize = (mFrameWidth * mFrameHeight * 3) / 2;
+ struct stat buf;
+ stat(mFileName.c_str(), &buf);
+ size_t fileSize = buf.st_size;
+ int64_t totalFrames = (int64_t)(fileSize/frameSize);
+ return totalFrames;
+}
+
+void Mpeg4H263EncoderTest::processEncoder(int32_t numFramesToEncode) {
+ bool status;
+ int64_t numEncodedFrames = 0;
+ int32_t bytesRead;
+ int32_t frameSize = (mFrameWidth * mFrameHeight * 3) / 2;
+ while(numFramesToEncode != 0) {
+ bytesRead = fread(mInputBuffer, 1, frameSize, mFpInput);
+ // End of file.
+ if (bytesRead != frameSize) {
+ break;
+ }
+
+ VideoEncFrameIO videoIn, videoOut;
+ videoIn.height = mFrameHeight;
+ videoIn.pitch = mFrameWidth;
+ videoIn.timestamp = (numEncodedFrames * 1000) / mFrameRate; // in ms.
+ videoIn.yChan = mInputBuffer;
+ videoIn.uChan = videoIn.yChan + videoIn.height * videoIn.pitch;
+ videoIn.vChan = videoIn.uChan + ((videoIn.height * videoIn.pitch) >> 2);
+ uint32_t modTimeMs = 0;
+ int32_t dataLength = mOutputBufferSize;
+ int32_t nLayer = 0;
+ status = PVEncodeVideoFrame(mEncodeControl, &videoIn, &videoOut, &modTimeMs, mOutputBuffer,
+ &dataLength, &nLayer);
+ ASSERT_TRUE(status) << "Failed to Encode: " << mFileName;
+
+ MP4HintTrack hintTrack;
+ status = PVGetHintTrack(mEncodeControl, &hintTrack);
+ ASSERT_TRUE(status) << "Failed to get hint track!";
+ UChar *overrunBuffer = PVGetOverrunBuffer(mEncodeControl);
+ ASSERT_EQ(overrunBuffer, nullptr) << "Overrun of buffer!";
+
+ int64_t numBytes = fwrite(mOutputBuffer, 1, dataLength, mFpOutput);
+ ASSERT_EQ(numBytes, dataLength) << "Failed to write to the output file!";
+ numEncodedFrames++;
+ numFramesToEncode--;
+ }
+}
+
+TEST_P(Mpeg4H263EncoderTest, EncodeTest) {
+ mInputBuffer = (uint8_t *)malloc((mFrameWidth * mFrameWidth * 3) / 2);
+ ASSERT_NE(mInputBuffer, nullptr) << "Failed to allocate the input buffer!";
+
+ mOutputBuffer = (uint8_t *)malloc(mOutputBufferSize);
+ ASSERT_NE(mOutputBuffer, nullptr) << "Failed to allocate the output buffer!";
+
+ mFpInput = fopen(mFileName.c_str(), "rb");
+ ASSERT_NE(mFpInput, nullptr) << "Failed to open the input file: " << mFileName;
+
+ mFpOutput = fopen(ENCODED_FILE, "wb");
+ ASSERT_NE(mFpOutput, nullptr) << "Failed to open the output file:" << ENCODED_FILE;
+
+ bool status = PVInitVideoEncoder(mEncodeControl, mEncodeHandle);
+ ASSERT_TRUE(status) << "Failed to initialize the encoder!";
+
+ // Get VOL header.
+ int32_t size = mOutputBufferSize;
+ status = PVGetVolHeader(mEncodeControl, mOutputBuffer, &size, 0);
+ ASSERT_TRUE(status) << "Failed to get the VOL header!";
+
+ // Write the VOL header on the first frame.
+ int32_t numBytes = fwrite(mOutputBuffer, 1, size, mFpOutput);
+ ASSERT_EQ(numBytes, size) << "Failed to write the VOL header!";
+
+ int64_t totalFrames = getTotalFrames();
+ ASSERT_NO_FATAL_FAILURE(processEncoder(totalFrames)) << "Failed to Encode: " << mFileName;
+ status = PVCleanUpVideoEncoder(mEncodeControl);
+ ASSERT_TRUE(status) << "Failed to clean up the encoder resources!";
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ EncodeTest, Mpeg4H263EncoderTest,
+ ::testing::Values(
+ make_tuple("bbb_352x288_420p_30fps_32frames.yuv", false, 352, 288, 25, 1024),
+ make_tuple("bbb_352x288_420p_30fps_32frames.yuv", true, 352, 288, 25, 1024),
+ make_tuple("bbb_352x288_420p_30fps_32frames.yuv", false, 176, 144, 25, 1024),
+ make_tuple("bbb_352x288_420p_30fps_32frames.yuv", true, 176, 144, 25, 1024),
+ make_tuple("football_qvga.yuv", false, 352, 288, 25, 1024),
+ make_tuple("football_qvga.yuv", true, 352, 288, 25, 1024),
+ make_tuple("football_qvga.yuv", false, 176, 144, 30, 1024),
+ make_tuple("football_qvga.yuv", true, 176, 144, 30, 1024)));
+
+int32_t main(int argc, char **argv) {
+ gEnv = new Mpeg4H263EncoderTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ uint8_t status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGI("Encoder Test Result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTestEnvironment.h b/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTestEnvironment.h
new file mode 100644
index 0000000..7ee36e0
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/enc/test/Mpeg4H263EncoderTestEnvironment.h
@@ -0,0 +1,73 @@
+/*
+ * 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 __MPEG4_H263_ENCODER_TEST_ENVIRONMENT_H__
+#define __MPEG4_H263_ENCODER_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class Mpeg4H263EncoderTestEnvironment : public::testing::Environment {
+ public:
+ Mpeg4H263EncoderTestEnvironment() : res("/data/local/tmp/Mpeg4H263EncoderTest/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int Mpeg4H263EncoderTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"path", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P': {
+ setRes(optarg);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __MPEG4_H263_ENCODER_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/codecs/m4v_h263/enc/test/README.md b/media/libstagefright/codecs/m4v_h263/enc/test/README.md
new file mode 100644
index 0000000..25de878
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/enc/test/README.md
@@ -0,0 +1,38 @@
+## Media Testing ##
+---
+
+#### Mpeg4H263Encoder :
+The Mpeg4H263Encoder Test Suite validates the Mpeg4 and H263 encoder available in libstagefright.
+Run the following steps to build the test suite:
+```
+m Mpeg4H263EncoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/Mpeg4H263EncoderTest/Mpeg4H263EncoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/Mpeg4H263EncoderTest/Mpeg4H263EncoderTest /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/enc/test/Mpeg4H263Encoder.zip ) Download, unzip and push these files into device for testing.
+
+```
+adb push Mpeg4H263Encoder/. /data/local/tmp/
+```
+
+usage: Mpeg4H263EncoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/Mpeg4H263EncoderTest -P /data/local/tmp/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest Mpeg4H263EncoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp b/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp
new file mode 100644
index 0000000..aa79d37
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp
@@ -0,0 +1,60 @@
+/******************************************************************************
+ *
+ * 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: "mpeg4_dec_fuzzer",
+ host_supported: true,
+ srcs: [
+ "mpeg4_h263_dec_fuzzer.cpp",
+ ],
+ static_libs: [
+ "libstagefright_m4vh263dec",
+ "liblog",
+ ],
+ cflags: [
+ "-DOSCL_IMPORT_REF=",
+ "-DMPEG4",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
+
+cc_fuzz {
+ name: "h263_dec_fuzzer",
+ host_supported: true,
+ srcs: [
+ "mpeg4_h263_dec_fuzzer.cpp",
+ ],
+ static_libs: [
+ "libstagefright_m4vh263dec",
+ "liblog",
+ ],
+ cflags: [
+ "-DOSCL_IMPORT_REF=",
+ ],
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
+}
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/README.md b/media/libstagefright/codecs/m4v_h263/fuzzer/README.md
new file mode 100644
index 0000000..c2a4f69
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/README.md
@@ -0,0 +1,57 @@
+# Fuzzer for libstagefright_m4vh263dec decoder
+
+## 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
+Dict files (dictionary files) are created for MPEG4 and H263 to ensure that the required start
+bytes are present in every input file that goes to the fuzzer.
+This ensures that decoder does not reject any input file in the first check
+
+##### Maximize utilization of input data
+The plugin feeds the entire input data to the codec using a loop.
+ * If the decode operation was successful, the input is advanced by the number of bytes consumed
+ in the decode call.
+ * If the decode operation was un-successful, the input is advanced by 1 byte 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.
+
+##### Other considerations
+ * Two fuzzer binaries - mpeg4_dec_fuzzer and h263_dec_fuzzer are generated based on the presence
+ of a flag - 'MPEG4'
+ * The number of decode calls are kept to a maximum of 100 so that the fuzzer does not timeout.
+
+## Build
+
+This describes steps to build mpeg4_dec_fuzzer and h263_dec_fuzzer binary.
+
+### Android
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) mpeg4_dec_fuzzer
+ $ mm -j$(nproc) h263_dec_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some MPEG4 or H263 files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/mpeg4_dec_fuzzer/mpeg4_dec_fuzzer CORPUS_DIR
+ $ adb shell /data/fuzz/arm64/h263_dec_fuzzer/h263_dec_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/mpeg4_dec_fuzzer/mpeg4_dec_fuzzer CORPUS_DIR
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/h263_dec_fuzzer/h263_dec_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/h263_dec_fuzzer.dict b/media/libstagefright/codecs/m4v_h263/fuzzer/h263_dec_fuzzer.dict
new file mode 100644
index 0000000..591d37e
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/h263_dec_fuzzer.dict
@@ -0,0 +1,2 @@
+# Start code (bytes 0-3)
+kw1="\x00\x00\x80\x02"
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_dec_fuzzer.dict b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_dec_fuzzer.dict
new file mode 100644
index 0000000..76241a6
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_dec_fuzzer.dict
@@ -0,0 +1,2 @@
+# Start code (bytes 0-3)
+kw1="\x00\x00\x01\xB0"
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_dec_fuzzer.cpp b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_dec_fuzzer.cpp
new file mode 100644
index 0000000..912c821
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_dec_fuzzer.cpp
@@ -0,0 +1,205 @@
+/******************************************************************************
+ *
+ * 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 "mp4dec_api.h"
+#define MPEG4_MAX_WIDTH 1920
+#define MPEG4_MAX_HEIGHT 1080
+#define H263_MAX_WIDTH 352
+#define H263_MAX_HEIGHT 288
+#define DEFAULT_WIDTH 352
+#define DEFAULT_HEIGHT 288
+
+constexpr size_t kMaxNumDecodeCalls = 100;
+constexpr uint8_t kNumOutputBuffers = 2;
+constexpr int kLayer = 1;
+
+struct tagvideoDecControls;
+
+/* == ceil(num / den) * den. T must be integer type, alignment must be positive power of 2 */
+template <class T, class U>
+inline static const T align(const T &num, const U &den) {
+ return (num + (T)(den - 1)) & (T) ~(den - 1);
+}
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitDecoder(); }
+ bool initDecoder();
+ bool allocOutputBuffer(size_t outputBufferSize);
+ void freeOutputBuffer();
+ void handleResolutionChange();
+ void decodeFrames(const uint8_t *data, size_t size);
+ void deInitDecoder();
+
+ private:
+ tagvideoDecControls *mDecHandle = nullptr;
+ uint8_t *mOutputBuffer[kNumOutputBuffers];
+ bool mInitialized = false;
+ bool mFramesConfigured = false;
+#ifdef MPEG4
+ MP4DecodingMode mInputMode = MPEG4_MODE;
+ size_t mMaxWidth = MPEG4_MAX_WIDTH;
+ size_t mMaxHeight = MPEG4_MAX_HEIGHT;
+#else
+ MP4DecodingMode mInputMode = H263_MODE;
+ size_t mMaxWidth = H263_MAX_WIDTH;
+ size_t mMaxHeight = H263_MAX_HEIGHT;
+#endif
+ uint32_t mNumSamplesOutput = 0;
+ uint32_t mWidth = DEFAULT_WIDTH;
+ uint32_t mHeight = DEFAULT_HEIGHT;
+};
+
+bool Codec::initDecoder() {
+ mDecHandle = new tagvideoDecControls;
+ if (!mDecHandle) {
+ return false;
+ }
+ memset(mDecHandle, 0, sizeof(tagvideoDecControls));
+ return true;
+}
+
+bool Codec::allocOutputBuffer(size_t outputBufferSize) {
+ for (uint8_t i = 0; i < kNumOutputBuffers; ++i) {
+ if (!mOutputBuffer[i]) {
+ mOutputBuffer[i] = static_cast<uint8_t *>(malloc(outputBufferSize));
+ if (!mOutputBuffer[i]) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void Codec::freeOutputBuffer() {
+ for (uint8_t i = 0; i < kNumOutputBuffers; ++i) {
+ if (mOutputBuffer[i]) {
+ free(mOutputBuffer[i]);
+ mOutputBuffer[i] = nullptr;
+ }
+ }
+}
+
+void Codec::handleResolutionChange() {
+ int32_t dispWidth, dispHeight;
+ PVGetVideoDimensions(mDecHandle, &dispWidth, &dispHeight);
+
+ int32_t bufWidth, bufHeight;
+ PVGetBufferDimensions(mDecHandle, &bufWidth, &bufHeight);
+
+ if (dispWidth != mWidth || dispHeight != mHeight) {
+ mWidth = dispWidth;
+ mHeight = dispHeight;
+ }
+}
+
+void Codec::decodeFrames(const uint8_t *data, size_t size) {
+ size_t outputBufferSize = align(mMaxWidth, 16) * align(mMaxHeight, 16) * 3 / 2;
+ uint8_t *start_code = const_cast<uint8_t *>(data);
+ static const uint8_t volInfo[] = {0x00, 0x00, 0x01, 0xB0};
+ bool volHeader = memcmp(start_code, volInfo, 4) == 0;
+ if (volHeader) {
+ PVCleanUpVideoDecoder(mDecHandle);
+ mInitialized = false;
+ }
+
+ if (!mInitialized) {
+ uint8_t *volData[1]{};
+ int32_t volSize = 0;
+
+ if (volHeader) { /* removed some codec config part */
+ volData[0] = const_cast<uint8_t *>(data);
+ volSize = size;
+ }
+
+ if (!PVInitVideoDecoder(mDecHandle, volData, &volSize, kLayer, mMaxWidth, mMaxHeight,
+ mInputMode)) {
+ return;
+ }
+ mInitialized = true;
+ MP4DecodingMode actualMode = PVGetDecBitstreamMode(mDecHandle);
+ if (mInputMode != actualMode) {
+ return;
+ }
+
+ PVSetPostProcType(mDecHandle, 0);
+ }
+ size_t yFrameSize = sizeof(uint8) * mDecHandle->size;
+ if (outputBufferSize < yFrameSize * 3 / 2) {
+ return;
+ }
+ if (!allocOutputBuffer(outputBufferSize)) {
+ return;
+ }
+ size_t numDecodeCalls = 0;
+ while ((size > 0) && (numDecodeCalls < kMaxNumDecodeCalls)) {
+ if (!mFramesConfigured) {
+ PVSetReferenceYUV(mDecHandle, mOutputBuffer[1]);
+ mFramesConfigured = true;
+ }
+
+ // Need to check if header contains new info, e.g., width/height, etc.
+ VopHeaderInfo header_info;
+ uint32_t useExtTimestamp = (numDecodeCalls == 0);
+ int32_t tempSize = (int32_t)size;
+ uint8_t *bitstreamTmp = const_cast<uint8_t *>(data);
+ uint32_t timestamp = 0;
+ if (PVDecodeVopHeader(mDecHandle, &bitstreamTmp, ×tamp, &tempSize, &header_info,
+ &useExtTimestamp, mOutputBuffer[mNumSamplesOutput & 1]) != PV_TRUE) {
+ return;
+ }
+
+ handleResolutionChange();
+
+ PVDecodeVopBody(mDecHandle, &tempSize);
+ uint32_t bytesConsumed = 1;
+ if (size > tempSize) {
+ bytesConsumed = size - tempSize;
+ }
+ data += bytesConsumed;
+ size -= bytesConsumed;
+ ++mNumSamplesOutput;
+ ++numDecodeCalls;
+ }
+ freeOutputBuffer();
+}
+
+void Codec::deInitDecoder() {
+ PVCleanUpVideoDecoder(mDecHandle);
+ delete mDecHandle;
+ mDecHandle = nullptr;
+ mInitialized = false;
+ freeOutputBuffer();
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < 4) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initDecoder()) {
+ codec->decodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/mp3dec/test/Android.bp b/media/libstagefright/codecs/mp3dec/test/Android.bp
new file mode 100644
index 0000000..0ff8b12
--- /dev/null
+++ b/media/libstagefright/codecs/mp3dec/test/Android.bp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+cc_test {
+ name: "Mp3DecoderTest",
+ gtest: true,
+
+ srcs: [
+ "mp3reader.cpp",
+ "Mp3DecoderTest.cpp",
+ ],
+
+ static_libs: [
+ "libstagefright_mp3dec",
+ "libsndfile",
+ "libaudioutils",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml b/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml
new file mode 100644
index 0000000..7ff9732
--- /dev/null
+++ b/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for Mp3 Decoder unit test">
+ <option name="test-suite-tag" value="Mp3DecoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <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.zip?unzip=true"
+ value="/data/local/tmp/Mp3DecoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="Mp3DecoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/Mp3DecoderTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp
new file mode 100644
index 0000000..99553ec
--- /dev/null
+++ b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp
@@ -0,0 +1,200 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Mp3DecoderTest"
+
+#include <utils/Log.h>
+
+#include <audio_utils/sndfile.h>
+#include <stdio.h>
+
+#include "mp3reader.h"
+#include "pvmp3decoder_api.h"
+
+#include "Mp3DecoderTestEnvironment.h"
+
+#define OUTPUT_FILE "/data/local/tmp/mp3Decode.out"
+
+constexpr int32_t kInputBufferSize = 1024 * 10;
+constexpr int32_t kOutputBufferSize = 4608 * 2;
+constexpr int32_t kMaxCount = 10;
+constexpr int32_t kNumFrameReset = 150;
+
+static Mp3DecoderTestEnvironment *gEnv = nullptr;
+
+class Mp3DecoderTest : public ::testing::TestWithParam<string> {
+ public:
+ Mp3DecoderTest() : mConfig(nullptr) {}
+
+ ~Mp3DecoderTest() {
+ if (mConfig) {
+ delete mConfig;
+ mConfig = nullptr;
+ }
+ }
+
+ virtual void SetUp() override {
+ mConfig = new tPVMP3DecoderExternal{};
+ ASSERT_NE(mConfig, nullptr) << "Failed to initialize config. No Memory available";
+ mConfig->equalizerType = flat;
+ mConfig->crcEnabled = false;
+ }
+
+ tPVMP3DecoderExternal *mConfig;
+ Mp3Reader mMp3Reader;
+
+ ERROR_CODE DecodeFrames(void *decoderbuf, SNDFILE *outFileHandle, SF_INFO sfInfo,
+ int32_t frameCount = INT32_MAX);
+ SNDFILE *openOutputFile(SF_INFO *sfInfo);
+};
+
+ERROR_CODE Mp3DecoderTest::DecodeFrames(void *decoderBuf, SNDFILE *outFileHandle, SF_INFO sfInfo,
+ int32_t frameCount) {
+ uint8_t inputBuf[kInputBufferSize];
+ int16_t outputBuf[kOutputBufferSize];
+ uint32_t bytesRead;
+ ERROR_CODE decoderErr;
+ while (frameCount > 0) {
+ bool success = mMp3Reader.getFrame(inputBuf, &bytesRead);
+ if (!success) {
+ break;
+ }
+ mConfig->inputBufferCurrentLength = bytesRead;
+ mConfig->inputBufferMaxLength = 0;
+ mConfig->inputBufferUsedLength = 0;
+ mConfig->pInputBuffer = inputBuf;
+ mConfig->pOutputBuffer = outputBuf;
+ mConfig->outputFrameSize = kOutputBufferSize / sizeof(int16_t);
+ decoderErr = pvmp3_framedecoder(mConfig, decoderBuf);
+ if (decoderErr != NO_DECODING_ERROR) break;
+ sf_writef_short(outFileHandle, outputBuf, mConfig->outputFrameSize / sfInfo.channels);
+ frameCount--;
+ }
+ return decoderErr;
+}
+
+SNDFILE *Mp3DecoderTest::openOutputFile(SF_INFO *sfInfo) {
+ memset(sfInfo, 0, sizeof(SF_INFO));
+ sfInfo->channels = mMp3Reader.getNumChannels();
+ sfInfo->format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+ sfInfo->samplerate = mMp3Reader.getSampleRate();
+ SNDFILE *outFileHandle = sf_open(OUTPUT_FILE, SFM_WRITE, sfInfo);
+ return outFileHandle;
+}
+
+TEST_F(Mp3DecoderTest, MultiCreateMp3DecoderTest) {
+ size_t memRequirements = pvmp3_decoderMemRequirements();
+ ASSERT_NE(memRequirements, 0) << "Failed to get the memory requirement size";
+ void *decoderBuf = malloc(memRequirements);
+ ASSERT_NE(decoderBuf, nullptr)
+ << "Failed to allocate decoder memory of size " << memRequirements;
+ for (int count = 0; count < kMaxCount; count++) {
+ pvmp3_InitDecoder(mConfig, decoderBuf);
+ ALOGV("Decoder created successfully");
+ }
+ if (decoderBuf) {
+ free(decoderBuf);
+ decoderBuf = nullptr;
+ }
+}
+
+TEST_P(Mp3DecoderTest, DecodeTest) {
+ size_t memRequirements = pvmp3_decoderMemRequirements();
+ ASSERT_NE(memRequirements, 0) << "Failed to get the memory requirement size";
+ void *decoderBuf = malloc(memRequirements);
+ ASSERT_NE(decoderBuf, nullptr)
+ << "Failed to allocate decoder memory of size " << memRequirements;
+
+ pvmp3_InitDecoder(mConfig, decoderBuf);
+ ALOGV("Decoder created successfully");
+ string inputFile = gEnv->getRes() + GetParam();
+ bool status = mMp3Reader.init(inputFile.c_str());
+ ASSERT_TRUE(status) << "Unable to initialize the mp3Reader";
+
+ // Open the output file.
+ SF_INFO sfInfo;
+ SNDFILE *outFileHandle = openOutputFile(&sfInfo);
+ ASSERT_NE(outFileHandle, nullptr) << "Error opening output file for writing decoded output";
+
+ ERROR_CODE decoderErr = DecodeFrames(decoderBuf, outFileHandle, sfInfo);
+ ASSERT_EQ(decoderErr, NO_DECODING_ERROR) << "Failed to decode the frames";
+ ASSERT_EQ(sfInfo.channels, mConfig->num_channels) << "Number of channels does not match";
+ ASSERT_EQ(sfInfo.samplerate, mConfig->samplingRate) << "Sample rate does not match";
+
+ mMp3Reader.close();
+ sf_close(outFileHandle);
+ if (decoderBuf) {
+ free(decoderBuf);
+ decoderBuf = nullptr;
+ }
+}
+
+TEST_P(Mp3DecoderTest, ResetDecoderTest) {
+ size_t memRequirements = pvmp3_decoderMemRequirements();
+ ASSERT_NE(memRequirements, 0) << "Failed to get the memory requirement size";
+ void *decoderBuf = malloc(memRequirements);
+ ASSERT_NE(decoderBuf, nullptr)
+ << "Failed to allocate decoder memory of size " << memRequirements;
+
+ pvmp3_InitDecoder(mConfig, decoderBuf);
+ ALOGV("Decoder created successfully.");
+ string inputFile = gEnv->getRes() + GetParam();
+ bool status = mMp3Reader.init(inputFile.c_str());
+ ASSERT_TRUE(status) << "Unable to initialize the mp3Reader";
+
+ // Open the output file.
+ SF_INFO sfInfo;
+ SNDFILE *outFileHandle = openOutputFile(&sfInfo);
+ ASSERT_NE(outFileHandle, nullptr) << "Error opening output file for writing decoded output";
+
+ ERROR_CODE decoderErr;
+ decoderErr = DecodeFrames(decoderBuf, outFileHandle, sfInfo, kNumFrameReset);
+ ASSERT_EQ(decoderErr, NO_DECODING_ERROR) << "Failed to decode the frames";
+ ASSERT_EQ(sfInfo.channels, mConfig->num_channels) << "Number of channels does not match";
+ ASSERT_EQ(sfInfo.samplerate, mConfig->samplingRate) << "Sample rate does not match";
+
+ pvmp3_resetDecoder(decoderBuf);
+ // Decode the same file.
+ decoderErr = DecodeFrames(decoderBuf, outFileHandle, sfInfo);
+ ASSERT_EQ(decoderErr, NO_DECODING_ERROR) << "Failed to decode the frames";
+ ASSERT_EQ(sfInfo.channels, mConfig->num_channels) << "Number of channels does not match";
+ ASSERT_EQ(sfInfo.samplerate, mConfig->samplingRate) << "Sample rate does not match";
+
+ mMp3Reader.close();
+ sf_close(outFileHandle);
+ if (decoderBuf) {
+ free(decoderBuf);
+ decoderBuf = nullptr;
+ }
+}
+
+INSTANTIATE_TEST_SUITE_P(Mp3DecoderTestAll, Mp3DecoderTest,
+ ::testing::Values(("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3"),
+ ("bbb_44100hz_2ch_128kbps_mp3_5mins.mp3"),
+ ("bbb_mp3_stereo_192kbps_48000hz.mp3")));
+
+int main(int argc, char **argv) {
+ gEnv = new Mp3DecoderTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTestEnvironment.h b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTestEnvironment.h
new file mode 100644
index 0000000..a54b34c
--- /dev/null
+++ b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTestEnvironment.h
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef __MP3DECODER_TEST_ENVIRONMENT_H__
+#define __MP3DECODER_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class Mp3DecoderTestEnvironment : public ::testing::Environment {
+ public:
+ Mp3DecoderTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int Mp3DecoderTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P':
+ setRes(optarg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __MP3DECODER_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/codecs/mp3dec/test/README.md b/media/libstagefright/codecs/mp3dec/test/README.md
new file mode 100644
index 0000000..f59fec7
--- /dev/null
+++ b/media/libstagefright/codecs/mp3dec/test/README.md
@@ -0,0 +1,39 @@
+## Media Testing ##
+---
+#### Mp3Decoder :
+The Mp3Decoder Test Suite validates the mp3decoder available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m Mp3DecoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/Mp3DecoderTest/Mp3DecoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/Mp3DecoderTest/Mp3DecoderTest /data/local/tmp/
+```
+
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/mp3dec/test/Mp3DecoderTest.zip). Download, unzip and push these files into device for testing.
+
+```
+adb push Mp3DecoderTestRes/. /data/local/tmp/
+```
+
+usage: Mp3DecoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/Mp3DecoderTest -P /data/local/tmp/Mp3DecoderTestRes/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest Mp3DecoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/codecs/on2/enc/Android.bp b/media/libstagefright/codecs/on2/enc/Android.bp
index cd69e0d..705e554 100644
--- a/media/libstagefright/codecs/on2/enc/Android.bp
+++ b/media/libstagefright/codecs/on2/enc/Android.bp
@@ -21,4 +21,5 @@
},
shared_libs: ["libvpx"],
+ header_libs: ["libbase_headers"],
}
diff --git a/media/libstagefright/flac/dec/test/Android.bp b/media/libstagefright/flac/dec/test/Android.bp
new file mode 100644
index 0000000..70ca80a
--- /dev/null
+++ b/media/libstagefright/flac/dec/test/Android.bp
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+cc_test {
+ name: "FlacDecoderTest",
+ gtest: true,
+
+ srcs: [
+ "FlacDecoderTest.cpp",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ static_libs: [
+ "libstagefright_flacdec",
+ "libFLAC",
+ ],
+
+ header_libs: [
+ "libstagefright_foundation_headers",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ cfi: true,
+ },
+}
diff --git a/media/libstagefright/flac/dec/test/AndroidTest.xml b/media/libstagefright/flac/dec/test/AndroidTest.xml
new file mode 100644
index 0000000..bebba8e
--- /dev/null
+++ b/media/libstagefright/flac/dec/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for flac decoder unit tests">
+ <option name="test-suite-tag" value="FlacDecoderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="FlacDecoderTest->/data/local/tmp/FlacDecoderTest/" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/flac/dec/test/FlacDecoder.zip?unzip=true"
+ value="/data/local/tmp/FlacDecoderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="FlacDecoderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/FlacDecoderTestRes/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/libstagefright/flac/dec/test/FlacDecoderTest.cpp b/media/libstagefright/flac/dec/test/FlacDecoderTest.cpp
new file mode 100644
index 0000000..34f12db
--- /dev/null
+++ b/media/libstagefright/flac/dec/test/FlacDecoderTest.cpp
@@ -0,0 +1,270 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "FlacDecoderTest"
+
+#include <utils/Log.h>
+#include <fstream>
+
+#include "FLACDecoder.h"
+
+#include "FlacDecoderTestEnvironment.h"
+
+#define OUTPUT_FILE_NAME "/data/local/tmp/FlacDecoderOutput.raw"
+#define CODEC_CONFIG_FLAG 32
+
+constexpr uint32_t kMaxCount = 10;
+constexpr int32_t kMaxBlockSize = 4096;
+
+using namespace android;
+
+struct FrameInfo {
+ int32_t bytesCount;
+ uint32_t flags;
+ int64_t timestamp;
+};
+
+static FlacDecoderTestEnvironment *gEnv = nullptr;
+
+class FLACDecoderTest : public ::testing::TestWithParam<tuple<string, string, bool>> {
+ public:
+ FLACDecoderTest() : mFLACDecoder(nullptr), mHasStreamInfo(false), mInputBufferCount(0) {}
+
+ ~FLACDecoderTest() {
+ if (mEleStream.is_open()) mEleStream.close();
+ if (mFLACDecoder) delete mFLACDecoder;
+ mFLACDecoder = nullptr;
+ }
+
+ virtual void SetUp() override {
+ mFLACDecoder = FLACDecoder::Create();
+ ASSERT_NE(mFLACDecoder, nullptr) << "initDecoder: failed to create FLACDecoder";
+ }
+
+ int32_t processFlacDecoder(vector<FrameInfo> Info, int32_t offset, int32_t range,
+ bool outputFloat, ofstream &ostrm);
+
+ FLACDecoder *mFLACDecoder;
+ FLAC__StreamMetadata_StreamInfo mStreamInfo;
+
+ bool mHasStreamInfo;
+ int32_t mInputBufferCount;
+ ifstream mEleStream;
+};
+
+void getInfo(string infoFileName, vector<FrameInfo> &Info) {
+ ifstream eleInfo;
+ eleInfo.open(infoFileName);
+ ASSERT_EQ(eleInfo.is_open(), true);
+ int32_t bytesCount = 0;
+ uint32_t flags = 0;
+ uint32_t timestamp = 0;
+ while (1) {
+ if (!(eleInfo >> bytesCount)) break;
+ eleInfo >> flags;
+ eleInfo >> timestamp;
+ Info.push_back({bytesCount, flags, timestamp});
+ }
+ if (eleInfo.is_open()) eleInfo.close();
+}
+
+int32_t FLACDecoderTest::processFlacDecoder(vector<FrameInfo> Info, int32_t offset, int32_t range,
+ bool outputFloat, ofstream &ostrm) {
+ memset(&mStreamInfo, 0, sizeof(mStreamInfo));
+
+ int32_t frameID = offset;
+ if (range + offset > Info.size() || range < 0 || offset > Info.size() - 1 || offset < 0) {
+ ALOGE("Invalid offset or range or both passed for decoding");
+ ALOGE("offset = %d \t range = %d \t Info.size() = %zu", offset, range, Info.size());
+ return -1;
+ }
+
+ while (1) {
+ if (frameID == Info.size() || frameID == (offset + range)) break;
+ int64_t flags = (Info)[frameID].flags;
+ int32_t size = (Info)[frameID].bytesCount;
+ if (size < 0) {
+ ALOGE("Size for the memory allocation is negative");
+ return -1;
+ }
+ char *data = (char *)malloc(size);
+ if (!data) {
+ ALOGE("Insufficient memory to read frame");
+ return -1;
+ }
+
+ mEleStream.read(data, size);
+ if (mEleStream.gcount() != size) {
+ if (data) {
+ free(data);
+ data = nullptr;
+ }
+ ALOGE("Invalid size read, requested: %d and read: %zu", size, mEleStream.gcount());
+ return -1;
+ }
+
+ if (flags == CODEC_CONFIG_FLAG && mInputBufferCount == 0) {
+ status_t decoderErr = mFLACDecoder->parseMetadata((uint8_t *)data, size);
+ if (decoderErr == WOULD_BLOCK) {
+ ALOGV("process: parseMetadata is Blocking, Continue %d", decoderErr);
+ } else if (decoderErr == OK) {
+ mStreamInfo = mFLACDecoder->getStreamInfo();
+ if (mStreamInfo.sample_rate && mStreamInfo.max_blocksize && mStreamInfo.channels) {
+ mHasStreamInfo = true;
+ }
+ ALOGV("decoder configuration : %d Hz, %d channels, %d samples,"
+ " %d block size",
+ mStreamInfo.sample_rate, mStreamInfo.channels,
+ (int32_t)mStreamInfo.total_samples, mStreamInfo.max_blocksize);
+ } else {
+ ALOGE("FLACDecoder parseMetaData returns error %d", decoderErr);
+ if (data) {
+ free(data);
+ data = nullptr;
+ }
+ return decoderErr;
+ }
+ } else {
+ const size_t sampleSize = outputFloat ? sizeof(float) : sizeof(int16_t);
+ size_t outSize = mHasStreamInfo
+ ? mStreamInfo.max_blocksize * mStreamInfo.channels * sampleSize
+ : kMaxBlockSize * FLACDecoder::kMaxChannels * sampleSize;
+
+ void *out_buf = malloc(outSize);
+ if (!out_buf) {
+ if (data) {
+ free(data);
+ data = nullptr;
+ }
+ ALOGE("Output buffer allocation failed");
+ return -1;
+ }
+ status_t decoderErr = mFLACDecoder->decodeOneFrame((uint8_t *)data, size, out_buf,
+ &outSize, outputFloat);
+ if (decoderErr != OK) {
+ ALOGE("decodeOneFrame returns error %d", decoderErr);
+ if (data) {
+ free(data);
+ data = nullptr;
+ }
+ if (out_buf) {
+ free(out_buf);
+ out_buf = nullptr;
+ }
+ return decoderErr;
+ }
+ ostrm.write(reinterpret_cast<char *>(out_buf), outSize);
+ free(out_buf);
+ out_buf = nullptr;
+ }
+ mInputBufferCount++;
+ frameID++;
+ free(data);
+ data = nullptr;
+ }
+ ALOGV("frameID=%d", frameID);
+ return 0;
+}
+
+TEST_F(FLACDecoderTest, CreateDeleteTest) {
+ if (mFLACDecoder) delete mFLACDecoder;
+ mFLACDecoder = nullptr;
+
+ for (int32_t i = 0; i < kMaxCount; i++) {
+ mFLACDecoder = FLACDecoder::Create();
+ ASSERT_NE(mFLACDecoder, nullptr) << "FLACDecoder Creation Failed";
+ if (mFLACDecoder) delete mFLACDecoder;
+ mFLACDecoder = nullptr;
+ }
+}
+
+TEST_P(FLACDecoderTest, FlushTest) {
+ tuple<string /* InputFileName */, string /* InfoFileName */, bool /* outputfloat */> params =
+ GetParam();
+
+ string inputFileName = gEnv->getRes() + get<0>(params);
+ string infoFileName = gEnv->getRes() + get<1>(params);
+ bool outputFloat = get<2>(params);
+
+ vector<FrameInfo> Info;
+ getInfo(infoFileName, Info);
+
+ mEleStream.open(inputFileName, ifstream::binary);
+ ASSERT_EQ(mEleStream.is_open(), true);
+
+ ofstream ostrm;
+ ostrm.open(OUTPUT_FILE_NAME, std::ofstream::binary);
+ ASSERT_EQ(ostrm.is_open(), true);
+
+ int32_t status = processFlacDecoder(Info, 0, Info.size() / 3, outputFloat, ostrm);
+ ASSERT_EQ(status, 0) << "Test Failed. Decode returned error = " << status << endl;
+ mFLACDecoder->flush();
+ mHasStreamInfo = false;
+ status = processFlacDecoder(Info, (Info.size() / 3), Info.size() - (Info.size() / 3),
+ outputFloat, ostrm);
+ ostrm.close();
+ Info.clear();
+ ASSERT_EQ(status, 0) << "Test Failed. Decode returned error = " << status << endl;
+}
+
+TEST_P(FLACDecoderTest, DecodeTest) {
+ tuple<string /* InputFileName */, string /* InfoFileName */, bool /* outputfloat */> params =
+ GetParam();
+
+ string inputFileName = gEnv->getRes() + get<0>(params);
+ string infoFileName = gEnv->getRes() + get<1>(params);
+ bool outputFloat = get<2>(params);
+
+ vector<FrameInfo> Info;
+ getInfo(infoFileName, Info);
+
+ mEleStream.open(inputFileName, ifstream::binary);
+ ASSERT_EQ(mEleStream.is_open(), true);
+
+ ofstream ostrm;
+ ostrm.open(OUTPUT_FILE_NAME, std::ofstream::binary);
+ ASSERT_EQ(ostrm.is_open(), true);
+
+ int32_t status = processFlacDecoder(Info, 0, Info.size(), outputFloat, ostrm);
+ ostrm.close();
+ Info.clear();
+ ASSERT_EQ(status, 0) << "Test Failed. Decode returned error = " << status << endl;
+}
+
+// TODO: Add remaining tests
+INSTANTIATE_TEST_SUITE_P(
+ FLACDecoderTestAll, FLACDecoderTest,
+ ::testing::Values(make_tuple("bbb_flac_stereo_680kbps_48000hz.flac",
+ "bbb_flac_stereo_680kbps_48000hz.info", true),
+ make_tuple("bbb_flac_stereo_680kbps_48000hz.flac",
+ "bbb_flac_stereo_680kbps_48000hz.info", false),
+ make_tuple("bbb_flac_stereo_600kbps_44100hz.flac",
+ "bbb_flac_stereo_600kbps_44100hz.info", true),
+ make_tuple("bbb_flac_stereo_600kbps_44100hz.flac",
+ "bbb_flac_stereo_600kbps_44100hz.info", false)));
+
+int main(int argc, char **argv) {
+ gEnv = new FlacDecoderTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGV("Flac Decoder Test Result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/flac/dec/test/FlacDecoderTestEnvironment.h b/media/libstagefright/flac/dec/test/FlacDecoderTestEnvironment.h
new file mode 100644
index 0000000..1334bba
--- /dev/null
+++ b/media/libstagefright/flac/dec/test/FlacDecoderTestEnvironment.h
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+#ifndef __FLAC_DECODER_TEST_ENVIRONMENT_H__
+#define __FLAC_DECODER_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class FlacDecoderTestEnvironment : public ::testing::Environment {
+ public:
+ FlacDecoderTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int FlacDecoderTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"path", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P': {
+ setRes(optarg);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __FLAC_DECODER_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/flac/dec/test/README.md b/media/libstagefright/flac/dec/test/README.md
new file mode 100644
index 0000000..4d194cd
--- /dev/null
+++ b/media/libstagefright/flac/dec/test/README.md
@@ -0,0 +1,40 @@
+## Media Testing ##
+---
+#### FlacDecoder :
+The FlacDecoder Test Suite validates the FlacDecoder available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m FlacDecoderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/FlacDecoderTest/FlacDecoderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/FlacDecoderTest/FlacDecoderTest /data/local/tmp/
+```
+
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/flac/dec/test/FlacDecoder.zip).
+Download, unzip and push these files into device for testing.
+
+```
+adb push FlacDecoder /data/local/tmp/
+```
+
+usage: FlacDecoderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/FlacDecoderTest -P /data/local/tmp/FlacDecoder/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest FlacDecoderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp
index b95f054..effbb4e 100644
--- a/media/libstagefright/foundation/Android.bp
+++ b/media/libstagefright/foundation/Android.bp
@@ -34,10 +34,6 @@
"media_plugin_headers",
],
- export_shared_lib_headers: [
- "libbinder",
- ],
-
cflags: [
"-Wno-multichar",
"-Werror",
diff --git a/media/libstagefright/foundation/OpusHeader.cpp b/media/libstagefright/foundation/OpusHeader.cpp
index 513e41f..42ac026 100644
--- a/media/libstagefright/foundation/OpusHeader.cpp
+++ b/media/libstagefright/foundation/OpusHeader.cpp
@@ -126,12 +126,20 @@
}
header->num_streams = data[kOpusHeaderNumStreamsOffset];
header->num_coupled = data[kOpusHeaderNumCoupledStreamsOffset];
- if (header->num_streams + header->num_coupled != header->channels) {
- ALOGV("Inconsistent channel mapping.");
+ if (header->num_coupled > header->num_streams ||
+ header->num_streams + header->num_coupled != header->channels) {
+ ALOGV("Inconsistent channel mapping, streams: %d coupled: %d channels: %d",
+ header->num_streams, header->num_coupled, header->channels);
return false;
}
- for (int i = 0; i < header->channels; ++i)
- header->stream_map[i] = data[kOpusHeaderStreamMapOffset + i];
+ for (int i = 0; i < header->channels; ++i) {
+ uint8_t value = data[kOpusHeaderStreamMapOffset + i];
+ if (value != 255 && value >= header->channels) {
+ ALOGV("Invalid channel mapping for index %i : %d", i, value);
+ return false;
+ }
+ header->stream_map[i] = value;
+ }
return true;
}
diff --git a/media/libstagefright/foundation/TEST_MAPPING b/media/libstagefright/foundation/TEST_MAPPING
new file mode 100644
index 0000000..3301c4b
--- /dev/null
+++ b/media/libstagefright/foundation/TEST_MAPPING
@@ -0,0 +1,5 @@
+{
+ "presubmit": [
+ { "name": "sf_foundation_test" }
+ ]
+}
diff --git a/media/libstagefright/foundation/tests/Android.bp b/media/libstagefright/foundation/tests/Android.bp
new file mode 100644
index 0000000..f2157c9
--- /dev/null
+++ b/media/libstagefright/foundation/tests/Android.bp
@@ -0,0 +1,27 @@
+cc_test {
+ name: "sf_foundation_test",
+ test_suites: ["device-tests"],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ include_dirs: [
+ "frameworks/av/include",
+ ],
+
+ shared_libs: [
+ "liblog",
+ "libstagefright_foundation",
+ "libutils",
+ ],
+
+ srcs: [
+ "AData_test.cpp",
+ "Base64_test.cpp",
+ "Flagged_test.cpp",
+ "TypeTraits_test.cpp",
+ "Utils_test.cpp",
+ ],
+}
diff --git a/media/libstagefright/foundation/tests/Android.mk b/media/libstagefright/foundation/tests/Android.mk
deleted file mode 100644
index a9e3c76..0000000
--- a/media/libstagefright/foundation/tests/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Build the unit tests.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_MODULE := sf_foundation_test
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- AData_test.cpp \
- Base64_test.cpp \
- Flagged_test.cpp \
- TypeTraits_test.cpp \
- Utils_test.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libstagefright_foundation \
- libutils \
-
-LOCAL_C_INCLUDES := \
- frameworks/av/include \
-
-LOCAL_CFLAGS += -Werror -Wall
-LOCAL_CLANG := true
-
-include $(BUILD_NATIVE_TEST)
-
-# Include subdirectory makefiles
-# ============================================================
-
-# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
-# team really wants is to build the stuff defined by this makefile.
-ifeq (,$(ONE_SHOT_MAKEFILE))
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
diff --git a/media/libstagefright/foundation/tests/OpusHeader/Android.bp b/media/libstagefright/foundation/tests/OpusHeader/Android.bp
new file mode 100644
index 0000000..c1251a8
--- /dev/null
+++ b/media/libstagefright/foundation/tests/OpusHeader/Android.bp
@@ -0,0 +1,45 @@
+/*
+ * 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: "OpusHeaderTest",
+ gtest: true,
+
+ srcs: [
+ "OpusHeaderTest.cpp",
+ ],
+
+ shared_libs: [
+ "liblog",
+ ],
+
+ static_libs: [
+ "libstagefright_foundation",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ cfi: true,
+ },
+}
diff --git a/media/libstagefright/foundation/tests/OpusHeader/AndroidTest.xml b/media/libstagefright/foundation/tests/OpusHeader/AndroidTest.xml
new file mode 100644
index 0000000..afee16a
--- /dev/null
+++ b/media/libstagefright/foundation/tests/OpusHeader/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for opus header unit tests">
+ <option name="test-suite-tag" value="OpusHeaderTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="OpusHeaderTest->/data/local/tmp/OpusHeaderTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/foundation/tests/OpusHeader/OpusHeader.zip?unzip=true"
+ value="/data/local/tmp/OpusHeaderTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="OpusHeaderTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/OpusHeaderTestRes/" />
+ </test>
+</configuration>
\ No newline at end of file
diff --git a/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTest.cpp b/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTest.cpp
new file mode 100644
index 0000000..d142781
--- /dev/null
+++ b/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTest.cpp
@@ -0,0 +1,321 @@
+/*
+ * 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 "OpusHeaderTest"
+#include <utils/Log.h>
+
+#include <fstream>
+#include <stdio.h>
+#include <string.h>
+
+#include <media/stagefright/foundation/OpusHeader.h>
+
+#include "OpusHeaderTestEnvironment.h"
+
+using namespace android;
+
+#define OUTPUT_FILE_NAME "/data/local/tmp/OpusOutput"
+
+// Opus in WebM is a well-known, yet under-documented, format. The codec private data
+// of the track is an Opus Ogg header (https://tools.ietf.org/html/rfc7845#section-5.1)
+// channel mapping offset in opus header
+constexpr size_t kOpusHeaderStreamMapOffset = 21;
+constexpr size_t kMaxOpusHeaderSize = 100;
+// AOPUSHDR + AOPUSHDRLength +
+// (8 + 8 ) +
+// Header(csd) + num_streams + num_coupled + 1
+// (19 + 1 + 1 + 1) +
+// AOPUSDLY + AOPUSDLYLength + DELAY + AOPUSPRL + AOPUSPRLLength + PRL
+// (8 + 8 + 8 + 8 + 8 + 8)
+// = 86
+constexpr size_t kOpusHeaderChannelMapOffset = 86;
+constexpr uint32_t kOpusSampleRate = 48000;
+constexpr uint64_t kOpusSeekPrerollNs = 80000000;
+constexpr int64_t kNsecPerSec = 1000000000ll;
+
+// Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies
+// mappings for up to 8 channels. This information is part of the Vorbis I
+// Specification:
+// http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html
+constexpr int kMaxChannels = 8;
+constexpr uint8_t kOpusChannelMap[kMaxChannels][kMaxChannels] = {
+ {0},
+ {0, 1},
+ {0, 2, 1},
+ {0, 1, 2, 3},
+ {0, 4, 1, 2, 3},
+ {0, 4, 1, 2, 3, 5},
+ {0, 4, 1, 2, 3, 5, 6},
+ {0, 6, 1, 2, 3, 4, 5, 7},
+};
+
+static OpusHeaderTestEnvironment *gEnv = nullptr;
+
+class OpusHeaderTest {
+ public:
+ OpusHeaderTest() : mInputBuffer(nullptr) {}
+
+ ~OpusHeaderTest() {
+ if (mEleStream.is_open()) mEleStream.close();
+ if (mInputBuffer) {
+ free(mInputBuffer);
+ mInputBuffer = nullptr;
+ }
+ }
+ ifstream mEleStream;
+ uint8_t *mInputBuffer;
+};
+
+class OpusHeaderParseTest : public OpusHeaderTest,
+ public ::testing::TestWithParam<
+ tuple<string /* InputFileName */, int32_t /* ChannelCount */,
+ bool /* isHeaderValid */, bool /* isCodecDelayValid */,
+ bool /* isSeekPreRollValid */, bool /* isInputValid */>> {
+};
+
+class OpusHeaderWriteTest
+ : public OpusHeaderTest,
+ public ::testing::TestWithParam<pair<int32_t /* ChannelCount */, int32_t /* skipSamples */>> {
+};
+
+TEST_P(OpusHeaderWriteTest, WriteTest) {
+ OpusHeader writtenHeader;
+ memset(&writtenHeader, 0, sizeof(writtenHeader));
+ int32_t channels = GetParam().first;
+ writtenHeader.channels = channels;
+ writtenHeader.num_streams = channels;
+ writtenHeader.channel_mapping = ((channels > 8) ? 255 : (channels > 2));
+ int32_t skipSamples = GetParam().second;
+ writtenHeader.skip_samples = skipSamples;
+ uint64_t codecDelayNs = skipSamples * kNsecPerSec / kOpusSampleRate;
+ uint8_t headerData[kMaxOpusHeaderSize];
+ int32_t headerSize = WriteOpusHeaders(writtenHeader, kOpusSampleRate, headerData,
+ sizeof(headerData), codecDelayNs, kOpusSeekPrerollNs);
+ ASSERT_GT(headerSize, 0) << "failed to generate Opus header";
+ ASSERT_LE(headerSize, kMaxOpusHeaderSize)
+ << "Invalid header written. Header size can't exceed kMaxOpusHeaderSize";
+
+ ofstream ostrm;
+ ostrm.open(OUTPUT_FILE_NAME, ofstream::binary);
+ ASSERT_TRUE(ostrm.is_open()) << "Failed to open output file " << OUTPUT_FILE_NAME;
+
+ // TODO : Validate bitstream (b/150116402)
+ ostrm.write(reinterpret_cast<char *>(headerData), sizeof(headerData));
+ ostrm.close();
+
+ size_t opusHeadSize = 0;
+ size_t codecDelayBufSize = 0;
+ size_t seekPreRollBufSize = 0;
+ void *opusHeadBuf = nullptr;
+ void *codecDelayBuf = nullptr;
+ void *seekPreRollBuf = nullptr;
+ bool status = GetOpusHeaderBuffers(headerData, headerSize, &opusHeadBuf, &opusHeadSize,
+ &codecDelayBuf, &codecDelayBufSize, &seekPreRollBuf,
+ &seekPreRollBufSize);
+ ASSERT_TRUE(status) << "Encountered error in GetOpusHeaderBuffers";
+
+ uint64_t value = *((uint64_t *)codecDelayBuf);
+ ASSERT_EQ(value, codecDelayNs);
+
+ value = *((uint64_t *)seekPreRollBuf);
+ ASSERT_EQ(value, kOpusSeekPrerollNs);
+
+ OpusHeader parsedHeader;
+ status = ParseOpusHeader((uint8_t *)opusHeadBuf, opusHeadSize, &parsedHeader);
+ ASSERT_TRUE(status) << "Encountered error while Parsing Opus Header.";
+
+ ASSERT_EQ(writtenHeader.channels, parsedHeader.channels)
+ << "Invalid header generated. Mismatch between channel counts";
+
+ ASSERT_EQ(writtenHeader.skip_samples, parsedHeader.skip_samples)
+ << "Mismatch between no of skipSamples written "
+ "and no of skipSamples got after parsing";
+
+ ASSERT_EQ(writtenHeader.channel_mapping, parsedHeader.channel_mapping)
+ << "Mismatch between channelMapping written "
+ "and channelMapping got after parsing";
+
+ if (parsedHeader.channel_mapping) {
+ ASSERT_GT(parsedHeader.channels, 2);
+ ASSERT_EQ(writtenHeader.num_streams, parsedHeader.num_streams)
+ << "Invalid header generated. Mismatch between channel counts";
+
+ ASSERT_EQ(writtenHeader.num_coupled, parsedHeader.num_coupled)
+ << "Invalid header generated. Mismatch between channel counts";
+
+ ASSERT_EQ(parsedHeader.num_coupled + parsedHeader.num_streams, parsedHeader.channels);
+
+ ASSERT_LE(parsedHeader.num_coupled, parsedHeader.num_streams)
+ << "Invalid header generated. Number of coupled streams cannot be greater than "
+ "number "
+ "of streams.";
+
+ ASSERT_EQ(headerSize, kOpusHeaderChannelMapOffset + writtenHeader.channels)
+ << "Invalid header written. Header size should be equal to 86 + "
+ "writtenHeader.channels";
+
+ uint8_t mappedChannelNumber;
+ for (int32_t channelNumber = 0; channelNumber < channels; channelNumber++) {
+ mappedChannelNumber = *(reinterpret_cast<uint8_t *>(opusHeadBuf) +
+ kOpusHeaderStreamMapOffset + channelNumber);
+ ASSERT_LT(mappedChannelNumber, channels) << "Invalid header generated. Channel mapping "
+ "cannot be greater than channel count.";
+
+ ASSERT_EQ(mappedChannelNumber, kOpusChannelMap[channels - 1][channelNumber])
+ << "Invalid header generated. Channel mapping is not as per specification.";
+ }
+ } else {
+ ASSERT_LE(parsedHeader.channels, 2);
+ }
+}
+
+TEST_P(OpusHeaderParseTest, ParseTest) {
+ tuple<string, int32_t, bool, bool, bool, bool> params = GetParam();
+ string inputFileName = gEnv->getRes() + get<0>(params);
+ mEleStream.open(inputFileName, ifstream::binary);
+ ASSERT_EQ(mEleStream.is_open(), true) << "Failed to open inputfile " << get<0>(params);
+ bool isHeaderValid = get<2>(params);
+ bool isCodecDelayValid = get<3>(params);
+ bool isSeekPreRollValid = get<4>(params);
+ bool isInputValid = get<5>(params);
+
+ struct stat buf;
+ stat(inputFileName.c_str(), &buf);
+ size_t fileSize = buf.st_size;
+ mInputBuffer = (uint8_t *)malloc(fileSize);
+ ASSERT_NE(mInputBuffer, nullptr) << "Insufficient memory. Malloc failed for size " << fileSize;
+
+ mEleStream.read(reinterpret_cast<char *>(mInputBuffer), fileSize);
+ ASSERT_EQ(mEleStream.gcount(), fileSize) << "mEleStream.gcount() != bytesCount";
+
+ OpusHeader header;
+ size_t opusHeadSize = 0;
+ size_t codecDelayBufSize = 0;
+ size_t seekPreRollBufSize = 0;
+ void *opusHeadBuf = nullptr;
+ void *codecDelayBuf = nullptr;
+ void *seekPreRollBuf = nullptr;
+ bool status = GetOpusHeaderBuffers(mInputBuffer, fileSize, &opusHeadBuf, &opusHeadSize,
+ &codecDelayBuf, &codecDelayBufSize, &seekPreRollBuf,
+ &seekPreRollBufSize);
+ if (!isHeaderValid) {
+ ASSERT_EQ(opusHeadBuf, nullptr);
+ } else {
+ ASSERT_NE(opusHeadBuf, nullptr);
+ }
+ if (!isCodecDelayValid) {
+ ASSERT_EQ(codecDelayBuf, nullptr);
+ } else {
+ ASSERT_NE(codecDelayBuf, nullptr);
+ }
+ if (!isSeekPreRollValid) {
+ ASSERT_EQ(seekPreRollBuf, nullptr);
+ } else {
+ ASSERT_NE(seekPreRollBuf, nullptr);
+ }
+ if (!status) {
+ ASSERT_FALSE(isInputValid) << "GetOpusHeaderBuffers failed";
+ return;
+ }
+
+ status = ParseOpusHeader((uint8_t *)opusHeadBuf, opusHeadSize, &header);
+
+ if (status) {
+ ASSERT_TRUE(isInputValid) << "Parse opus header didn't fail for invalid input";
+ } else {
+ ASSERT_FALSE(isInputValid);
+ return;
+ }
+
+ int32_t channels = get<1>(params);
+ ASSERT_EQ(header.channels, channels) << "Parser returned invalid channel count";
+ ASSERT_LE(header.channels, kMaxChannels);
+
+ ASSERT_LE(header.num_coupled, header.num_streams)
+ << "Invalid header generated. Number of coupled streams cannot be greater than number "
+ "of streams.";
+
+ ASSERT_EQ(header.num_coupled + header.num_streams, header.channels);
+
+ if (header.channel_mapping) {
+ uint8_t mappedChannelNumber;
+ for (int32_t channelNumber = 0; channelNumber < channels; channelNumber++) {
+ mappedChannelNumber = *(reinterpret_cast<uint8_t *>(opusHeadBuf) +
+ kOpusHeaderStreamMapOffset + channelNumber);
+ ASSERT_LT(mappedChannelNumber, channels)
+ << "Invalid header. Channel mapping cannot be greater than channel count.";
+
+ ASSERT_EQ(mappedChannelNumber, kOpusChannelMap[channels - 1][channelNumber])
+ << "Invalid header generated. Channel mapping "
+ "is not as per specification.";
+ }
+ }
+}
+
+INSTANTIATE_TEST_SUITE_P(OpusHeaderTestAll, OpusHeaderWriteTest,
+ ::testing::Values(make_pair(1, 312),
+ make_pair(2, 312),
+ make_pair(5, 312),
+ make_pair(6, 312),
+ make_pair(1, 0),
+ make_pair(2, 0),
+ make_pair(5, 0),
+ make_pair(6, 0),
+ make_pair(1, 624),
+ make_pair(2, 624),
+ make_pair(5, 624),
+ make_pair(6, 624)));
+
+INSTANTIATE_TEST_SUITE_P(
+ OpusHeaderTestAll, OpusHeaderParseTest,
+ ::testing::Values(
+ make_tuple("2ch_valid_size83B.opus", 2, true, true, true, true),
+ make_tuple("3ch_valid_size88B.opus", 3, true, true, true, true),
+ make_tuple("5ch_valid.opus", 5, true, false, false, true),
+ make_tuple("6ch_valid.opus", 6, true, false, false, true),
+ make_tuple("1ch_valid.opus", 1, true, false, false, true),
+ make_tuple("2ch_valid.opus", 2, true, false, false, true),
+ make_tuple("3ch_invalid_size.opus", 3, true, true, true, false),
+ make_tuple("3ch_invalid_streams.opus", 3, true, true, true, false),
+ make_tuple("5ch_invalid_channelmapping.opus", 5, true, false, false, false),
+ make_tuple("5ch_invalid_coupledstreams.opus", 5, true, false, false, false),
+ make_tuple("6ch_invalid_channelmapping.opus", 6, true, false, false, false),
+ make_tuple("9ch_invalid_channels.opus", 9, true, true, true, false),
+ make_tuple("2ch_invalid_header.opus", 2, false, false, false, false),
+ make_tuple("2ch_invalid_headerlength_16.opus", 2, false, false, false, false),
+ make_tuple("2ch_invalid_headerlength_256.opus", 2, false, false, false, false),
+ make_tuple("2ch_invalid_size.opus", 2, false, false, false, false),
+ make_tuple("3ch_invalid_channelmapping_0.opus", 3, true, true, true, false),
+ make_tuple("3ch_invalid_coupledstreams.opus", 3, true, true, true, false),
+ make_tuple("3ch_invalid_headerlength.opus", 3, true, true, true, false),
+ make_tuple("3ch_invalid_headerSize1.opus", 3, false, false, false, false),
+ make_tuple("3ch_invalid_headerSize2.opus", 3, false, false, false, false),
+ make_tuple("3ch_invalid_headerSize3.opus", 3, false, false, false, false),
+ make_tuple("3ch_invalid_nodelay.opus", 3, false, false, false, false),
+ make_tuple("3ch_invalid_nopreroll.opus", 3, false, false, false, false)));
+
+int main(int argc, char **argv) {
+ gEnv = new OpusHeaderTestEnvironment();
+ ::testing::AddGlobalTestEnvironment(gEnv);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ status = RUN_ALL_TESTS();
+ ALOGD("Opus Header Test Result = %d\n", status);
+ }
+ return status;
+}
diff --git a/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTestEnvironment.h b/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTestEnvironment.h
new file mode 100644
index 0000000..d0163c3
--- /dev/null
+++ b/media/libstagefright/foundation/tests/OpusHeader/OpusHeaderTestEnvironment.h
@@ -0,0 +1,73 @@
+/*
+ * 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 __OPUS_HEADER_TEST_ENVIRONMENT_H__
+#define __OPUS_HEADER_TEST_ENVIRONMENT_H__
+
+#include <gtest/gtest.h>
+
+#include <getopt.h>
+
+using namespace std;
+
+class OpusHeaderTestEnvironment : public ::testing::Environment {
+ public:
+ OpusHeaderTestEnvironment() : res("/data/local/tmp/") {}
+
+ // Parses the command line arguments
+ int initFromOptions(int argc, char **argv);
+
+ void setRes(const char *_res) { res = _res; }
+
+ const string getRes() const { return res; }
+
+ private:
+ string res;
+};
+
+int OpusHeaderTestEnvironment::initFromOptions(int argc, char **argv) {
+ static struct option options[] = {{"path", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'P': {
+ setRes(optarg);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --path: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+}
+
+#endif // __OPUS_HEADER_TEST_ENVIRONMENT_H__
diff --git a/media/libstagefright/foundation/tests/OpusHeader/README.md b/media/libstagefright/foundation/tests/OpusHeader/README.md
new file mode 100644
index 0000000..860c827
--- /dev/null
+++ b/media/libstagefright/foundation/tests/OpusHeader/README.md
@@ -0,0 +1,39 @@
+## Media Testing ##
+---
+#### Opus Header
+The OpusHeader Test Suite validates the OPUS header available in libstagefright.
+
+Run the following steps to build the test suite:
+```
+m OpusHeaderTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/OpusHeaderTest/OpusHeaderTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/OpusHeaderTest/OpusHeaderTest /data/local/tmp/
+```
+
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/foundation/tests/OpusHeader/OpusHeader.zip). Download, unzip and push these files into device for testing.
+
+```
+adb push OpusHeader /data/local/tmp/
+```
+
+usage: OpusHeaderTest -P \<path_to_folder\>
+```
+adb shell /data/local/tmp/OpusHeaderTest -P /data/local/tmp/OpusHeader/
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest OpusHeaderTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index 792a68a..425468f 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -32,7 +32,7 @@
static const size_t kMaxMetadataSize = 3 * 1024 * 1024;
-struct MemorySource : public DataSourceBase {
+struct ID3::MemorySource : public DataSourceBase {
MemorySource(const uint8_t *data, size_t size)
: mData(data),
mSize(size) {
@@ -58,7 +58,7 @@
DISALLOW_EVIL_CONSTRUCTORS(MemorySource);
};
-class DataSourceUnwrapper : public DataSourceBase {
+class ID3::DataSourceUnwrapper : public DataSourceBase {
public:
explicit DataSourceUnwrapper(DataSourceHelper *sourcehelper) {
diff --git a/media/libstagefright/id3/test/AndroidTest.xml b/media/libstagefright/id3/test/AndroidTest.xml
new file mode 100644
index 0000000..6c6697d
--- /dev/null
+++ b/media/libstagefright/id3/test/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for ID3 unit tests">
+ <option name="test-suite-tag" value="ID3Test" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="ID3Test->/data/local/tmp/ID3Test" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/id3/test/ID3Test.zip?unzip=true"
+ value="/data/local/tmp/ID3TestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="ID3Test" />
+ <option name="native-test-flag" value="-P /data/local/tmp/ID3TestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/id3/test/README.md b/media/libstagefright/id3/test/README.md
index 72f730c..7fd8901 100644
--- a/media/libstagefright/id3/test/README.md
+++ b/media/libstagefright/id3/test/README.md
@@ -22,13 +22,19 @@
adb push ${OUT}/data/nativetest/ID3Test/ID3Test /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://drive.google.com/drive/folders/1pt5HFVSysbqfyqY1sVJ9MTupZKCdqjYZ). Push these files into device for testing.
-Download ID3 folder and push all the files in this folder to /data/local/tmp/ID3 on the device.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/id3/test/ID3Test.zip ).
+Download, unzip and push these files into device for testing.
+
```
-adb push ID3/. /data/local/tmp/ID3
+adb push ID3Test /data/local/tmp/
```
usage: ID3Test -P \<path_to_folder\>
```
adb shell /data/local/tmp/ID3Test -P /data/local/tmp/ID3/
```
+Alternatively, the test can also be run using atest command.
+
+```
+atest ID3Test -- --enable-module-dynamic-download=true
+```
diff --git a/media/libstagefright/include/ID3.h b/media/libstagefright/include/ID3.h
index 5e433ea..2843a7a 100644
--- a/media/libstagefright/include/ID3.h
+++ b/media/libstagefright/include/ID3.h
@@ -77,6 +77,8 @@
size_t rawSize() const { return mRawSize; }
private:
+ class DataSourceUnwrapper;
+ struct MemorySource;
bool mIsValid;
uint8_t *mData;
size_t mSize;
diff --git a/media/libstagefright/tests/writer/AndroidTest.xml b/media/libstagefright/tests/writer/AndroidTest.xml
new file mode 100644
index 0000000..d831555
--- /dev/null
+++ b/media/libstagefright/tests/writer/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for writer tests">
+ <option name="test-suite-tag" value="writerTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="writerTest->/data/local/tmp/writerTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/Writer.zip?unzip=true"
+ value="/data/local/tmp/writerTestRes/" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="writerTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/writerTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/tests/writer/WriterTest.cpp b/media/libstagefright/tests/writer/WriterTest.cpp
index 409f141..ff063e3 100644
--- a/media/libstagefright/tests/writer/WriterTest.cpp
+++ b/media/libstagefright/tests/writer/WriterTest.cpp
@@ -243,6 +243,10 @@
sp<MetaData> trackMeta = new MetaData;
convertMessageToMetaData(format, trackMeta);
mCurrentTrack = new MediaAdapter(trackMeta);
+ if (mCurrentTrack == nullptr) {
+ ALOGE("MediaAdapter returned nullptr");
+ return -1;
+ }
status_t result = mWriter->addSource(mCurrentTrack);
return result;
}
@@ -301,7 +305,7 @@
getFileDetails(inputFile, inputInfo, param, isAudio, inputFileIdx);
ASSERT_NE(inputFile.compare(gEnv->getRes()), 0) << "No input file specified";
- getInputBufferInfo(inputFile, inputInfo);
+ ASSERT_NO_FATAL_FAILURE(getInputBufferInfo(inputFile, inputInfo));
status = addWriterSource(isAudio, param);
ASSERT_EQ((status_t)OK, status) << "Failed to add source for " << writerFormat << "Writer";
@@ -338,7 +342,7 @@
getFileDetails(inputFile, inputInfo, param, isAudio, inputFileIdx);
ASSERT_NE(inputFile.compare(gEnv->getRes()), 0) << "No input file specified";
- getInputBufferInfo(inputFile, inputInfo);
+ ASSERT_NO_FATAL_FAILURE(getInputBufferInfo(inputFile, inputInfo));
status = addWriterSource(isAudio, param);
ASSERT_EQ((status_t)OK, status) << "Failed to add source for " << writerFormat << "Writer";
@@ -397,7 +401,7 @@
getFileDetails(inputFile, inputInfo, param, isAudio, inputFileIdx);
ASSERT_NE(inputFile.compare(gEnv->getRes()), 0) << "No input file specified";
- getInputBufferInfo(inputFile, inputInfo);
+ ASSERT_NO_FATAL_FAILURE(getInputBufferInfo(inputFile, inputInfo));
status = addWriterSource(isAudio, param);
ASSERT_EQ((status_t)OK, status) << "Failed to add source for " << writerFormat << "Writer";
diff --git a/media/libstagefright/webm/tests/Android.bp b/media/libstagefright/webm/tests/Android.bp
new file mode 100644
index 0000000..5183a49
--- /dev/null
+++ b/media/libstagefright/webm/tests/Android.bp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+cc_test {
+ name: "WebmFrameThreadUnitTest",
+ gtest: true,
+
+ srcs: [
+ "WebmFrameThreadUnitTest.cpp",
+ ],
+
+ include_dirs: [
+ "frameworks/av/media/libstagefright",
+ ],
+
+ static_libs: [
+ "libdatasource",
+ "libstagefright",
+ "libstagefright_webm",
+ "libstagefright_foundation",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "liblog",
+ "libutils",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/webm/tests/README.md b/media/libstagefright/webm/tests/README.md
new file mode 100644
index 0000000..2e74f34
--- /dev/null
+++ b/media/libstagefright/webm/tests/README.md
@@ -0,0 +1,26 @@
+## Media Testing ##
+---
+#### Webm Writer Utility Tests :
+The Webm Writer Utility Test Suite validates the APIs being used by the WebmWriter.
+
+Run the following steps to build the test suite:
+```
+mmm frameworks/av/media/libstagefright/webm/tests/
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+#### WebmFrameThread
+To test 64-bit binary push binaries from nativetest64.
+
+adb push ${OUT}/data/nativetest64/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/
+
+To test 32-bit binary push binaries from nativetest.
+
+adb push ${OUT}/data/nativetest/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/
+
+```
+adb shell /data/local/tmp/WebmFrameThreadUnitTest
+```
diff --git a/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp b/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp
new file mode 100644
index 0000000..89cd2ca
--- /dev/null
+++ b/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "WebmFrameThreadUnitTest"
+#include <utils/Log.h>
+
+#include <gtest/gtest.h>
+
+#include <media/stagefright/MediaAdapter.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MetaData.h>
+#include <media/stagefright/Utils.h>
+
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/foundation/OpusHeader.h>
+
+#include "webm/EbmlUtil.h"
+#include "webm/WebmConstants.h"
+#include "webm/WebmFrameThread.h"
+
+using namespace android;
+using namespace webm;
+
+static constexpr int32_t kVideoIdx = 0;
+static constexpr int32_t kAudioIdx = 1;
+static constexpr int32_t kMaxStreamCount = 2;
+
+static constexpr int32_t kCsdSize = 32;
+static constexpr int32_t kFrameSize = 128;
+
+static constexpr int32_t kMaxLoopCount = 20;
+static constexpr int32_t kNumFramesToWrite = 32;
+static constexpr int32_t kSyncFrameInterval = 10;
+static constexpr uint64_t kDefaultTimeCodeScaleUs = 1000000; /* 1sec */
+
+#define OUTPUT_FILE_NAME "/data/local/tmp/webmFrameThreadOutput.webm"
+
+// LookUpTable of clips and metadata for component testing
+static const struct InputData {
+ const char *mime;
+ int32_t firstParam;
+ int32_t secondParam;
+ bool isAudio;
+} kInputData[] = {
+ {MEDIA_MIMETYPE_AUDIO_OPUS, 48000, 6, true},
+ {MEDIA_MIMETYPE_AUDIO_VORBIS, 44100, 1, true},
+ {MEDIA_MIMETYPE_VIDEO_VP9, 176, 144, false},
+ {MEDIA_MIMETYPE_VIDEO_VP8, 1920, 1080, false},
+};
+
+class WebmFrameThreadUnitTest : public ::testing::TestWithParam<std::pair<int32_t, int32_t>> {
+ public:
+ WebmFrameThreadUnitTest()
+ : mSinkThread(nullptr), mAudioThread(nullptr), mVideoThread(nullptr), mSource{} {}
+
+ ~WebmFrameThreadUnitTest() {
+ if (mSinkThread) mSinkThread.clear();
+ if (mAudioThread) mAudioThread.clear();
+ if (mVideoThread) mVideoThread.clear();
+ }
+
+ virtual void SetUp() override {
+ mSegmentDataStart = 0;
+ mFd = open(OUTPUT_FILE_NAME, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
+ ASSERT_GE(mFd, 0) << "Failed to open output file " << OUTPUT_FILE_NAME;
+ }
+
+ virtual void TearDown() override {
+ if (mFd >= 0) close(mFd);
+ for (int32_t idx = 0; idx < kMaxStreamCount; idx++) {
+ if (mSource[idx] != nullptr) {
+ mSource[idx].clear();
+ }
+ }
+ mVSink.clear();
+ mASink.clear();
+ mCuePoints.clear();
+ }
+
+ void addTrack(bool isAudio, int32_t index);
+ void writeFileData(int32_t inputFrameId, int32_t range);
+
+ void createWebmThreads(std::initializer_list<int32_t> indexList);
+ void startWebmFrameThreads();
+ void stopWebmFrameThreads();
+
+ int32_t mFd;
+ uint64_t mSegmentDataStart;
+
+ sp<WebmFrameSinkThread> mSinkThread;
+ sp<WebmFrameSourceThread> mAudioThread;
+ sp<WebmFrameSourceThread> mVideoThread;
+
+ List<sp<WebmElement>> mCuePoints;
+ sp<MediaAdapter> mSource[kMaxStreamCount];
+ LinkedBlockingQueue<const sp<WebmFrame>> mVSink;
+ LinkedBlockingQueue<const sp<WebmFrame>> mASink;
+};
+
+void writeAudioHeaderData(const sp<AMessage> &format, const char *mimeType) {
+ if (strncasecmp(mimeType, MEDIA_MIMETYPE_AUDIO_OPUS, strlen(MEDIA_MIMETYPE_AUDIO_OPUS) + 1) &&
+ strncasecmp(mimeType, MEDIA_MIMETYPE_AUDIO_VORBIS,
+ strlen(MEDIA_MIMETYPE_AUDIO_VORBIS) + 1)) {
+ ASSERT_TRUE(false) << "Unsupported mime type";
+ }
+
+ // Dummy CSD buffers for Opus and Vorbis
+ char csdBuffer[kCsdSize];
+ memset(csdBuffer, 0xFF, sizeof(csdBuffer));
+
+ sp<ABuffer> csdBuffer0 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer0.get(), nullptr) << "Unable to allocate buffer for CSD0 data";
+ ASSERT_NE(csdBuffer0->base(), nullptr) << "ABuffer base is null for CSD0";
+
+ sp<ABuffer> csdBuffer1 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer1.get(), nullptr) << "Unable to allocate buffer for CSD1 data";
+ ASSERT_NE(csdBuffer1->base(), nullptr) << "ABuffer base is null for CSD1";
+
+ sp<ABuffer> csdBuffer2 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer2.get(), nullptr) << "Unable to allocate buffer for CSD2 data";
+ ASSERT_NE(csdBuffer2->base(), nullptr) << "ABuffer base is null for CSD2";
+
+ format->setBuffer("csd-0", csdBuffer0);
+ format->setBuffer("csd-1", csdBuffer1);
+ format->setBuffer("csd-2", csdBuffer2);
+}
+
+void WebmFrameThreadUnitTest::addTrack(bool isAudio, int32_t index) {
+ ASSERT_LT(index, sizeof(kInputData) / sizeof(kInputData[0]))
+ << "Invalid index for loopup table";
+
+ sp<AMessage> format = new AMessage;
+ format->setString("mime", kInputData[index].mime);
+ if (!isAudio) {
+ format->setInt32("width", kInputData[index].firstParam);
+ format->setInt32("height", kInputData[index].secondParam);
+ } else {
+ format->setInt32("sample-rate", kInputData[index].firstParam);
+ format->setInt32("channel-count", kInputData[index].secondParam);
+ ASSERT_NO_FATAL_FAILURE(writeAudioHeaderData(format, kInputData[index].mime));
+ }
+
+ sp<MetaData> trackMeta = new MetaData;
+ convertMessageToMetaData(format, trackMeta);
+
+ if (!isAudio) {
+ mSource[kVideoIdx] = new MediaAdapter(trackMeta);
+ ASSERT_NE(mSource[kVideoIdx], nullptr) << "Unable to create source";
+ } else {
+ mSource[kAudioIdx] = new MediaAdapter(trackMeta);
+ ASSERT_NE(mSource[kAudioIdx], nullptr) << "Unable to create source";
+ }
+}
+
+void WebmFrameThreadUnitTest::createWebmThreads(std::initializer_list<int32_t> indexList) {
+ mSinkThread = new WebmFrameSinkThread(mFd, mSegmentDataStart, mVSink, mASink, mCuePoints);
+ ASSERT_NE(mSinkThread, nullptr) << "Failed to create Sink Thread";
+
+ bool isAudio;
+ // MultiTrack input
+ for (int32_t index : indexList) {
+ isAudio = kInputData[index].isAudio;
+ ASSERT_NO_FATAL_FAILURE(addTrack(isAudio, index));
+ if (!isAudio) {
+ mVideoThread = new WebmFrameMediaSourceThread(mSource[kVideoIdx], kVideoType, mVSink,
+ kDefaultTimeCodeScaleUs, 0, 0, 1, 0);
+ } else {
+ mAudioThread = new WebmFrameMediaSourceThread(mSource[kAudioIdx], kAudioType, mASink,
+ kDefaultTimeCodeScaleUs, 0, 0, 1, 0);
+ }
+ }
+ // To handle single track file
+ if (!mVideoThread) {
+ mVideoThread = new WebmFrameEmptySourceThread(kVideoType, mVSink);
+ } else if (!mAudioThread) {
+ mAudioThread = new WebmFrameEmptySourceThread(kAudioType, mASink);
+ }
+ ASSERT_NE(mVideoThread, nullptr) << "Failed to create Video Thread";
+ ASSERT_NE(mAudioThread, nullptr) << "Failed to create Audio Thread";
+}
+
+void WebmFrameThreadUnitTest::startWebmFrameThreads() {
+ status_t status = mAudioThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Audio Thread";
+ status = mVideoThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Video Thread";
+ status = mSinkThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Sink Thread";
+}
+
+void WebmFrameThreadUnitTest::stopWebmFrameThreads() {
+ status_t status = mAudioThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Audio Thread";
+ status = mVideoThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Video Thread";
+ status = mSinkThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Sink Thread";
+}
+
+// Write dummy data to a file
+void WebmFrameThreadUnitTest::writeFileData(int32_t inputFrameId, int32_t range) {
+ char data[kFrameSize];
+ memset(data, 0xFF, sizeof(data));
+ int32_t status = OK;
+ do {
+ // Queue frames for both A/V tracks
+ for (int32_t idx = kVideoIdx; idx < kMaxStreamCount; idx++) {
+ sp<ABuffer> buffer = new ABuffer((void *)data, kFrameSize);
+ ASSERT_NE(buffer.get(), nullptr) << "ABuffer returned nullptr";
+
+ // Released in MediaAdapter::signalBufferReturned().
+ MediaBuffer *mediaBuffer = new MediaBuffer(buffer);
+ ASSERT_NE(mediaBuffer, nullptr) << "MediaBuffer returned nullptr";
+
+ mediaBuffer->add_ref();
+ mediaBuffer->set_range(buffer->offset(), buffer->size());
+
+ MetaDataBase &sampleMetaData = mediaBuffer->meta_data();
+ sampleMetaData.setInt64(kKeyTime, inputFrameId * kDefaultTimeCodeScaleUs);
+
+ // For audio codecs, treat all frame as sync frame
+ if ((idx == kAudioIdx) || (inputFrameId % kSyncFrameInterval == 0)) {
+ sampleMetaData.setInt32(kKeyIsSyncFrame, true);
+ }
+
+ // This pushBuffer will wait until the mediaBuffer is consumed.
+ if (mSource[idx] != nullptr) {
+ status = mSource[idx]->pushBuffer(mediaBuffer);
+ }
+ ASSERT_EQ(status, OK);
+ }
+ inputFrameId++;
+ } while (inputFrameId < range);
+}
+
+TEST_P(WebmFrameThreadUnitTest, WriteTest) {
+ int32_t index1 = GetParam().first;
+ int32_t index2 = GetParam().second;
+ ASSERT_NO_FATAL_FAILURE(createWebmThreads({index1, index2}));
+
+ ASSERT_NO_FATAL_FAILURE(startWebmFrameThreads());
+
+ ASSERT_NO_FATAL_FAILURE(writeFileData(0, kNumFramesToWrite));
+
+ if (mSource[kAudioIdx]) mSource[kAudioIdx]->stop();
+ if (mSource[kVideoIdx]) mSource[kVideoIdx]->stop();
+
+ ASSERT_NO_FATAL_FAILURE(stopWebmFrameThreads());
+}
+
+TEST_P(WebmFrameThreadUnitTest, PauseTest) {
+ int32_t index1 = GetParam().first;
+ int32_t index2 = GetParam().second;
+ ASSERT_NO_FATAL_FAILURE(createWebmThreads({index1, index2}));
+
+ ASSERT_NO_FATAL_FAILURE(startWebmFrameThreads());
+
+ int32_t offset = 0;
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+
+ for (int idx = 0; idx < kMaxLoopCount; idx++) {
+ // pause the threads
+ status_t status = mAudioThread->pause();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to pause Audio Thread";
+ status = mVideoThread->pause();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to pause Video Thread";
+
+ // Under pause state, no write should happen
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+
+ status = mAudioThread->resume();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to resume Audio Thread";
+ status = mVideoThread->resume();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to resume Video Thread";
+
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+ }
+
+ if (mSource[kAudioIdx]) mSource[kAudioIdx]->stop();
+ if (mSource[kVideoIdx]) mSource[kVideoIdx]->stop();
+ ASSERT_NO_FATAL_FAILURE(stopWebmFrameThreads());
+}
+
+INSTANTIATE_TEST_SUITE_P(WebmFrameThreadUnitTestAll, WebmFrameThreadUnitTest,
+ ::testing::Values(std::make_pair(0, 1), std::make_pair(0, 2),
+ std::make_pair(0, 3), std::make_pair(1, 0),
+ std::make_pair(1, 2), std::make_pair(1, 3),
+ std::make_pair(2, 3)));
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ return status;
+}
diff --git a/media/ndk/Android.bp b/media/ndk/Android.bp
index aac6d71..24cad4d 100644
--- a/media/ndk/Android.bp
+++ b/media/ndk/Android.bp
@@ -113,10 +113,6 @@
symbol_file: "libmediandk.map.txt",
versions: ["29"],
},
-
- // Bug: http://b/124522995 libmediandk has linker errors when built with
- // coverage
- native_coverage: false,
}
llndk_library {
diff --git a/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml b/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
index 1179d6c..1890661 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
+++ b/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
@@ -14,6 +14,12 @@
limitations under the License.
-->
<configuration description="Runs Media Benchmark Tests">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/tests/benchmark/MediaBenchmark.zip?unzip=true"
+ value="/data/local/tmp/MediaBenchmark/res/" />
+ </target_preparer>
<target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
<option name="cleanup-apks" value="false" />
<option name="test-file-name" value="MediaBenchmarkTest.apk" />
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
index c41f198..afd70a3 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
@@ -78,7 +78,7 @@
{"bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", false},
{"bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", false},
{"bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", false},
- {"bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", false},
+ {"bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", false},
{"bbb_44100hz_2ch_600kbps_flac_30sec.mp4", false},
{"bbb_48000hz_2ch_100kbps_opus_30sec.webm", false},
// Audio Async Test
@@ -86,7 +86,7 @@
{"bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", true},
{"bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", true},
{"bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", true},
- {"bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", true},
+ {"bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", true},
{"bbb_44100hz_2ch_600kbps_flac_30sec.mp4", true},
{"bbb_48000hz_2ch_100kbps_opus_30sec.webm", true},
// Video Sync Test
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
index 831467a..48e1422 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
@@ -19,6 +19,9 @@
import android.content.Context;
import android.media.MediaCodec;
import android.media.MediaFormat;
+
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible;
+
import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -65,6 +68,7 @@
private static final int ENCODE_DEFAULT_FRAME_RATE = 25;
private static final int ENCODE_DEFAULT_BIT_RATE = 8000000 /* 8 Mbps */;
private static final int ENCODE_MIN_BIT_RATE = 600000 /* 600 Kbps */;
+ private static final int ENCODE_DEFAULT_AUDIO_BIT_RATE = 128000 /* 128 Kbps */;
private String mInputFile;
@Parameterized.Parameters
@@ -98,7 +102,7 @@
}
@Test(timeout = PER_TEST_TIMEOUT_MS)
- public void sampleEncoderTest() throws Exception {
+ public void testEncoder() throws Exception {
int status;
int frameSize;
//Parameters for video
@@ -107,6 +111,7 @@
int profile = 0;
int level = 0;
int frameRate = 0;
+
//Parameters for audio
int bitRate = 0;
int sampleRate = 0;
@@ -122,6 +127,7 @@
ArrayList<ByteBuffer> inputBuffer = new ArrayList<>();
ArrayList<MediaCodec.BufferInfo> frameInfo = new ArrayList<>();
for (int currentTrack = 0; currentTrack < trackCount; currentTrack++) {
+ int colorFormat = COLOR_FormatYUV420Flexible;
extractor.selectExtractorTrack(currentTrack);
MediaFormat format = extractor.getFormat(currentTrack);
// Get samples from extractor
@@ -148,6 +154,7 @@
status = decoder.decode(inputBuffer, frameInfo, false, format, "");
assertEquals("Decoder returned error " + status + " for file: " + mInputFile, 0,
status);
+ MediaFormat decoderFormat = decoder.getFormat();
decoder.deInitCodec();
extractor.unselectExtractorTrack(currentTrack);
inputBuffer.clear();
@@ -203,10 +210,17 @@
if (format.containsKey(MediaFormat.KEY_PROFILE)) {
level = format.getInteger(MediaFormat.KEY_LEVEL);
}
+ if (decoderFormat.containsKey(MediaFormat.KEY_COLOR_FORMAT)) {
+ colorFormat = decoderFormat.getInteger(MediaFormat.KEY_COLOR_FORMAT);
+ }
} else {
sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
numChannels = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
- bitRate = sampleRate * numChannels * 16;
+ if (decoderFormat.containsKey(MediaFormat.KEY_BIT_RATE)) {
+ bitRate = decoderFormat.getInteger(MediaFormat.KEY_BIT_RATE);
+ } else {
+ bitRate = ENCODE_DEFAULT_AUDIO_BIT_RATE;
+ }
}
/*Setup Encode Format*/
MediaFormat encodeFormat;
@@ -219,6 +233,7 @@
encodeFormat.setInteger(MediaFormat.KEY_LEVEL, level);
encodeFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1);
encodeFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, frameSize);
+ encodeFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
} else {
encodeFormat = MediaFormat.createAudioFormat(mime, sampleRate, numChannels);
encodeFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
@@ -255,7 +270,7 @@
fileInput.close();
}
- @Test
+ @Test(timeout = PER_TEST_TIMEOUT_MS)
public void testNativeEncoder() throws Exception {
File inputFile = new File(mInputFilePath + mInputFile);
assertTrue("Cannot find " + mInputFile + " in directory " + mInputFilePath,
@@ -275,8 +290,8 @@
// Encoding the decoder's output
for (String codecName : mediaCodecs) {
Native nativeEncoder = new Native();
- int status = nativeEncoder.Encode(
- mInputFilePath, mInputFile, mDecodedFile, mStatsFile, codecName);
+ int status = nativeEncoder
+ .Encode(mInputFilePath, mInputFile, mDecodedFile, mStatsFile, codecName);
assertEquals(
codecName + " encoder returned error " + status + " for " + "file:" + " " +
mInputFile, 0, status);
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
index 6b7aad1..4d026c1 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
@@ -70,7 +70,7 @@
{"bbb_44100hz_2ch_600kbps_flac_5mins.flac", 0},
{"bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", 0},
{"bbb_16000hz_1ch_9kbps_amrwb_5mins.3gp", 0},
- {"bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", 0},
+ {"bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", 0},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", 0}});
}
@@ -88,7 +88,7 @@
}
@Test
- public void sampleExtractTest() throws IOException {
+ public void testExtractor() throws IOException {
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
inputFile.exists());
@@ -107,7 +107,7 @@
}
@Test
- public void sampleExtractNativeTest() throws IOException {
+ public void testNativeExtractor() throws IOException {
Native nativeExtractor = new Native();
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
index 2efdba2..21ba957 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
@@ -86,7 +86,7 @@
{"crowd_1920x1080_25fps_6700kbps_h264.ts", "3gpp"},
{"crowd_1920x1080_25fps_4000kbps_h265.mkv", "3gpp"},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", "ogg"},
- {"bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", "webm"},
+ {"bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", "webm"},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", "webm"},
{"bbb_44100hz_2ch_128kbps_aac_5mins.mp4", "mp4"},
{"bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", "mp4"},
@@ -110,7 +110,7 @@
}
@Test
- public void sampleMuxerTest() throws IOException {
+ public void testMuxer() throws IOException {
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
inputFile.exists());
@@ -159,7 +159,7 @@
}
@Test
- public void sampleMuxerNativeTest() {
+ public void testNativeMuxer() {
Native nativeMuxer = new Native();
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/Android.bp b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/Android.bp
index c72eb55..3e5e4c8 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/Android.bp
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/Android.bp
@@ -1,5 +1,6 @@
cc_test_library {
name: "libmediabenchmark_jni",
+ sdk_version: "current",
defaults: [
"libmediabenchmark_common-defaults",
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
index 271b852..1277c8b 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
@@ -18,9 +18,9 @@
#define LOG_TAG "NativeEncoder"
#include <jni.h>
+#include <sys/stat.h>
#include <fstream>
#include <iostream>
-#include <sys/stat.h>
#include <android/log.h>
@@ -29,6 +29,11 @@
#include <stdio.h>
+constexpr int32_t ENCODE_DEFAULT_FRAME_RATE = 25;
+constexpr int32_t ENCODE_DEFAULT_AUDIO_BIT_RATE = 128000 /* 128 Kbps */;
+constexpr int32_t ENCODE_DEFAULT_BIT_RATE = 8000000 /* 8 Mbps */;
+constexpr int32_t ENCODE_MIN_BIT_RATE = 600000 /* 600 Kbps */;
+
extern "C" JNIEXPORT int JNICALL Java_com_android_media_benchmark_library_Native_Encode(
JNIEnv *env, jobject thiz, jstring jFilePath, jstring jFileName, jstring jOutFilePath,
jstring jStatsFile, jstring jCodecName) {
@@ -72,7 +77,7 @@
ALOGE("Track Format invalid");
return -1;
}
- uint8_t *inputBuffer = (uint8_t *) malloc(fileSize);
+ uint8_t *inputBuffer = (uint8_t *)malloc(fileSize);
if (!inputBuffer) {
ALOGE("Insufficient memory");
return -1;
@@ -110,6 +115,8 @@
free(inputBuffer);
return -1;
}
+
+ AMediaFormat *decoderFormat = decoder->getFormat();
AMediaFormat *format = extractor->getFormat();
if (inputBuffer) {
free(inputBuffer);
@@ -146,29 +153,34 @@
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_FRAME_RATE, &encParams.frameRate);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_BIT_RATE, &encParams.bitrate);
if (encParams.bitrate <= 0 || encParams.frameRate <= 0) {
- encParams.frameRate = 25;
+ encParams.frameRate = ENCODE_DEFAULT_FRAME_RATE;
if (!strcmp(mime, "video/3gpp") || !strcmp(mime, "video/mp4v-es")) {
- encParams.bitrate = 600000 /* 600 Kbps */;
+ encParams.bitrate = ENCODE_MIN_BIT_RATE /* 600 Kbps */;
} else {
- encParams.bitrate = 8000000 /* 8 Mbps */;
+ encParams.bitrate = ENCODE_DEFAULT_BIT_RATE /* 8 Mbps */;
}
}
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_PROFILE, &encParams.profile);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_LEVEL, &encParams.level);
+ AMediaFormat_getInt32(decoderFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT,
+ &encParams.colorFormat);
} else {
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_SAMPLE_RATE, &encParams.sampleRate);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_CHANNEL_COUNT,
&encParams.numChannels);
- encParams.bitrate =
- encParams.sampleRate * encParams.numChannels * 16 /* bitsPerSample */;
+ encParams.bitrate = ENCODE_DEFAULT_AUDIO_BIT_RATE;
}
Encoder *encoder = new Encoder();
encoder->setupEncoder();
status = encoder->encode(sCodecName, eleStream, eleSize, asyncMode[i], encParams,
- (char *) mime);
+ (char *)mime);
+ if (status != AMEDIA_OK) {
+ ALOGE("Encoder returned error");
+ return -1;
+ }
+ ALOGV("Encoding complete with codec %s for asyncMode = %d", sCodecName.c_str(),
+ asyncMode[i]);
encoder->deInitCodec();
- cout << "codec : " << codecName << endl;
- ALOGV(" asyncMode = %d \n", asyncMode[i]);
const char *statsFile = env->GetStringUTFChars(jStatsFile, nullptr);
encoder->dumpStatistics(sInputReference, extractor->getClipDuration(), sCodecName,
(asyncMode[i] ? "async" : "sync"), statsFile);
@@ -189,6 +201,10 @@
AMediaFormat_delete(format);
format = nullptr;
}
+ if (decoderFormat) {
+ AMediaFormat_delete(decoderFormat);
+ decoderFormat = nullptr;
+ }
decoder->deInitCodec();
decoder->resetDecoder();
}
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
index 3b1eed4..66fee33 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
@@ -134,7 +134,6 @@
mStats.addOutputTime();
onOutputAvailable(mediaCodec, outputBufferId, bufferInfo);
if (mSawOutputEOS) {
- Log.i(TAG, "Saw output EOS");
synchronized (mLock) { mLock.notify(); }
}
}
@@ -211,9 +210,6 @@
}
onOutputAvailable(mCodec, outputBufferId, outputBufferInfo);
}
- if (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
- Log.i(TAG, "Saw output EOS");
- }
}
}
mInputBuffer.clear();
@@ -256,14 +252,21 @@
*/
public void resetDecoder() { mStats.reset(); }
+ /**
+ * Returns the format of the output buffers
+ */
+ public MediaFormat getFormat() {
+ return mCodec.getOutputFormat();
+ }
+
private void onInputAvailable(int inputBufferId, MediaCodec mediaCodec) {
if ((inputBufferId >= 0) && !mSawInputEOS) {
ByteBuffer inputCodecBuffer = mediaCodec.getInputBuffer(inputBufferId);
BufferInfo bufInfo = mInputBufferInfo.get(mIndex);
inputCodecBuffer.put(mInputBuffer.get(mIndex).array());
mIndex++;
- if (bufInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
- mSawInputEOS = true;
+ mSawInputEOS = (bufInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
+ if (mSawInputEOS) {
Log.i(TAG, "Saw input EOS");
}
mStats.addFrameSize(bufInfo.size);
@@ -301,6 +304,9 @@
}
}
mediaCodec.releaseOutputBuffer(outputBufferId, false);
- mSawOutputEOS = (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM);
+ mSawOutputEOS = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
+ if (mSawOutputEOS) {
+ Log.i(TAG, "Saw output EOS");
+ }
}
}
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
index 40cf8bd..45e5574 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
@@ -29,7 +29,9 @@
import java.nio.ByteBuffer;
public class Encoder {
- private static final int ENCODE_DEFAULT_MAX_INPUT_SIZE = 3840;
+ // Change in AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE should also be taken to
+ // kDefaultAudioEncodeFrameSize present in BenchmarkCommon.h
+ private static final int AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE = 4096;
private static final String TAG = "Encoder";
private static final boolean DEBUG = false;
private static final int kQueueDequeueTimeoutUs = 1000;
@@ -134,7 +136,7 @@
if (mMime.startsWith("video/")) {
mFrameSize = frameSize;
} else {
- int maxInputSize = ENCODE_DEFAULT_MAX_INPUT_SIZE;
+ int maxInputSize = AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE;
MediaFormat format = mCodec.getInputFormat();
if (format.containsKey(MediaFormat.KEY_MAX_INPUT_SIZE)) {
maxInputSize = format.getInteger(MediaFormat.KEY_MAX_INPUT_SIZE);
@@ -260,12 +262,12 @@
}
mStats.addFrameSize(outputBuffer.remaining());
mediaCodec.releaseOutputBuffer(outputBufferId, false);
- mSawOutputEOS = (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM);
+ mSawOutputEOS = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
}
private void onInputAvailable(MediaCodec mediaCodec, int inputBufferId) throws IOException {
- if (mSawOutputEOS || inputBufferId < 0) {
- if (mSawOutputEOS) {
+ if (mSawInputEOS || inputBufferId < 0) {
+ if (mSawInputEOS) {
Log.i(TAG, "Saw input EOS");
}
return;
@@ -281,19 +283,27 @@
return;
}
int bufSize = inputBuffer.capacity();
- int bytesRead = mFrameSize;
+ int bytesToRead = mFrameSize;
if (mInputBufferSize - mOffset < mFrameSize) {
- bytesRead = (int) (mInputBufferSize - mOffset);
+ bytesToRead = (int) (mInputBufferSize - mOffset);
}
- if (bufSize < bytesRead) {
- mSignalledError = true;
- return;
+ //b/148655275 - Update Frame size, as Format value may not be valid
+ if (bufSize < bytesToRead) {
+ if(mNumInputFrame == 0) {
+ mFrameSize = bufSize;
+ bytesToRead = bufSize;
+ mNumFrames = (int) ((mInputBufferSize + mFrameSize - 1) / mFrameSize);
+ } else {
+ mSignalledError = true;
+ return;
+ }
}
- byte[] inputArray = new byte[bytesRead];
- mInputStream.read(inputArray, 0, bytesRead);
+
+ byte[] inputArray = new byte[bytesToRead];
+ mInputStream.read(inputArray, 0, bytesToRead);
inputBuffer.put(inputArray);
int flag = 0;
- if (mNumInputFrame >= mNumFrames - 1 || bytesRead == 0) {
+ if (mNumInputFrame >= mNumFrames - 1 || bytesToRead == 0) {
Log.i(TAG, "Sending EOS on input last frame");
mSawInputEOS = true;
flag = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
@@ -304,9 +314,9 @@
} else {
presentationTimeUs = mNumInputFrame * mFrameSize * 1000000 / mSampleRate;
}
- mediaCodec.queueInputBuffer(inputBufferId, 0, bytesRead, presentationTimeUs, flag);
+ mediaCodec.queueInputBuffer(inputBufferId, 0, bytesToRead, presentationTimeUs, flag);
mNumInputFrame++;
- mOffset += bytesRead;
+ mOffset += bytesToRead;
}
/**
diff --git a/media/tests/benchmark/src/native/common/Android.bp b/media/tests/benchmark/src/native/common/Android.bp
index f8ea25c..d4389da 100644
--- a/media/tests/benchmark/src/native/common/Android.bp
+++ b/media/tests/benchmark/src/native/common/Android.bp
@@ -46,6 +46,8 @@
cc_defaults {
name: "libmediabenchmark-defaults",
+ sdk_version: "current",
+ stl: "c++_shared",
shared_libs: [
"libmediandk",
diff --git a/media/tests/benchmark/src/native/common/BenchmarkC2Common.cpp b/media/tests/benchmark/src/native/common/BenchmarkC2Common.cpp
index 622a0e1..e09f468 100644
--- a/media/tests/benchmark/src/native/common/BenchmarkC2Common.cpp
+++ b/media/tests/benchmark/src/native/common/BenchmarkC2Common.cpp
@@ -22,6 +22,9 @@
int32_t BenchmarkC2Common::setupCodec2() {
ALOGV("In %s", __func__);
mClient = android::Codec2Client::CreateFromService("default");
+ if (!mClient) {
+ mClient = android::Codec2Client::CreateFromService("software");
+ }
if (!mClient) return -1;
std::shared_ptr<C2AllocatorStore> store = android::GetCodec2PlatformAllocatorStore();
diff --git a/media/tests/benchmark/src/native/common/BenchmarkCommon.h b/media/tests/benchmark/src/native/common/BenchmarkCommon.h
index c11fe36..40a8c9e 100644
--- a/media/tests/benchmark/src/native/common/BenchmarkCommon.h
+++ b/media/tests/benchmark/src/native/common/BenchmarkCommon.h
@@ -35,6 +35,9 @@
constexpr uint32_t kQueueDequeueTimeoutUs = 1000;
constexpr uint32_t kMaxCSDStrlen = 16;
constexpr uint32_t kMaxBufferSize = 1024 * 1024 * 16;
+// Change in kDefaultAudioEncodeFrameSize should also be taken to
+// AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE present in Encoder.java
+constexpr uint32_t kDefaultAudioEncodeFrameSize = 4096;
template <typename T>
class CallBackQueue {
diff --git a/media/tests/benchmark/src/native/decoder/Decoder.cpp b/media/tests/benchmark/src/native/decoder/Decoder.cpp
index 2171589..090f3e1 100644
--- a/media/tests/benchmark/src/native/decoder/Decoder.cpp
+++ b/media/tests/benchmark/src/native/decoder/Decoder.cpp
@@ -63,8 +63,8 @@
ssize_t bytesRead = 0;
uint32_t flag = 0;
int64_t presentationTimeUs = 0;
- tie(bytesRead, flag, presentationTimeUs) = readSampleData(
- mInputBuffer, mOffset, mFrameMetaData, buf, mNumInputFrame, bufSize);
+ tie(bytesRead, flag, presentationTimeUs) =
+ readSampleData(mInputBuffer, mOffset, mFrameMetaData, buf, mNumInputFrame, bufSize);
if (flag == AMEDIA_ERROR_MALFORMED) {
mErrorCode = (media_status_t)flag;
mSignalledError = true;
@@ -144,6 +144,11 @@
if (!mFormat) mFormat = mExtractor->getFormat();
}
+AMediaFormat *Decoder::getFormat() {
+ ALOGV("In %s", __func__);
+ return AMediaCodec_getOutputFormat(mCodec);
+}
+
int32_t Decoder::decode(uint8_t *inputBuffer, vector<AMediaCodecBufferInfo> &frameInfo,
string &codecName, bool asyncMode, FILE *outFp) {
ALOGV("In %s", __func__);
diff --git a/media/tests/benchmark/src/native/decoder/Decoder.h b/media/tests/benchmark/src/native/decoder/Decoder.h
index f3fa6a1..e619cb4 100644
--- a/media/tests/benchmark/src/native/decoder/Decoder.h
+++ b/media/tests/benchmark/src/native/decoder/Decoder.h
@@ -57,6 +57,8 @@
void resetDecoder();
+ AMediaFormat *getFormat();
+
// Async callback APIs
void onInputAvailable(AMediaCodec *codec, int32_t index) override;
diff --git a/media/tests/benchmark/src/native/encoder/Encoder.cpp b/media/tests/benchmark/src/native/encoder/Encoder.cpp
index 2db612c..26fb1b9 100644
--- a/media/tests/benchmark/src/native/encoder/Encoder.cpp
+++ b/media/tests/benchmark/src/native/encoder/Encoder.cpp
@@ -47,29 +47,36 @@
mEncoderDoneCondition.notify_one();
return;
}
- size_t bytesRead = mParams.frameSize;
+ size_t bytesToRead = mParams.frameSize;
if (mInputBufferSize - mOffset < mParams.frameSize) {
- bytesRead = mInputBufferSize - mOffset;
+ bytesToRead = mInputBufferSize - mOffset;
}
- if (bufSize < bytesRead) {
- ALOGE("bytes to read %zu bufSize %zu \n", bytesRead, bufSize);
+ //b/148655275 - Update Frame size, as Format value may not be valid
+ if (bufSize < bytesToRead) {
+ if(mNumInputFrame == 0) {
+ mParams.frameSize = bufSize;
+ bytesToRead = bufSize;
+ mParams.numFrames = (mInputBufferSize + mParams.frameSize - 1) / mParams.frameSize;
+ } else {
+ ALOGE("bytes to read %zu bufSize %zu \n", bytesToRead, bufSize);
+ mErrorCode = AMEDIA_ERROR_MALFORMED;
+ mSignalledError = true;
+ mEncoderDoneCondition.notify_one();
+ return;
+ }
+ }
+ if (bytesToRead < mParams.frameSize && mNumInputFrame < mParams.numFrames - 1) {
+ ALOGE("Partial frame at frameID %d bytesToRead %zu frameSize %d total numFrames %d\n",
+ mNumInputFrame, bytesToRead, mParams.frameSize, mParams.numFrames);
mErrorCode = AMEDIA_ERROR_MALFORMED;
mSignalledError = true;
mEncoderDoneCondition.notify_one();
return;
}
- if (bytesRead < mParams.frameSize && mNumInputFrame < mParams.numFrames - 1) {
- ALOGE("Partial frame at frameID %d bytesRead %zu frameSize %d total numFrames %d\n",
- mNumInputFrame, bytesRead, mParams.frameSize, mParams.numFrames);
- mErrorCode = AMEDIA_ERROR_MALFORMED;
- mSignalledError = true;
- mEncoderDoneCondition.notify_one();
- return;
- }
- mEleStream->read(buf, bytesRead);
+ mEleStream->read(buf, bytesToRead);
size_t bytesgcount = mEleStream->gcount();
- if (bytesgcount != bytesRead) {
- ALOGE("bytes to read %zu actual bytes read %zu \n", bytesRead, bytesgcount);
+ if (bytesgcount != bytesToRead) {
+ ALOGE("bytes to read %zu actual bytes read %zu \n", bytesToRead, bytesgcount);
mErrorCode = AMEDIA_ERROR_MALFORMED;
mSignalledError = true;
mEncoderDoneCondition.notify_one();
@@ -77,7 +84,7 @@
}
uint32_t flag = 0;
- if (mNumInputFrame == mParams.numFrames - 1 || bytesRead == 0) {
+ if (mNumInputFrame == mParams.numFrames - 1 || bytesToRead == 0) {
ALOGD("Sending EOS on input Last frame\n");
flag |= AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM;
}
@@ -92,10 +99,10 @@
if (flag == AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) mSawInputEOS = true;
ALOGV("%s bytesRead : %zd presentationTimeUs : %" PRIu64 " mSawInputEOS : %s", __FUNCTION__,
- bytesRead, presentationTimeUs, mSawInputEOS ? "TRUE" : "FALSE");
+ bytesToRead, presentationTimeUs, mSawInputEOS ? "TRUE" : "FALSE");
media_status_t status = AMediaCodec_queueInputBuffer(mCodec, bufIdx, 0 /* offset */,
- bytesRead, presentationTimeUs, flag);
+ bytesToRead, presentationTimeUs, flag);
if (AMEDIA_OK != status) {
mErrorCode = status;
mSignalledError = true;
@@ -103,7 +110,7 @@
return;
}
mNumInputFrame++;
- mOffset += bytesRead;
+ mOffset += bytesToRead;
}
}
@@ -181,8 +188,8 @@
mStats->dumpStatistics(operation, inputReference, durationUs, componentName, mode, statsFile);
}
-int32_t Encoder::encode(string &codecName, ifstream &eleStream, size_t eleSize,
- bool asyncMode, encParameter encParams, char *mime) {
+int32_t Encoder::encode(string &codecName, ifstream &eleStream, size_t eleSize, bool asyncMode,
+ encParameter encParams, char *mime) {
ALOGV("In %s", __func__);
mEleStream = &eleStream;
mInputBufferSize = eleSize;
@@ -202,6 +209,7 @@
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_PROFILE, mParams.profile);
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_LEVEL, mParams.level);
}
+ AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT, mParams.colorFormat);
} else {
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_SAMPLE_RATE, mParams.sampleRate);
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_CHANNEL_COUNT, mParams.numChannels);
@@ -219,13 +227,12 @@
if (!strncmp(mMime, "video/", 6)) {
mParams.frameSize = mParams.width * mParams.height * 3 / 2;
} else {
- mParams.frameSize = 4096;
+ mParams.frameSize = kDefaultAudioEncodeFrameSize;
// Get mInputMaxBufSize
AMediaFormat *inputFormat = AMediaCodec_getInputFormat(mCodec);
AMediaFormat_getInt32(inputFormat, AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, &mParams.maxFrameSize);
if (mParams.maxFrameSize < 0) {
- ALOGE("Invalid mParams.maxFrameSize %d\n", mParams.maxFrameSize);
- return AMEDIA_ERROR_INVALID_PARAMETER;
+ mParams.maxFrameSize = kDefaultAudioEncodeFrameSize;
}
if (mParams.frameSize > mParams.maxFrameSize) {
mParams.frameSize = mParams.maxFrameSize;
diff --git a/media/tests/benchmark/src/native/encoder/Encoder.h b/media/tests/benchmark/src/native/encoder/Encoder.h
index 3d12600..5ad142b 100644
--- a/media/tests/benchmark/src/native/encoder/Encoder.h
+++ b/media/tests/benchmark/src/native/encoder/Encoder.h
@@ -23,9 +23,11 @@
#include <queue>
#include <thread>
+#include "media/NdkImage.h"
#include "BenchmarkCommon.h"
#include "Stats.h"
+
struct encParameter {
int32_t bitrate = -1;
int32_t numFrames = -1;
@@ -38,6 +40,7 @@
int32_t frameRate = -1;
int32_t profile = 0;
int32_t level = 0;
+ int32_t colorFormat = AIMAGE_FORMAT_YUV_420_888;
};
class Encoder : public CallBackHandle {
diff --git a/media/tests/benchmark/tests/C2DecoderTest.cpp b/media/tests/benchmark/tests/C2DecoderTest.cpp
index c8afd61..85dcbc1 100644
--- a/media/tests/benchmark/tests/C2DecoderTest.cpp
+++ b/media/tests/benchmark/tests/C2DecoderTest.cpp
@@ -158,7 +158,7 @@
make_pair("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "mp3"),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "amrnb"),
make_pair("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "amrnb"),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "vorbis"),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "vorbis"),
make_pair("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "flac"),
make_pair("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "opus")));
diff --git a/media/tests/benchmark/tests/DecoderTest.cpp b/media/tests/benchmark/tests/DecoderTest.cpp
index 51d5171..81ef02a 100644
--- a/media/tests/benchmark/tests/DecoderTest.cpp
+++ b/media/tests/benchmark/tests/DecoderTest.cpp
@@ -102,7 +102,7 @@
make_tuple("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "", false),
make_tuple("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "", false),
make_tuple("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "", false),
- make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "", false),
+ make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "", false),
make_tuple("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "", false),
make_tuple("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "", false)));
@@ -112,7 +112,7 @@
make_tuple("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "", true),
make_tuple("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "", true),
make_tuple("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "", true),
- make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "", true),
+ make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "", true),
make_tuple("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "", true),
make_tuple("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "", true)));
diff --git a/media/tests/benchmark/tests/ExtractorTest.cpp b/media/tests/benchmark/tests/ExtractorTest.cpp
index 9f45caa..d14d15b 100644
--- a/media/tests/benchmark/tests/ExtractorTest.cpp
+++ b/media/tests/benchmark/tests/ExtractorTest.cpp
@@ -68,7 +68,7 @@
make_pair("bbb_44100hz_2ch_600kbps_flac_5mins.flac", 0),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", 0),
make_pair("bbb_16000hz_1ch_9kbps_amrwb_5mins.3gp", 0),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", 0),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", 0),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm",
0)));
diff --git a/media/tests/benchmark/tests/MuxerTest.cpp b/media/tests/benchmark/tests/MuxerTest.cpp
index 418cbbd..991644b 100644
--- a/media/tests/benchmark/tests/MuxerTest.cpp
+++ b/media/tests/benchmark/tests/MuxerTest.cpp
@@ -136,7 +136,7 @@
make_pair("crowd_1920x1080_25fps_6700kbps_h264.ts", "3gpp"),
make_pair("crowd_1920x1080_25fps_4000kbps_h265.mkv", "3gpp"),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm", "ogg"),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", "webm"),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", "webm"),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm", "webm"),
make_pair("bbb_44100hz_2ch_128kbps_aac_5mins.mp4", "mp4"),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", "mp4"),
diff --git a/services/audioflinger/Android.bp b/services/audioflinger/Android.bp
index 46472c9..c58360d 100644
--- a/services/audioflinger/Android.bp
+++ b/services/audioflinger/Android.bp
@@ -3,8 +3,6 @@
cc_library_shared {
name: "libaudioflinger",
- tidy: false, // b/146435095, segmentation fault with Effects.cpp
-
srcs: [
"AudioFlinger.cpp",
"AudioHwDevice.cpp",
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 10a9c63..9e36f77 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -29,6 +29,7 @@
#include <string>
#include <sys/time.h>
#include <sys/resource.h>
+#include <thread>
#include <android/os/IExternalVibratorService.h>
#include <binder/IPCThreadState.h>
@@ -143,6 +144,19 @@
return sExternalVibratorService;
}
+class DevicesFactoryHalCallbackImpl : public DevicesFactoryHalCallback {
+ public:
+ void onNewDevicesAvailable() override {
+ // Start a detached thread to execute notification in parallel.
+ // This is done to prevent mutual blocking of audio_flinger and
+ // audio_policy services during system initialization.
+ std::thread notifier([]() {
+ AudioSystem::onNewAudioModulesAvailable();
+ });
+ notifier.detach();
+ }
+};
+
// ----------------------------------------------------------------------------
std::string formatToString(audio_format_t format) {
@@ -221,6 +235,9 @@
mMode = AUDIO_MODE_NORMAL;
gAudioFlinger = this;
+
+ mDevicesFactoryHalCallback = new DevicesFactoryHalCallbackImpl;
+ mDevicesFactoryHal->setCallbackOnce(mDevicesFactoryHalCallback);
}
status_t AudioFlinger::setAudioHalPids(const std::vector<pid_t>& pids) {
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index a43a6dc..115bbb8 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -103,6 +103,7 @@
class AudioBuffer;
class AudioResampler;
class DeviceHalInterface;
+class DevicesFactoryHalCallback;
class DevicesFactoryHalInterface;
class EffectsFactoryHalInterface;
class FastMixer;
@@ -827,6 +828,7 @@
DefaultKeyedVector<audio_module_handle_t, AudioHwDevice*> mAudioHwDevs;
sp<DevicesFactoryHalInterface> mDevicesFactoryHal;
+ sp<DevicesFactoryHalCallback> mDevicesFactoryHalCallback;
// for dump, indicates which hardware operation is currently in progress (but not stream ops)
enum hardware_call_state {
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 598caeb..59d0ad9 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -6013,6 +6013,7 @@
mHwPaused = false;
mFlushPending = false;
mTimestampVerifier.discontinuity(); // DIRECT and OFFLOADED flush resets frame count.
+ mTimestamp.clear();
}
int64_t AudioFlinger::DirectOutputThread::computeWaitTimeNs_l() const {
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index 1fe60d4..9676d09 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -75,6 +75,10 @@
// configuration functions
//
+ // Informs APM that new HAL modules are available. This typically happens
+ // due to registration of an audio HAL service.
+ virtual void onNewAudioModulesAvailable() = 0;
+
// indicate a change in device connection status
virtual status_t setDeviceConnectionState(audio_devices_t device,
audio_policy_dev_state_t state,
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h b/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
index 0843fea..a5de655 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPatch.h
@@ -31,12 +31,24 @@
public:
AudioPatch(const struct audio_patch *patch, uid_t uid);
+ audio_patch_handle_t getHandle() const { return mHandle; }
+
+ audio_patch_handle_t getAfHandle() const { return mAfPatchHandle; }
+
+ void setAfHandle(audio_patch_handle_t afHandle) { mAfPatchHandle = afHandle; }
+
+ uid_t getUid() const { return mUid; }
+
+ void setUid(uid_t uid) { mUid = uid; }
+
void dump(String8 *dst, int spaces, int index) const;
- audio_patch_handle_t mHandle;
struct audio_patch mPatch;
+
+private:
+ const audio_patch_handle_t mHandle;
uid_t mUid;
- audio_patch_handle_t mAfPatchHandle;
+ audio_patch_handle_t mAfPatchHandle = AUDIO_PATCH_HANDLE_NONE;
};
class AudioPatchCollection : public DefaultKeyedVector<audio_patch_handle_t, sp<AudioPatch> >
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
index 56596f5..47c6e68 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h
@@ -37,13 +37,13 @@
{
public:
AudioPolicyConfig(HwModuleCollection &hwModules,
- DeviceVector &availableOutputDevices,
- DeviceVector &availableInputDevices,
+ DeviceVector &outputDevices,
+ DeviceVector &inputDevices,
sp<DeviceDescriptor> &defaultOutputDevice)
: mEngineLibraryNameSuffix(kDefaultEngineLibraryNameSuffix),
mHwModules(hwModules),
- mAvailableOutputDevices(availableOutputDevices),
- mAvailableInputDevices(availableInputDevices),
+ mOutputDevices(outputDevices),
+ mInputDevices(inputDevices),
mDefaultOutputDevice(defaultOutputDevice),
mIsSpeakerDrcEnabled(false)
{}
@@ -69,23 +69,23 @@
mHwModules = hwModules;
}
- void addAvailableDevice(const sp<DeviceDescriptor> &availableDevice)
+ void addDevice(const sp<DeviceDescriptor> &device)
{
- if (audio_is_output_device(availableDevice->type())) {
- mAvailableOutputDevices.add(availableDevice);
- } else if (audio_is_input_device(availableDevice->type())) {
- mAvailableInputDevices.add(availableDevice);
+ if (audio_is_output_device(device->type())) {
+ mOutputDevices.add(device);
+ } else if (audio_is_input_device(device->type())) {
+ mInputDevices.add(device);
}
}
- void addAvailableInputDevices(const DeviceVector &availableInputDevices)
+ void addInputDevices(const DeviceVector &inputDevices)
{
- mAvailableInputDevices.add(availableInputDevices);
+ mInputDevices.add(inputDevices);
}
- void addAvailableOutputDevices(const DeviceVector &availableOutputDevices)
+ void addOutputDevices(const DeviceVector &outputDevices)
{
- mAvailableOutputDevices.add(availableOutputDevices);
+ mOutputDevices.add(outputDevices);
}
bool isSpeakerDrcEnabled() const { return mIsSpeakerDrcEnabled; }
@@ -97,14 +97,14 @@
const HwModuleCollection getHwModules() const { return mHwModules; }
- const DeviceVector &getAvailableInputDevices() const
+ const DeviceVector &getInputDevices() const
{
- return mAvailableInputDevices;
+ return mInputDevices;
}
- const DeviceVector &getAvailableOutputDevices() const
+ const DeviceVector &getOutputDevices() const
{
- return mAvailableOutputDevices;
+ return mOutputDevices;
}
void setDefaultOutputDevice(const sp<DeviceDescriptor> &defaultDevice)
@@ -125,13 +125,11 @@
sp<AudioProfile> micProfile = new AudioProfile(
AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_MONO, 8000);
defaultInputDevice->addAudioProfile(micProfile);
- mAvailableOutputDevices.add(mDefaultOutputDevice);
- mAvailableInputDevices.add(defaultInputDevice);
+ mOutputDevices.add(mDefaultOutputDevice);
+ mInputDevices.add(defaultInputDevice);
sp<HwModule> module = new HwModule(AUDIO_HARDWARE_MODULE_ID_PRIMARY, 2 /*halVersionMajor*/);
mHwModules.add(module);
- mDefaultOutputDevice->attach(module);
- defaultInputDevice->attach(module);
sp<OutputProfile> outProfile = new OutputProfile("primary");
outProfile->addAudioProfile(
@@ -182,8 +180,8 @@
std::string mSource;
std::string mEngineLibraryNameSuffix;
HwModuleCollection &mHwModules; /**< Collection of Module, with Profiles, i.e. Mix Ports. */
- DeviceVector &mAvailableOutputDevices;
- DeviceVector &mAvailableInputDevices;
+ DeviceVector &mOutputDevices;
+ DeviceVector &mInputDevices;
sp<DeviceDescriptor> &mDefaultOutputDevice;
// TODO: remove when legacy conf file is removed. true on devices that use DRC on the
// DEVICE_CATEGORY_SPEAKER path to boost soft sounds, used to adjust volume curves accordingly.
diff --git a/services/audiopolicy/common/managerdefinitions/include/ClientDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/ClientDescriptor.h
index 0d05a63..0c5d1d0 100644
--- a/services/audiopolicy/common/managerdefinitions/include/ClientDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/ClientDescriptor.h
@@ -183,13 +183,17 @@
{
public:
SourceClientDescriptor(audio_port_handle_t portId, uid_t uid, audio_attributes_t attributes,
- const sp<AudioPatch>& patchDesc, const sp<DeviceDescriptor>& srcDevice,
+ const struct audio_port_config &config,
+ const sp<DeviceDescriptor>& srcDevice,
audio_stream_type_t stream, product_strategy_t strategy,
VolumeSource volumeSource);
+
~SourceClientDescriptor() override = default;
- sp<AudioPatch> patchDesc() const { return mPatchDesc; }
- sp<DeviceDescriptor> srcDevice() const { return mSrcDevice; };
+ audio_patch_handle_t getPatchHandle() const { return mPatchHandle; }
+ void setPatchHandle(audio_patch_handle_t patchHandle) { mPatchHandle = patchHandle; }
+
+ sp<DeviceDescriptor> srcDevice() const { return mSrcDevice; }
wp<SwAudioOutputDescriptor> swOutput() const { return mSwOutput; }
void setSwOutput(const sp<SwAudioOutputDescriptor>& swOutput);
wp<HwAudioOutputDescriptor> hwOutput() const { return mHwOutput; }
@@ -199,7 +203,7 @@
void dump(String8 *dst, int spaces, int index) const override;
private:
- const sp<AudioPatch> mPatchDesc;
+ audio_patch_handle_t mPatchHandle = AUDIO_PATCH_HANDLE_NONE;
const sp<DeviceDescriptor> mSrcDevice;
wp<SwAudioOutputDescriptor> mSwOutput;
wp<HwAudioOutputDescriptor> mHwOutput;
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index dd51658..aaa28bc 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -33,7 +33,10 @@
namespace android {
-DeviceTypeSet APM_AUDIO_OUT_DEVICE_REMOTE_ALL = {AUDIO_DEVICE_OUT_REMOTE_SUBMIX};
+static const DeviceTypeSet& getAllOutRemoteDevices() {
+ static const DeviceTypeSet allOutRemoteDevices = {AUDIO_DEVICE_OUT_REMOTE_SUBMIX};
+ return allOutRemoteDevices;
+}
AudioOutputDescriptor::AudioOutputDescriptor(const sp<PolicyAudioPort>& policyAudioPort,
AudioPolicyClientInterface *clientInterface)
@@ -681,7 +684,7 @@
const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i);
if (outputDesc->isActive(volumeSource, inPastMs, sysTime)
&& (!(outputDesc->devices()
- .containsDeviceAmongTypes(APM_AUDIO_OUT_DEVICE_REMOTE_ALL)))) {
+ .containsDeviceAmongTypes(getAllOutRemoteDevices())))) {
return true;
}
}
@@ -693,7 +696,7 @@
nsecs_t sysTime = systemTime();
for (size_t i = 0; i < size(); i++) {
const sp<SwAudioOutputDescriptor> outputDesc = valueAt(i);
- if (outputDesc->devices().containsDeviceAmongTypes(APM_AUDIO_OUT_DEVICE_REMOTE_ALL) &&
+ if (outputDesc->devices().containsDeviceAmongTypes(getAllOutRemoteDevices()) &&
outputDesc->isActive(volumeSource, inPastMs, sysTime)) {
// do not consider re routing (when the output is going to a dynamic policy)
// as "remote playback"
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
index bf0cc94..d79110a 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPatch.cpp
@@ -26,10 +26,9 @@
namespace android {
AudioPatch::AudioPatch(const struct audio_patch *patch, uid_t uid) :
- mHandle(HandleGenerator<audio_patch_handle_t>::getNextHandle()),
mPatch(*patch),
- mUid(uid),
- mAfPatchHandle(AUDIO_PATCH_HANDLE_NONE)
+ mHandle(HandleGenerator<audio_patch_handle_t>::getNextHandle()),
+ mUid(uid)
{
}
@@ -68,7 +67,7 @@
add(handle, patch);
ALOGV("addAudioPatch() handle %d af handle %d num_sources %d num_sinks %d source handle %d"
"sink handle %d",
- handle, patch->mAfPatchHandle, patch->mPatch.num_sources, patch->mPatch.num_sinks,
+ handle, patch->getAfHandle(), patch->mPatch.num_sources, patch->mPatch.num_sinks,
patch->mPatch.sources[0].id, patch->mPatch.sinks[0].id);
return NO_ERROR;
}
@@ -81,7 +80,7 @@
ALOGW("removeAudioPatch() patch %d not in", handle);
return ALREADY_EXISTS;
}
- ALOGV("removeAudioPatch() handle %d af handle %d", handle, valueAt(index)->mAfPatchHandle);
+ ALOGV("removeAudioPatch() handle %d af handle %d", handle, valueAt(index)->getAfHandle());
removeItemsAt(index);
return NO_ERROR;
}
@@ -123,7 +122,7 @@
}
if (patchesWritten < patchesMax) {
patches[patchesWritten] = patch->mPatch;
- patches[patchesWritten++].id = patch->mHandle;
+ patches[patchesWritten++].id = patch->getHandle();
}
(*num_patches)++;
ALOGV("listAudioPatches() patch %zu num_sources %d num_sinks %d",
diff --git a/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
index 1dc7020..95822b9 100644
--- a/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
@@ -82,14 +82,13 @@
}
SourceClientDescriptor::SourceClientDescriptor(audio_port_handle_t portId, uid_t uid,
- audio_attributes_t attributes, const sp<AudioPatch>& patchDesc,
+ audio_attributes_t attributes, const struct audio_port_config &config,
const sp<DeviceDescriptor>& srcDevice, audio_stream_type_t stream,
product_strategy_t strategy, VolumeSource volumeSource) :
TrackClientDescriptor::TrackClientDescriptor(portId, uid, AUDIO_SESSION_NONE, attributes,
- AUDIO_CONFIG_BASE_INITIALIZER, AUDIO_PORT_HANDLE_NONE,
+ {config.sample_rate, config.channel_mask, config.format}, AUDIO_PORT_HANDLE_NONE,
stream, strategy, volumeSource, AUDIO_OUTPUT_FLAG_NONE, false,
- {} /* Sources do not support secondary outputs*/),
- mPatchDesc(patchDesc), mSrcDevice(srcDevice)
+ {} /* Sources do not support secondary outputs*/), mSrcDevice(srcDevice)
{
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
index 4de8d3b..b8e1cbd 100644
--- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
@@ -199,6 +199,7 @@
struct Attributes
{
static constexpr const char *speakerDrcEnabled = "speaker_drc_enabled";
+ static constexpr const char *engineLibrarySuffix = "engine_library";
};
static status_t deserialize(const xmlNode *root, AudioPolicyConfig *config);
@@ -651,7 +652,7 @@
sp<DeviceDescriptor> device = module->getDeclaredDevices().
getDeviceFromTagName(std::string(reinterpret_cast<const char*>(
attachedDevice.get())));
- ctx->addAvailableDevice(device);
+ ctx->addDevice(device);
}
}
}
@@ -687,6 +688,10 @@
convertTo<std::string, bool>(speakerDrcEnabled, isSpeakerDrcEnabled)) {
config->setSpeakerDrcEnabled(isSpeakerDrcEnabled);
}
+ std::string engineLibrarySuffix = getXmlAttribute(cur, Attributes::engineLibrarySuffix);
+ if (!engineLibrarySuffix.empty()) {
+ config->setEngineLibraryNameSuffix(engineLibrarySuffix);
+ }
return NO_ERROR;
}
}
diff --git a/services/audiopolicy/config/Android.bp b/services/audiopolicy/config/Android.bp
index 4b5e788..f4610bb 100644
--- a/services/audiopolicy/config/Android.bp
+++ b/services/audiopolicy/config/Android.bp
@@ -92,6 +92,10 @@
srcs: ["audio_policy_configuration_generic.xml"],
}
filegroup {
+ name: "audio_policy_configuration_generic_configurable",
+ srcs: ["audio_policy_configuration_generic_configurable.xml"],
+}
+filegroup {
name: "usb_audio_policy_configuration",
srcs: ["usb_audio_policy_configuration.xml"],
}
diff --git a/services/audiopolicy/config/audio_policy_configuration_generic_configurable.xml b/services/audiopolicy/config/audio_policy_configuration_generic_configurable.xml
new file mode 100644
index 0000000..fbe4f7f
--- /dev/null
+++ b/services/audiopolicy/config/audio_policy_configuration_generic_configurable.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- 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.
+-->
+
+<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="false" engine_library="configurable"/>
+
+ <modules>
+ <!-- Primary Audio HAL -->
+ <xi:include href="primary_audio_policy_configuration.xml"/>
+
+ <!-- Remote Submix Audio HAL -->
+ <xi:include href="r_submix_audio_policy_configuration.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/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp
index 46b950c..b46a50a 100644
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
@@ -107,6 +107,14 @@
engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig()
{
auto loadVolumeConfig = [](auto &volumeGroups, auto &volumeConfig) {
+ // Ensure name unicity to prevent duplicate
+ const auto &iter = std::find_if(std::begin(volumeGroups), std::end(volumeGroups),
+ [&volumeConfig](const auto &volumeGroup) {
+ return volumeConfig.name == volumeGroup.second->getName(); });
+ LOG_ALWAYS_FATAL_IF(iter != std::end(volumeGroups),
+ "group name %s defined twice, review the configuration",
+ volumeConfig.name.c_str());
+
sp<VolumeGroup> volumeGroup = new VolumeGroup(volumeConfig.name, volumeConfig.indexMin,
volumeConfig.indexMax);
volumeGroups[volumeGroup->getId()] = volumeGroup;
@@ -125,13 +133,21 @@
}
return volumeGroup;
};
- auto addSupportedStreamAttributes = [](auto &group, auto &volumeGroup, auto &strategy) {
- volumeGroup->addSupportedStream(group.stream);
+ auto addSupportedAttributesToGroup = [](auto &group, auto &volumeGroup, auto &strategy) {
for (const auto &attr : group.attributesVect) {
strategy->addAttributes({group.stream, volumeGroup->getId(), attr});
volumeGroup->addSupportedAttributes(attr);
}
};
+ auto checkStreamForGroups = [](auto streamType, const auto &volumeGroups) {
+ const auto &iter = std::find_if(std::begin(volumeGroups), std::end(volumeGroups),
+ [&streamType](const auto &volumeGroup) {
+ const auto& streams = volumeGroup.second->getStreamTypes();
+ return std::find(std::begin(streams), std::end(streams), streamType) !=
+ std::end(streams);
+ });
+ return iter != end(volumeGroups);
+ };
auto result = engineConfig::parse();
if (result.parsedConfig == nullptr) {
@@ -140,15 +156,30 @@
android::status_t ret = engineConfig::parseLegacyVolumes(config.volumeGroups);
result = {std::make_unique<engineConfig::Config>(config),
static_cast<size_t>(ret == NO_ERROR ? 0 : 1)};
+ } else {
+ // Append for internal use only volume groups (e.g. rerouting/patch)
+ result.parsedConfig->volumeGroups.insert(
+ std::end(result.parsedConfig->volumeGroups),
+ std::begin(gSystemVolumeGroups), std::end(gSystemVolumeGroups));
}
+ // Append for internal use only strategies (e.g. rerouting/patch)
+ result.parsedConfig->productStrategies.insert(
+ std::end(result.parsedConfig->productStrategies),
+ std::begin(gOrderedSystemStrategies), std::end(gOrderedSystemStrategies));
+
+
ALOGE_IF(result.nbSkippedElement != 0, "skipped %zu elements", result.nbSkippedElement);
engineConfig::VolumeGroup defaultVolumeConfig;
+ engineConfig::VolumeGroup defaultSystemVolumeConfig;
for (auto &volumeConfig : result.parsedConfig->volumeGroups) {
// save default volume config for streams not defined in configuration
if (volumeConfig.name.compare("AUDIO_STREAM_MUSIC") == 0) {
defaultVolumeConfig = volumeConfig;
}
+ if (volumeConfig.name.compare("AUDIO_STREAM_PATCH") == 0) {
+ defaultSystemVolumeConfig = volumeConfig;
+ }
loadVolumeConfig(mVolumeGroups, volumeConfig);
}
for (auto& strategyConfig : result.parsedConfig->productStrategies) {
@@ -157,18 +188,31 @@
const auto &iter = std::find_if(begin(mVolumeGroups), end(mVolumeGroups),
[&group](const auto &volumeGroup) {
return group.volumeGroup == volumeGroup.second->getName(); });
- if (group.stream != AUDIO_STREAM_DEFAULT) {
- if (iter == end(mVolumeGroups)) {
- ALOGW("%s: No configuration of %s found, using default volume configuration"
- , __FUNCTION__, group.volumeGroup.c_str());
- defaultVolumeConfig.name = group.volumeGroup;
- sp<VolumeGroup> volumeGroup =
- loadVolumeConfig(mVolumeGroups, defaultVolumeConfig);
- addSupportedStreamAttributes(group, volumeGroup, strategy);
+ sp<VolumeGroup> volumeGroup = nullptr;
+ // If no volume group provided for this strategy, creates a new one using
+ // Music Volume Group configuration (considered as the default)
+ if (iter == end(mVolumeGroups)) {
+ engineConfig::VolumeGroup volumeConfig;
+ if (group.stream >= AUDIO_STREAM_PUBLIC_CNT) {
+ volumeConfig = defaultSystemVolumeConfig;
} else {
- addSupportedStreamAttributes(group, iter->second, strategy);
+ volumeConfig = defaultVolumeConfig;
}
+ ALOGW("%s: No configuration of %s found, using default volume configuration"
+ , __FUNCTION__, group.volumeGroup.c_str());
+ volumeConfig.name = group.volumeGroup;
+ volumeGroup = loadVolumeConfig(mVolumeGroups, volumeConfig);
+ } else {
+ volumeGroup = iter->second;
}
+ if (group.stream != AUDIO_STREAM_DEFAULT) {
+ // A legacy stream can be assigned once to a volume group
+ LOG_ALWAYS_FATAL_IF(checkStreamForGroups(group.stream, mVolumeGroups),
+ "stream %s already assigned to a volume group, "
+ "review the configuration", toString(group.stream).c_str());
+ volumeGroup->addSupportedStream(group.stream);
+ }
+ addSupportedAttributesToGroup(group, volumeGroup, strategy);
}
product_strategy_t strategyId = strategy->getId();
mProductStrategies[strategyId] = strategy;
diff --git a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
index 6331856..a3071d7 100644
--- a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
+++ b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
@@ -118,15 +118,22 @@
AUDIO_FLAG_BEACON, ""}}
}
},
- },
- {"STRATEGY_REROUTING",
+ }
+};
+
+/**
+ * For Internal use of respectively audio policy and audioflinger
+ * For compatibility reason why apm volume config file, volume group name is the stream type.
+ */
+const engineConfig::ProductStrategies gOrderedSystemStrategies = {
+ {"rerouting",
{
{"", AUDIO_STREAM_REROUTING, "AUDIO_STREAM_REROUTING",
{{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT, 0, ""}}
}
},
},
- {"STRATEGY_PATCH",
+ {"patch",
{
{"", AUDIO_STREAM_PATCH, "AUDIO_STREAM_PATCH",
{{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT, 0, ""}}
@@ -134,6 +141,28 @@
},
}
};
+const engineConfig::VolumeGroups gSystemVolumeGroups = {
+ {"AUDIO_STREAM_REROUTING", 0, 1,
+ {
+ {"DEVICE_CATEGORY_SPEAKER", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_HEADSET", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_EARPIECE", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_EXT_MEDIA", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_HEARING_AID", {{0,0}, {100, 0}}},
+
+ }
+ },
+ {"AUDIO_STREAM_PATCH", 0, 1,
+ {
+ {"DEVICE_CATEGORY_SPEAKER", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_HEADSET", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_EARPIECE", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_EXT_MEDIA", {{0,0}, {100, 0}}},
+ {"DEVICE_CATEGORY_HEARING_AID", {{0,0}, {100, 0}}},
+
+ }
+ }
+};
const engineConfig::Config gDefaultEngineConfig = {
1.0,
diff --git a/services/audiopolicy/engine/config/Android.bp b/services/audiopolicy/engine/config/Android.bp
index 885b5fa..ff840f9 100644
--- a/services/audiopolicy/engine/config/Android.bp
+++ b/services/audiopolicy/engine/config/Android.bp
@@ -1,4 +1,4 @@
-cc_library_static {
+cc_library {
name: "libaudiopolicyengine_config",
export_include_dirs: ["include"],
include_dirs: [
@@ -14,17 +14,14 @@
],
shared_libs: [
"libmedia_helper",
- "libandroidicu",
"libxml2",
"libutils",
"liblog",
"libcutils",
],
- static_libs: [
- "libaudiopolicycomponents",
- ],
header_libs: [
"libaudio_system_headers",
- "libaudiopolicycommon",
+ "libmedia_headers",
+ "libaudioclient_headers",
],
}
diff --git a/services/audiopolicy/engine/config/src/EngineConfig.cpp b/services/audiopolicy/engine/config/src/EngineConfig.cpp
index d47fbd2..7f8cdd9 100644
--- a/services/audiopolicy/engine/config/src/EngineConfig.cpp
+++ b/services/audiopolicy/engine/config/src/EngineConfig.cpp
@@ -18,7 +18,6 @@
//#define LOG_NDEBUG 0
#include "EngineConfig.h"
-#include <policy.h>
#include <cutils/properties.h>
#include <media/TypeConverter.h>
#include <media/convert.h>
diff --git a/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_product_strategies.xml b/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_product_strategies.xml
index 0ee83a2..f598cf2 100644
--- a/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_product_strategies.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_product_strategies.xml
@@ -84,7 +84,7 @@
</AttributesGroup>
</ProductStrategy>
<ProductStrategy name="voice_command">
- <AttributesGroup volumeGroup="speech">
+ <AttributesGroup volumeGroup="speech" streamType="AUDIO_STREAM_ASSISTANT">
<Attributes>
<ContentType value="AUDIO_CONTENT_TYPE_SPEECH"/>
<Usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
@@ -147,10 +147,6 @@
<ProductStrategy name="notification">
<AttributesGroup streamType="AUDIO_STREAM_NOTIFICATION" volumeGroup="ring">
<Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_EVENT"/> </Attributes>
</AttributesGroup>
</ProductStrategy>
<ProductStrategy name="system">
@@ -167,19 +163,5 @@
</AttributesGroup>
</ProductStrategy>
- <!-- Routing Strategy rerouting may be removed as following media??? -->
- <ProductStrategy name="rerouting">
- <AttributesGroup streamType="AUDIO_STREAM_REROUTING" volumeGroup="rerouting">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
- <!-- Patch stream needs full scale volume, define it otherwise switch to default... -->
- <ProductStrategy name="patch">
- <AttributesGroup streamType="AUDIO_STREAM_PATCH" volumeGroup="patch">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
</ProductStrategies>
diff --git a/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_volumes.xml b/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_volumes.xml
index 6e72dc5..97a25a8 100644
--- a/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_volumes.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/automotive/audio_policy_engine_volumes.xml
@@ -189,25 +189,5 @@
</volume>
</volumeGroup>
- <volumeGroup>
- <name>rerouting</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET">
- <point>0,0</point>
- <point>100,0</point>
- </volume>
- </volumeGroup>
-
- <volumeGroup>
- <name>patch</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET">
- <point>0,0</point>
- <point>100,0</point>
- </volume>
- </volumeGroup>
-
</volumeGroups>
diff --git a/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_product_strategies.xml b/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_product_strategies.xml
index adcbd83..f598cf2 100644
--- a/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_product_strategies.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_product_strategies.xml
@@ -84,7 +84,7 @@
</AttributesGroup>
</ProductStrategy>
<ProductStrategy name="voice_command">
- <AttributesGroup volumeGroup="speech">
+ <AttributesGroup volumeGroup="speech" streamType="AUDIO_STREAM_ASSISTANT">
<Attributes>
<ContentType value="AUDIO_CONTENT_TYPE_SPEECH"/>
<Usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
@@ -147,10 +147,6 @@
<ProductStrategy name="notification">
<AttributesGroup streamType="AUDIO_STREAM_NOTIFICATION" volumeGroup="ring">
<Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/> </Attributes>
- <Attributes> <Usage value="AUDIO_USAGE_NOTIFICATION_EVENT"/> </Attributes>
</AttributesGroup>
</ProductStrategy>
<ProductStrategy name="system">
@@ -167,18 +163,5 @@
</AttributesGroup>
</ProductStrategy>
- <!-- Routing Strategy rerouting may be removed as following media??? -->
- <ProductStrategy name="rerouting">
- <AttributesGroup streamType="AUDIO_STREAM_REROUTING" volumeGroup="rerouting">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
- <!-- Patch stream needs full scale volume, define it otherwise switch to default... -->
- <ProductStrategy name="patch">
- <AttributesGroup streamType="AUDIO_STREAM_PATCH" volumeGroup="patch">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
</ProductStrategies>
diff --git a/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_volumes.xml b/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_volumes.xml
index 6e72dc5..97a25a8 100644
--- a/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_volumes.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/caremu/audio_policy_engine_volumes.xml
@@ -189,25 +189,5 @@
</volume>
</volumeGroup>
- <volumeGroup>
- <name>rerouting</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET">
- <point>0,0</point>
- <point>100,0</point>
- </volume>
- </volumeGroup>
-
- <volumeGroup>
- <name>patch</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET">
- <point>0,0</point>
- <point>100,0</point>
- </volume>
- </volumeGroup>
-
</volumeGroups>
diff --git a/services/audiopolicy/engineconfigurable/config/example/common/audio_policy_engine_criterion_types.xml.in b/services/audiopolicy/engineconfigurable/config/example/common/audio_policy_engine_criterion_types.xml.in
index fe17369..e134c42 100644
--- a/services/audiopolicy/engineconfigurable/config/example/common/audio_policy_engine_criterion_types.xml.in
+++ b/services/audiopolicy/engineconfigurable/config/example/common/audio_policy_engine_criterion_types.xml.in
@@ -22,7 +22,12 @@
<value literal="0" numerical="1"/>
</values>
</criterion_type>
- <criterion_type name="InputDevicesAddressesType" type="inclusive"/>
+ <criterion_type name="InputDevicesAddressesType" type="inclusive">
+ <values>
+ <!-- legacy remote submix -->
+ <value literal="0" numerical="1"/>
+ </values>
+ </criterion_type>
<criterion_type name="AndroidModeType" type="exclusive"/>
<criterion_type name="BooleanType" type="exclusive">
<values>
diff --git a/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_product_strategies.xml b/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_product_strategies.xml
index b1c0dcf..a7388da 100644
--- a/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_product_strategies.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_product_strategies.xml
@@ -97,20 +97,5 @@
</AttributesGroup>
</ProductStrategy>
- <!-- Routing Strategy rerouting may be removed as following media??? -->
- <ProductStrategy name="STRATEGY_REROUTING">
- <AttributesGroup streamType="AUDIO_STREAM_REROUTING" volumeGroup="rerouting">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
- <!-- Default product strategy has empty attributes -->
- <ProductStrategy name="STRATEGY_PATCH">
- <AttributesGroup streamType="AUDIO_STREAM_PATCH" volumeGroup="patch">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
-
</ProductStrategies>
diff --git a/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_stream_volumes.xml b/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_stream_volumes.xml
index 0f9614e..8aa71ca 100644
--- a/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_stream_volumes.xml
+++ b/services/audiopolicy/engineconfigurable/config/example/phone/audio_policy_engine_stream_volumes.xml
@@ -215,26 +215,6 @@
<volume deviceCategory="DEVICE_CATEGORY_EXT_MEDIA" ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
<volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
</volumeGroup>
- <volumeGroup>
- <name>rerouting</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_SPEAKER" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EARPIECE" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EXT_MEDIA" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="FULL_SCALE_VOLUME_CURVE"/>
- </volumeGroup>
- <volumeGroup>
- <name>patch</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_SPEAKER" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EARPIECE" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EXT_MEDIA" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="FULL_SCALE_VOLUME_CURVE"/>
- </volumeGroup>
</volumeGroups>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/Android.bp
index a0b874a..90ebffd 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/Android.bp
@@ -31,9 +31,13 @@
prebuilt_etc {
name: "PolicySubsystem-CommonTypes.xml",
vendor: true,
- src: ":PolicySubsystem-CommonTypes",
+ src: ":buildcommontypesstructure_gen",
sub_dir: "parameter-framework/Structure/Policy",
}
+genrule {
+ name: "buildcommontypesstructure_gen",
+ defaults: ["buildcommontypesstructurerule"],
+}
filegroup {
name: "product_strategies_structure_template",
@@ -48,8 +52,8 @@
srcs: ["examples/common/Structure/PolicySubsystem-no-strategy.xml"],
}
filegroup {
- name: "PolicySubsystem-CommonTypes",
- srcs: ["examples/common/Structure/PolicySubsystem-CommonTypes.xml"],
+ name: "common_types_structure_template",
+ srcs: ["examples/common/Structure/PolicySubsystem-CommonTypes.xml.in"],
}
filegroup {
name: "PolicyClass",
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Android.bp
index 5078268..82b1b6d 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Android.bp
@@ -85,7 +85,7 @@
srcs: [
":PolicyClass",
":PolicySubsystem",
- ":PolicySubsystem-CommonTypes",
+ ":buildcommontypesstructure_gen",
":buildstrategiesstructure_gen",
],
}
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Settings/device_for_product_strategies.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Settings/device_for_product_strategies.pfw
index 57ad592..ddae356 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Settings/device_for_product_strategies.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Car/Settings/device_for_product_strategies.pfw
@@ -14,7 +14,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -59,7 +59,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -106,7 +106,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -152,7 +152,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -205,7 +205,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -251,7 +251,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -304,7 +304,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -357,7 +357,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -411,7 +411,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -464,7 +464,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -517,7 +517,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -570,7 +570,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -623,7 +623,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -676,7 +676,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -729,7 +729,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Android.bp
index 0917440..e4605b2 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Android.bp
@@ -86,7 +86,7 @@
srcs: [
":PolicyClass",
":PolicySubsystem",
- ":PolicySubsystem-CommonTypes",
+ ":buildcommontypesstructure_gen",
":buildstrategiesstructure_gen",
],
}
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Settings/device_for_product_strategies.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Settings/device_for_product_strategies.pfw
index ca3464f..cc778df 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Settings/device_for_product_strategies.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/CarEmu/Settings/device_for_product_strategies.pfw
@@ -14,7 +14,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -59,7 +59,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -106,7 +106,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -153,7 +153,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -198,7 +198,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -245,7 +245,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -291,7 +291,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -337,7 +337,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -384,7 +384,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -430,7 +430,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -476,7 +476,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -522,7 +522,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -568,7 +568,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -614,7 +614,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -659,7 +659,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Android.bp
index 11e220b..61b54cf 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Android.bp
@@ -94,7 +94,7 @@
srcs: [
":PolicyClass",
":PolicySubsystem",
- ":PolicySubsystem-CommonTypes",
+ ":buildcommontypesstructure_gen",
":buildstrategiesstructure_gen",
],
}
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_accessibility.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_accessibility.pfw
index 53e93de..d16a904 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_accessibility.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_accessibility.pfw
@@ -45,7 +45,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -73,7 +73,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -101,7 +101,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -129,7 +129,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -157,7 +157,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -186,7 +186,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -215,7 +215,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -244,7 +244,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -281,7 +281,7 @@
wired_headset = 0
wired_headphone = 1
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -317,7 +317,7 @@
wired_headset = 0
wired_headphone = 0
line = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -354,7 +354,7 @@
wired_headset = 1
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -394,7 +394,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -425,7 +425,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 1
usb_device = 0
@@ -455,7 +455,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -485,7 +485,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -517,7 +517,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -546,7 +546,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -568,7 +568,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -588,7 +588,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_dtmf.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_dtmf.pfw
index b8426c6..414445d 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_dtmf.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_dtmf.pfw
@@ -34,7 +34,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -62,7 +62,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -90,7 +90,7 @@
bluetooth_a2dp_headphones = 1
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -118,7 +118,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 1
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -147,7 +147,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -176,7 +176,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -205,7 +205,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -242,7 +242,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -281,7 +281,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -318,7 +318,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -358,7 +358,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -389,7 +389,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 1
usb_device = 0
@@ -419,7 +419,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -449,7 +449,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -481,7 +481,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -510,7 +510,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -548,7 +548,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -568,7 +568,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_enforced_audible.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_enforced_audible.pfw
index 2daa9ac..36b8f3c 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_enforced_audible.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_enforced_audible.pfw
@@ -77,7 +77,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -100,7 +100,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -123,7 +123,7 @@
bluetooth_a2dp_headphones = 1
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -146,7 +146,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 1
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -169,7 +169,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -192,7 +192,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -215,7 +215,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -238,7 +238,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 1
usb_device = 0
@@ -261,7 +261,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -284,7 +284,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -307,7 +307,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -331,7 +331,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -351,7 +351,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_media.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_media.pfw
index d6d355c..6210a57 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_media.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_media.pfw
@@ -26,7 +26,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -46,7 +46,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -66,7 +66,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -86,7 +86,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -109,7 +109,7 @@
speaker = 1
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -127,7 +127,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -145,7 +145,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -163,7 +163,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 1
@@ -181,7 +181,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 1
wired_headset = 0
@@ -199,7 +199,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 1
usb_accessory = 0
wired_headset = 0
@@ -217,7 +217,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -235,7 +235,7 @@
speaker = 0
hdmi = 1
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -254,7 +254,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -277,7 +277,7 @@
speaker = 1
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
@@ -293,7 +293,7 @@
speaker = 0
hdmi = 0
dgtl_dock_headset = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
usb_device = 0
usb_accessory = 0
wired_headset = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_patch.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_patch.pfw
index d2cc090..feeeec6 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_patch.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_patch.pfw
@@ -14,7 +14,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_phone.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_phone.pfw
index 5693d4e..da2fc9b 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_phone.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_phone.pfw
@@ -32,7 +32,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -55,7 +55,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -78,7 +78,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -108,7 +108,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -138,7 +138,7 @@
bluetooth_a2dp_headphones = 1
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -168,7 +168,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 1
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -195,7 +195,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -222,7 +222,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -245,7 +245,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -283,7 +283,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -311,7 +311,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -339,7 +339,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -367,7 +367,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -395,7 +395,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -422,7 +422,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -449,7 +449,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -472,7 +472,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_rerouting.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_rerouting.pfw
index 10f8814..3275cdf 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_rerouting.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_rerouting.pfw
@@ -14,7 +14,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification.pfw
index c4edeeb..a60445b 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification.pfw
@@ -69,7 +69,7 @@
bluetooth_a2dp = 1
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -95,7 +95,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 1
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -121,7 +121,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -148,7 +148,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -175,7 +175,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -202,7 +202,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -238,7 +238,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -276,7 +276,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -312,7 +312,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -349,7 +349,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -378,7 +378,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 1
usb_device = 0
@@ -407,7 +407,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -437,7 +437,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -464,7 +464,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -482,7 +482,7 @@
bluetooth_a2dp = 0
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification_respectful.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification_respectful.pfw
index 0a3dd5f..6b11e23 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification_respectful.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_sonification_respectful.pfw
@@ -92,7 +92,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -119,7 +119,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -146,7 +146,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -173,7 +173,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -200,7 +200,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -227,7 +227,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -264,7 +264,7 @@
wired_headset = 0
wired_headphone = 1
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -305,7 +305,7 @@
wired_headset = 0
wired_headphone = 0
line = 1
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -342,7 +342,7 @@
wired_headset = 1
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -380,7 +380,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 1
@@ -410,7 +410,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 1
usb_device = 0
@@ -440,7 +440,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 1
usb_accessory = 0
usb_device = 0
@@ -470,7 +470,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -501,7 +501,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 1
+ anlg_dock_headset = 1
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -528,7 +528,7 @@
wired_headset = 0
wired_headphone = 0
line = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_transmitted_through_speaker.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_transmitted_through_speaker.pfw
index 3fc7670..418f3cc 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_transmitted_through_speaker.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Phone/Settings/device_for_product_strategy_transmitted_through_speaker.pfw
@@ -19,7 +19,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
index 0710441..baffa81 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/PolicyConfigurableDomains.xml
@@ -145,7 +145,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/speaker"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/hdmi"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset"/>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/wired_headset"/>
@@ -167,8 +167,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -208,8 +208,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -249,8 +249,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -290,8 +290,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -331,8 +331,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -372,8 +372,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -413,8 +413,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -454,8 +454,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -495,8 +495,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -536,8 +536,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">1</BitParameter>
@@ -577,8 +577,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -618,8 +618,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -659,8 +659,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -700,8 +700,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -741,8 +741,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/media/selected_output_devices/mask/usb_device">
<BitParameter Name="usb_device">0</BitParameter>
@@ -1039,7 +1039,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/bluetooth_a2dp_headphones"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/bluetooth_a2dp_speaker"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi"/>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/usb_device"/>
@@ -1079,8 +1079,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1132,8 +1132,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1185,8 +1185,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1238,8 +1238,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1291,8 +1291,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1344,8 +1344,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1397,8 +1397,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1450,8 +1450,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1503,8 +1503,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1556,8 +1556,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1609,8 +1609,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1662,8 +1662,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -1715,8 +1715,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1768,8 +1768,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1821,8 +1821,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1874,8 +1874,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -1927,8 +1927,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/phone/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2228,7 +2228,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_headphones"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker"/>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/usb_device"/>
@@ -2264,8 +2264,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2311,8 +2311,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2358,8 +2358,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2405,8 +2405,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2452,8 +2452,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2499,8 +2499,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2546,8 +2546,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2593,8 +2593,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2640,8 +2640,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2687,8 +2687,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2734,8 +2734,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2781,8 +2781,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -2828,8 +2828,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2875,8 +2875,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -2922,8 +2922,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/bluetooth_a2dp_speaker">
<BitParameter Name="bluetooth_a2dp_speaker">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3246,7 +3246,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/wired_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/wired_headphone"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line"/>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/usb_device"/>
@@ -3284,8 +3284,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3331,8 +3331,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3378,8 +3378,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3425,8 +3425,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3472,8 +3472,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3519,8 +3519,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3566,8 +3566,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3613,8 +3613,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3660,8 +3660,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3707,8 +3707,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3754,8 +3754,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3801,8 +3801,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -3848,8 +3848,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3895,8 +3895,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -3942,8 +3942,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/sonification_respectful/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4207,7 +4207,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bluetooth_a2dp_headphones"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/bluetooth_a2dp_speaker"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi"/>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/usb_device"/>
@@ -4247,8 +4247,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4300,8 +4300,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4353,8 +4353,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4406,8 +4406,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4459,8 +4459,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4512,8 +4512,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4565,8 +4565,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4618,8 +4618,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4671,8 +4671,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4724,8 +4724,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4777,8 +4777,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4830,8 +4830,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4883,8 +4883,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -4936,8 +4936,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -4989,8 +4989,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5042,8 +5042,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5095,8 +5095,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5148,8 +5148,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/dtmf/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5448,7 +5448,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_a2dp_headphones"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/bluetooth_a2dp_speaker"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi"/>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/usb_device"/>
@@ -5490,8 +5490,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5543,8 +5543,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5596,8 +5596,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5649,8 +5649,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5702,8 +5702,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5755,8 +5755,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5808,8 +5808,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5861,8 +5861,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5914,8 +5914,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -5967,8 +5967,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -6020,8 +6020,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6073,8 +6073,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6126,8 +6126,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/enforced_audible/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6170,7 +6170,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/bluetooth_a2dp_headphones"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/bluetooth_a2dp_speaker"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/hdmi"/>
- <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/usb_device"/>
@@ -6230,8 +6230,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/hdmi">
<BitParameter Name="hdmi">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/transmitted_through_speaker/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6539,7 +6539,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/wired_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/wired_headphone"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line"/>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/usb_device"/>
@@ -6583,8 +6583,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6636,8 +6636,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6689,8 +6689,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6742,8 +6742,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6795,8 +6795,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6848,8 +6848,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6901,8 +6901,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -6954,8 +6954,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7007,8 +7007,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7060,8 +7060,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7113,8 +7113,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7166,8 +7166,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7219,8 +7219,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7272,8 +7272,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -7325,8 +7325,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7378,8 +7378,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7431,8 +7431,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7484,8 +7484,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7537,8 +7537,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/accessibility/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7710,7 +7710,7 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/wired_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/wired_headphone"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line"/>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset"/>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/usb_accessory"/>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/usb_device"/>
@@ -7742,8 +7742,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7783,8 +7783,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7824,8 +7824,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7865,8 +7865,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7906,8 +7906,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7947,8 +7947,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -7988,8 +7988,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">1</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8029,8 +8029,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8070,8 +8070,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8111,8 +8111,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8152,8 +8152,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">1</BitParameter>
@@ -8193,8 +8193,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8234,8 +8234,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">1</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">1</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8275,8 +8275,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
@@ -8316,8 +8316,8 @@
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/line">
<BitParameter Name="line">0</BitParameter>
</ConfigurableElement>
- <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/angl_dock_headset">
- <BitParameter Name="angl_dock_headset">0</BitParameter>
+ <ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/anlg_dock_headset">
+ <BitParameter Name="anlg_dock_headset">0</BitParameter>
</ConfigurableElement>
<ConfigurableElement Path="/Policy/policy/strategies/rerouting/selected_output_devices/mask/dgtl_dock_headset">
<BitParameter Name="dgtl_dock_headset">0</BitParameter>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw
index 7db4537..cf1857e 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/Settings/volumes.pfw
@@ -11,6 +11,7 @@
/Policy/policy/streams/enforced_audible/applicable_volume_profile/volume_profile = enforced_audible
/Policy/policy/streams/tts/applicable_volume_profile/volume_profile = tts
/Policy/policy/streams/accessibility/applicable_volume_profile/volume_profile = accessibility
+ /Policy/policy/streams/assistant/applicable_volume_profile/volume_profile = assistant
/Policy/policy/streams/rerouting/applicable_volume_profile/volume_profile = rerouting
/Policy/policy/streams/patch/applicable_volume_profile/volume_profile = patch
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoInput/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoInput/Android.bp
index ffd494e..9abcb70 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoInput/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoInput/Android.bp
@@ -55,7 +55,7 @@
srcs: [
":PolicyClass",
":PolicySubsystem",
- ":PolicySubsystem-CommonTypes",
+ ":buildcommontypesstructure_gen",
],
}
filegroup {
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/Android.bp b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/Android.bp
index 6fca048..27172a4 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/Android.bp
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/Android.bp
@@ -54,7 +54,7 @@
srcs: [
":PolicyClass",
":PolicySubsystem",
- ":PolicySubsystem-CommonTypes",
+ ":buildcommontypesstructure_gen",
],
}
filegroup {
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/device_for_strategies.pfw b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/device_for_strategies.pfw
index f923610..e259c00 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/device_for_strategies.pfw
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/SettingsNoOutput/device_for_strategies.pfw
@@ -13,7 +13,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -41,7 +41,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -69,7 +69,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -97,7 +97,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -125,7 +125,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -153,7 +153,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -181,7 +181,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -209,7 +209,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
@@ -237,7 +237,7 @@
bluetooth_a2dp_headphones = 0
bluetooth_a2dp_speaker = 0
hdmi = 0
- angl_dock_headset = 0
+ anlg_dock_headset = 0
dgtl_dock_headset = 0
usb_accessory = 0
usb_device = 0
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml
deleted file mode 100644
index d17c021..0000000
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ComponentTypeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xsi:noNamespaceSchemaLocation="Schemas/ComponentTypeSet.xsd">
- <!-- Output devices definition as a bitfield for the supported devices per output
- profile. It must match with the output device enum parameter.
- -->
- <!--#################### GLOBAL COMPONENTS BEGIN ####################-->
-
- <!--#################### GLOBAL COMPONENTS END ####################-->
-
- <ComponentType Name="OutputDevicesMask" Description="32th bit is not allowed as dedicated
- for input devices detection">
- <BitParameterBlock Name="mask" Size="32">
- <BitParameter Name="earpiece" Size="1" Pos="0"/>
- <BitParameter Name="speaker" Size="1" Pos="1"/>
- <BitParameter Name="wired_headset" Size="1" Pos="2"/>
- <BitParameter Name="wired_headphone" Size="1" Pos="3"/>
- <BitParameter Name="bluetooth_sco" Size="1" Pos="4"/>
- <BitParameter Name="bluetooth_sco_headset" Size="1" Pos="5"/>
- <BitParameter Name="bluetooth_sco_carkit" Size="1" Pos="6"/>
- <BitParameter Name="bluetooth_a2dp" Size="1" Pos="7"/>
- <BitParameter Name="bluetooth_a2dp_headphones" Size="1" Pos="8"/>
- <BitParameter Name="bluetooth_a2dp_speaker" Size="1" Pos="9"/>
- <BitParameter Name="hdmi" Size="1" Pos="10"/>
- <BitParameter Name="angl_dock_headset" Size="1" Pos="11"/>
- <BitParameter Name="dgtl_dock_headset" Size="1" Pos="12"/>
- <BitParameter Name="usb_accessory" Size="1" Pos="13"/>
- <BitParameter Name="usb_device" Size="1" Pos="14"/>
- <BitParameter Name="remote_submix" Size="1" Pos="15"/>
- <BitParameter Name="telephony_tx" Size="1" Pos="16"/>
- <BitParameter Name="line" Size="1" Pos="17"/>
- <BitParameter Name="hdmi_arc" Size="1" Pos="18"/>
- <BitParameter Name="spdif" Size="1" Pos="19"/>
- <BitParameter Name="fm" Size="1" Pos="20"/>
- <BitParameter Name="aux_line" Size="1" Pos="21"/>
- <BitParameter Name="speaker_safe" Size="1" Pos="22"/>
- <BitParameter Name="ip" Size="1" Pos="23"/>
- <BitParameter Name="bus" Size="1" Pos="24"/>
- <BitParameter Name="proxy" Size="1" Pos="25"/>
- <BitParameter Name="usb_headset" Size="1" Pos="26"/>
- <BitParameter Name="hearing_aid" Size="1" Pos="27"/>
- <BitParameter Name="echo_canceller" Size="1" Pos="28"/>
- <BitParameter Name="stub" Size="1" Pos="30"/>
- </BitParameterBlock>
- </ComponentType>
-
- <!-- Input devices definition as a bitfield for the supported devices per Input
- profile. It must match with the Input device enum parameter.
- -->
- <ComponentType Name="InputDevicesMask">
- <BitParameterBlock Name="mask" Size="32">
- <BitParameter Name="communication" Size="1" Pos="0"/>
- <BitParameter Name="ambient" Size="1" Pos="1"/>
- <BitParameter Name="builtin_mic" Size="1" Pos="2"/>
- <BitParameter Name="bluetooth_sco_headset" Size="1" Pos="3"/>
- <BitParameter Name="wired_headset" Size="1" Pos="4"/>
- <BitParameter Name="hdmi" Size="1" Pos="5"/>
- <BitParameter Name="telephony_rx" Size="1" Pos="6"/>
- <BitParameter Name="back_mic" Size="1" Pos="7"/>
- <BitParameter Name="remote_submix" Size="1" Pos="8"/>
- <BitParameter Name="anlg_dock_headset" Size="1" Pos="9"/>
- <BitParameter Name="dgtl_dock_headset" Size="1" Pos="10"/>
- <BitParameter Name="usb_accessory" Size="1" Pos="11"/>
- <BitParameter Name="usb_device" Size="1" Pos="12"/>
- <BitParameter Name="fm_tuner" Size="1" Pos="13"/>
- <BitParameter Name="tv_tuner" Size="1" Pos="14"/>
- <BitParameter Name="line" Size="1" Pos="15"/>
- <BitParameter Name="spdif" Size="1" Pos="16"/>
- <BitParameter Name="bluetooth_a2dp" Size="1" Pos="17"/>
- <BitParameter Name="loopback" Size="1" Pos="18"/>
- <BitParameter Name="ip" Size="1" Pos="19"/>
- <BitParameter Name="bus" Size="1" Pos="20"/>
- <BitParameter Name="proxy" Size="1" Pos="21"/>
- <BitParameter Name="usb_headset" Size="1" Pos="22"/>
- <BitParameter Name="bluetooth_ble" Size="1" Pos="23"/>
- <BitParameter Name="hdmi_arc" Size="1" Pos="24"/>
- <BitParameter Name="echo_reference" Size="1" Pos="25"/>
- <BitParameter Name="stub" Size="1" Pos="30"/>
- </BitParameterBlock>
- </ComponentType>
-
- <ComponentType Name="OutputFlags"
- Description="the audio output flags serve two purposes:
- - when an AudioTrack is created they indicate a wish to be connected to an
- output stream with attributes corresponding to the specified flags.
- - when present in an output profile descriptor listed for a particular audio
- hardware module, they indicate that an output stream can be opened that
- supports the attributes indicated by the flags.
- The audio policy manager will try to match the flags in the request
- (when getOuput() is called) to an available output stream.">
- <BitParameterBlock Name="mask" Size="32">
- <BitParameter Name="direct" Size="1" Pos="0"/>
- <BitParameter Name="primary" Size="1" Pos="1"/>
- <BitParameter Name="fast" Size="1" Pos="2"/>
- <BitParameter Name="deep_buffer" Size="1" Pos="3"/>
- <BitParameter Name="compress_offload" Size="1" Pos="4"/>
- <BitParameter Name="non_blocking" Size="1" Pos="5"/>
- <BitParameter Name="hw_av_sync" Size="1" Pos="6"/>
- <BitParameter Name="tts" Size="1" Pos="7"/>
- <BitParameter Name="raw" Size="1" Pos="8"/>
- <BitParameter Name="sync" Size="1" Pos="9"/>
- <BitParameter Name="iec958_nonaudio" Size="1" Pos="10"/>
- </BitParameterBlock>
- </ComponentType>
-
- <ComponentType Name="InputFlags"
- Description="The audio input flags are analogous to audio output flags.
- Currently they are used only when an AudioRecord is created,
- to indicate a preference to be connected to an input stream with
- attributes corresponding to the specified flags.">
- <BitParameterBlock Name="mask" Size="32">
- <BitParameter Name="fast" Size="1" Pos="0"/>
- <BitParameter Name="hw_hotword" Size="1" Pos="2"/>
- <BitParameter Name="raw" Size="1" Pos="3"/>
- <BitParameter Name="sync" Size="1" Pos="4"/>
- </BitParameterBlock>
- </ComponentType>
-
- <ComponentType Name="InputSourcesMask" Description="The audio input source is also known
- as the use case.">
- <BitParameterBlock Name="mask" Size="32">
- <BitParameter Name="default" Size="1" Pos="0"/>
- <BitParameter Name="mic" Size="1" Pos="1"/>
- <BitParameter Name="voice_uplink" Size="1" Pos="2"/>
- <BitParameter Name="voice_downlink" Size="1" Pos="3"/>
- <BitParameter Name="voice_call" Size="1" Pos="4"/>
- <BitParameter Name="camcorder" Size="1" Pos="5"/>
- <BitParameter Name="voice_recognition" Size="1" Pos="6"/>
- <BitParameter Name="voice_communication" Size="1" Pos="7"/>
- <BitParameter Name="remote_submix" Size="1" Pos="8"/>
- <BitParameter Name="unprocessed" Size="1" Pos="9"/>
- <BitParameter Name="voice_performance" Size="1" Pos="10"/>
- <BitParameter Name="echo_reference" Size="1" Pos="11"/>
- <BitParameter Name="fm_tuner" Size="1" Pos="12"/>
- <BitParameter Name="hotword" Size="1" Pos="13"/>
- </BitParameterBlock>
- </ComponentType>
-
- <!--#################### STREAM COMMON TYPES BEGIN ####################-->
-
- <ComponentType Name="VolumeProfileType">
- <EnumParameter Name="volume_profile" Size="32">
- <ValuePair Literal="voice_call" Numerical="0"/>
- <ValuePair Literal="system" Numerical="1"/>
- <ValuePair Literal="ring" Numerical="2"/>
- <ValuePair Literal="music" Numerical="3"/>
- <ValuePair Literal="alarm" Numerical="4"/>
- <ValuePair Literal="notification" Numerical="5"/>
- <ValuePair Literal="bluetooth_sco" Numerical="6"/>
- <ValuePair Literal="enforced_audible" Numerical="7"/>
- <ValuePair Literal="dtmf" Numerical="8"/>
- <ValuePair Literal="tts" Numerical="9"/>
- <ValuePair Literal="accessibility" Numerical="10"/>
- <ValuePair Literal="rerouting" Numerical="11"/>
- <ValuePair Literal="patch" Numerical="12"/>
- </EnumParameter>
- </ComponentType>
-
- <ComponentType Name="Stream" Mapping="Stream">
- <Component Name="applicable_volume_profile" Type="VolumeProfileType"
- Description="Volume profile followed by a given stream type."/>
- </ComponentType>
-
- <!--#################### STREAM COMMON TYPES END ####################-->
-
- <!--#################### INPUT SOURCE COMMON TYPES BEGIN ####################-->
-
- <ComponentType Name="InputSource">
- <Component Name="applicable_input_device" Type="InputDevicesMask"
- Mapping="InputSource" Description="Selected Input device"/>
- </ComponentType>
-
- <!--#################### INPUT SOURCE COMMON TYPES END ####################-->
-
- <!--#################### PRODUCT STRATEGY COMMON TYPES BEGIN ####################-->
-
- <ComponentType Name="ProductStrategy" Mapping="ProductStrategy">
- <Component Name="selected_output_devices" Type="OutputDevicesMask"/>
- <StringParameter Name="device_address" MaxLength="256"
- Description="if any, device address associated"/>
- </ComponentType>
-
- <!--#################### PRODUCT STRATEGY COMMON TYPES END ####################-->
-
-</ComponentTypeSet>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml.in b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml.in
new file mode 100644
index 0000000..2e9f37e
--- /dev/null
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-CommonTypes.xml.in
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ComponentTypeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xsi:noNamespaceSchemaLocation="Schemas/ComponentTypeSet.xsd">
+ <!-- Output devices definition as a bitfield for the supported devices per output
+ profile. It must match with the output device enum parameter.
+ -->
+ <!--#################### GLOBAL COMPONENTS BEGIN ####################-->
+
+ <!--#################### GLOBAL COMPONENTS END ####################-->
+
+ <!-- Automatically filled from audio-base.h file -->
+ <ComponentType Name="OutputDevicesMask" Description="32th bit is not allowed as dedicated for input devices detection">
+ <BitParameterBlock Name="mask" Size="32">
+ </BitParameterBlock>
+ </ComponentType>
+
+ <!-- Input devices definition as a bitfield for the supported devices per Input
+ profile. It must match with the Input device enum parameter.
+ -->
+ <!-- Automatically filled from audio-base.h file -->
+ <ComponentType Name="InputDevicesMask">
+ <BitParameterBlock Name="mask" Size="32">
+ </BitParameterBlock>
+ </ComponentType>
+
+ <!--#################### STREAM COMMON TYPES BEGIN ####################-->
+ <!-- Automatically filled from audio-base.h file. VolumeProfileType is associated to stream type -->
+ <ComponentType Name="VolumeProfileType">
+ <EnumParameter Name="volume_profile" Size="32">
+ </EnumParameter>
+ </ComponentType>
+
+ <ComponentType Name="Stream" Mapping="Stream">
+ <Component Name="applicable_volume_profile" Type="VolumeProfileType"
+ Description="Volume profile followed by a given stream type."/>
+ </ComponentType>
+
+ <!--#################### STREAM COMMON TYPES END ####################-->
+
+ <!--#################### INPUT SOURCE COMMON TYPES BEGIN ####################-->
+
+ <ComponentType Name="InputSource">
+ <Component Name="applicable_input_device" Type="InputDevicesMask"
+ Mapping="InputSource" Description="Selected Input device"/>
+ </ComponentType>
+
+ <!--#################### INPUT SOURCE COMMON TYPES END ####################-->
+
+ <!--#################### PRODUCT STRATEGY COMMON TYPES BEGIN ####################-->
+
+ <ComponentType Name="ProductStrategy" Mapping="ProductStrategy">
+ <Component Name="selected_output_devices" Type="OutputDevicesMask"/>
+ <StringParameter Name="device_address" MaxLength="256"
+ Description="if any, device address associated"/>
+ </ComponentType>
+
+ <!--#################### PRODUCT STRATEGY COMMON TYPES END ####################-->
+
+</ComponentTypeSet>
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-no-strategy.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-no-strategy.xml
index a4e7537..ed349c8 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-no-strategy.xml
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem-no-strategy.xml
@@ -28,6 +28,8 @@
Description="Transmitted Through Speaker. Plays over speaker only, silent on other devices"/>
<Component Name="accessibility" Type="Stream" Mapping="Name:AUDIO_STREAM_ACCESSIBILITY"
Description="For accessibility talk back prompts"/>
+ <Component Name="assistant" Type="Stream" Mapping="Name:AUDIO_STREAM_ASSISTANT"
+ Description="used by a virtual assistant like Google Assistant, Bixby, etc."/>
<Component Name="rerouting" Type="Stream" Mapping="Name:AUDIO_STREAM_REROUTING"
Description="For dynamic policy output mixes"/>
<Component Name="patch" Type="Stream" Mapping="Name:AUDIO_STREAM_PATCH"
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem.xml b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem.xml
index 585ce87..7bbb57a 100644
--- a/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem.xml
+++ b/services/audiopolicy/engineconfigurable/parameter-framework/examples/common/Structure/PolicySubsystem.xml
@@ -44,6 +44,8 @@
Description="Transmitted Through Speaker. Plays over speaker only, silent on other devices"/>
<Component Name="accessibility" Type="Stream" Mapping="Name:AUDIO_STREAM_ACCESSIBILITY"
Description="For accessibility talk back prompts"/>
+ <Component Name="assistant" Type="Stream" Mapping="Name:AUDIO_STREAM_ASSISTANT"
+ Description="used by a virtual assistant like Google Assistant, Bixby, etc."/>
<Component Name="rerouting" Type="Stream" Mapping="Name:AUDIO_STREAM_REROUTING"
Description="For dynamic policy output mixes"/>
<Component Name="patch" Type="Stream" Mapping="Name:AUDIO_STREAM_PATCH"
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.cpp b/services/audiopolicy/engineconfigurable/src/Engine.cpp
index 752ba92..6d42fcf 100644
--- a/services/audiopolicy/engineconfigurable/src/Engine.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Engine.cpp
@@ -80,8 +80,9 @@
status_t Engine::initCheck()
{
- if (mPolicyParameterMgr == nullptr || mPolicyParameterMgr->start() != NO_ERROR) {
- ALOGE("%s: could not start Policy PFW", __FUNCTION__);
+ std::string error;
+ if (mPolicyParameterMgr == nullptr || mPolicyParameterMgr->start(error) != NO_ERROR) {
+ ALOGE("%s: could not start Policy PFW: %s", __FUNCTION__, error.c_str());
return NO_INIT;
}
return EngineBase::initCheck();
@@ -128,7 +129,7 @@
Element<Key> *element = getFromCollection<Key>(key);
if (element == NULL) {
ALOGE("%s: Element not found within collection", __FUNCTION__);
- return BAD_VALUE;
+ return false;
}
return element->template set<Property>(property) == NO_ERROR;
}
@@ -162,21 +163,21 @@
return mPolicyParameterMgr->getForceUse(usage);
}
-status_t Engine::setDeviceConnectionState(const sp<DeviceDescriptor> devDesc,
+status_t Engine::setDeviceConnectionState(const sp<DeviceDescriptor> device,
audio_policy_dev_state_t state)
{
- mPolicyParameterMgr->setDeviceConnectionState(devDesc, state);
-
- if (audio_is_output_device(devDesc->type())) {
+ mPolicyParameterMgr->setDeviceConnectionState(
+ device->type(), device->address().c_str(), state);
+ if (audio_is_output_device(device->type())) {
// FIXME: Use DeviceTypeSet when the interface is ready
return mPolicyParameterMgr->setAvailableOutputDevices(
deviceTypesToBitMask(getApmObserver()->getAvailableOutputDevices().types()));
- } else if (audio_is_input_device(devDesc->type())) {
+ } else if (audio_is_input_device(device->type())) {
// FIXME: Use DeviceTypeSet when the interface is ready
return mPolicyParameterMgr->setAvailableInputDevices(
deviceTypesToBitMask(getApmObserver()->getAvailableInputDevices().types()));
}
- return EngineBase::setDeviceConnectionState(devDesc, state);
+ return EngineBase::setDeviceConnectionState(device, state);
}
status_t Engine::loadAudioPolicyEngineConfig()
diff --git a/services/audiopolicy/engineconfigurable/src/InputSource.cpp b/services/audiopolicy/engineconfigurable/src/InputSource.cpp
index d252d3f..aa06ae3 100644
--- a/services/audiopolicy/engineconfigurable/src/InputSource.cpp
+++ b/services/audiopolicy/engineconfigurable/src/InputSource.cpp
@@ -30,7 +30,7 @@
return BAD_VALUE;
}
mIdentifier = identifier;
- ALOGD("%s: InputSource %s identifier 0x%X", __FUNCTION__, getName().c_str(), identifier);
+ ALOGV("%s: InputSource %s identifier 0x%X", __FUNCTION__, getName().c_str(), identifier);
return NO_ERROR;
}
@@ -46,15 +46,18 @@
template <>
status_t Element<audio_source_t>::set(audio_devices_t devices)
{
- if (devices != AUDIO_DEVICE_NONE) {
- devices |= AUDIO_DEVICE_BIT_IN;
+ if (devices == AUDIO_DEVICE_NONE) {
+ // Reset
+ mApplicableDevices = devices;
+ return NO_ERROR;
}
+ devices |= AUDIO_DEVICE_BIT_IN;
if (!audio_is_input_device(devices)) {
ALOGE("%s: trying to set an invalid device 0x%X for input source %s",
__FUNCTION__, devices, getName().c_str());
return BAD_VALUE;
}
- ALOGD("%s: 0x%X for input source %s", __FUNCTION__, devices, getName().c_str());
+ ALOGV("%s: 0x%X for input source %s", __FUNCTION__, devices, getName().c_str());
mApplicableDevices = devices;
return NO_ERROR;
}
diff --git a/services/audiopolicy/engineconfigurable/src/InputSource.h b/services/audiopolicy/engineconfigurable/src/InputSource.h
index e1865cc..d64a60a 100644
--- a/services/audiopolicy/engineconfigurable/src/InputSource.h
+++ b/services/audiopolicy/engineconfigurable/src/InputSource.h
@@ -73,10 +73,11 @@
Element(const Element &object);
Element &operator=(const Element &object);
- std::string mName; /**< Unique literal Identifier of a policy base element*/
- audio_source_t mIdentifier; /**< Unique numerical Identifier of a policy base element*/
-
- audio_devices_t mApplicableDevices; /**< Applicable input device for this input source. */
+ const std::string mName; /**< Unique literal Identifier of a policy base element*/
+ /** Unique numerical Identifier of a policy base element */
+ audio_source_t mIdentifier = AUDIO_SOURCE_DEFAULT;
+ /** Applicable input device for this input source. */
+ audio_devices_t mApplicableDevices = AUDIO_DEVICE_NONE;
};
typedef Element<audio_source_t> InputSource;
diff --git a/services/audiopolicy/engineconfigurable/src/Stream.cpp b/services/audiopolicy/engineconfigurable/src/Stream.cpp
index 297eb02..e64ba4b 100644
--- a/services/audiopolicy/engineconfigurable/src/Stream.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Stream.cpp
@@ -30,7 +30,7 @@
return BAD_VALUE;
}
mIdentifier = identifier;
- ALOGD("%s: Stream %s identifier 0x%X", __FUNCTION__, getName().c_str(), identifier);
+ ALOGV("%s: Stream %s identifier 0x%X", __FUNCTION__, getName().c_str(), identifier);
return NO_ERROR;
}
@@ -41,7 +41,7 @@
return BAD_VALUE;
}
mVolumeProfile = volumeProfile;
- ALOGD("%s: 0x%X for Stream %s", __FUNCTION__, mVolumeProfile, getName().c_str());
+ ALOGV("%s: 0x%X for Stream %s", __FUNCTION__, mVolumeProfile, getName().c_str());
return NO_ERROR;
}
diff --git a/services/audiopolicy/engineconfigurable/tools/Android.bp b/services/audiopolicy/engineconfigurable/tools/Android.bp
index d9e97af..3e47324 100644
--- a/services/audiopolicy/engineconfigurable/tools/Android.bp
+++ b/services/audiopolicy/engineconfigurable/tools/Android.bp
@@ -133,3 +133,29 @@
],
out: ["ProductStrategies.xml"],
}
+
+//##################################################################################################
+// Tools for policy parameter-framework common type structure file generation
+//
+python_binary_host {
+ name: "buildCommonTypesStructureFile.py",
+ main: "buildCommonTypesStructureFile.py",
+ srcs: [
+ "buildCommonTypesStructureFile.py",
+ ],
+ defaults: ["tools_default"],
+}
+
+genrule_defaults {
+ name: "buildcommontypesstructurerule",
+ tools: ["buildCommonTypesStructureFile.py"],
+ cmd: "$(location buildCommonTypesStructureFile.py) " +
+ "--androidaudiobaseheader $(location :libaudio_system_audio_base) " +
+ "--commontypesstructure $(location :common_types_structure_template) " +
+ "--outputfile $(out)",
+ srcs: [
+ ":common_types_structure_template",
+ ":libaudio_system_audio_base",
+ ],
+ out: ["PolicySubsystem-CommonTypes.xml"],
+}
diff --git a/services/audiopolicy/engineconfigurable/tools/buildCommonTypesStructureFile.py b/services/audiopolicy/engineconfigurable/tools/buildCommonTypesStructureFile.py
new file mode 100755
index 0000000..9a7fa8f
--- /dev/null
+++ b/services/audiopolicy/engineconfigurable/tools/buildCommonTypesStructureFile.py
@@ -0,0 +1,184 @@
+#! /usr/bin/python3
+#
+# pylint: disable=line-too-long, missing-docstring, logging-format-interpolation, invalid-name
+
+#
+# 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.
+
+import argparse
+import re
+import sys
+import os
+import logging
+import xml.etree.ElementTree as ET
+from collections import OrderedDict
+import xml.dom.minidom as MINIDOM
+
+def parseArgs():
+ argparser = argparse.ArgumentParser(description="Parameter-Framework XML \
+ structure file generator.\n\
+ Exit with the number of (recoverable or not) error that occured.")
+ argparser.add_argument('--androidaudiobaseheader',
+ help="Android Audio Base C header file, Mandatory.",
+ metavar="ANDROID_AUDIO_BASE_HEADER",
+ type=argparse.FileType('r'),
+ required=True)
+ argparser.add_argument('--commontypesstructure',
+ help="Structure XML base file. Mandatory.",
+ metavar="STRUCTURE_FILE_IN",
+ type=argparse.FileType('r'),
+ required=True)
+ argparser.add_argument('--outputfile',
+ help="Structure XML file. Mandatory.",
+ metavar="STRUCTURE_FILE_OUT",
+ type=argparse.FileType('w'),
+ required=True)
+ argparser.add_argument('--verbose',
+ action='store_true')
+
+ return argparser.parse_args()
+
+
+def findBitPos(decimal):
+ pos = 0
+ i = 1
+ while i != decimal:
+ i = i << 1
+ pos = pos + 1
+ if pos == 32:
+ return -1
+ return pos
+
+
+def generateXmlStructureFile(componentTypeDict, structureTypesFile, outputFile):
+
+ logging.info("Importing structureTypesFile {}".format(structureTypesFile))
+ component_types_in_tree = ET.parse(structureTypesFile)
+
+ component_types_root = component_types_in_tree.getroot()
+
+ for component_types_name, values_dict in componentTypeDict.items():
+ for component_type in component_types_root.findall('ComponentType'):
+ if component_type.get('Name') == component_types_name:
+ bitparameters_node = component_type.find("BitParameterBlock")
+ if bitparameters_node is not None:
+ ordered_values = OrderedDict(sorted(values_dict.items(), key=lambda x: x[1]))
+ for key, value in ordered_values.items():
+ value_node = ET.SubElement(bitparameters_node, "BitParameter")
+ value_node.set('Name', key)
+ value_node.set('Size', "1")
+ value_node.set('Pos', str(findBitPos(value)))
+
+ enum_parameter_node = component_type.find("EnumParameter")
+ if enum_parameter_node is not None:
+ ordered_values = OrderedDict(sorted(values_dict.items(), key=lambda x: x[1]))
+ for key, value in ordered_values.items():
+ value_node = ET.SubElement(enum_parameter_node, "ValuePair")
+ value_node.set('Literal', key)
+ value_node.set('Numerical', str(value))
+
+ xmlstr = ET.tostring(component_types_root, encoding='utf8', method='xml')
+ reparsed = MINIDOM.parseString(xmlstr)
+ prettyXmlStr = reparsed.toprettyxml(indent=" ", newl='\n')
+ prettyXmlStr = os.linesep.join([s for s in prettyXmlStr.splitlines() if s.strip()])
+ outputFile.write(prettyXmlStr)
+
+
+def capitalizeLine(line):
+ return ' '.join((w.capitalize() for w in line.split(' ')))
+
+def parseAndroidAudioFile(androidaudiobaseheaderFile):
+ #
+ # Adaptation table between Android Enumeration prefix and Audio PFW Criterion type names
+ #
+ component_type_mapping_table = {
+ 'AUDIO_STREAM' : "VolumeProfileType",
+ 'AUDIO_DEVICE_OUT' : "OutputDevicesMask",
+ 'AUDIO_DEVICE_IN' : "InputDevicesMask"}
+
+ all_component_types = {
+ 'VolumeProfileType' : {},
+ 'OutputDevicesMask' : {},
+ 'InputDevicesMask' : {}
+ }
+
+ #
+ # _CNT, _MAX, _ALL and _NONE are prohibited values as ther are just helpers for enum users.
+ #
+ ignored_values = ['CNT', 'MAX', 'ALL', 'NONE']
+
+ criteria_pattern = re.compile(
+ r"\s*(?P<type>(?:"+'|'.join(component_type_mapping_table.keys()) + "))_" \
+ r"(?P<literal>(?!" + '|'.join(ignored_values) + ")\w*)\s*=\s*" \
+ r"(?P<values>(?:0[xX])?[0-9a-fA-F]+)")
+
+ logging.info("Checking Android Header file {}".format(androidaudiobaseheaderFile))
+
+ for line_number, line in enumerate(androidaudiobaseheaderFile):
+ match = criteria_pattern.match(line)
+ if match:
+ logging.debug("The following line is VALID: {}:{}\n{}".format(
+ androidaudiobaseheaderFile.name, line_number, line))
+
+ component_type_name = component_type_mapping_table[match.groupdict()['type']]
+ component_type_literal = match.groupdict()['literal'].lower()
+
+ component_type_numerical_value = match.groupdict()['values']
+
+ # for AUDIO_DEVICE_IN: need to remove sign bit / rename default to stub
+ if component_type_name == "InputDevicesMask":
+ component_type_numerical_value = str(int(component_type_numerical_value, 0) & ~2147483648)
+ if component_type_literal == "default":
+ component_type_literal = "stub"
+
+ if component_type_name == "OutputDevicesMask":
+ if component_type_literal == "default":
+ component_type_literal = "stub"
+
+ # Remove duplicated numerical values
+ if int(component_type_numerical_value, 0) in all_component_types[component_type_name].values():
+ logging.info("The value {}:{} is duplicated for criterion {}, KEEPING LATEST".format(component_type_numerical_value, component_type_literal, component_type_name))
+ for key in list(all_component_types[component_type_name]):
+ if all_component_types[component_type_name][key] == int(component_type_numerical_value, 0):
+ del all_component_types[component_type_name][key]
+
+ all_component_types[component_type_name][component_type_literal] = int(component_type_numerical_value, 0)
+
+ logging.debug("type:{}, literal:{}, values:{}.".format(component_type_name, component_type_literal, component_type_numerical_value))
+
+ # Transform input source in inclusive criterion
+ shift = len(all_component_types['OutputDevicesMask'])
+ if shift > 32:
+ logging.critical("OutputDevicesMask incompatible with criterion representation on 32 bits")
+ logging.info("EXIT ON FAILURE")
+ exit(1)
+
+ for component_types in all_component_types:
+ values = ','.join('{}:{}'.format(value, key) for key, value in all_component_types[component_types].items())
+ logging.info("{}: <{}>".format(component_types, values))
+
+ return all_component_types
+
+
+def main():
+ logging.root.setLevel(logging.INFO)
+ args = parseArgs()
+ route_criteria = 0
+
+ all_component_types = parseAndroidAudioFile(args.androidaudiobaseheader)
+
+ generateXmlStructureFile(all_component_types, args.commontypesstructure, args.outputfile)
+
+# If this file is directly executed
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/services/audiopolicy/engineconfigurable/wrapper/Android.bp b/services/audiopolicy/engineconfigurable/wrapper/Android.bp
index 6f59487..301ecc0 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/Android.bp
+++ b/services/audiopolicy/engineconfigurable/wrapper/Android.bp
@@ -11,7 +11,6 @@
"libbase_headers",
"libaudiopolicycommon",
],
- static_libs: ["libaudiopolicycomponents"],
shared_libs: [
"liblog",
"libutils",
diff --git a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
index 465a6f9..63990ac 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
+++ b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
@@ -92,7 +92,8 @@
template <>
struct ParameterManagerWrapper::parameterManagerElementSupported<ISelectionCriterionTypeInterface> {};
-ParameterManagerWrapper::ParameterManagerWrapper()
+ParameterManagerWrapper::ParameterManagerWrapper(bool enableSchemaVerification,
+ const std::string &schemaUri)
: mPfwConnectorLogger(new ParameterMgrPlatformConnectorLogger)
{
// Connector
@@ -104,6 +105,15 @@
// Logger
mPfwConnector->setLogger(mPfwConnectorLogger);
+
+ // Schema validation
+ std::string error;
+ bool ret = mPfwConnector->setValidateSchemasOnStart(enableSchemaVerification, error);
+ ALOGE_IF(!ret, "Failed to activate schema validation: %s", error.c_str());
+ if (enableSchemaVerification && ret && !schemaUri.empty()) {
+ ALOGE("Schema verification activated with schema URI: %s", schemaUri.c_str());
+ mPfwConnector->setSchemaUri(schemaUri);
+ }
}
status_t ParameterManagerWrapper::addCriterion(const std::string &name, bool isInclusive,
@@ -145,11 +155,10 @@
delete mPfwConnector;
}
-status_t ParameterManagerWrapper::start()
+status_t ParameterManagerWrapper::start(std::string &error)
{
ALOGD("%s: in", __FUNCTION__);
/// Start PFW
- std::string error;
if (!mPfwConnector->start(error)) {
ALOGE("%s: Policy PFW start error: %s", __FUNCTION__, error.c_str());
return NO_INIT;
@@ -253,13 +262,13 @@
return interface->getLiteralValue(valueToCheck, literalValue);
}
-status_t ParameterManagerWrapper::setDeviceConnectionState(const sp<DeviceDescriptor> devDesc,
- audio_policy_dev_state_t state)
+status_t ParameterManagerWrapper::setDeviceConnectionState(
+ audio_devices_t type, const std::string address, audio_policy_dev_state_t state)
{
- std::string criterionName = audio_is_output_device(devDesc->type()) ?
+ std::string criterionName = audio_is_output_device(type) ?
gOutputDeviceAddressCriterionName : gInputDeviceAddressCriterionName;
- ALOGV("%s: device with address %s %s", __FUNCTION__, devDesc->address().c_str(),
+ ALOGV("%s: device with address %s %s", __FUNCTION__, address.c_str(),
state != AUDIO_POLICY_DEVICE_STATE_AVAILABLE? "disconnected" : "connected");
ISelectionCriterionInterface *criterion =
getElement<ISelectionCriterionInterface>(criterionName, mPolicyCriteria);
@@ -271,8 +280,9 @@
auto criterionType = criterion->getCriterionType();
int deviceAddressId;
- if (not criterionType->getNumericalValue(devDesc->address().c_str(), deviceAddressId)) {
- ALOGW("%s: unknown device address reported (%s)", __FUNCTION__, devDesc->address().c_str());
+ if (not criterionType->getNumericalValue(address.c_str(), deviceAddressId)) {
+ ALOGW("%s: unknown device address reported (%s) for criterion %s", __FUNCTION__,
+ address.c_str(), criterionName.c_str());
return BAD_TYPE;
}
int currentValueMask = criterion->getCriterionState();
diff --git a/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h b/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
index 8443008..62b129a 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
+++ b/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
@@ -16,9 +16,6 @@
#pragma once
-#include <PolicyAudioPort.h>
-#include <HwModule.h>
-#include <DeviceDescriptor.h>
#include <system/audio.h>
#include <system/audio_policy.h>
#include <utils/Errors.h>
@@ -47,16 +44,18 @@
using Criteria = std::map<std::string, ISelectionCriterionInterface *>;
public:
- ParameterManagerWrapper();
+ ParameterManagerWrapper(bool enableSchemaVerification = false,
+ const std::string &schemaUri = {});
~ParameterManagerWrapper();
/**
* Starts the platform state service.
* It starts the parameter framework policy instance.
+ * @param[out] contains human readable error if starts failed
*
- * @return NO_ERROR if success, error code otherwise.
+ * @return NO_ERROR if success, error code otherwise, and error is set to human readable string.
*/
- status_t start();
+ status_t start(std::string &error);
/**
* The following API wrap policy action to criteria
@@ -117,7 +116,15 @@
*/
status_t setAvailableOutputDevices(audio_devices_t outputDevices);
- status_t setDeviceConnectionState(const sp<DeviceDescriptor> devDesc,
+ /**
+ * @brief setDeviceConnectionState propagates a state event on a given device(s)
+ * @param type bit mask of the device whose state has changed
+ * @param address of the device whose state has changed
+ * @param state new state of the given device
+ * @return NO_ERROR if new state corretly propagated to Engine Parameter-Framework, error
+ * code otherwise.
+ */
+ status_t setDeviceConnectionState(audio_devices_t type, const std::string address,
audio_policy_dev_state_t state);
/**
diff --git a/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_product_strategies.xml b/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_product_strategies.xml
index b1c0dcf..a7388da 100644
--- a/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_product_strategies.xml
+++ b/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_product_strategies.xml
@@ -97,20 +97,5 @@
</AttributesGroup>
</ProductStrategy>
- <!-- Routing Strategy rerouting may be removed as following media??? -->
- <ProductStrategy name="STRATEGY_REROUTING">
- <AttributesGroup streamType="AUDIO_STREAM_REROUTING" volumeGroup="rerouting">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
- <!-- Default product strategy has empty attributes -->
- <ProductStrategy name="STRATEGY_PATCH">
- <AttributesGroup streamType="AUDIO_STREAM_PATCH" volumeGroup="patch">
- <Attributes></Attributes>
- </AttributesGroup>
- </ProductStrategy>
-
-
</ProductStrategies>
diff --git a/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_stream_volumes.xml b/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_stream_volumes.xml
index a259950..d5c3896 100644
--- a/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_stream_volumes.xml
+++ b/services/audiopolicy/enginedefault/config/example/phone/audio_policy_engine_stream_volumes.xml
@@ -217,26 +217,5 @@
<volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="DEFAULT_HEARING_AID_VOLUME_CURVE"/>
</volumeGroup>
- <volumeGroup>
- <name>rerouting</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_SPEAKER" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EARPIECE" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EXT_MEDIA" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="FULL_SCALE_VOLUME_CURVE"/>
- </volumeGroup>
-
- <volumeGroup>
- <name>patch</name>
- <indexMin>0</indexMin>
- <indexMax>1</indexMax>
- <volume deviceCategory="DEVICE_CATEGORY_HEADSET" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_SPEAKER" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EARPIECE" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_EXT_MEDIA" ref="FULL_SCALE_VOLUME_CURVE"/>
- <volume deviceCategory="DEVICE_CATEGORY_HEARING_AID" ref="FULL_SCALE_VOLUME_CURVE"/>
- </volumeGroup>
</volumeGroups>
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 02b99d0..41bb4e4 100755
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -41,18 +41,21 @@
{
struct legacy_strategy_map { const char *name; legacy_strategy id; };
-static const std::vector<legacy_strategy_map> gLegacyStrategy = {
- { "STRATEGY_NONE", STRATEGY_NONE },
- { "STRATEGY_MEDIA", STRATEGY_MEDIA },
- { "STRATEGY_PHONE", STRATEGY_PHONE },
- { "STRATEGY_SONIFICATION", STRATEGY_SONIFICATION },
- { "STRATEGY_SONIFICATION_RESPECTFUL", STRATEGY_SONIFICATION_RESPECTFUL },
- { "STRATEGY_DTMF", STRATEGY_DTMF },
- { "STRATEGY_ENFORCED_AUDIBLE", STRATEGY_ENFORCED_AUDIBLE },
- { "STRATEGY_TRANSMITTED_THROUGH_SPEAKER", STRATEGY_TRANSMITTED_THROUGH_SPEAKER },
- { "STRATEGY_ACCESSIBILITY", STRATEGY_ACCESSIBILITY },
- { "STRATEGY_REROUTING", STRATEGY_REROUTING },
- { "STRATEGY_PATCH", STRATEGY_REROUTING }, // boiler to manage stream patch volume
+static const std::vector<legacy_strategy_map>& getLegacyStrategy() {
+ static const std::vector<legacy_strategy_map> legacyStrategy = {
+ { "STRATEGY_NONE", STRATEGY_NONE },
+ { "STRATEGY_MEDIA", STRATEGY_MEDIA },
+ { "STRATEGY_PHONE", STRATEGY_PHONE },
+ { "STRATEGY_SONIFICATION", STRATEGY_SONIFICATION },
+ { "STRATEGY_SONIFICATION_RESPECTFUL", STRATEGY_SONIFICATION_RESPECTFUL },
+ { "STRATEGY_DTMF", STRATEGY_DTMF },
+ { "STRATEGY_ENFORCED_AUDIBLE", STRATEGY_ENFORCED_AUDIBLE },
+ { "STRATEGY_TRANSMITTED_THROUGH_SPEAKER", STRATEGY_TRANSMITTED_THROUGH_SPEAKER },
+ { "STRATEGY_ACCESSIBILITY", STRATEGY_ACCESSIBILITY },
+ { "STRATEGY_REROUTING", STRATEGY_REROUTING },
+ { "STRATEGY_PATCH", STRATEGY_REROUTING }, // boiler to manage stream patch volume
+ };
+ return legacyStrategy;
};
Engine::Engine()
@@ -62,7 +65,8 @@
"Policy Engine configuration is partially invalid, skipped %zu elements",
result.nbSkippedElement);
- for (const auto &strategy : gLegacyStrategy) {
+ auto legacyStrategy = getLegacyStrategy();
+ for (const auto &strategy : legacyStrategy) {
mLegacyStrategyMap[getProductStrategyByName(strategy.name)] = strategy.id;
}
}
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index fbe5d0d..8de8ecd 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -526,12 +526,12 @@
// release existing RX patch if any
if (mCallRxPatch != 0) {
- mpClientInterface->releaseAudioPatch(mCallRxPatch->mAfPatchHandle, 0);
+ releaseAudioPatchInternal(mCallRxPatch->getHandle());
mCallRxPatch.clear();
}
// release TX patch if any
if (mCallTxPatch != 0) {
- mpClientInterface->releaseAudioPatch(mCallTxPatch->mAfPatchHandle, 0);
+ releaseAudioPatchInternal(mCallTxPatch->getHandle());
mCallTxPatch.clear();
}
@@ -557,11 +557,9 @@
ALOGE("updateCallRouting() no telephony Tx and/or RX device");
return muteWaitMs;
}
- // do not create a patch (aka Sw Bridging) if Primary HW module has declared supporting a
- // route between telephony RX to Sink device and Source device to telephony TX
- const auto &primaryModule = telephonyRxModule;
- createRxPatch = !primaryModule->supportsPatch(rxSourceDevice, rxDevices.itemAt(0));
- createTxPatch = !primaryModule->supportsPatch(txSourceDevice, txSinkDevice);
+ // createAudioPatchInternal now supports both HW / SW bridging
+ createRxPatch = true;
+ createTxPatch = true;
} else {
// If the RX device is on the primary HW module, then use legacy routing method for
// voice calls via setOutputDevice() on primary output.
@@ -585,6 +583,15 @@
// assuming the device uses audio HAL V5.0 and above
}
if (createTxPatch) { // create TX path audio patch
+ // terminate active capture if on the same HW module as the call TX source device
+ // FIXME: would be better to refine to only inputs whose profile connects to the
+ // call TX device but this information is not in the audio patch and logic here must be
+ // symmetric to the one in startInput()
+ for (const auto& activeDesc : mInputs.getActiveInputs()) {
+ if (activeDesc->hasSameHwModuleAs(txSourceDevice)) {
+ closeActiveClients(activeDesc);
+ }
+ }
mCallTxPatch = createTelephonyPatch(false /*isRx*/, txSourceDevice, delayMs);
}
@@ -598,6 +605,8 @@
if (device == nullptr) {
return nullptr;
}
+
+ // @TODO: still ignoring the address, or not dealing platform with mutliple telephony devices
if (isRx) {
patchBuilder.addSink(device).
addSource(mAvailableInputDevices.getDevice(
@@ -608,45 +617,15 @@
AUDIO_DEVICE_OUT_TELEPHONY_TX, String8(), AUDIO_FORMAT_DEFAULT));
}
- // @TODO: still ignoring the address, or not dealing platform with mutliple telephonydevices
- const sp<DeviceDescriptor> outputDevice = isRx ?
- device : mAvailableOutputDevices.getDevice(
- AUDIO_DEVICE_OUT_TELEPHONY_TX, String8(), AUDIO_FORMAT_DEFAULT);
- SortedVector<audio_io_handle_t> outputs =
- getOutputsForDevices(DeviceVector(outputDevice), mOutputs);
- const audio_io_handle_t output = selectOutput(outputs);
- // request to reuse existing output stream if one is already opened to reach the target device
- if (output != AUDIO_IO_HANDLE_NONE) {
- sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
- ALOG_ASSERT(!outputDesc->isDuplicated(), "%s() %s device output %d is duplicated", __func__,
- outputDevice->toString().c_str(), output);
- patchBuilder.addSource(outputDesc, { .stream = AUDIO_STREAM_PATCH });
+ audio_patch_handle_t patchHandle = AUDIO_PATCH_HANDLE_NONE;
+ status_t status =
+ createAudioPatchInternal(patchBuilder.patch(), &patchHandle, mUidCached, delayMs);
+ ssize_t index = mAudioPatches.indexOfKey(patchHandle);
+ if (status != NO_ERROR || index < 0) {
+ ALOGW("%s() error %d creating %s audio patch", __func__, status, isRx ? "RX" : "TX");
+ return nullptr;
}
-
- if (!isRx) {
- // terminate active capture if on the same HW module as the call TX source device
- // FIXME: would be better to refine to only inputs whose profile connects to the
- // call TX device but this information is not in the audio patch and logic here must be
- // symmetric to the one in startInput()
- for (const auto& activeDesc : mInputs.getActiveInputs()) {
- if (activeDesc->hasSameHwModuleAs(device)) {
- closeActiveClients(activeDesc);
- }
- }
- }
-
- audio_patch_handle_t afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
- status_t status = mpClientInterface->createAudioPatch(
- patchBuilder.patch(), &afPatchHandle, delayMs);
- ALOGW_IF(status != NO_ERROR,
- "%s() error %d creating %s audio patch", __func__, status, isRx ? "RX" : "TX");
- sp<AudioPatch> audioPatch;
- if (status == NO_ERROR) {
- audioPatch = new AudioPatch(patchBuilder.patch(), mUidCached);
- audioPatch->mAfPatchHandle = afPatchHandle;
- audioPatch->mUid = mUidCached;
- }
- return audioPatch;
+ return mAudioPatches.valueAt(index);
}
bool AudioPolicyManager::isDeviceOfModule(
@@ -729,11 +708,11 @@
updateCallRouting(rxDevices, delayMs);
} else if (oldState == AUDIO_MODE_IN_CALL) {
if (mCallRxPatch != 0) {
- mpClientInterface->releaseAudioPatch(mCallRxPatch->mAfPatchHandle, 0);
+ releaseAudioPatchInternal(mCallRxPatch->getHandle());
mCallRxPatch.clear();
}
if (mCallTxPatch != 0) {
- mpClientInterface->releaseAudioPatch(mCallTxPatch->mAfPatchHandle, 0);
+ releaseAudioPatchInternal(mCallTxPatch->getHandle());
mCallTxPatch.clear();
}
setOutputDevices(mPrimaryOutput, rxDevices, force, 0);
@@ -1209,7 +1188,7 @@
devices.containsDeviceWithType(sink->ext.device.type) &&
(address.isEmpty() || strncmp(sink->ext.device.address, address.string(),
AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0)) {
- releaseAudioPatch(patch->mHandle, mUidCached);
+ releaseAudioPatch(patch->getHandle(), mUidCached);
break;
}
}
@@ -1296,7 +1275,7 @@
const struct audio_port_config *source = &patch->mPatch.sources[j];
if (source->type == AUDIO_PORT_TYPE_DEVICE &&
source->ext.device.hw_module == msdModule->getHandle()) {
- msdPatches.addAudioPatch(patch->mHandle, patch);
+ msdPatches.addAudioPatch(patch->getHandle(), patch);
}
}
}
@@ -1426,7 +1405,7 @@
if (audio_patches_are_equal(¤tPatch->mPatch, patch)) {
return NO_ERROR;
}
- releaseAudioPatch(currentPatch->mHandle, mUidCached);
+ releaseAudioPatch(currentPatch->getHandle(), mUidCached);
}
status_t status = installPatch(__func__, -1 /*index*/, nullptr /*patchHandle*/,
patch, 0 /*delayMs*/, mUidCached, nullptr /*patchDescPtr*/);
@@ -2533,15 +2512,29 @@
if (curDevices.erase(AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
curDevices.insert(AUDIO_DEVICE_OUT_SPEAKER);
}
-
+ if (!(desc->isActive(vs) || isInCall())) {
+ continue;
+ }
+ if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME &&
+ curDevices.find(device) == curDevices.end()) {
+ continue;
+ }
+ bool applyVolume = false;
+ if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) {
+ curSrcDevices.insert(device);
+ applyVolume = (curSrcDevices.find(
+ Volume::getDeviceForVolume(curDevices)) != curSrcDevices.end());
+ } else {
+ applyVolume = !curves.hasVolumeIndexForDevice(curSrcDevice);
+ }
+ if (!applyVolume) {
+ continue; // next output
+ }
// Inter / intra volume group priority management: Loop on strategies arranged by priority
// If a higher priority strategy is active, and the output is routed to a device with a
// HW Gain management, do not change the volume
- bool applyVolume = false;
if (desc->useHwGain()) {
- if (!(desc->isActive(toVolumeSource(group)) || isInCall())) {
- continue;
- }
+ applyVolume = false;
for (const auto &productStrategy : mEngine->getOrderedProductStrategies()) {
auto activeClients = desc->clientsList(true /*activeOnly*/, productStrategy,
false /*preferredDevice*/);
@@ -2575,39 +2568,16 @@
if (!applyVolume) {
continue; // next output
}
- status_t volStatus = checkAndSetVolume(curves, vs, index, desc, curDevices,
- (vs == toVolumeSource(AUDIO_STREAM_SYSTEM)?
- TOUCH_SOUND_FIXED_DELAY_MS : 0));
- if (volStatus != NO_ERROR) {
- status = volStatus;
- }
- continue;
}
- if (!(desc->isActive(vs) || isInCall())) {
- continue;
- }
- if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME &&
- curDevices.find(device) == curDevices.end()) {
- continue;
- }
- if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) {
- curSrcDevices.insert(device);
- applyVolume = (curSrcDevices.find(
- Volume::getDeviceForVolume(curDevices)) != curSrcDevices.end());
- } else {
- applyVolume = !curves.hasVolumeIndexForDevice(curSrcDevice);
- }
- if (applyVolume) {
- //FIXME: workaround for truncated touch sounds
- // delayed volume change for system stream to be removed when the problem is
- // handled by system UI
- status_t volStatus = checkAndSetVolume(
- curves, vs, index, desc, curDevices,
- ((vs == toVolumeSource(AUDIO_STREAM_SYSTEM))?
- TOUCH_SOUND_FIXED_DELAY_MS : 0));
- if (volStatus != NO_ERROR) {
- status = volStatus;
- }
+ //FIXME: workaround for truncated touch sounds
+ // delayed volume change for system stream to be removed when the problem is
+ // handled by system UI
+ status_t volStatus = checkAndSetVolume(
+ curves, vs, index, desc, curDevices,
+ ((vs == toVolumeSource(AUDIO_STREAM_SYSTEM))?
+ TOUCH_SOUND_FIXED_DELAY_MS : 0));
+ if (volStatus != NO_ERROR) {
+ status = volStatus;
}
}
mpClientInterface->onAudioVolumeGroupChanged(group, 0 /*flags*/);
@@ -3391,16 +3361,16 @@
return BAD_VALUE;
}
-status_t AudioPolicyManager::createAudioPatch(const struct audio_patch *patch,
- audio_patch_handle_t *handle,
- uid_t uid)
+status_t AudioPolicyManager::createAudioPatchInternal(const struct audio_patch *patch,
+ audio_patch_handle_t *handle,
+ uid_t uid, uint32_t delayMs,
+ const sp<SourceClientDescriptor>& sourceDesc)
{
- ALOGV("createAudioPatch()");
-
+ ALOGV("%s", __func__);
if (handle == NULL || patch == NULL) {
return BAD_VALUE;
}
- ALOGV("createAudioPatch() num sources %d num sinks %d", patch->num_sources, patch->num_sinks);
+ ALOGV("%s num sources %d num sinks %d", __func__, patch->num_sources, patch->num_sinks);
if (!audio_patch_is_valid(patch)) {
return BAD_VALUE;
@@ -3422,22 +3392,22 @@
sp<AudioPatch> patchDesc;
ssize_t index = mAudioPatches.indexOfKey(*handle);
- ALOGV("createAudioPatch source id %d role %d type %d", patch->sources[0].id,
- patch->sources[0].role,
- patch->sources[0].type);
+ ALOGV("%s source id %d role %d type %d", __func__, patch->sources[0].id,
+ patch->sources[0].role,
+ patch->sources[0].type);
#if LOG_NDEBUG == 0
for (size_t i = 0; i < patch->num_sinks; i++) {
- ALOGV("createAudioPatch sink %zu: id %d role %d type %d", i, patch->sinks[i].id,
- patch->sinks[i].role,
- patch->sinks[i].type);
+ ALOGV("%s sink %zu: id %d role %d type %d", __func__ ,i, patch->sinks[i].id,
+ patch->sinks[i].role,
+ patch->sinks[i].type);
}
#endif
if (index >= 0) {
patchDesc = mAudioPatches.valueAt(index);
- ALOGV("createAudioPatch() mUidCached %d patchDesc->mUid %d uid %d",
- mUidCached, patchDesc->mUid, uid);
- if (patchDesc->mUid != mUidCached && uid != patchDesc->mUid) {
+ ALOGV("%s mUidCached %d patchDesc->mUid %d uid %d",
+ __func__, mUidCached, patchDesc->getUid(), uid);
+ if (patchDesc->getUid() != mUidCached && uid != patchDesc->getUid()) {
return INVALID_OPERATION;
}
} else {
@@ -3447,15 +3417,15 @@
if (patch->sources[0].type == AUDIO_PORT_TYPE_MIX) {
sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id);
if (outputDesc == NULL) {
- ALOGV("createAudioPatch() output not found for id %d", patch->sources[0].id);
+ ALOGV("%s output not found for id %d", __func__, patch->sources[0].id);
return BAD_VALUE;
}
ALOG_ASSERT(!outputDesc->isDuplicated(),"duplicated output %d in source in ports",
outputDesc->mIoHandle);
if (patchDesc != 0) {
if (patchDesc->mPatch.sources[0].id != patch->sources[0].id) {
- ALOGV("createAudioPatch() source id differs for patch current id %d new id %d",
- patchDesc->mPatch.sources[0].id, patch->sources[0].id);
+ ALOGV("%s source id differs for patch current id %d new id %d",
+ __func__, patchDesc->mPatch.sources[0].id, patch->sources[0].id);
return BAD_VALUE;
}
}
@@ -3464,13 +3434,13 @@
// Only support mix to devices connection
// TODO add support for mix to mix connection
if (patch->sinks[i].type != AUDIO_PORT_TYPE_DEVICE) {
- ALOGV("createAudioPatch() source mix but sink is not a device");
+ ALOGV("%s source mix but sink is not a device", __func__);
return INVALID_OPERATION;
}
sp<DeviceDescriptor> devDesc =
mAvailableOutputDevices.getDeviceFromId(patch->sinks[i].id);
if (devDesc == 0) {
- ALOGV("createAudioPatch() out device not found for id %d", patch->sinks[i].id);
+ ALOGV("%s out device not found for id %d", __func__, patch->sinks[i].id);
return BAD_VALUE;
}
@@ -3482,8 +3452,7 @@
patch->sources[0].channel_mask,
NULL, // updatedChannelMask
AUDIO_OUTPUT_FLAG_NONE /*FIXME*/)) {
- ALOGV("createAudioPatch() profile not supported for device %08x",
- devDesc->type());
+ ALOGV("%s profile not supported for device %08x", __func__, devDesc->type());
return INVALID_OPERATION;
}
devices.add(devDesc);
@@ -3493,19 +3462,19 @@
}
// TODO: reconfigure output format and channels here
- ALOGV("createAudioPatch() setting device %s on output %d",
- dumpDeviceTypes(devices.types()).c_str(), outputDesc->mIoHandle);
+ ALOGV("%s setting device %s on output %d",
+ __func__, dumpDeviceTypes(devices.types()).c_str(), outputDesc->mIoHandle);
setOutputDevices(outputDesc, devices, true, 0, handle);
index = mAudioPatches.indexOfKey(*handle);
if (index >= 0) {
if (patchDesc != 0 && patchDesc != mAudioPatches.valueAt(index)) {
- ALOGW("createAudioPatch() setOutputDevice() did not reuse the patch provided");
+ ALOGW("%s setOutputDevice() did not reuse the patch provided", __func__);
}
patchDesc = mAudioPatches.valueAt(index);
- patchDesc->mUid = uid;
- ALOGV("createAudioPatch() success");
+ patchDesc->setUid(uid);
+ ALOGV("%s success", __func__);
} else {
- ALOGW("createAudioPatch() setOutputDevice() failed to create a patch");
+ ALOGW("%s setOutputDevice() failed to create a patch", __func__);
return INVALID_OPERATION;
}
} else if (patch->sources[0].type == AUDIO_PORT_TYPE_DEVICE) {
@@ -3544,19 +3513,19 @@
return INVALID_OPERATION;
}
// TODO: reconfigure output format and channels here
- ALOGV("%s() setting device %s on output %d", __func__,
+ ALOGV("%s setting device %s on output %d", __func__,
device->toString().c_str(), inputDesc->mIoHandle);
setInputDevice(inputDesc->mIoHandle, device, true, handle);
index = mAudioPatches.indexOfKey(*handle);
if (index >= 0) {
if (patchDesc != 0 && patchDesc != mAudioPatches.valueAt(index)) {
- ALOGW("createAudioPatch() setInputDevice() did not reuse the patch provided");
+ ALOGW("%s setInputDevice() did not reuse the patch provided", __func__);
}
patchDesc = mAudioPatches.valueAt(index);
- patchDesc->mUid = uid;
- ALOGV("createAudioPatch() success");
+ patchDesc->setUid(uid);
+ ALOGV("%s success", __func__);
} else {
- ALOGW("createAudioPatch() setInputDevice() failed to create a patch");
+ ALOGW("%s setInputDevice() failed to create a patch", __func__);
return INVALID_OPERATION;
}
} else if (patch->sinks[0].type == AUDIO_PORT_TYPE_DEVICE) {
@@ -3574,55 +3543,96 @@
//update source and sink with our own data as the data passed in the patch may
// be incomplete.
- struct audio_patch newPatch = *patch;
- srcDevice->toAudioPortConfig(&newPatch.sources[0], &patch->sources[0]);
+ PatchBuilder patchBuilder;
+ audio_port_config sourcePortConfig = {};
+ srcDevice->toAudioPortConfig(&sourcePortConfig, &patch->sources[0]);
+ patchBuilder.addSource(sourcePortConfig);
for (size_t i = 0; i < patch->num_sinks; i++) {
if (patch->sinks[i].type != AUDIO_PORT_TYPE_DEVICE) {
- ALOGV("createAudioPatch() source device but one sink is not a device");
+ ALOGV("%s source device but one sink is not a device", __func__);
return INVALID_OPERATION;
}
-
sp<DeviceDescriptor> sinkDevice =
mAvailableOutputDevices.getDeviceFromId(patch->sinks[i].id);
if (sinkDevice == 0) {
return BAD_VALUE;
}
- sinkDevice->toAudioPortConfig(&newPatch.sinks[i], &patch->sinks[i]);
+ audio_port_config sinkPortConfig = {};
+ sinkDevice->toAudioPortConfig(&sinkPortConfig, &patch->sinks[i]);
+ patchBuilder.addSink(sinkPortConfig);
// create a software bridge in PatchPanel if:
// - source and sink devices are on different HW modules OR
// - audio HAL version is < 3.0
// - audio HAL version is >= 3.0 but no route has been declared between devices
+ // - called from startAudioSource (aka sourceDesc != nullptr) and source device does
+ // not have a gain controller
if (!srcDevice->hasSameHwModuleAs(sinkDevice) ||
(srcDevice->getModuleVersionMajor() < 3) ||
- !srcDevice->getModule()->supportsPatch(srcDevice, sinkDevice)) {
+ !srcDevice->getModule()->supportsPatch(srcDevice, sinkDevice) ||
+ (sourceDesc != nullptr &&
+ srcDevice->getAudioPort()->getGains().size() == 0)) {
// support only one sink device for now to simplify output selection logic
if (patch->num_sinks > 1) {
return INVALID_OPERATION;
}
- SortedVector<audio_io_handle_t> outputs =
- getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
- // if the sink device is reachable via an opened output stream, request to go via
- // this output stream by adding a second source to the patch description
- const audio_io_handle_t output = selectOutput(outputs);
- if (output != AUDIO_IO_HANDLE_NONE) {
- sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
- if (outputDesc->isDuplicated()) {
+ audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
+ if (sourceDesc != nullptr) {
+ // take care of dynamic routing for SwOutput selection,
+ audio_attributes_t attributes = sourceDesc->attributes();
+ audio_stream_type_t stream = sourceDesc->stream();
+ audio_attributes_t resultAttr;
+ audio_config_t config = AUDIO_CONFIG_INITIALIZER;
+ config.sample_rate = sourceDesc->config().sample_rate;
+ config.channel_mask = sourceDesc->config().channel_mask;
+ config.format = sourceDesc->config().format;
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
+ audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
+ bool isRequestedDeviceForExclusiveUse = false;
+ std::vector<sp<SwAudioOutputDescriptor>> secondaryOutputs;
+ getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE, &attributes,
+ &stream, sourceDesc->uid(), &config, &flags,
+ &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
+ &secondaryOutputs);
+ if (output == AUDIO_IO_HANDLE_NONE) {
+ ALOGV("%s no output for device %s",
+ __FUNCTION__, sinkDevice->toString().c_str());
return INVALID_OPERATION;
}
- outputDesc->toAudioPortConfig(&newPatch.sources[1], &patch->sources[0]);
- newPatch.sources[1].ext.mix.usecase.stream = AUDIO_STREAM_PATCH;
- newPatch.num_sources = 2;
+ } else {
+ SortedVector<audio_io_handle_t> outputs =
+ getOutputsForDevices(DeviceVector(sinkDevice), mOutputs);
+ // if the sink device is reachable via an opened output stream, request to
+ // go via this output stream by adding a second source to the patch
+ // description
+ output = selectOutput(outputs);
+ }
+ if (output != AUDIO_IO_HANDLE_NONE) {
+ sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
+ if (outputDesc->isDuplicated()) {
+ ALOGV("%s output for device %s is duplicated",
+ __FUNCTION__, sinkDevice->toString().c_str());
+ return INVALID_OPERATION;
+ }
+ audio_port_config srcMixPortConfig = {};
+ outputDesc->toAudioPortConfig(&srcMixPortConfig, &patch->sources[0]);
+ if (sourceDesc != nullptr) {
+ sourceDesc->setSwOutput(outputDesc);
+ }
+ // for volume control, we may need a valid stream
+ srcMixPortConfig.ext.mix.usecase.stream = sourceDesc != nullptr ?
+ sourceDesc->stream() : AUDIO_STREAM_PATCH;
+ patchBuilder.addSource(srcMixPortConfig);
}
}
}
// TODO: check from routing capabilities in config file and other conflicting patches
- status_t status = installPatch(__func__, index, handle, &newPatch, 0, uid, &patchDesc);
+ status_t status = installPatch(
+ __func__, index, handle, patchBuilder.patch(), delayMs, uid, &patchDesc);
if (status != NO_ERROR) {
- ALOGW("createAudioPatch() patch panel could not connect device patch, error %d",
- status);
+ ALOGW("%s patch panel could not connect device patch, error %d", __func__, status);
return INVALID_OPERATION;
}
} else {
@@ -3645,18 +3655,29 @@
return BAD_VALUE;
}
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- ALOGV("releaseAudioPatch() mUidCached %d patchDesc->mUid %d uid %d",
- mUidCached, patchDesc->mUid, uid);
- if (patchDesc->mUid != mUidCached && uid != patchDesc->mUid) {
+ ALOGV("%s() mUidCached %d patchDesc->mUid %d uid %d",
+ __func__, mUidCached, patchDesc->getUid(), uid);
+ if (patchDesc->getUid() != mUidCached && uid != patchDesc->getUid()) {
return INVALID_OPERATION;
}
+ return releaseAudioPatchInternal(handle);
+}
+status_t AudioPolicyManager::releaseAudioPatchInternal(audio_patch_handle_t handle,
+ uint32_t delayMs)
+{
+ ALOGV("%s patch %d", __func__, handle);
+ if (mAudioPatches.indexOfKey(handle) < 0) {
+ ALOGE("%s: no patch found with handle=%d", __func__, handle);
+ return BAD_VALUE;
+ }
+ sp<AudioPatch> patchDesc = mAudioPatches.valueFor(handle);
struct audio_patch *patch = &patchDesc->mPatch;
- patchDesc->mUid = mUidCached;
+ patchDesc->setUid(mUidCached);
if (patch->sources[0].type == AUDIO_PORT_TYPE_MIX) {
sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id);
if (outputDesc == NULL) {
- ALOGV("releaseAudioPatch() output not found for id %d", patch->sources[0].id);
+ ALOGV("%s output not found for id %d", __func__, patch->sources[0].id);
return BAD_VALUE;
}
@@ -3669,7 +3690,7 @@
if (patch->sinks[0].type == AUDIO_PORT_TYPE_MIX) {
sp<AudioInputDescriptor> inputDesc = mInputs.getInputFromId(patch->sinks[0].id);
if (inputDesc == NULL) {
- ALOGV("releaseAudioPatch() input not found for id %d", patch->sinks[0].id);
+ ALOGV("%s input not found for id %d", __func__, patch->sinks[0].id);
return BAD_VALUE;
}
setInputDevice(inputDesc->mIoHandle,
@@ -3677,10 +3698,11 @@
true,
NULL);
} else if (patch->sinks[0].type == AUDIO_PORT_TYPE_DEVICE) {
- status_t status = mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, 0);
- ALOGV("releaseAudioPatch() patch panel returned %d patchHandle %d",
- status, patchDesc->mAfPatchHandle);
- removeAudioPatch(patchDesc->mHandle);
+ status_t status =
+ mpClientInterface->releaseAudioPatch(patchDesc->getAfHandle(), delayMs);
+ ALOGV("%s patch panel returned %d patchHandle %d",
+ __func__, status, patchDesc->getAfHandle());
+ removeAudioPatch(patchDesc->getHandle());
nextAudioPortGeneration();
mpClientInterface->onAudioPatchListUpdate();
} else {
@@ -3778,7 +3800,7 @@
{
for (ssize_t i = (ssize_t)mAudioPatches.size() - 1; i >= 0; i--) {
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(i);
- if (patchDesc->mUid == uid) {
+ if (patchDesc->getUid() == uid) {
releaseAudioPatch(mAudioPatches.keyAt(i), uid);
}
}
@@ -3914,11 +3936,8 @@
*portId = PolicyAudioPort::getNextUniqueId();
- struct audio_patch dummyPatch = {};
- sp<AudioPatch> patchDesc = new AudioPatch(&dummyPatch, uid);
-
sp<SourceClientDescriptor> sourceDesc =
- new SourceClientDescriptor(*portId, uid, *attributes, patchDesc, srcDevice,
+ new SourceClientDescriptor(*portId, uid, *attributes, *source, srcDevice,
mEngine->getStreamTypeForAttributes(*attributes),
mEngine->getProductStrategyForAttributes(*attributes),
toVolumeSource(*attributes));
@@ -3938,7 +3957,6 @@
disconnectAudioSource(sourceDesc);
audio_attributes_t attributes = sourceDesc->attributes();
- audio_stream_type_t stream = sourceDesc->stream();
sp<DeviceDescriptor> srcDevice = sourceDesc->srcDevice();
DeviceVector sinkDevices =
@@ -3947,92 +3965,55 @@
sp<DeviceDescriptor> sinkDevice = sinkDevices.itemAt(0);
ALOG_ASSERT(mAvailableOutputDevices.contains(sinkDevice), "%s: Device %s not available",
__FUNCTION__, sinkDevice->toString().c_str());
-
- audio_patch_handle_t afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
-
- if (srcDevice->hasSameHwModuleAs(sinkDevice) &&
- srcDevice->getModuleVersionMajor() >= 3 &&
- sinkDevice->getModule()->supportsPatch(srcDevice, sinkDevice) &&
- srcDevice->getAudioPort()->getGains().size() > 0) {
- ALOGV("%s Device to Device route supported by >=3.0 HAL", __FUNCTION__);
- // TODO: may explicitly specify whether we should use HW or SW patch
- // create patch between src device and output device
- // create Hwoutput and add to mHwOutputs
- } else {
- audio_attributes_t resultAttr;
- audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
- audio_config_t config = AUDIO_CONFIG_INITIALIZER;
- config.sample_rate = sourceDesc->config().sample_rate;
- config.channel_mask = sourceDesc->config().channel_mask;
- config.format = sourceDesc->config().format;
- audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE;
- audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE;
- bool isRequestedDeviceForExclusiveUse = false;
- std::vector<sp<SwAudioOutputDescriptor>> secondaryOutputs;
- getOutputForAttrInt(&resultAttr, &output, AUDIO_SESSION_NONE,
- &attributes, &stream, sourceDesc->uid(), &config, &flags,
- &selectedDeviceId, &isRequestedDeviceForExclusiveUse,
- &secondaryOutputs);
- if (output == AUDIO_IO_HANDLE_NONE) {
- ALOGV("%s no output for device %s",
- __FUNCTION__, dumpDeviceTypes(sinkDevices.types()).c_str());
- return INVALID_OPERATION;
- }
- sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);
- if (outputDesc->isDuplicated()) {
- ALOGV("%s output for device %s is duplicated",
- __FUNCTION__, dumpDeviceTypes(sinkDevices.types()).c_str());
- return INVALID_OPERATION;
- }
- status_t status = outputDesc->start();
+ PatchBuilder patchBuilder;
+ patchBuilder.addSink(sinkDevice).addSource(srcDevice);
+ audio_patch_handle_t handle = AUDIO_PATCH_HANDLE_NONE;
+ status_t status =
+ createAudioPatchInternal(patchBuilder.patch(), &handle, mUidCached, 0, sourceDesc);
+ if (status != NO_ERROR || mAudioPatches.indexOfKey(handle) < 0) {
+ ALOGW("%s patch panel could not connect device patch, error %d", __func__, status);
+ return INVALID_OPERATION;
+ }
+ sourceDesc->setPatchHandle(handle);
+ // SW Bridge? (@todo: HW bridge, keep track of HwOutput for device selection "reconsideration")
+ sp<SwAudioOutputDescriptor> swOutput = sourceDesc->swOutput().promote();
+ if (swOutput != 0) {
+ status = swOutput->start();
if (status != NO_ERROR) {
- return status;
+ goto FailureSourceAdded;
}
-
- // create a special patch with no sink and two sources:
- // - the second source indicates to PatchPanel through which output mix this patch should
- // be connected as well as the stream type for volume control
- // - the sink is defined by whatever output device is currently selected for the output
- // though which this patch is routed.
- PatchBuilder patchBuilder;
- patchBuilder.addSource(srcDevice).addSource(outputDesc, { .stream = stream });
- status = mpClientInterface->createAudioPatch(patchBuilder.patch(),
- &afPatchHandle,
- 0);
- ALOGV("%s patch panel returned %d patchHandle %d", __FUNCTION__,
- status, afPatchHandle);
- sourceDesc->patchDesc()->mPatch = *patchBuilder.patch();
- if (status != NO_ERROR) {
- ALOGW("%s patch panel could not connect device patch, error %d",
- __FUNCTION__, status);
- return INVALID_OPERATION;
- }
-
- if (outputDesc->getClient(sourceDesc->portId()) != nullptr) {
+ if (swOutput->getClient(sourceDesc->portId()) != nullptr) {
ALOGW("%s source portId has already been attached to outputDesc", __func__);
- return INVALID_OPERATION;
+ goto FailureReleasePatch;
}
- outputDesc->addClient(sourceDesc);
-
+ swOutput->addClient(sourceDesc);
uint32_t delayMs = 0;
- status = startSource(outputDesc, sourceDesc, &delayMs);
-
+ status = startSource(swOutput, sourceDesc, &delayMs);
if (status != NO_ERROR) {
- mpClientInterface->releaseAudioPatch(sourceDesc->patchDesc()->mAfPatchHandle, 0);
- outputDesc->removeClient(sourceDesc->portId());
- outputDesc->stop();
- return status;
+ ALOGW("%s failed to start source, error %d", __FUNCTION__, status);
+ goto FailureSourceActive;
}
- sourceDesc->setSwOutput(outputDesc);
if (delayMs != 0) {
usleep(delayMs * 1000);
}
+ } else {
+ sp<HwAudioOutputDescriptor> hwOutputDesc = sourceDesc->hwOutput().promote();
+ if (hwOutputDesc != 0) {
+ // create Hwoutput and add to mHwOutputs
+ } else {
+ ALOGW("%s source has neither SW nor HW output", __FUNCTION__);
+ }
}
-
- sourceDesc->patchDesc()->mAfPatchHandle = afPatchHandle;
- addAudioPatch(sourceDesc->patchDesc()->mHandle, sourceDesc->patchDesc());
-
return NO_ERROR;
+
+FailureSourceActive:
+ swOutput->stop();
+ releaseOutput(sourceDesc->portId());
+FailureSourceAdded:
+ sourceDesc->setSwOutput(nullptr);
+FailureReleasePatch:
+ releaseAudioPatchInternal(handle);
+ return INVALID_OPERATION;
}
status_t AudioPolicyManager::stopAudioSource(audio_port_handle_t portId)
@@ -4270,33 +4251,22 @@
status_t AudioPolicyManager::disconnectAudioSource(const sp<SourceClientDescriptor>& sourceDesc)
{
ALOGV("%s port Id %d", __FUNCTION__, sourceDesc->portId());
-
- sp<AudioPatch> patchDesc = mAudioPatches.valueFor(sourceDesc->patchDesc()->mHandle);
- if (patchDesc == 0) {
- ALOGW("%s source has no patch with handle %d", __FUNCTION__,
- sourceDesc->patchDesc()->mHandle);
- return BAD_VALUE;
- }
- removeAudioPatch(sourceDesc->patchDesc()->mHandle);
-
- sp<SwAudioOutputDescriptor> swOutputDesc = sourceDesc->swOutput().promote();
- if (swOutputDesc != 0) {
- status_t status = stopSource(swOutputDesc, sourceDesc);
+ sp<SwAudioOutputDescriptor> swOutput = sourceDesc->swOutput().promote();
+ if (swOutput != 0) {
+ status_t status = stopSource(swOutput, sourceDesc);
if (status == NO_ERROR) {
- swOutputDesc->stop();
+ swOutput->stop();
}
- swOutputDesc->removeClient(sourceDesc->portId());
- mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, 0);
+ releaseOutput(sourceDesc->portId());
} else {
sp<HwAudioOutputDescriptor> hwOutputDesc = sourceDesc->hwOutput().promote();
if (hwOutputDesc != 0) {
- // release patch between src device and output device
// close Hwoutput and remove from mHwOutputs
} else {
ALOGW("%s source has neither SW nor HW output", __FUNCTION__);
}
}
- return NO_ERROR;
+ return releaseAudioPatchInternal(sourceDesc->getPatchHandle());
}
sp<SourceClientDescriptor> AudioPolicyManager::getSourceForAttributesOnOutput(
@@ -4370,7 +4340,7 @@
mpClientInterface(clientInterface),
mLimitRingtoneVolume(false), mLastVoiceVolume(-1.0f),
mA2dpSuspended(false),
- mConfig(mHwModulesAll, mAvailableOutputDevices, mAvailableInputDevices, mDefaultOutputDevice),
+ mConfig(mHwModulesAll, mOutputDevicesAll, mInputDevicesAll, mDefaultOutputDevice),
mAudioPortGeneration(1),
mBeaconMuteRefCount(0),
mBeaconPlayingRefCount(0),
@@ -4415,141 +4385,9 @@
return status;
}
- // mAvailableOutputDevices and mAvailableInputDevices now contain all attached devices
+ // after parsing the config, mOutputDevicesAll and mInputDevicesAll contain all known devices;
// open all output streams needed to access attached devices
- for (const auto& hwModule : mHwModulesAll) {
- hwModule->setHandle(mpClientInterface->loadHwModule(hwModule->getName()));
- if (hwModule->getHandle() == AUDIO_MODULE_HANDLE_NONE) {
- ALOGW("could not open HW module %s", hwModule->getName());
- continue;
- }
- mHwModules.push_back(hwModule);
- // open all output streams needed to access attached devices
- // except for direct output streams that are only opened when they are actually
- // required by an app.
- // This also validates mAvailableOutputDevices list
- for (const auto& outProfile : hwModule->getOutputProfiles()) {
- if (!outProfile->canOpenNewIo()) {
- ALOGE("Invalid Output profile max open count %u for profile %s",
- outProfile->maxOpenCount, outProfile->getTagName().c_str());
- continue;
- }
- if (!outProfile->hasSupportedDevices()) {
- ALOGW("Output profile contains no device on module %s", hwModule->getName());
- continue;
- }
- if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_TTS) != 0) {
- mTtsOutputAvailable = true;
- }
-
- if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT) != 0) {
- continue;
- }
- const DeviceVector &supportedDevices = outProfile->getSupportedDevices();
- DeviceVector availProfileDevices = supportedDevices.filter(mAvailableOutputDevices);
- sp<DeviceDescriptor> supportedDevice = 0;
- if (supportedDevices.contains(mDefaultOutputDevice)) {
- supportedDevice = mDefaultOutputDevice;
- } else {
- // choose first device present in profile's SupportedDevices also part of
- // mAvailableOutputDevices.
- if (availProfileDevices.isEmpty()) {
- continue;
- }
- supportedDevice = availProfileDevices.itemAt(0);
- }
- if (!mAvailableOutputDevices.contains(supportedDevice)) {
- continue;
- }
- sp<SwAudioOutputDescriptor> outputDesc = new SwAudioOutputDescriptor(outProfile,
- mpClientInterface);
- audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
- status_t status = outputDesc->open(nullptr, DeviceVector(supportedDevice),
- AUDIO_STREAM_DEFAULT,
- AUDIO_OUTPUT_FLAG_NONE, &output);
- if (status != NO_ERROR) {
- ALOGW("Cannot open output stream for devices %s on hw module %s",
- supportedDevice->toString().c_str(), hwModule->getName());
- continue;
- }
- for (const auto &device : availProfileDevices) {
- // give a valid ID to an attached device once confirmed it is reachable
- if (!device->isAttached()) {
- device->attach(hwModule);
- }
- }
- if (mPrimaryOutput == 0 &&
- outProfile->getFlags() & AUDIO_OUTPUT_FLAG_PRIMARY) {
- mPrimaryOutput = outputDesc;
- }
- addOutput(output, outputDesc);
- setOutputDevices(outputDesc,
- DeviceVector(supportedDevice),
- true,
- 0,
- NULL);
- }
- // open input streams needed to access attached devices to validate
- // mAvailableInputDevices list
- for (const auto& inProfile : hwModule->getInputProfiles()) {
- if (!inProfile->canOpenNewIo()) {
- ALOGE("Invalid Input profile max open count %u for profile %s",
- inProfile->maxOpenCount, inProfile->getTagName().c_str());
- continue;
- }
- if (!inProfile->hasSupportedDevices()) {
- ALOGW("Input profile contains no device on module %s", hwModule->getName());
- continue;
- }
- // chose first device present in profile's SupportedDevices also part of
- // available input devices
- const DeviceVector &supportedDevices = inProfile->getSupportedDevices();
- DeviceVector availProfileDevices = supportedDevices.filter(mAvailableInputDevices);
- if (availProfileDevices.isEmpty()) {
- ALOGE("%s: Input device list is empty!", __FUNCTION__);
- continue;
- }
- sp<AudioInputDescriptor> inputDesc =
- new AudioInputDescriptor(inProfile, mpClientInterface);
-
- audio_io_handle_t input = AUDIO_IO_HANDLE_NONE;
- status_t status = inputDesc->open(nullptr,
- availProfileDevices.itemAt(0),
- AUDIO_SOURCE_MIC,
- AUDIO_INPUT_FLAG_NONE,
- &input);
- if (status != NO_ERROR) {
- ALOGW("Cannot open input stream for device %s on hw module %s",
- availProfileDevices.toString().c_str(),
- hwModule->getName());
- continue;
- }
- for (const auto &device : availProfileDevices) {
- // give a valid ID to an attached device once confirmed it is reachable
- if (!device->isAttached()) {
- device->attach(hwModule);
- device->importAudioPortAndPickAudioProfile(inProfile, true);
- }
- }
- inputDesc->close();
- }
- }
- // make sure all attached devices have been allocated a unique ID
- auto checkAndSetAvailable = [this](auto& devices) {
- for (size_t i = 0; i < devices.size();) {
- const auto &device = devices[i];
- if (!device->isAttached()) {
- ALOGW("device %s is unreachable", device->toString().c_str());
- devices.remove(device);
- continue;
- }
- // Device is now validated and can be appended to the available devices of the engine
- setEngineDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_AVAILABLE);
- i++;
- }
- };
- checkAndSetAvailable(mAvailableOutputDevices);
- checkAndSetAvailable(mAvailableInputDevices);
+ onNewAudioModulesAvailable();
// make sure default device is reachable
if (mDefaultOutputDevice == 0 || !mAvailableOutputDevices.contains(mDefaultOutputDevice)) {
@@ -4604,6 +4442,134 @@
// ---
+void AudioPolicyManager::onNewAudioModulesAvailable()
+{
+ for (const auto& hwModule : mHwModulesAll) {
+ if (std::find(mHwModules.begin(), mHwModules.end(), hwModule) != mHwModules.end()) {
+ continue;
+ }
+ hwModule->setHandle(mpClientInterface->loadHwModule(hwModule->getName()));
+ if (hwModule->getHandle() == AUDIO_MODULE_HANDLE_NONE) {
+ ALOGW("could not open HW module %s", hwModule->getName());
+ continue;
+ }
+ mHwModules.push_back(hwModule);
+ // open all output streams needed to access attached devices
+ // except for direct output streams that are only opened when they are actually
+ // required by an app.
+ // This also validates mAvailableOutputDevices list
+ for (const auto& outProfile : hwModule->getOutputProfiles()) {
+ if (!outProfile->canOpenNewIo()) {
+ ALOGE("Invalid Output profile max open count %u for profile %s",
+ outProfile->maxOpenCount, outProfile->getTagName().c_str());
+ continue;
+ }
+ if (!outProfile->hasSupportedDevices()) {
+ ALOGW("Output profile contains no device on module %s", hwModule->getName());
+ continue;
+ }
+ if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_TTS) != 0) {
+ mTtsOutputAvailable = true;
+ }
+
+ if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT) != 0) {
+ continue;
+ }
+ const DeviceVector &supportedDevices = outProfile->getSupportedDevices();
+ DeviceVector availProfileDevices = supportedDevices.filter(mOutputDevicesAll);
+ sp<DeviceDescriptor> supportedDevice = 0;
+ if (supportedDevices.contains(mDefaultOutputDevice)) {
+ supportedDevice = mDefaultOutputDevice;
+ } else {
+ // choose first device present in profile's SupportedDevices also part of
+ // mAvailableOutputDevices.
+ if (availProfileDevices.isEmpty()) {
+ continue;
+ }
+ supportedDevice = availProfileDevices.itemAt(0);
+ }
+ if (!mOutputDevicesAll.contains(supportedDevice)) {
+ continue;
+ }
+ sp<SwAudioOutputDescriptor> outputDesc = new SwAudioOutputDescriptor(outProfile,
+ mpClientInterface);
+ audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
+ status_t status = outputDesc->open(nullptr, DeviceVector(supportedDevice),
+ AUDIO_STREAM_DEFAULT,
+ AUDIO_OUTPUT_FLAG_NONE, &output);
+ if (status != NO_ERROR) {
+ ALOGW("Cannot open output stream for devices %s on hw module %s",
+ supportedDevice->toString().c_str(), hwModule->getName());
+ continue;
+ }
+ for (const auto &device : availProfileDevices) {
+ // give a valid ID to an attached device once confirmed it is reachable
+ if (!device->isAttached()) {
+ device->attach(hwModule);
+ mAvailableOutputDevices.add(device);
+ setEngineDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_AVAILABLE);
+ }
+ }
+ if (mPrimaryOutput == 0 &&
+ outProfile->getFlags() & AUDIO_OUTPUT_FLAG_PRIMARY) {
+ mPrimaryOutput = outputDesc;
+ }
+ addOutput(output, outputDesc);
+ setOutputDevices(outputDesc,
+ DeviceVector(supportedDevice),
+ true,
+ 0,
+ NULL);
+ }
+ // open input streams needed to access attached devices to validate
+ // mAvailableInputDevices list
+ for (const auto& inProfile : hwModule->getInputProfiles()) {
+ if (!inProfile->canOpenNewIo()) {
+ ALOGE("Invalid Input profile max open count %u for profile %s",
+ inProfile->maxOpenCount, inProfile->getTagName().c_str());
+ continue;
+ }
+ if (!inProfile->hasSupportedDevices()) {
+ ALOGW("Input profile contains no device on module %s", hwModule->getName());
+ continue;
+ }
+ // chose first device present in profile's SupportedDevices also part of
+ // available input devices
+ const DeviceVector &supportedDevices = inProfile->getSupportedDevices();
+ DeviceVector availProfileDevices = supportedDevices.filter(mInputDevicesAll);
+ if (availProfileDevices.isEmpty()) {
+ ALOGE("%s: Input device list is empty!", __FUNCTION__);
+ continue;
+ }
+ sp<AudioInputDescriptor> inputDesc =
+ new AudioInputDescriptor(inProfile, mpClientInterface);
+
+ audio_io_handle_t input = AUDIO_IO_HANDLE_NONE;
+ status_t status = inputDesc->open(nullptr,
+ availProfileDevices.itemAt(0),
+ AUDIO_SOURCE_MIC,
+ AUDIO_INPUT_FLAG_NONE,
+ &input);
+ if (status != NO_ERROR) {
+ ALOGW("Cannot open input stream for device %s on hw module %s",
+ availProfileDevices.toString().c_str(),
+ hwModule->getName());
+ continue;
+ }
+ for (const auto &device : availProfileDevices) {
+ // give a valid ID to an attached device once confirmed it is reachable
+ if (!device->isAttached()) {
+ device->attach(hwModule);
+ device->importAudioPortAndPickAudioProfile(inProfile, true);
+ mAvailableInputDevices.add(device);
+ setEngineDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_AVAILABLE);
+ }
+ }
+ inputDesc->close();
+ }
+ }
+}
+
void AudioPolicyManager::addOutput(audio_io_handle_t output,
const sp<SwAudioOutputDescriptor>& outputDesc)
{
@@ -5004,7 +4970,8 @@
ssize_t index = mAudioPatches.indexOfKey(closingOutput->getPatchHandle());
if (index >= 0) {
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- (void) /*status_t status*/ mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, 0);
+ (void) /*status_t status*/ mpClientInterface->releaseAudioPatch(
+ patchDesc->getAfHandle(), 0);
mAudioPatches.removeItemsAt(index);
mpClientInterface->onAudioPatchListUpdate();
}
@@ -5052,7 +5019,8 @@
ssize_t index = mAudioPatches.indexOfKey(inputDesc->getPatchHandle());
if (index >= 0) {
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- (void) /*status_t status*/ mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, 0);
+ (void) /*status_t status*/ mpClientInterface->releaseAudioPatch(
+ patchDesc->getAfHandle(), 0);
mAudioPatches.removeItemsAt(index);
mpClientInterface->onAudioPatchListUpdate();
}
@@ -5265,7 +5233,7 @@
ssize_t index = mAudioPatches.indexOfKey(outputDesc->getPatchHandle());
if (index >= 0) {
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- if (patchDesc->mUid != mUidCached) {
+ if (patchDesc->getUid() != mUidCached) {
ALOGV("%s device %s forced by patch %d", __func__,
outputDesc->devices().toString().c_str(), outputDesc->getPatchHandle());
return outputDesc->devices();
@@ -5316,7 +5284,7 @@
ssize_t index = mAudioPatches.indexOfKey(inputDesc->getPatchHandle());
if (index >= 0) {
sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- if (patchDesc->mUid != mUidCached) {
+ if (patchDesc->getUid() != mUidCached) {
ALOGV("getNewInputDevice() device %s forced by patch %d",
inputDesc->getDevice()->toString().c_str(), inputDesc->getPatchHandle());
return inputDesc->getDevice();
@@ -5643,10 +5611,10 @@
return INVALID_OPERATION;
}
sp< AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- status_t status = mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, delayMs);
+ status_t status = mpClientInterface->releaseAudioPatch(patchDesc->getAfHandle(), delayMs);
ALOGV("resetOutputDevice() releaseAudioPatch returned %d", status);
outputDesc->setPatchHandle(AUDIO_PATCH_HANDLE_NONE);
- removeAudioPatch(patchDesc->mHandle);
+ removeAudioPatch(patchDesc->getHandle());
nextAudioPortGeneration();
mpClientInterface->onAudioPatchListUpdate();
return status;
@@ -5696,10 +5664,10 @@
return INVALID_OPERATION;
}
sp< AudioPatch> patchDesc = mAudioPatches.valueAt(index);
- status_t status = mpClientInterface->releaseAudioPatch(patchDesc->mAfPatchHandle, 0);
+ status_t status = mpClientInterface->releaseAudioPatch(patchDesc->getAfHandle(), 0);
ALOGV("resetInputDevice() releaseAudioPatch returned %d", status);
inputDesc->setPatchHandle(AUDIO_PATCH_HANDLE_NONE);
- removeAudioPatch(patchDesc->mHandle);
+ removeAudioPatch(patchDesc->getHandle());
nextAudioPortGeneration();
mpClientInterface->onAudioPatchListUpdate();
return status;
@@ -6112,8 +6080,8 @@
}
}
if (release) {
- ALOGV("%s releasing patch %u", __FUNCTION__, patchDesc->mHandle);
- releaseAudioPatch(patchDesc->mHandle, patchDesc->mUid);
+ ALOGV("%s releasing patch %u", __FUNCTION__, patchDesc->getHandle());
+ releaseAudioPatch(patchDesc->getHandle(), patchDesc->getUid());
}
}
@@ -6288,7 +6256,7 @@
status_t status = installPatch(
caller, index, patchHandle, patch, delayMs, mUidCached, &patchDesc);
if (status == NO_ERROR) {
- ioDescriptor->setPatchHandle(patchDesc->mHandle);
+ ioDescriptor->setPatchHandle(patchDesc->getHandle());
}
return status;
}
@@ -6305,7 +6273,7 @@
audio_patch_handle_t afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
if (index >= 0) {
patchDesc = mAudioPatches.valueAt(index);
- afPatchHandle = patchDesc->mAfPatchHandle;
+ afPatchHandle = patchDesc->getAfHandle();
}
status_t status = mpClientInterface->createAudioPatch(patch, &afPatchHandle, delayMs);
@@ -6314,13 +6282,13 @@
if (status == NO_ERROR) {
if (index < 0) {
patchDesc = new AudioPatch(patch, uid);
- addAudioPatch(patchDesc->mHandle, patchDesc);
+ addAudioPatch(patchDesc->getHandle(), patchDesc);
} else {
patchDesc->mPatch = *patch;
}
- patchDesc->mAfPatchHandle = afPatchHandle;
+ patchDesc->setAfHandle(afPatchHandle);
if (patchHandle) {
- *patchHandle = patchDesc->mHandle;
+ *patchHandle = patchDesc->getHandle();
}
nextAudioPortGeneration();
mpClientInterface->onAudioPatchListUpdate();
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index d516d7b..4604676 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -233,7 +233,10 @@
virtual status_t getAudioPort(struct audio_port *port);
virtual status_t createAudioPatch(const struct audio_patch *patch,
audio_patch_handle_t *handle,
- uid_t uid);
+ uid_t uid) {
+ return createAudioPatchInternal(patch, handle, uid);
+ }
+
virtual status_t releaseAudioPatch(audio_patch_handle_t handle,
uid_t uid);
virtual status_t listAudioPatches(unsigned int *num_patches,
@@ -312,6 +315,8 @@
return volumeGroup != VOLUME_GROUP_NONE ? NO_ERROR : BAD_VALUE;
}
+ void onNewAudioModulesAvailable() override;
+
status_t initialize();
protected:
@@ -714,6 +719,8 @@
SwAudioOutputCollection mPreviousOutputs;
AudioInputCollection mInputs; // list of input descriptors
+ DeviceVector mOutputDevicesAll; // all output devices from the config
+ DeviceVector mInputDevicesAll; // all input devices from the config
DeviceVector mAvailableOutputDevices; // all available output devices
DeviceVector mAvailableInputDevices; // all available input devices
@@ -724,9 +731,8 @@
EffectDescriptorCollection mEffects; // list of registered audio effects
sp<DeviceDescriptor> mDefaultOutputDevice; // output device selected by default at boot time
- HwModuleCollection mHwModules; // contains only modules that have been loaded successfully
- HwModuleCollection mHwModulesAll; // normally not needed, used during construction and for
- // dumps
+ HwModuleCollection mHwModules; // contains modules that have been loaded successfully
+ HwModuleCollection mHwModulesAll; // contains all modules declared in the config
AudioPolicyConfig mConfig;
@@ -868,6 +874,29 @@
param.addInt(String8(AudioParameter::keyMonoOutput), (int)mMasterMono);
mpClientInterface->setParameters(output, param.toString());
}
+
+ /**
+ * @brief createAudioPatchInternal internal function to manage audio patch creation
+ * @param[in] patch structure containing sink and source ports configuration
+ * @param[out] handle patch handle to be provided if patch installed correctly
+ * @param[in] uid of the client
+ * @param[in] delayMs if required
+ * @param[in] sourceDesc [optional] in case of external source, source client to be
+ * configured by the patch, i.e. assigning an Output (HW or SW)
+ * @return NO_ERROR if patch installed correclty, error code otherwise.
+ */
+ status_t createAudioPatchInternal(const struct audio_patch *patch,
+ audio_patch_handle_t *handle,
+ uid_t uid, uint32_t delayMs = 0,
+ const sp<SourceClientDescriptor>& sourceDesc = nullptr);
+ /**
+ * @brief releaseAudioPatchInternal internal function to remove an audio patch
+ * @param[in] handle of the patch to be removed
+ * @param[in] delayMs if required
+ * @return NO_ERROR if patch removed correclty, error code otherwise.
+ */
+ status_t releaseAudioPatchInternal(audio_patch_handle_t handle, uint32_t delayMs = 0);
+
status_t installPatch(const char *caller,
audio_patch_handle_t *patchHandle,
AudioIODescriptorInterface *ioDescriptor,
diff --git a/services/audiopolicy/service/AudioPolicyEffects.cpp b/services/audiopolicy/service/AudioPolicyEffects.cpp
index 60caa31..738a279 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.cpp
+++ b/services/audiopolicy/service/AudioPolicyEffects.cpp
@@ -42,7 +42,10 @@
AudioPolicyEffects::AudioPolicyEffects()
{
status_t loadResult = loadAudioEffectXmlConfig();
- if (loadResult < 0) {
+ if (loadResult == NO_ERROR) {
+ mDefaultDeviceEffectFuture = std::async(
+ std::launch::async, &AudioPolicyEffects::initDefaultDeviceEffects, this);
+ } else if (loadResult < 0) {
ALOGW("Failed to load XML effect configuration, fallback to .conf");
// load automatic audio effect modules
if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE, R_OK) == 0) {
@@ -908,8 +911,24 @@
streams.add(stream.type, effectDescs.release());
}
};
+
+ auto loadDeviceProcessingChain = [](auto &processingChain, auto& devicesEffects) {
+ for (auto& deviceProcess : processingChain) {
+
+ auto effectDescs = std::make_unique<EffectDescVector>();
+ for (auto& effect : deviceProcess.effects) {
+ effectDescs->mEffects.add(
+ new EffectDesc{effect.get().name.c_str(), effect.get().uuid});
+ }
+ auto deviceEffects = std::make_unique<DeviceEffects>(
+ std::move(effectDescs), deviceProcess.type, deviceProcess.address);
+ devicesEffects.emplace(deviceProcess.address, std::move(deviceEffects));
+ }
+ };
+
loadProcessingChain(result.parsedConfig->preprocess, mInputSources);
loadProcessingChain(result.parsedConfig->postprocess, mOutputStreams);
+ loadDeviceProcessingChain(result.parsedConfig->deviceprocess, mDeviceEffects);
// Casting from ssize_t to status_t is probably safe, there should not be more than 2^31 errors
return result.nbSkippedElement;
}
@@ -942,5 +961,32 @@
return NO_ERROR;
}
+void AudioPolicyEffects::initDefaultDeviceEffects()
+{
+ Mutex::Autolock _l(mLock);
+ for (const auto& deviceEffectsIter : mDeviceEffects) {
+ const auto& deviceEffects = deviceEffectsIter.second;
+ for (const auto& effectDesc : deviceEffects->mEffectDescriptors->mEffects) {
+ auto fx = std::make_unique<AudioEffect>(
+ EFFECT_UUID_NULL, String16("android"), &effectDesc->mUuid, 0, nullptr,
+ nullptr, AUDIO_SESSION_DEVICE, AUDIO_IO_HANDLE_NONE,
+ AudioDeviceTypeAddr{deviceEffects->getDeviceType(),
+ deviceEffects->getDeviceAddress()});
+ status_t status = fx->initCheck();
+ if (status != NO_ERROR && status != ALREADY_EXISTS) {
+ ALOGE("%s(): failed to create Fx %s on port type=%d address=%s", __func__,
+ effectDesc->mName, deviceEffects->getDeviceType(),
+ deviceEffects->getDeviceAddress().c_str());
+ // fx goes out of scope and strong ref on AudioEffect is released
+ continue;
+ }
+ fx->setEnabled(true);
+ ALOGV("%s(): create Fx %s added on port type=%d address=%s", __func__,
+ effectDesc->mName, deviceEffects->getDeviceType(),
+ deviceEffects->getDeviceAddress().c_str());
+ deviceEffects->mEffects.push_back(std::move(fx));
+ }
+ }
+}
} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h
index dcf093b..88be1ad 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.h
+++ b/services/audiopolicy/service/AudioPolicyEffects.h
@@ -25,6 +25,9 @@
#include <system/audio.h>
#include <utils/Vector.h>
#include <utils/SortedVector.h>
+#include <android-base/thread_annotations.h>
+
+#include <future>
namespace android {
@@ -104,6 +107,7 @@
status_t removeStreamDefaultEffect(audio_unique_id_t id);
private:
+ void initDefaultDeviceEffects();
// class to store the description of an effects and its parameters
// as defined in audio_effects.conf
@@ -192,6 +196,28 @@
Vector< sp<AudioEffect> >mEffects;
};
+ /**
+ * @brief The DeviceEffects class stores the effects associated to a given Device Port.
+ */
+ class DeviceEffects {
+ public:
+ explicit DeviceEffects(std::unique_ptr<EffectDescVector> effectDescriptors,
+ audio_devices_t device, const std::string& address) :
+ mEffectDescriptors(std::move(effectDescriptors)),
+ mDeviceType(device), mDeviceAddress(address) {}
+ /*virtual*/ ~DeviceEffects() = default;
+
+ std::vector<std::unique_ptr<AudioEffect>> mEffects;
+ audio_devices_t getDeviceType() const { return mDeviceType; }
+ std::string getDeviceAddress() const { return mDeviceAddress; }
+ const std::unique_ptr<EffectDescVector> mEffectDescriptors;
+
+ private:
+ const audio_devices_t mDeviceType;
+ const std::string mDeviceAddress;
+
+ };
+
static const char * const kInputSourceNames[AUDIO_SOURCE_CNT -1];
static audio_source_t inputSourceNameToEnum(const char *name);
@@ -237,6 +263,19 @@
KeyedVector< audio_stream_type_t, EffectDescVector* > mOutputStreams;
// Automatic output effects are unique for audiosession ID
KeyedVector< audio_session_t, EffectVector* > mOutputSessions;
+
+ /**
+ * @brief mDeviceEffects map of device effects indexed by the device address
+ */
+ std::map<std::string, std::unique_ptr<DeviceEffects>> mDeviceEffects GUARDED_BY(mLock);
+
+ /**
+ * Device Effect initialization must be asynchronous: the audio_policy service parses and init
+ * effect on first reference. AudioFlinger will handle effect creation and register these
+ * effect on audio_policy service.
+ * We must store the reference of the furture garantee real asynchronous operation.
+ */
+ std::future<void> mDefaultDeviceEffectFuture;
};
} // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index c1190be..227adc7 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -28,6 +28,14 @@
// ----------------------------------------------------------------------------
+void AudioPolicyService::doOnNewAudioModulesAvailable()
+{
+ if (mAudioPolicyManager == NULL) return;
+ Mutex::Autolock _l(mLock);
+ AutoCallerClear acc;
+ mAudioPolicyManager->onNewAudioModulesAvailable();
+}
+
status_t AudioPolicyService::setDeviceConnectionState(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 90939ce..3d9278b 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -1278,6 +1278,16 @@
mLock.lock();
}
} break;
+ case AUDIO_MODULES_UPDATE: {
+ ALOGV("AudioCommandThread() processing audio modules update");
+ svc = mService.promote();
+ if (svc == 0) {
+ break;
+ }
+ mLock.unlock();
+ svc->doOnNewAudioModulesAvailable();
+ mLock.lock();
+ } break;
default:
ALOGW("AudioCommandThread() unknown command %d", command->mCommand);
@@ -1567,6 +1577,13 @@
sendCommand(command);
}
+void AudioPolicyService::AudioCommandThread::audioModulesUpdateCommand()
+{
+ sp<AudioCommand> command = new AudioCommand();
+ command->mCommand = AUDIO_MODULES_UPDATE;
+ sendCommand(command);
+}
+
status_t AudioPolicyService::AudioCommandThread::sendCommand(sp<AudioCommand>& command, int delayMs)
{
{
@@ -1814,6 +1831,11 @@
mAudioCommandThread->setEffectSuspendedCommand(effectId, sessionId, suspended);
}
+void AudioPolicyService::onNewAudioModulesAvailable()
+{
+ mAudioCommandThread->audioModulesUpdateCommand();
+}
+
extern "C" {
audio_module_handle_t aps_load_hw_module(void *service __unused,
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index 7b72dc1..0370438 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -60,6 +60,7 @@
// BnAudioPolicyService (see AudioPolicyInterface for method descriptions)
//
+ void onNewAudioModulesAvailable() override;
virtual status_t setDeviceConnectionState(audio_devices_t device,
audio_policy_dev_state_t state,
const char *device_address,
@@ -268,6 +269,7 @@
virtual status_t setRttEnabled(bool enabled);
+ void doOnNewAudioModulesAvailable();
status_t doStopOutput(audio_port_handle_t portId);
void doReleaseOutput(audio_port_handle_t portId);
@@ -450,6 +452,7 @@
DYN_POLICY_MIX_STATE_UPDATE,
RECORDING_CONFIGURATION_UPDATE,
SET_EFFECT_SUSPENDED,
+ AUDIO_MODULES_UPDATE,
};
AudioCommandThread (String8 name, const wp<AudioPolicyService>& service);
@@ -495,6 +498,7 @@
void setEffectSuspendedCommand(int effectId,
audio_session_t sessionId,
bool suspended);
+ void audioModulesUpdateCommand();
void insertCommand_l(AudioCommand *command, int delayMs = 0);
private:
class AudioCommandData;
diff --git a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
index c2a92d7..af69466 100644
--- a/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
+++ b/services/audiopolicy/tests/AudioPolicyManagerTestClient.h
@@ -15,6 +15,7 @@
*/
#include <map>
+#include <set>
#include <system/audio.h>
#include <utils/Log.h>
@@ -27,7 +28,10 @@
class AudioPolicyManagerTestClient : public AudioPolicyTestClient {
public:
// AudioPolicyClientInterface implementation
- audio_module_handle_t loadHwModule(const char * /*name*/) override {
+ audio_module_handle_t loadHwModule(const char* name) override {
+ if (!mAllowedModuleNames.empty() && !mAllowedModuleNames.count(name)) {
+ return AUDIO_MODULE_HANDLE_NONE;
+ }
return mNextModuleHandle++;
}
@@ -101,11 +105,18 @@
return &it->second;
};
+ audio_module_handle_t peekNextModuleHandle() const { return mNextModuleHandle; }
+
+ void swapAllowedModuleNames(std::set<std::string>&& names = {}) {
+ mAllowedModuleNames.swap(names);
+ }
+
private:
audio_module_handle_t mNextModuleHandle = AUDIO_MODULE_HANDLE_NONE + 1;
audio_io_handle_t mNextIoHandle = AUDIO_IO_HANDLE_NONE + 1;
audio_patch_handle_t mNextPatchHandle = AUDIO_PATCH_HANDLE_NONE + 1;
std::map<audio_patch_handle_t, struct audio_patch> mActivePatches;
+ std::set<std::string> mAllowedModuleNames;
};
} // namespace android
diff --git a/services/audiopolicy/tests/AudioPolicyTestManager.h b/services/audiopolicy/tests/AudioPolicyTestManager.h
index c77dcdc..e8c2d33 100644
--- a/services/audiopolicy/tests/AudioPolicyTestManager.h
+++ b/services/audiopolicy/tests/AudioPolicyTestManager.h
@@ -26,6 +26,8 @@
using AudioPolicyManager::getConfig;
using AudioPolicyManager::loadConfig;
using AudioPolicyManager::initialize;
+ using AudioPolicyManager::getAvailableOutputDevices;
+ using AudioPolicyManager::getAvailableInputDevices;
};
} // namespace android
diff --git a/services/audiopolicy/tests/audio_health_tests.cpp b/services/audiopolicy/tests/audio_health_tests.cpp
index 8736cf1..b5c67a1 100644
--- a/services/audiopolicy/tests/audio_health_tests.cpp
+++ b/services/audiopolicy/tests/audio_health_tests.cpp
@@ -67,10 +67,10 @@
manager.loadConfig();
ASSERT_NE("AudioPolicyConfig::setDefault", manager.getConfig().getSource());
- for (auto desc : manager.getConfig().getAvailableInputDevices()) {
+ for (auto desc : manager.getConfig().getInputDevices()) {
ASSERT_NE(attachedDevices.end(), attachedDevices.find(desc->type()));
}
- for (auto desc : manager.getConfig().getAvailableOutputDevices()) {
+ for (auto desc : manager.getConfig().getOutputDevices()) {
ASSERT_NE(attachedDevices.end(), attachedDevices.find(desc->type()));
}
}
diff --git a/services/audiopolicy/tests/audiopolicymanager_tests.cpp b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
index 0263597..acd61ed 100644
--- a/services/audiopolicy/tests/audiopolicymanager_tests.cpp
+++ b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
@@ -292,9 +292,9 @@
audio_patch_handle_t handle = AUDIO_PATCH_HANDLE_NONE;
uid_t uid = 42;
const PatchCountCheck patchCount = snapshotPatchCount();
- ASSERT_FALSE(mManager->getConfig().getAvailableInputDevices().isEmpty());
+ ASSERT_FALSE(mManager->getAvailableInputDevices().isEmpty());
PatchBuilder patchBuilder;
- patchBuilder.addSource(mManager->getConfig().getAvailableInputDevices()[0]).
+ patchBuilder.addSource(mManager->getAvailableInputDevices()[0]).
addSink(mManager->getConfig().getDefaultOutputDevice());
ASSERT_EQ(NO_ERROR, mManager->createAudioPatch(patchBuilder.patch(), &handle, uid));
ASSERT_NE(AUDIO_PATCH_HANDLE_NONE, handle);
@@ -328,15 +328,13 @@
sp<AudioProfile> pcmInputProfile = new AudioProfile(
AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_STEREO, 44100);
mMsdInputDevice->addAudioProfile(pcmInputProfile);
- config.addAvailableDevice(mMsdOutputDevice);
- config.addAvailableDevice(mMsdInputDevice);
+ config.addDevice(mMsdOutputDevice);
+ config.addDevice(mMsdInputDevice);
sp<HwModule> msdModule = new HwModule(AUDIO_HARDWARE_MODULE_ID_MSD, 2 /*halVersionMajor*/);
HwModuleCollection modules = config.getHwModules();
modules.add(msdModule);
config.setHwModules(modules);
- mMsdOutputDevice->attach(msdModule);
- mMsdInputDevice->attach(msdModule);
sp<OutputProfile> msdOutputProfile = new OutputProfile("msd input");
msdOutputProfile->addAudioProfile(pcmOutputProfile);
@@ -1058,3 +1056,40 @@
"hfp_client_out"})
)
);
+
+class AudioPolicyManagerDynamicHwModulesTest : public AudioPolicyManagerTestWithConfigurationFile {
+protected:
+ void SetUpManagerConfig() override;
+};
+
+void AudioPolicyManagerDynamicHwModulesTest::SetUpManagerConfig() {
+ AudioPolicyManagerTestWithConfigurationFile::SetUpManagerConfig();
+ // Only allow successful opening of "primary" hw module during APM initialization.
+ mClient->swapAllowedModuleNames({"primary"});
+}
+
+TEST_F(AudioPolicyManagerDynamicHwModulesTest, InitSuccess) {
+ // SetUp must finish with no assertions.
+}
+
+TEST_F(AudioPolicyManagerDynamicHwModulesTest, DynamicAddition) {
+ const auto handleBefore = mClient->peekNextModuleHandle();
+ mManager->onNewAudioModulesAvailable();
+ ASSERT_EQ(handleBefore, mClient->peekNextModuleHandle());
+ // Reset module loading restrictions.
+ mClient->swapAllowedModuleNames();
+ mManager->onNewAudioModulesAvailable();
+ const auto handleAfter = mClient->peekNextModuleHandle();
+ ASSERT_GT(handleAfter, handleBefore);
+ mManager->onNewAudioModulesAvailable();
+ ASSERT_EQ(handleAfter, mClient->peekNextModuleHandle());
+}
+
+TEST_F(AudioPolicyManagerDynamicHwModulesTest, AddedDeviceAvailable) {
+ ASSERT_EQ(AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, mManager->getDeviceConnectionState(
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX, "0"));
+ mClient->swapAllowedModuleNames({"primary", "r_submix"});
+ mManager->onNewAudioModulesAvailable();
+ ASSERT_EQ(AUDIO_POLICY_DEVICE_STATE_AVAILABLE, mManager->getDeviceConnectionState(
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX, "0"));
+}
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index c50a3c6..072afd2 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -112,6 +112,10 @@
"android.hardware.camera.device@3.5",
],
+ static_libs: [
+ "libbinderthreadstateutils",
+ ],
+
export_shared_lib_headers: [
"libbinder",
"libcamera_client",
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 850b275..595c3e8 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -43,6 +43,7 @@
#include <binder/PermissionController.h>
#include <binder/ProcessInfoService.h>
#include <binder/IResultReceiver.h>
+#include <binderthreadstate/CallerUtils.h>
#include <cutils/atomic.h>
#include <cutils/properties.h>
#include <cutils/misc.h>
@@ -56,7 +57,6 @@
#include <media/IMediaHTTPService.h>
#include <media/mediaplayer.h>
#include <mediautils/BatteryNotifier.h>
-#include <sensorprivacy/SensorPrivacyManager.h>
#include <utils/Errors.h>
#include <utils/Log.h>
#include <utils/String16.h>
@@ -1030,7 +1030,7 @@
// Only allow clients who are being used by the current foreground device user, unless calling
// from our own process OR the caller is using the cameraserver's HIDL interface.
- if (!hardware::IPCThreadState::self()->isServingCall() && callingPid != getpid() &&
+ if (getCurrentServingCall() != BinderCallType::HWBINDER && callingPid != getpid() &&
(mAllowedUsers.find(clientUserId) == mAllowedUsers.end())) {
ALOGE("CameraService::connect X (PID %d) rejected (cannot connect from "
"device user %d, currently allowed device users: %s)", callingPid, clientUserId,
@@ -1351,7 +1351,7 @@
// If the thread serving this call is not a hwbinder thread and the caller
// isn't the cameraserver itself, and the camera id being requested is to be
// publically hidden, we should reject the connection.
- if (!hardware::IPCThreadState::self()->isServingCall() &&
+ if (getCurrentServingCall() != BinderCallType::HWBINDER &&
CameraThreadState::getCallingPid() != getpid() &&
isPublicallyHiddenSecureCamera(cameraId)) {
return true;
@@ -1372,7 +1372,8 @@
String8 id = String8(cameraId);
sp<CameraDeviceClient> client = nullptr;
String16 clientPackageNameAdj = clientPackageName;
- if (hardware::IPCThreadState::self()->isServingCall()) {
+
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
std::string vendorClient =
StringPrintf("vendor.client.pid<%d>", CameraThreadState::getCallingPid());
clientPackageNameAdj = String16(vendorClient.c_str());
@@ -2405,7 +2406,7 @@
}
mClientPackageName = packages[0];
}
- if (!hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() != BinderCallType::HWBINDER) {
mAppOpsManager = std::make_unique<AppOpsManager>();
}
}
@@ -2853,10 +2854,9 @@
if (mRegistered) {
return;
}
- SensorPrivacyManager spm;
- spm.addSensorPrivacyListener(this);
- mSensorPrivacyEnabled = spm.isSensorPrivacyEnabled();
- status_t res = spm.linkToDeath(this);
+ mSpm.addSensorPrivacyListener(this);
+ mSensorPrivacyEnabled = mSpm.isSensorPrivacyEnabled();
+ status_t res = mSpm.linkToDeath(this);
if (res == OK) {
mRegistered = true;
ALOGV("SensorPrivacyPolicy: Registered with SensorPrivacyManager");
@@ -2865,9 +2865,8 @@
void CameraService::SensorPrivacyPolicy::unregisterSelf() {
Mutex::Autolock _l(mSensorPrivacyLock);
- SensorPrivacyManager spm;
- spm.removeSensorPrivacyListener(this);
- spm.unlinkToDeath(this);
+ mSpm.removeSensorPrivacyListener(this);
+ mSpm.unlinkToDeath(this);
mRegistered = false;
ALOGV("SensorPrivacyPolicy: Unregistered with SensorPrivacyManager");
}
@@ -3030,7 +3029,7 @@
const std::set<String8>& conflictingKeys, int32_t score, int32_t ownerId,
int32_t state) {
- bool isVendorClient = hardware::IPCThreadState::self()->isServingCall();
+ bool isVendorClient = getCurrentServingCall() == BinderCallType::HWBINDER;
int32_t score_adj = isVendorClient ? kVendorClientScore : score;
int32_t state_adj = isVendorClient ? kVendorClientState: state;
@@ -3310,8 +3309,15 @@
Mutex::Autolock lock(mStatusListenerLock);
for (auto& listener : mListenerList) {
- if (!listener.first && (isHidden || !supportsHAL3)) {
- ALOGV("Skipping camera discovery callback for system-only / HAL1 camera %s",
+ bool isVendorListener = listener.first;
+ if (isVendorListener && !supportsHAL3) {
+ ALOGV("Skipping vendor listener camera discovery callback for HAL1 camera %s",
+ cameraId.c_str());
+ continue;
+ }
+
+ if (!isVendorListener && isHidden) {
+ ALOGV("Skipping camera discovery callback for system-only camera %s",
cameraId.c_str());
continue;
}
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 8bb78cd..4e04f0e 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -31,6 +31,7 @@
#include <binder/IAppOpsCallback.h>
#include <binder/IUidObserver.h>
#include <hardware/camera.h>
+#include <sensorprivacy/SensorPrivacyManager.h>
#include <android/hardware/camera/common/1.0/types.h>
@@ -49,6 +50,7 @@
#include <string>
#include <map>
#include <memory>
+#include <optional>
#include <utility>
#include <unordered_map>
#include <unordered_set>
@@ -599,6 +601,7 @@
virtual void binderDied(const wp<IBinder> &who);
private:
+ SensorPrivacyManager mSpm;
wp<CameraService> mService;
Mutex mSensorPrivacyLock;
bool mSensorPrivacyEnabled;
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index c7a4f2b..3587db3 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -2004,6 +2004,15 @@
}
}
+ for (size_t i = 0; i < mCompositeStreamMap.size(); i++) {
+ auto ret = mCompositeStreamMap.valueAt(i)->deleteInternalStreams();
+ if (ret != OK) {
+ ALOGE("%s: Failed removing composite stream %s (%d)", __FUNCTION__,
+ strerror(-ret), ret);
+ }
+ }
+ mCompositeStreamMap.clear();
+
Camera2ClientBase::detachDevice();
}
diff --git a/services/camera/libcameraservice/api2/DepthCompositeStream.cpp b/services/camera/libcameraservice/api2/DepthCompositeStream.cpp
index 8ebaa2b..0b91016 100644
--- a/services/camera/libcameraservice/api2/DepthCompositeStream.cpp
+++ b/services/camera/libcameraservice/api2/DepthCompositeStream.cpp
@@ -247,7 +247,7 @@
return ret;
}
-status_t DepthCompositeStream::processInputFrame(const InputFrame &inputFrame) {
+status_t DepthCompositeStream::processInputFrame(nsecs_t ts, const InputFrame &inputFrame) {
status_t res;
sp<ANativeWindow> outputANW = mOutputSurface;
ANativeWindowBuffer *anb;
@@ -370,6 +370,13 @@
return NO_MEMORY;
}
+ res = native_window_set_buffers_timestamp(mOutputSurface.get(), ts);
+ if (res != OK) {
+ ALOGE("%s: Stream %d: Error setting timestamp: %s (%d)", __FUNCTION__,
+ getStreamId(), strerror(-res), res);
+ return res;
+ }
+
ALOGV("%s: Final jpeg size: %zu", __func__, finalJpegSize);
uint8_t* header = static_cast<uint8_t *> (dstBuffer) +
(gb->getWidth() - sizeof(struct camera3_jpeg_blob));
@@ -459,7 +466,7 @@
}
}
- auto res = processInputFrame(mPendingInputFrames[currentTs]);
+ auto res = processInputFrame(currentTs, mPendingInputFrames[currentTs]);
Mutex::Autolock l(mMutex);
if (res != OK) {
ALOGE("%s: Failed processing frame with timestamp: %" PRIu64 ": %s (%d)", __FUNCTION__,
diff --git a/services/camera/libcameraservice/api2/DepthCompositeStream.h b/services/camera/libcameraservice/api2/DepthCompositeStream.h
index 975c59b..28a7826 100644
--- a/services/camera/libcameraservice/api2/DepthCompositeStream.h
+++ b/services/camera/libcameraservice/api2/DepthCompositeStream.h
@@ -97,7 +97,7 @@
size_t maxJpegSize, uint8_t jpegQuality,
std::vector<std::unique_ptr<Item>>* items /*out*/);
std::unique_ptr<ImagingModel> getImagingModel();
- status_t processInputFrame(const InputFrame &inputFrame);
+ status_t processInputFrame(nsecs_t ts, const InputFrame &inputFrame);
// Buffer/Results handling
void compilePendingInputLocked();
diff --git a/services/camera/libcameraservice/api2/HeicCompositeStream.cpp b/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
index d21641c..9790e32 100644
--- a/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
+++ b/services/camera/libcameraservice/api2/HeicCompositeStream.cpp
@@ -31,7 +31,6 @@
#include <mediadrm/ICrypto.h>
#include <media/MediaCodecBuffer.h>
#include <media/stagefright/foundation/ABuffer.h>
-#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/MediaDefs.h>
#include <media/stagefright/MediaCodecConstants.h>
@@ -61,12 +60,13 @@
mUseGrid(false),
mAppSegmentStreamId(-1),
mAppSegmentSurfaceId(-1),
- mAppSegmentBufferAcquired(false),
mMainImageStreamId(-1),
mMainImageSurfaceId(-1),
mYuvBufferAcquired(false),
mProducerListener(new ProducerListener()),
- mOutputBufferCounter(0),
+ mDequeuedOutputBufferCnt(0),
+ mLockedAppSegmentBufferCnt(0),
+ mCodecOutputCounter(0),
mGridTimestampUs(0) {
}
@@ -132,7 +132,7 @@
sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer);
- mAppSegmentConsumer = new CpuConsumer(consumer, 1);
+ mAppSegmentConsumer = new CpuConsumer(consumer, kMaxAcquiredAppSegment);
mAppSegmentConsumer->setFrameAvailableListener(this);
mAppSegmentConsumer->setName(String8("Camera3-HeicComposite-AppSegmentStream"));
mAppSegmentSurface = new Surface(producer);
@@ -231,6 +231,8 @@
if (bufferInfo.mError) return;
mCodecOutputBufferTimestamps.push(bufferInfo.mTimestamp);
+ ALOGV("%s: [%" PRId64 "]: Adding codecOutputBufferTimestamp (%zu timestamps in total)",
+ __FUNCTION__, bufferInfo.mTimestamp, mCodecOutputBufferTimestamps.size());
}
// We need to get the settings early to handle the case where the codec output
@@ -361,6 +363,8 @@
mCodecOutputBuffers.push_back(outputBufferInfo);
mInputReadyCondition.signal();
} else {
+ ALOGV("%s: Releasing output buffer: size %d flags: 0x%x ", __FUNCTION__,
+ outputBufferInfo.size, outputBufferInfo.flags);
mCodec->releaseOutputBuffer(outputBufferInfo.index);
}
} else {
@@ -414,8 +418,10 @@
mNumOutputTiles = 1;
}
- ALOGV("%s: mNumOutputTiles is %zu", __FUNCTION__, mNumOutputTiles);
mFormat = newFormat;
+
+ ALOGV("%s: mNumOutputTiles is %zu", __FUNCTION__, mNumOutputTiles);
+ mInputReadyCondition.signal();
}
void HeicCompositeStream::onHeicCodecError() {
@@ -459,9 +465,8 @@
// Cannot use SourceSurface buffer count since it could be codec's 512*512 tile
// buffer count.
- int maxProducerBuffers = 1;
if ((res = native_window_set_buffer_count(
- anwConsumer, maxProducerBuffers + maxConsumerBuffers)) != OK) {
+ anwConsumer, kMaxOutputSurfaceProducerCount + maxConsumerBuffers)) != OK) {
ALOGE("%s: Unable to set buffer count for stream %d", __FUNCTION__, mMainImageStreamId);
return res;
}
@@ -505,6 +510,8 @@
}
if (mSettingsByFrameNumber.find(resultExtras.frameNumber) != mSettingsByFrameNumber.end()) {
+ ALOGV("%s: [%" PRId64 "]: frameNumber %" PRId64, __FUNCTION__,
+ timestamp, resultExtras.frameNumber);
mFrameNumberMap.emplace(resultExtras.frameNumber, timestamp);
mSettingsByTimestamp[timestamp] = mSettingsByFrameNumber[resultExtras.frameNumber];
mSettingsByFrameNumber.erase(resultExtras.frameNumber);
@@ -520,12 +527,12 @@
mSettingsByTimestamp.erase(it);
}
- while (!mInputAppSegmentBuffers.empty() && !mAppSegmentBufferAcquired) {
+ while (!mInputAppSegmentBuffers.empty()) {
CpuConsumer::LockedBuffer imgBuffer;
auto it = mInputAppSegmentBuffers.begin();
auto res = mAppSegmentConsumer->lockNextBuffer(&imgBuffer);
if (res == NOT_ENOUGH_DATA) {
- // Canot not lock any more buffers.
+ // Can not lock any more buffers.
break;
} else if ((res != OK) || (*it != imgBuffer.timestamp)) {
if (res != OK) {
@@ -535,6 +542,7 @@
ALOGE("%s: Expecting JPEG_APP_SEGMENTS buffer with time stamp: %" PRId64
" received buffer with time stamp: %" PRId64, __FUNCTION__,
*it, imgBuffer.timestamp);
+ mAppSegmentConsumer->unlockBuffer(imgBuffer);
}
mPendingInputFrames[*it].error = true;
mInputAppSegmentBuffers.erase(it);
@@ -546,7 +554,7 @@
mAppSegmentConsumer->unlockBuffer(imgBuffer);
} else {
mPendingInputFrames[imgBuffer.timestamp].appSegmentBuffer = imgBuffer;
- mAppSegmentBufferAcquired = true;
+ mLockedAppSegmentBufferCnt++;
}
mInputAppSegmentBuffers.erase(it);
}
@@ -556,7 +564,7 @@
auto it = mInputYuvBuffers.begin();
auto res = mMainImageConsumer->lockNextBuffer(&imgBuffer);
if (res == NOT_ENOUGH_DATA) {
- // Canot not lock any more buffers.
+ // Can not lock any more buffers.
break;
} else if (res != OK) {
ALOGE("%s: Error locking YUV_888 image buffer: %s (%d)", __FUNCTION__,
@@ -589,17 +597,20 @@
// to look up timestamp.
int64_t bufferTime = -1;
if (mCodecOutputBufferTimestamps.empty()) {
- ALOGE("%s: Failed to find buffer timestamp for codec output buffer!", __FUNCTION__);
+ ALOGV("%s: Failed to find buffer timestamp for codec output buffer!", __FUNCTION__);
+ break;
} else {
// Direct mapping between camera timestamp (in ns) and codec timestamp (in us).
bufferTime = mCodecOutputBufferTimestamps.front();
- mOutputBufferCounter++;
- if (mOutputBufferCounter == mNumOutputTiles) {
+ mCodecOutputCounter++;
+ if (mCodecOutputCounter == mNumOutputTiles) {
mCodecOutputBufferTimestamps.pop();
- mOutputBufferCounter = 0;
+ mCodecOutputCounter = 0;
}
mPendingInputFrames[bufferTime].codecOutputBuffers.push_back(*it);
+ ALOGV("%s: [%" PRId64 "]: Pushing codecOutputBuffers (time %" PRId64 " us)",
+ __FUNCTION__, bufferTime, it->timeUs);
}
mCodecOutputBuffers.erase(it);
}
@@ -607,6 +618,7 @@
while (!mFrameNumberMap.empty()) {
auto it = mFrameNumberMap.begin();
mPendingInputFrames[it->second].frameNumber = it->first;
+ ALOGV("%s: [%" PRId64 "]: frameNumber is %" PRId64, __FUNCTION__, it->second, it->first);
mFrameNumberMap.erase(it);
}
@@ -675,16 +687,29 @@
}
bool newInputAvailable = false;
- for (const auto& it : mPendingInputFrames) {
+ for (auto& it : mPendingInputFrames) {
+ // New input is considered to be available only if:
+ // 1. input buffers are ready, or
+ // 2. App segment and muxer is created, or
+ // 3. A codec output tile is ready, and an output buffer is available.
+ // This makes sure that muxer gets created only when an output tile is
+ // generated, because right now we only handle 1 HEIC output buffer at a
+ // time (max dequeued buffer count is 1).
bool appSegmentReady = (it.second.appSegmentBuffer.data != nullptr) &&
- !it.second.appSegmentWritten && it.second.result != nullptr;
+ !it.second.appSegmentWritten && it.second.result != nullptr &&
+ it.second.muxer != nullptr;
bool codecOutputReady = !it.second.codecOutputBuffers.empty();
bool codecInputReady = (it.second.yuvBuffer.data != nullptr) &&
(!it.second.codecInputBuffers.empty());
+ bool hasOutputBuffer = it.second.muxer != nullptr ||
+ (mDequeuedOutputBufferCnt < kMaxOutputSurfaceProducerCount);
if ((!it.second.error) &&
(it.first < *currentTs) &&
- (appSegmentReady || codecOutputReady || codecInputReady)) {
+ (appSegmentReady || (codecOutputReady && hasOutputBuffer) || codecInputReady)) {
*currentTs = it.first;
+ if (it.second.format == nullptr && mFormat != nullptr) {
+ it.second.format = mFormat->dup();
+ }
newInputAvailable = true;
break;
}
@@ -716,15 +741,17 @@
status_t res = OK;
bool appSegmentReady = inputFrame.appSegmentBuffer.data != nullptr &&
- !inputFrame.appSegmentWritten && inputFrame.result != nullptr;
+ !inputFrame.appSegmentWritten && inputFrame.result != nullptr &&
+ inputFrame.muxer != nullptr;
bool codecOutputReady = inputFrame.codecOutputBuffers.size() > 0;
bool codecInputReady = inputFrame.yuvBuffer.data != nullptr &&
- !inputFrame.codecInputBuffers.empty();
+ !inputFrame.codecInputBuffers.empty();
+ bool hasOutputBuffer = inputFrame.muxer != nullptr ||
+ (mDequeuedOutputBufferCnt < kMaxOutputSurfaceProducerCount);
- if (!appSegmentReady && !codecOutputReady && !codecInputReady) {
- ALOGW("%s: No valid appSegmentBuffer/codec input/outputBuffer available!", __FUNCTION__);
- return OK;
- }
+ ALOGV("%s: [%" PRId64 "]: appSegmentReady %d, codecOutputReady %d, codecInputReady %d,"
+ " dequeuedOutputBuffer %d", __FUNCTION__, timestamp, appSegmentReady,
+ codecOutputReady, codecInputReady, mDequeuedOutputBufferCnt);
// Handle inputs for Hevc tiling
if (codecInputReady) {
@@ -736,7 +763,13 @@
}
}
- // Initialize and start muxer if not yet done so
+ if (!(codecOutputReady && hasOutputBuffer) && !appSegmentReady) {
+ return OK;
+ }
+
+ // Initialize and start muxer if not yet done so. In this case,
+ // codecOutputReady must be true. Otherwise, appSegmentReady is guaranteed
+ // to be false, and the function must have returned early.
if (inputFrame.muxer == nullptr) {
res = startMuxerForInputFrame(timestamp, inputFrame);
if (res != OK) {
@@ -747,7 +780,7 @@
}
// Write JPEG APP segments data to the muxer.
- if (appSegmentReady && inputFrame.muxer != nullptr) {
+ if (appSegmentReady) {
res = processAppSegment(timestamp, inputFrame);
if (res != OK) {
ALOGE("%s: Failed to process JPEG APP segments: %s (%d)", __FUNCTION__,
@@ -766,12 +799,18 @@
}
}
- if (inputFrame.appSegmentWritten && inputFrame.pendingOutputTiles == 0) {
- res = processCompletedInputFrame(timestamp, inputFrame);
- if (res != OK) {
- ALOGE("%s: Failed to process completed input frame: %s (%d)", __FUNCTION__,
- strerror(-res), res);
- return res;
+ if (inputFrame.pendingOutputTiles == 0) {
+ if (inputFrame.appSegmentWritten) {
+ res = processCompletedInputFrame(timestamp, inputFrame);
+ if (res != OK) {
+ ALOGE("%s: Failed to process completed input frame: %s (%d)", __FUNCTION__,
+ strerror(-res), res);
+ return res;
+ }
+ } else if (mLockedAppSegmentBufferCnt == kMaxAcquiredAppSegment) {
+ ALOGE("%s: Out-of-order app segment buffers reaches limit %u", __FUNCTION__,
+ kMaxAcquiredAppSegment);
+ return INVALID_OPERATION;
}
}
@@ -780,11 +819,6 @@
status_t HeicCompositeStream::startMuxerForInputFrame(nsecs_t timestamp, InputFrame &inputFrame) {
sp<ANativeWindow> outputANW = mOutputSurface;
- if (inputFrame.codecOutputBuffers.size() == 0) {
- // No single codec output buffer has been generated. Continue to
- // wait.
- return OK;
- }
auto res = outputANW->dequeueBuffer(mOutputSurface.get(), &inputFrame.anb, &inputFrame.fenceFd);
if (res != OK) {
@@ -792,6 +826,7 @@
res);
return res;
}
+ mDequeuedOutputBufferCnt++;
// Combine current thread id, stream id and timestamp to uniquely identify image.
std::ostringstream tempOutputFile;
@@ -828,7 +863,7 @@
}
}
- ssize_t trackId = inputFrame.muxer->addTrack(mFormat);
+ ssize_t trackId = inputFrame.muxer->addTrack(inputFrame.format);
if (trackId < 0) {
ALOGE("%s: Failed to addTrack to the muxer: %zd", __FUNCTION__, trackId);
return NO_INIT;
@@ -844,6 +879,8 @@
return res;
}
+ ALOGV("%s: [%" PRId64 "]: Muxer started for inputFrame", __FUNCTION__,
+ timestamp);
return OK;
}
@@ -852,9 +889,6 @@
auto appSegmentSize = findAppSegmentsSize(inputFrame.appSegmentBuffer.data,
inputFrame.appSegmentBuffer.width * inputFrame.appSegmentBuffer.height,
&app1Size);
- ALOGV("%s: appSegmentSize is %zu, width %d, height %d, app1Size %zu", __FUNCTION__,
- appSegmentSize, inputFrame.appSegmentBuffer.width,
- inputFrame.appSegmentBuffer.height, app1Size);
if (appSegmentSize == 0) {
ALOGE("%s: Failed to find JPEG APP segment size", __FUNCTION__);
return NO_INIT;
@@ -910,7 +944,16 @@
__FUNCTION__, strerror(-res), res);
return res;
}
+
+ ALOGV("%s: [%" PRId64 "]: appSegmentSize is %zu, width %d, height %d, app1Size %zu",
+ __FUNCTION__, timestamp, appSegmentSize, inputFrame.appSegmentBuffer.width,
+ inputFrame.appSegmentBuffer.height, app1Size);
+
inputFrame.appSegmentWritten = true;
+ // Release the buffer now so any pending input app segments can be processed
+ mAppSegmentConsumer->unlockBuffer(inputFrame.appSegmentBuffer);
+ inputFrame.appSegmentBuffer.data = nullptr;
+ mLockedAppSegmentBufferCnt--;
return OK;
}
@@ -934,8 +977,9 @@
mOutputWidth - tileX * mGridWidth : mGridWidth;
size_t height = (tileY == static_cast<size_t>(mGridRows) - 1) ?
mOutputHeight - tileY * mGridHeight : mGridHeight;
- ALOGV("%s: inputBuffer tileIndex [%zu, %zu], top %zu, left %zu, width %zu, height %zu",
- __FUNCTION__, tileX, tileY, top, left, width, height);
+ ALOGV("%s: inputBuffer tileIndex [%zu, %zu], top %zu, left %zu, width %zu, height %zu,"
+ " timeUs %" PRId64, __FUNCTION__, tileX, tileY, top, left, width, height,
+ inputBuffer.timeUs);
res = copyOneYuvTile(buffer, inputFrame.yuvBuffer, top, left, width, height);
if (res != OK) {
@@ -990,6 +1034,9 @@
}
inputFrame.codecOutputBuffers.erase(inputFrame.codecOutputBuffers.begin());
+
+ ALOGV("%s: [%" PRId64 "]: Output buffer index %d",
+ __FUNCTION__, timestamp, it->index);
return OK;
}
@@ -1046,7 +1093,9 @@
return res;
}
inputFrame.anb = nullptr;
+ mDequeuedOutputBufferCnt--;
+ ALOGV("%s: [%" PRId64 "]", __FUNCTION__, timestamp);
ATRACE_ASYNC_END("HEIC capture", inputFrame.frameNumber);
return OK;
}
@@ -1060,7 +1109,6 @@
if (inputFrame->appSegmentBuffer.data != nullptr) {
mAppSegmentConsumer->unlockBuffer(inputFrame->appSegmentBuffer);
inputFrame->appSegmentBuffer.data = nullptr;
- mAppSegmentBufferAcquired = false;
}
while (!inputFrame->codecOutputBuffers.empty()) {
@@ -1098,11 +1146,13 @@
}
}
-void HeicCompositeStream::releaseInputFramesLocked(int64_t currentTs) {
+void HeicCompositeStream::releaseInputFramesLocked() {
auto it = mPendingInputFrames.begin();
while (it != mPendingInputFrames.end()) {
- if (it->first <= currentTs) {
- releaseInputFrameLocked(&it->second);
+ auto& inputFrame = it->second;
+ if (inputFrame.error ||
+ (inputFrame.appSegmentWritten && inputFrame.pendingOutputTiles == 0)) {
+ releaseInputFrameLocked(&inputFrame);
it = mPendingInputFrames.erase(it);
} else {
it++;
@@ -1506,7 +1556,7 @@
// In case we landed in error state, return any pending buffers and
// halt all further processing.
compilePendingInputLocked();
- releaseInputFramesLocked(currentTs);
+ releaseInputFramesLocked();
return false;
}
@@ -1548,11 +1598,7 @@
mPendingInputFrames[currentTs].error = true;
}
- if (mPendingInputFrames[currentTs].error ||
- (mPendingInputFrames[currentTs].appSegmentWritten &&
- mPendingInputFrames[currentTs].pendingOutputTiles == 0)) {
- releaseInputFramesLocked(currentTs);
- }
+ releaseInputFramesLocked();
return true;
}
diff --git a/services/camera/libcameraservice/api2/HeicCompositeStream.h b/services/camera/libcameraservice/api2/HeicCompositeStream.h
index 260c68e..04e7b83 100644
--- a/services/camera/libcameraservice/api2/HeicCompositeStream.h
+++ b/services/camera/libcameraservice/api2/HeicCompositeStream.h
@@ -25,6 +25,7 @@
#include <media/hardware/VideoAPI.h>
#include <media/MediaCodecBuffer.h>
#include <media/stagefright/foundation/ALooper.h>
+#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/MediaCodec.h>
#include <media/stagefright/MediaMuxer.h>
@@ -157,6 +158,7 @@
bool errorNotified;
int64_t frameNumber;
+ sp<AMessage> format;
sp<MediaMuxer> muxer;
int fenceFd;
int fileFd;
@@ -187,7 +189,7 @@
status_t processCompletedInputFrame(nsecs_t timestamp, InputFrame &inputFrame);
void releaseInputFrameLocked(InputFrame *inputFrame /*out*/);
- void releaseInputFramesLocked(int64_t currentTs);
+ void releaseInputFramesLocked();
size_t findAppSegmentsSize(const uint8_t* appSegmentBuffer, size_t maxSize,
size_t* app1SegmentSize);
@@ -205,11 +207,13 @@
static_cast<android_dataspace>(HAL_DATASPACE_JPEG_APP_SEGMENTS);
static const android_dataspace kHeifDataSpace =
static_cast<android_dataspace>(HAL_DATASPACE_HEIF);
+ // Use the limit of pipeline depth in the API sepc as maximum number of acquired
+ // app segment buffers.
+ static const uint32_t kMaxAcquiredAppSegment = 8;
int mAppSegmentStreamId, mAppSegmentSurfaceId;
sp<CpuConsumer> mAppSegmentConsumer;
sp<Surface> mAppSegmentSurface;
- bool mAppSegmentBufferAcquired;
size_t mAppSegmentMaxSize;
CameraMetadata mStaticInfo;
@@ -218,9 +222,10 @@
sp<CpuConsumer> mMainImageConsumer; // Only applicable for HEVC codec.
bool mYuvBufferAcquired; // Only applicable to HEVC codec
+ static const int32_t kMaxOutputSurfaceProducerCount = 1;
sp<Surface> mOutputSurface;
sp<ProducerListener> mProducerListener;
-
+ int32_t mDequeuedOutputBufferCnt;
// Map from frame number to JPEG setting of orientation+quality
std::map<int64_t, std::pair<int32_t, int32_t>> mSettingsByFrameNumber;
@@ -229,11 +234,12 @@
// Keep all incoming APP segment Blob buffer pending further processing.
std::vector<int64_t> mInputAppSegmentBuffers;
+ int32_t mLockedAppSegmentBufferCnt;
// Keep all incoming HEIC blob buffer pending further processing.
std::vector<CodecOutputBufferInfo> mCodecOutputBuffers;
std::queue<int64_t> mCodecOutputBufferTimestamps;
- size_t mOutputBufferCounter;
+ size_t mCodecOutputCounter;
// Keep all incoming Yuv buffer pending tiling and encoding (for HEVC YUV tiling only)
std::vector<int64_t> mInputYuvBuffers;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index bda35f3..dfe5eb0 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -339,100 +339,103 @@
status_t Camera3Device::disconnectImpl() {
ATRACE_CALL();
- Mutex::Autolock il(mInterfaceLock);
-
ALOGI("%s: E", __FUNCTION__);
status_t res = OK;
std::vector<wp<Camera3StreamInterface>> streams;
- nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
{
- Mutex::Autolock l(mLock);
- if (mStatus == STATUS_UNINITIALIZED) return res;
+ Mutex::Autolock il(mInterfaceLock);
+ nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
+ {
+ Mutex::Autolock l(mLock);
+ if (mStatus == STATUS_UNINITIALIZED) return res;
- if (mStatus == STATUS_ACTIVE ||
- (mStatus == STATUS_ERROR && mRequestThread != NULL)) {
- res = mRequestThread->clearRepeatingRequests();
- if (res != OK) {
- SET_ERR_L("Can't stop streaming");
- // Continue to close device even in case of error
- } else {
- res = waitUntilStateThenRelock(/*active*/ false, maxExpectedDuration);
+ if (mStatus == STATUS_ACTIVE ||
+ (mStatus == STATUS_ERROR && mRequestThread != NULL)) {
+ res = mRequestThread->clearRepeatingRequests();
if (res != OK) {
- SET_ERR_L("Timeout waiting for HAL to drain (% " PRIi64 " ns)",
- maxExpectedDuration);
+ SET_ERR_L("Can't stop streaming");
// Continue to close device even in case of error
+ } else {
+ res = waitUntilStateThenRelock(/*active*/ false, maxExpectedDuration);
+ if (res != OK) {
+ SET_ERR_L("Timeout waiting for HAL to drain (% " PRIi64 " ns)",
+ maxExpectedDuration);
+ // Continue to close device even in case of error
+ }
}
}
- }
- if (mStatus == STATUS_ERROR) {
- CLOGE("Shutting down in an error state");
- }
+ if (mStatus == STATUS_ERROR) {
+ CLOGE("Shutting down in an error state");
+ }
- if (mStatusTracker != NULL) {
- mStatusTracker->requestExit();
- }
+ if (mStatusTracker != NULL) {
+ mStatusTracker->requestExit();
+ }
- if (mRequestThread != NULL) {
- mRequestThread->requestExit();
- }
+ if (mRequestThread != NULL) {
+ mRequestThread->requestExit();
+ }
- streams.reserve(mOutputStreams.size() + (mInputStream != nullptr ? 1 : 0));
- for (size_t i = 0; i < mOutputStreams.size(); i++) {
- streams.push_back(mOutputStreams[i]);
- }
- if (mInputStream != nullptr) {
- streams.push_back(mInputStream);
+ streams.reserve(mOutputStreams.size() + (mInputStream != nullptr ? 1 : 0));
+ for (size_t i = 0; i < mOutputStreams.size(); i++) {
+ streams.push_back(mOutputStreams[i]);
+ }
+ if (mInputStream != nullptr) {
+ streams.push_back(mInputStream);
+ }
}
}
-
- // Joining done without holding mLock, otherwise deadlocks may ensue
- // as the threads try to access parent state
+ // Joining done without holding mLock and mInterfaceLock, otherwise deadlocks may ensue
+ // as the threads try to access parent state (b/143513518)
if (mRequestThread != NULL && mStatus != STATUS_ERROR) {
// HAL may be in a bad state, so waiting for request thread
// (which may be stuck in the HAL processCaptureRequest call)
// could be dangerous.
+ // give up mInterfaceLock here and then lock it again. Could this lead
+ // to other deadlocks
mRequestThread->join();
}
-
- if (mStatusTracker != NULL) {
- mStatusTracker->join();
- }
-
- HalInterface* interface;
{
- Mutex::Autolock l(mLock);
- mRequestThread.clear();
- Mutex::Autolock stLock(mTrackerLock);
- mStatusTracker.clear();
- interface = mInterface.get();
- }
+ Mutex::Autolock il(mInterfaceLock);
+ if (mStatusTracker != NULL) {
+ mStatusTracker->join();
+ }
- // Call close without internal mutex held, as the HAL close may need to
- // wait on assorted callbacks,etc, to complete before it can return.
- interface->close();
+ HalInterface* interface;
+ {
+ Mutex::Autolock l(mLock);
+ mRequestThread.clear();
+ Mutex::Autolock stLock(mTrackerLock);
+ mStatusTracker.clear();
+ interface = mInterface.get();
+ }
- flushInflightRequests();
+ // Call close without internal mutex held, as the HAL close may need to
+ // wait on assorted callbacks,etc, to complete before it can return.
+ interface->close();
- {
- Mutex::Autolock l(mLock);
- mInterface->clear();
- mOutputStreams.clear();
- mInputStream.clear();
- mDeletedStreams.clear();
- mBufferManager.clear();
- internalUpdateStatusLocked(STATUS_UNINITIALIZED);
- }
+ flushInflightRequests();
- for (auto& weakStream : streams) {
- sp<Camera3StreamInterface> stream = weakStream.promote();
- if (stream != nullptr) {
- ALOGE("%s: Stream %d leaked! strong reference (%d)!",
- __FUNCTION__, stream->getId(), stream->getStrongCount() - 1);
+ {
+ Mutex::Autolock l(mLock);
+ mInterface->clear();
+ mOutputStreams.clear();
+ mInputStream.clear();
+ mDeletedStreams.clear();
+ mBufferManager.clear();
+ internalUpdateStatusLocked(STATUS_UNINITIALIZED);
+ }
+
+ for (auto& weakStream : streams) {
+ sp<Camera3StreamInterface> stream = weakStream.promote();
+ if (stream != nullptr) {
+ ALOGE("%s: Stream %d leaked! strong reference (%d)!",
+ __FUNCTION__, stream->getId(), stream->getStrongCount() - 1);
+ }
}
}
-
ALOGI("%s: X", __FUNCTION__);
return res;
}
@@ -2165,9 +2168,7 @@
}
void Camera3Device::pauseStateNotify(bool enable) {
- // We must not hold mInterfaceLock here since this function is called from
- // RequestThread::threadLoop and holding mInterfaceLock could lead to
- // deadlocks (http://b/143513518)
+ Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
mPauseStateNotify = enable;
@@ -2744,9 +2745,7 @@
ATRACE_CALL();
bool ret = false;
- // We must not hold mInterfaceLock here since this function is called from
- // RequestThread::threadLoop and holding mInterfaceLock could lead to
- // deadlocks (http://b/143513518)
+ Mutex::Autolock il(mInterfaceLock);
nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
Mutex::Autolock l(mLock);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index cae34ce..9b0648d 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -244,7 +244,6 @@
// A lock to enforce serialization on the input/configure side
// of the public interface.
- // Only locked by public methods inherited from CameraDeviceBase.
// Not locked by methods guarded by mOutputLock, since they may act
// concurrently to the input/configure side of the interface.
// Must be locked before mLock if both will be locked by a method
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index acb8b3c..e1d35e8 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -54,9 +54,8 @@
mState = STATE_ERROR;
}
- if (setId > CAMERA3_STREAM_SET_ID_INVALID) {
- mBufferReleasedListener = new BufferReleasedListener(this);
- }
+ bool needsReleaseNotify = setId > CAMERA3_STREAM_SET_ID_INVALID;
+ mBufferProducerListener = new BufferProducerListener(this, needsReleaseNotify);
}
Camera3OutputStream::Camera3OutputStream(int id,
@@ -87,9 +86,8 @@
mState = STATE_ERROR;
}
- if (setId > CAMERA3_STREAM_SET_ID_INVALID) {
- mBufferReleasedListener = new BufferReleasedListener(this);
- }
+ bool needsReleaseNotify = setId > CAMERA3_STREAM_SET_ID_INVALID;
+ mBufferProducerListener = new BufferProducerListener(this, needsReleaseNotify);
}
Camera3OutputStream::Camera3OutputStream(int id,
@@ -124,10 +122,8 @@
}
mConsumerName = String8("Deferred");
- if (setId > CAMERA3_STREAM_SET_ID_INVALID) {
- mBufferReleasedListener = new BufferReleasedListener(this);
- }
-
+ bool needsReleaseNotify = setId > CAMERA3_STREAM_SET_ID_INVALID;
+ mBufferProducerListener = new BufferProducerListener(this, needsReleaseNotify);
}
Camera3OutputStream::Camera3OutputStream(int id, camera3_stream_type_t type,
@@ -151,9 +147,8 @@
mDropBuffers(false),
mDequeueBufferLatency(kDequeueLatencyBinSize) {
- if (setId > CAMERA3_STREAM_SET_ID_INVALID) {
- mBufferReleasedListener = new BufferReleasedListener(this);
- }
+ bool needsReleaseNotify = setId > CAMERA3_STREAM_SET_ID_INVALID;
+ mBufferProducerListener = new BufferProducerListener(this, needsReleaseNotify);
// Subclasses expected to initialize mConsumer themselves
}
@@ -261,7 +256,7 @@
notifyBufferReleased(anwBuffer);
if (mUseBufferManager) {
// Return this buffer back to buffer manager.
- mBufferReleasedListener->onBufferReleased();
+ mBufferProducerListener->onBufferReleased();
}
} else {
if (mTraceFirstBuffer && (stream_type == CAMERA3_STREAM_OUTPUT)) {
@@ -387,8 +382,8 @@
// Configure consumer-side ANativeWindow interface. The listener may be used
// to notify buffer manager (if it is used) of the returned buffers.
res = mConsumer->connect(NATIVE_WINDOW_API_CAMERA,
- /*listener*/mBufferReleasedListener,
- /*reportBufferRemoval*/true);
+ /*reportBufferRemoval*/true,
+ /*listener*/mBufferProducerListener);
if (res != OK) {
ALOGE("%s: Unable to connect to native window for stream %d",
__FUNCTION__, mId);
@@ -790,7 +785,7 @@
return INVALID_OPERATION;
}
-void Camera3OutputStream::BufferReleasedListener::onBufferReleased() {
+void Camera3OutputStream::BufferProducerListener::onBufferReleased() {
sp<Camera3OutputStream> stream = mParent.promote();
if (stream == nullptr) {
ALOGV("%s: Parent camera3 output stream was destroyed", __FUNCTION__);
@@ -823,6 +818,25 @@
}
}
+void Camera3OutputStream::BufferProducerListener::onBuffersDiscarded(
+ const std::vector<sp<GraphicBuffer>>& buffers) {
+ sp<Camera3OutputStream> stream = mParent.promote();
+ if (stream == nullptr) {
+ ALOGV("%s: Parent camera3 output stream was destroyed", __FUNCTION__);
+ return;
+ }
+
+ if (buffers.size() > 0) {
+ Mutex::Autolock l(stream->mLock);
+ stream->onBuffersRemovedLocked(buffers);
+ if (stream->mUseBufferManager) {
+ stream->mBufferManager->onBuffersRemoved(stream->getId(),
+ stream->getStreamSetId(), buffers.size());
+ }
+ ALOGV("Stream %d: %zu Buffers discarded.", stream->getId(), buffers.size());
+ }
+}
+
void Camera3OutputStream::onBuffersRemovedLocked(
const std::vector<sp<GraphicBuffer>>& removedBuffers) {
sp<Camera3StreamBufferFreedListener> callback = mBufferFreedListener.promote();
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.h b/services/camera/libcameraservice/device3/Camera3OutputStream.h
index 729c655..b4e49f9 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.h
@@ -146,18 +146,22 @@
*/
virtual status_t setConsumers(const std::vector<sp<Surface>>& consumers);
- class BufferReleasedListener : public BnProducerListener {
+ class BufferProducerListener : public SurfaceListener {
public:
- BufferReleasedListener(wp<Camera3OutputStream> parent) : mParent(parent) {}
+ BufferProducerListener(wp<Camera3OutputStream> parent, bool needsReleaseNotify)
+ : mParent(parent), mNeedsReleaseNotify(needsReleaseNotify) {}
- /**
- * Implementation of IProducerListener, used to notify this stream that the consumer
- * has returned a buffer and it is ready to return to Camera3BufferManager for reuse.
- */
- virtual void onBufferReleased();
+ /**
+ * Implementation of IProducerListener, used to notify this stream that the consumer
+ * has returned a buffer and it is ready to return to Camera3BufferManager for reuse.
+ */
+ virtual void onBufferReleased();
+ virtual bool needsReleaseNotify() { return mNeedsReleaseNotify; }
+ virtual void onBuffersDiscarded(const std::vector<sp<GraphicBuffer>>& buffers);
private:
- wp<Camera3OutputStream> mParent;
+ wp<Camera3OutputStream> mParent;
+ bool mNeedsReleaseNotify;
};
virtual status_t detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd);
@@ -262,10 +266,10 @@
sp<Camera3BufferManager> mBufferManager;
/**
- * Buffer released listener, used to notify the buffer manager that a buffer is released
- * from consumer side.
+ * Buffer producer listener, used to handle notification when a buffer is released
+ * from consumer side, or a set of buffers are discarded by the consumer.
*/
- sp<BufferReleasedListener> mBufferReleasedListener;
+ sp<BufferProducerListener> mBufferProducerListener;
/**
* Flag indicating if the buffer manager is used to allocate the stream buffers
diff --git a/services/camera/libcameraservice/utils/CameraThreadState.cpp b/services/camera/libcameraservice/utils/CameraThreadState.cpp
index b9e344b..2352b80 100644
--- a/services/camera/libcameraservice/utils/CameraThreadState.cpp
+++ b/services/camera/libcameraservice/utils/CameraThreadState.cpp
@@ -17,33 +17,34 @@
#include "CameraThreadState.h"
#include <binder/IPCThreadState.h>
#include <hwbinder/IPCThreadState.h>
+#include <binderthreadstate/CallerUtils.h>
#include <unistd.h>
namespace android {
int CameraThreadState::getCallingUid() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->getCallingUid();
}
return IPCThreadState::self()->getCallingUid();
}
int CameraThreadState::getCallingPid() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->getCallingPid();
}
return IPCThreadState::self()->getCallingPid();
}
int64_t CameraThreadState::clearCallingIdentity() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->clearCallingIdentity();
}
return IPCThreadState::self()->clearCallingIdentity();
}
void CameraThreadState::restoreCallingIdentity(int64_t token) {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
hardware::IPCThreadState::self()->restoreCallingIdentity(token);
} else {
IPCThreadState::self()->restoreCallingIdentity(token);
diff --git a/services/camera/libcameraservice/utils/ClientManager.h b/services/camera/libcameraservice/utils/ClientManager.h
index ec6f01c..35d25bf 100644
--- a/services/camera/libcameraservice/utils/ClientManager.h
+++ b/services/camera/libcameraservice/utils/ClientManager.h
@@ -35,7 +35,7 @@
public:
/**
* Choosing to set mIsVendorClient through a parameter instead of calling
- * hardware::IPCThreadState::self()->isServingCall() to protect against the
+ * getCurrentServingCall() == BinderCallType::HWBINDER to protect against the
* case where the construction is offloaded to another thread which isn't a
* hwbinder thread.
*/
@@ -237,7 +237,7 @@
// We don't use the usual copy constructor here since we want to remember
// whether a client is a vendor client or not. This could have been wiped
// off in the incoming priority argument since an AIDL thread might have
- // called hardware::IPCThreadState::self()->isServingCall() after refreshing
+ // called getCurrentServingCall() == BinderCallType::HWBINDER after refreshing
// priorities for old clients through ProcessInfoService::getProcessStatesScoresFromPids().
mPriority.setScore(priority.getScore());
mPriority.setState(priority.getState());