Floating point support for audio post processing components
Source code is added/modified to support floating point processing for
audio post processing components.All the changes are done under the macro
BUILD_FLOAT
Enable/disable this macro in Android.mk files to build floating point or
fixed point code.
Based on the macro either fixed point code or floating point code gets compiled.
By default this macro is ENABLED.
(cherry picked from partner commit 2ceaff6aafadbcb0fb6d5135ca814ba7c790ab1a)
(Minor merge conflicts solved, some formatting and safety changes,
bugfixes in EffectReverb.cpp)
Test: audio comparisons between integer and floating point effects
Change-Id: Idb044ace1e8da1d86c67667aba0101ae8da6788e
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index 09793d1..ad546f2 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -20,7 +20,7 @@
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-utils)
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT
LOCAL_CFLAGS += -Wall -Werror
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index f27d5ca..519f4a8 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -33,6 +33,10 @@
#define MINUS_3_DB_IN_Q19_12 2896 // -3dB = 0.707 * 2^12 = 2896
+#ifdef BUILD_FLOAT
+#define MINUS_3_DB_IN_FLOAT 0.70710678f // -3dB = 0.70710678f
+#endif
+
// subset of possible audio_channel_mask_t values, and AUDIO_CHANNEL_OUT_* renamed to CHANNEL_MASK_*
typedef enum {
CHANNEL_MASK_QUAD_BACK = AUDIO_CHANNEL_OUT_QUAD_BACK,
@@ -82,8 +86,19 @@
// number of effects in this library
const int kNbEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-
-
+#ifdef BUILD_FLOAT
+static LVM_FLOAT clamp_float(LVM_FLOAT a) {
+ if (a > 1.0f) {
+ return 1.0f;
+ }
+ else if (a < -1.0f) {
+ return -1.0f;
+ }
+ else {
+ return a;
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Test code
*--------------------------------------------------------------------------*/
@@ -286,7 +301,7 @@
return -EINVAL;
}
-
+#ifndef BUILD_FLOAT
/*--- Effect Control Interface Implementation ---*/
static int Downmix_Process(effect_handle_t self,
@@ -385,7 +400,108 @@
return 0;
}
+#else /*BUILD_FLOAT*/
+/*--- Effect Control Interface Implementation ---*/
+static int Downmix_Process(effect_handle_t self,
+ audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) {
+
+ downmix_object_t *pDownmixer;
+ LVM_FLOAT *pSrc, *pDst;
+ downmix_module_t *pDwmModule = (downmix_module_t *)self;
+
+ if (pDwmModule == NULL) {
+ return -EINVAL;
+ }
+
+ if (inBuffer == NULL || inBuffer->raw == NULL ||
+ outBuffer == NULL || outBuffer->raw == NULL ||
+ inBuffer->frameCount != outBuffer->frameCount) {
+ return -EINVAL;
+ }
+
+ pDownmixer = (downmix_object_t*) &pDwmModule->context;
+
+ if (pDownmixer->state == DOWNMIX_STATE_UNINITIALIZED) {
+ ALOGE("Downmix_Process error: trying to use an uninitialized downmixer");
+ return -EINVAL;
+ } else if (pDownmixer->state == DOWNMIX_STATE_INITIALIZED) {
+ ALOGE("Downmix_Process error: trying to use a non-configured downmixer");
+ return -ENODATA;
+ }
+
+ pSrc = (LVM_FLOAT *) inBuffer->s16;
+ pDst = (LVM_FLOAT *) outBuffer->s16;
+ size_t numFrames = outBuffer->frameCount;
+
+ const bool accumulate =
+ (pDwmModule->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
+ const uint32_t downmixInputChannelMask = pDwmModule->config.inputCfg.channels;
+
+ switch(pDownmixer->type) {
+
+ case DOWNMIX_TYPE_STRIP:
+ if (accumulate) {
+ while (numFrames) {
+ pDst[0] = clamp_float(pDst[0] + pSrc[0]);
+ pDst[1] = clamp_float(pDst[1] + pSrc[1]);
+ pSrc += pDownmixer->input_channel_count;
+ pDst += 2;
+ numFrames--;
+ }
+ } else {
+ while (numFrames) {
+ pDst[0] = pSrc[0];
+ pDst[1] = pSrc[1];
+ pSrc += pDownmixer->input_channel_count;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+ break;
+
+ case DOWNMIX_TYPE_FOLD:
+#ifdef DOWNMIX_ALWAYS_USE_GENERIC_DOWNMIXER
+ // bypass the optimized downmix routines for the common formats
+ if (!Downmix_foldGeneric(
+ downmixInputChannelMask, pSrc, pDst, numFrames, accumulate)) {
+ ALOGE("Multichannel configuration 0x%" PRIx32 " is not supported",
+ downmixInputChannelMask);
+ return -EINVAL;
+ }
+ break;
+#endif
+ // optimize for the common formats
+ switch((downmix_input_channel_mask_t)downmixInputChannelMask) {
+ case CHANNEL_MASK_QUAD_BACK:
+ case CHANNEL_MASK_QUAD_SIDE:
+ Downmix_foldFromQuad(pSrc, pDst, numFrames, accumulate);
+ break;
+ case CHANNEL_MASK_5POINT1_BACK:
+ case CHANNEL_MASK_5POINT1_SIDE:
+ Downmix_foldFrom5Point1(pSrc, pDst, numFrames, accumulate);
+ break;
+ case CHANNEL_MASK_7POINT1:
+ Downmix_foldFrom7Point1(pSrc, pDst, numFrames, accumulate);
+ break;
+ default:
+ if (!Downmix_foldGeneric(
+ downmixInputChannelMask, pSrc, pDst, numFrames, accumulate)) {
+ ALOGE("Multichannel configuration 0x%" PRIx32 " is not supported",
+ downmixInputChannelMask);
+ return -EINVAL;
+ }
+ break;
+ }
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+#endif
static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
void *pCmdData, uint32_t *replySize, void *pReplyData) {
@@ -818,6 +934,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFromQuad(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
// sample at index 0 is FL
// sample at index 1 is FR
@@ -845,7 +962,35 @@
}
}
}
-
+#else
+void Downmix_foldFromQuad(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is RL
+ // sample at index 3 is RR
+ if (accumulate) {
+ while (numFrames) {
+ // FL + RL
+ pDst[0] = clamp_float(pDst[0] + ((pSrc[0] + pSrc[2]) / 2.0f));
+ // FR + RR
+ pDst[1] = clamp_float(pDst[1] + ((pSrc[1] + pSrc[3]) / 2.0f));
+ pSrc += 4;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // FL + RL
+ pDst[0] = clamp_float((pSrc[0] + pSrc[2]) / 2.0f);
+ // FR + RR
+ pDst[1] = clamp_float((pSrc[1] + pSrc[3]) / 2.0f);
+ pSrc += 4;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldFrom5Point1()
@@ -864,6 +1009,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFrom5Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
int32_t lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
// sample at index 0 is FL
@@ -908,7 +1054,52 @@
}
}
}
-
+#else
+void Downmix_foldFrom5Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ LVM_FLOAT lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is FC
+ // sample at index 3 is LFE
+ // sample at index 4 is RL
+ // sample at index 5 is RR
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[4];
+ // FR + centerPlusLfeContrib + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[5];
+ // accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += 6;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[4];
+ // FR + centerPlusLfeContrib + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[5];
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += 6;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldFrom7Point1()
@@ -927,6 +1118,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
void Downmix_foldFrom7Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
int32_t lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
// sample at index 0 is FL
@@ -973,8 +1165,54 @@
}
}
}
-
-
+#else
+void Downmix_foldFrom7Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+ LVM_FLOAT lt, rt, centerPlusLfeContrib; // samples in Q19.12 format
+ // sample at index 0 is FL
+ // sample at index 1 is FR
+ // sample at index 2 is FC
+ // sample at index 3 is LFE
+ // sample at index 4 is RL
+ // sample at index 5 is RR
+ // sample at index 6 is SL
+ // sample at index 7 is SR
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_Q19_12)
+ + (pSrc[3] * MINUS_3_DB_IN_Q19_12);
+ // FL + centerPlusLfeContrib + SL + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[6] + pSrc[4];
+ // FR + centerPlusLfeContrib + SR + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[7] + pSrc[5];
+ //accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += 8;
+ pDst += 2;
+ numFrames--;
+ }
+ } else { // same code as above but without adding and clamping pDst[i] to itself
+ while (numFrames) {
+ // centerPlusLfeContrib = FC(-3dB) + LFE(-3dB)
+ centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_FLOAT)
+ + (pSrc[3] * MINUS_3_DB_IN_FLOAT);
+ // FL + centerPlusLfeContrib + SL + RL
+ lt = pSrc[0] + centerPlusLfeContrib + pSrc[6] + pSrc[4];
+ // FR + centerPlusLfeContrib + SR + RR
+ rt = pSrc[1] + centerPlusLfeContrib + pSrc[7] + pSrc[5];
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += 8;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+}
+#endif
/*----------------------------------------------------------------------------
* Downmix_foldGeneric()
*----------------------------------------------------------------------------
@@ -1001,6 +1239,7 @@
*
*----------------------------------------------------------------------------
*/
+#ifndef BUILD_FLOAT
bool Downmix_foldGeneric(
uint32_t mask, int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) {
@@ -1092,3 +1331,96 @@
}
return true;
}
+#else
+bool Downmix_foldGeneric(
+ uint32_t mask, LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate) {
+
+ if (!Downmix_validChannelMask(mask)) {
+ return false;
+ }
+
+ const bool hasSides = (mask & kSides) != 0;
+ const bool hasBacks = (mask & kBacks) != 0;
+
+ const int numChan = audio_channel_count_from_out_mask(mask);
+ const bool hasFC = ((mask & AUDIO_CHANNEL_OUT_FRONT_CENTER) == AUDIO_CHANNEL_OUT_FRONT_CENTER);
+ const bool hasLFE =
+ ((mask & AUDIO_CHANNEL_OUT_LOW_FREQUENCY) == AUDIO_CHANNEL_OUT_LOW_FREQUENCY);
+ const bool hasBC = ((mask & AUDIO_CHANNEL_OUT_BACK_CENTER) == AUDIO_CHANNEL_OUT_BACK_CENTER);
+ // compute at what index each channel is: samples will be in the following order:
+ // FL FR FC LFE BL BR BC SL SR
+ // when a channel is not present, its index is set to the same as the index of the preceding
+ // channel
+ const int indexFC = hasFC ? 2 : 1; // front center
+ const int indexLFE = hasLFE ? indexFC + 1 : indexFC; // low frequency
+ const int indexBL = hasBacks ? indexLFE + 1 : indexLFE; // back left
+ const int indexBR = hasBacks ? indexBL + 1 : indexBL; // back right
+ const int indexBC = hasBC ? indexBR + 1 : indexBR; // back center
+ const int indexSL = hasSides ? indexBC + 1 : indexBC; // side left
+ const int indexSR = hasSides ? indexSL + 1 : indexSL; // side right
+
+ LVM_FLOAT lt, rt, centersLfeContrib;
+ // code is mostly duplicated between the two values of accumulate to avoid repeating the test
+ // for every sample
+ if (accumulate) {
+ while (numFrames) {
+ // compute contribution of FC, BC and LFE
+ centersLfeContrib = 0;
+ if (hasFC) { centersLfeContrib += pSrc[indexFC]; }
+ if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; }
+ if (hasBC) { centersLfeContrib += pSrc[indexBC]; }
+ centersLfeContrib *= MINUS_3_DB_IN_FLOAT;
+ // always has FL/FR
+ lt = pSrc[0];
+ rt = pSrc[1];
+ // mix in sides and backs
+ if (hasSides) {
+ lt += pSrc[indexSL];
+ rt += pSrc[indexSR];
+ }
+ if (hasBacks) {
+ lt += pSrc[indexBL];
+ rt += pSrc[indexBR];
+ }
+ lt += centersLfeContrib;
+ rt += centersLfeContrib;
+ // accumulate in destination
+ pDst[0] = clamp_float(pDst[0] + (lt / 2.0f));
+ pDst[1] = clamp_float(pDst[1] + (rt / 2.0f));
+ pSrc += numChan;
+ pDst += 2;
+ numFrames--;
+ }
+ } else {
+ while (numFrames) {
+ // compute contribution of FC, BC and LFE
+ centersLfeContrib = 0;
+ if (hasFC) { centersLfeContrib += pSrc[indexFC]; }
+ if (hasLFE) { centersLfeContrib += pSrc[indexLFE]; }
+ if (hasBC) { centersLfeContrib += pSrc[indexBC]; }
+ centersLfeContrib *= MINUS_3_DB_IN_FLOAT;
+ // always has FL/FR
+ lt = pSrc[0];
+ rt = pSrc[1];
+ // mix in sides and backs
+ if (hasSides) {
+ lt += pSrc[indexSL];
+ rt += pSrc[indexSR];
+ }
+ if (hasBacks) {
+ lt += pSrc[indexBL];
+ rt += pSrc[indexBR];
+ }
+ lt += centersLfeContrib;
+ rt += centersLfeContrib;
+ // store in destination
+ pDst[0] = clamp_float(lt / 2.0f); // differs from when accumulate is true above
+ pDst[1] = clamp_float(rt / 2.0f); // differs from when accumulate is true above
+ pSrc += numChan;
+ pDst += 2;
+ numFrames--;
+ }
+ }
+ return true;
+}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/downmix/EffectDownmix.h b/media/libeffects/downmix/EffectDownmix.h
index 2399abd..c1be0f2 100644
--- a/media/libeffects/downmix/EffectDownmix.h
+++ b/media/libeffects/downmix/EffectDownmix.h
@@ -27,7 +27,9 @@
*/
#define DOWNMIX_OUTPUT_CHANNELS AUDIO_CHANNEL_OUT_STEREO
-
+#ifdef BUILD_FLOAT
+#define LVM_FLOAT float
+#endif
typedef enum {
DOWNMIX_STATE_UNINITIALIZED,
DOWNMIX_STATE_INITIALIZED,
@@ -95,11 +97,18 @@
int Downmix_Reset(downmix_object_t *pDownmixer, bool init);
int Downmix_setParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t size, void *pValue);
int Downmix_getParameter(downmix_object_t *pDownmixer, int32_t param, uint32_t *pSize, void *pValue);
-
+#ifdef BUILD_FLOAT
+void Downmix_foldFromQuad(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+void Downmix_foldFrom5Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+void Downmix_foldFrom7Point1(LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+bool Downmix_foldGeneric(
+ uint32_t mask, LVM_FLOAT *pSrc, LVM_FLOAT *pDst, size_t numFrames, bool accumulate);
+#else
void Downmix_foldFromQuad(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
void Downmix_foldFrom5Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
void Downmix_foldFrom7Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
bool Downmix_foldGeneric(
uint32_t mask, int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate);
+#endif
#endif /*ANDROID_EFFECTDOWNMIX_H_*/
diff --git a/media/libeffects/lvm/lib/Android.mk b/media/libeffects/lvm/lib/Android.mk
index 83e8288..941eb3e 100644
--- a/media/libeffects/lvm/lib/Android.mk
+++ b/media/libeffects/lvm/lib/Android.mk
@@ -72,19 +72,25 @@
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 \
@@ -120,7 +126,7 @@
$(LOCAL_PATH)/StereoWidening/src \
$(LOCAL_PATH)/StereoWidening/lib
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
include $(BUILD_STATIC_LIBRARY)
@@ -179,6 +185,7 @@
$(LOCAL_PATH)/Common/lib \
$(LOCAL_PATH)/Common/src
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
+
include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
index 228977d..4c2b954 100644
--- a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
+++ b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
@@ -198,6 +198,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_96000 512
+#define LVDBE_CAP_FS_192000 1024
+#endif
typedef enum
{
@@ -210,6 +214,10 @@
LVDBE_FS_32000 = 6,
LVDBE_FS_44100 = 7,
LVDBE_FS_48000 = 8,
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ LVDBE_FS_96000 = 9,
+ LVDBE_FS_192000 = 10,
+#endif
LVDBE_FS_MAX = LVM_MAXINT_32
} LVDBE_Fs_en;
@@ -450,12 +458,17 @@
/* 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
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index b1ebadf..f32ed30 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -19,6 +19,7 @@
#define __LVDBE_COEFFS_H__
+#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* General */
@@ -514,5 +515,632 @@
#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 */
+/* */
+/************************************************************************************/
+
+ /* Coefficients for centre frequency 55Hz */
+#define HPF_Fs8000_Fc55_A0 0.958849f
+#define HPF_Fs8000_Fc55_A1 -1.917698f
+#define HPF_Fs8000_Fc55_A2 0.958849f
+#define HPF_Fs8000_Fc55_B1 -1.939001f
+#define HPF_Fs8000_Fc55_B2 0.940807f
+#define HPF_Fs11025_Fc55_A0 0.966909f
+#define HPF_Fs11025_Fc55_A1 -1.933818f
+#define HPF_Fs11025_Fc55_A2 0.966909f
+#define HPF_Fs11025_Fc55_B1 -1.955732f
+#define HPF_Fs11025_Fc55_B2 0.956690f
+#define HPF_Fs12000_Fc55_A0 0.968650f
+#define HPF_Fs12000_Fc55_A1 -1.937300f
+#define HPF_Fs12000_Fc55_A2 0.968650f
+#define HPF_Fs12000_Fc55_B1 -1.959327f
+#define HPF_Fs12000_Fc55_B2 0.960138f
+#define HPF_Fs16000_Fc55_A0 0.973588f
+#define HPF_Fs16000_Fc55_A1 -1.947176f
+#define HPF_Fs16000_Fc55_A2 0.973588f
+#define HPF_Fs16000_Fc55_B1 -1.969494f
+#define HPF_Fs16000_Fc55_B2 0.969952f
+#define HPF_Fs22050_Fc55_A0 0.977671f
+#define HPF_Fs22050_Fc55_A1 -1.955343f
+#define HPF_Fs22050_Fc55_A2 0.977671f
+#define HPF_Fs22050_Fc55_B1 -1.977863f
+#define HPF_Fs22050_Fc55_B2 0.978105f
+#define HPF_Fs24000_Fc55_A0 0.978551f
+#define HPF_Fs24000_Fc55_A1 -1.957102f
+#define HPF_Fs24000_Fc55_A2 0.978551f
+#define HPF_Fs24000_Fc55_B1 -1.979662f
+#define HPF_Fs24000_Fc55_B2 0.979866f
+#define HPF_Fs32000_Fc55_A0 0.981042f
+#define HPF_Fs32000_Fc55_A1 -1.962084f
+#define HPF_Fs32000_Fc55_A2 0.981042f
+#define HPF_Fs32000_Fc55_B1 -1.984746f
+#define HPF_Fs32000_Fc55_B2 0.984861f
+#define HPF_Fs44100_Fc55_A0 0.983097f
+#define HPF_Fs44100_Fc55_A1 -1.966194f
+#define HPF_Fs44100_Fc55_A2 0.983097f
+#define HPF_Fs44100_Fc55_B1 -1.988931f
+#define HPF_Fs44100_Fc55_B2 0.988992f
+#define HPF_Fs48000_Fc55_A0 0.983539f
+#define HPF_Fs48000_Fc55_A1 -1.967079f
+#define HPF_Fs48000_Fc55_A2 0.983539f
+#define HPF_Fs48000_Fc55_B1 -1.989831f
+#define HPF_Fs48000_Fc55_B2 0.989882f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc55_A0 0.986040f
+#define HPF_Fs96000_Fc55_A1 -1.972080f
+#define HPF_Fs96000_Fc55_A2 0.986040f
+#define HPF_Fs96000_Fc55_B1 -1.994915f
+#define HPF_Fs96000_Fc55_B2 0.994928f
+
+#define HPF_Fs192000_Fc55_A0 0.987294f
+#define HPF_Fs192000_Fc55_A1 -1.974588f
+#define HPF_Fs192000_Fc55_A2 0.987294f
+#define HPF_Fs192000_Fc55_B1 -1.997458f
+#define HPF_Fs192000_Fc55_B2 0.997461f
#endif
+
+
+ /* Coefficients for centre frequency 66Hz */
+#define HPF_Fs8000_Fc66_A0 0.953016f
+#define HPF_Fs8000_Fc66_A1 -1.906032f
+#define HPF_Fs8000_Fc66_A2 0.953016f
+#define HPF_Fs8000_Fc66_B1 -1.926810f
+#define HPF_Fs8000_Fc66_B2 0.929396f
+#define HPF_Fs11025_Fc66_A0 0.962638f
+#define HPF_Fs11025_Fc66_A1 -1.925275f
+#define HPF_Fs11025_Fc66_A2 0.962638f
+#define HPF_Fs11025_Fc66_B1 -1.946881f
+#define HPF_Fs11025_Fc66_B2 0.948256f
+#define HPF_Fs12000_Fc66_A0 0.964718f
+#define HPF_Fs12000_Fc66_A1 -1.929435f
+#define HPF_Fs12000_Fc66_A2 0.964718f
+#define HPF_Fs12000_Fc66_B1 -1.951196f
+#define HPF_Fs12000_Fc66_B2 0.952359f
+#define HPF_Fs16000_Fc66_A0 0.970622f
+#define HPF_Fs16000_Fc66_A1 -1.941244f
+#define HPF_Fs16000_Fc66_A2 0.970622f
+#define HPF_Fs16000_Fc66_B1 -1.963394f
+#define HPF_Fs16000_Fc66_B2 0.964052f
+#define HPF_Fs22050_Fc66_A0 0.975509f
+#define HPF_Fs22050_Fc66_A1 -1.951019f
+#define HPF_Fs22050_Fc66_A2 0.975509f
+#define HPF_Fs22050_Fc66_B1 -1.973436f
+#define HPF_Fs22050_Fc66_B2 0.973784f
+#define HPF_Fs24000_Fc66_A0 0.976563f
+#define HPF_Fs24000_Fc66_A1 -1.953125f
+#define HPF_Fs24000_Fc66_A2 0.976563f
+#define HPF_Fs24000_Fc66_B1 -1.975594f
+#define HPF_Fs24000_Fc66_B2 0.975889f
+#define HPF_Fs32000_Fc66_A0 0.979547f
+#define HPF_Fs32000_Fc66_A1 -1.959093f
+#define HPF_Fs32000_Fc66_A2 0.979547f
+#define HPF_Fs32000_Fc66_B1 -1.981695f
+#define HPF_Fs32000_Fc66_B2 0.981861f
+#define HPF_Fs44100_Fc66_A0 0.982010f
+#define HPF_Fs44100_Fc66_A1 -1.964019f
+#define HPF_Fs44100_Fc66_A2 0.982010f
+#define HPF_Fs44100_Fc66_B1 -1.986718f
+#define HPF_Fs44100_Fc66_B2 0.986805f
+#define HPF_Fs48000_Fc66_A0 0.982540f
+#define HPF_Fs48000_Fc66_A1 -1.965079f
+#define HPF_Fs48000_Fc66_A2 0.982540f
+#define HPF_Fs48000_Fc66_B1 -1.987797f
+#define HPF_Fs48000_Fc66_B2 0.987871f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc66_A0 0.985539f
+#define HPF_Fs96000_Fc66_A1 -1.971077f
+#define HPF_Fs96000_Fc66_A2 0.985539f
+#define HPF_Fs96000_Fc66_B1 -1.993898f
+#define HPF_Fs96000_Fc66_B2 0.993917f
+
+#define HPF_Fs192000_Fc66_A0 0.987043f
+#define HPF_Fs192000_Fc66_A1 -1.974086f
+#define HPF_Fs192000_Fc66_A2 0.987043f
+#define HPF_Fs192000_Fc66_B1 -1.996949f
+#define HPF_Fs192000_Fc66_B2 0.996954f
+#endif
+
+/* Coefficients for centre frequency 78Hz */
+#define HPF_Fs8000_Fc78_A0 0.946693f
+#define HPF_Fs8000_Fc78_A1 -1.893387f
+#define HPF_Fs8000_Fc78_A2 0.946693f
+#define HPF_Fs8000_Fc78_B1 -1.913517f
+#define HPF_Fs8000_Fc78_B2 0.917105f
+#define HPF_Fs11025_Fc78_A0 0.957999f
+#define HPF_Fs11025_Fc78_A1 -1.915998f
+#define HPF_Fs11025_Fc78_A2 0.957999f
+#define HPF_Fs11025_Fc78_B1 -1.937229f
+#define HPF_Fs11025_Fc78_B2 0.939140f
+#define HPF_Fs12000_Fc78_A0 0.960446f
+#define HPF_Fs12000_Fc78_A1 -1.920892f
+#define HPF_Fs12000_Fc78_A2 0.960446f
+#define HPF_Fs12000_Fc78_B1 -1.942326f
+#define HPF_Fs12000_Fc78_B2 0.943944f
+#define HPF_Fs16000_Fc78_A0 0.967397f
+#define HPF_Fs16000_Fc78_A1 -1.934794f
+#define HPF_Fs16000_Fc78_A2 0.967397f
+#define HPF_Fs16000_Fc78_B1 -1.956740f
+#define HPF_Fs16000_Fc78_B2 0.957656f
+#define HPF_Fs22050_Fc78_A0 0.973156f
+#define HPF_Fs22050_Fc78_A1 -1.946313f
+#define HPF_Fs22050_Fc78_A2 0.973156f
+#define HPF_Fs22050_Fc78_B1 -1.968607f
+#define HPF_Fs22050_Fc78_B2 0.969092f
+#define HPF_Fs24000_Fc78_A0 0.974398f
+#define HPF_Fs24000_Fc78_A1 -1.948797f
+#define HPF_Fs24000_Fc78_A2 0.974398f
+#define HPF_Fs24000_Fc78_B1 -1.971157f
+#define HPF_Fs24000_Fc78_B2 0.971568f
+#define HPF_Fs32000_Fc78_A0 0.977918f
+#define HPF_Fs32000_Fc78_A1 -1.955836f
+#define HPF_Fs32000_Fc78_A2 0.977918f
+#define HPF_Fs32000_Fc78_B1 -1.978367f
+#define HPF_Fs32000_Fc78_B2 0.978599f
+#define HPF_Fs44100_Fc78_A0 0.980824f
+#define HPF_Fs44100_Fc78_A1 -1.961649f
+#define HPF_Fs44100_Fc78_A2 0.980824f
+#define HPF_Fs44100_Fc78_B1 -1.984303f
+#define HPF_Fs44100_Fc78_B2 0.984425f
+#define HPF_Fs48000_Fc78_A0 0.981450f
+#define HPF_Fs48000_Fc78_A1 -1.962900f
+#define HPF_Fs48000_Fc78_A2 0.981450f
+#define HPF_Fs48000_Fc78_B1 -1.985578f
+#define HPF_Fs48000_Fc78_B2 0.985681f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc78_A0 0.984992f
+#define HPF_Fs96000_Fc78_A1 -1.969984f
+#define HPF_Fs96000_Fc78_A2 0.984992f
+#define HPF_Fs96000_Fc78_B1 -1.992789f
+#define HPF_Fs96000_Fc78_B2 0.992815f
+
+#define HPF_Fs192000_Fc78_A0 0.986769f
+#define HPF_Fs192000_Fc78_A1 -1.973539f
+#define HPF_Fs192000_Fc78_A2 0.986769f
+#define HPF_Fs192000_Fc78_B1 -1.996394f
+#define HPF_Fs192000_Fc78_B2 0.996401f
+#endif
+
+/* Coefficients for centre frequency 90Hz */
+#define HPF_Fs8000_Fc90_A0 0.940412f
+#define HPF_Fs8000_Fc90_A1 -1.880825f
+#define HPF_Fs8000_Fc90_A2 0.940412f
+#define HPF_Fs8000_Fc90_B1 -1.900231f
+#define HPF_Fs8000_Fc90_B2 0.904977f
+#define HPF_Fs11025_Fc90_A0 0.953383f
+#define HPF_Fs11025_Fc90_A1 -1.906766f
+#define HPF_Fs11025_Fc90_A2 0.953383f
+#define HPF_Fs11025_Fc90_B1 -1.927579f
+#define HPF_Fs11025_Fc90_B2 0.930111f
+#define HPF_Fs12000_Fc90_A0 0.956193f
+#define HPF_Fs12000_Fc90_A1 -1.912387f
+#define HPF_Fs12000_Fc90_A2 0.956193f
+#define HPF_Fs12000_Fc90_B1 -1.933459f
+#define HPF_Fs12000_Fc90_B2 0.935603f
+#define HPF_Fs16000_Fc90_A0 0.964183f
+#define HPF_Fs16000_Fc90_A1 -1.928365f
+#define HPF_Fs16000_Fc90_A2 0.964183f
+#define HPF_Fs16000_Fc90_B1 -1.950087f
+#define HPF_Fs16000_Fc90_B2 0.951303f
+#define HPF_Fs22050_Fc90_A0 0.970809f
+#define HPF_Fs22050_Fc90_A1 -1.941618f
+#define HPF_Fs22050_Fc90_A2 0.970809f
+#define HPF_Fs22050_Fc90_B1 -1.963778f
+#define HPF_Fs22050_Fc90_B2 0.964423f
+#define HPF_Fs24000_Fc90_A0 0.972239f
+#define HPF_Fs24000_Fc90_A1 -1.944477f
+#define HPF_Fs24000_Fc90_A2 0.972239f
+#define HPF_Fs24000_Fc90_B1 -1.966721f
+#define HPF_Fs24000_Fc90_B2 0.967266f
+#define HPF_Fs32000_Fc90_A0 0.976292f
+#define HPF_Fs32000_Fc90_A1 -1.952584f
+#define HPF_Fs32000_Fc90_A2 0.976292f
+#define HPF_Fs32000_Fc90_B1 -1.975040f
+#define HPF_Fs32000_Fc90_B2 0.975347f
+#define HPF_Fs44100_Fc90_A0 0.979641f
+#define HPF_Fs44100_Fc90_A1 -1.959282f
+#define HPF_Fs44100_Fc90_A2 0.979641f
+#define HPF_Fs44100_Fc90_B1 -1.981888f
+#define HPF_Fs44100_Fc90_B2 0.982050f
+#define HPF_Fs48000_Fc90_A0 0.980362f
+#define HPF_Fs48000_Fc90_A1 -1.960724f
+#define HPF_Fs48000_Fc90_A2 0.980362f
+#define HPF_Fs48000_Fc90_B1 -1.983359f
+#define HPF_Fs48000_Fc90_B2 0.983497f
+
+#ifdef HIGHER_FS
+#define HPF_Fs96000_Fc90_A0 0.984446f
+#define HPF_Fs96000_Fc90_A1 -1.968892f
+#define HPF_Fs96000_Fc90_A2 0.984446f
+#define HPF_Fs96000_Fc90_B1 -1.991680f
+#define HPF_Fs96000_Fc90_B2 0.991714f
+
+#define HPF_Fs192000_Fc90_A0 0.986496f
+#define HPF_Fs192000_Fc90_A1 -1.972992f
+#define HPF_Fs192000_Fc90_A2 0.986496f
+#define HPF_Fs192000_Fc90_B1 -1.995840f
+#define HPF_Fs192000_Fc90_B2 0.995848f
+#endif
+
+/************************************************************************************/
+/* */
+/* Band Pass Filter coefficients */
+/* */
+/************************************************************************************/
+
+/* Coefficients for centre frequency 55Hz */
+#define BPF_Fs8000_Fc55_A0 0.009197f
+#define BPF_Fs8000_Fc55_A1 0.000000f
+#define BPF_Fs8000_Fc55_A2 -0.009197f
+#define BPF_Fs8000_Fc55_B1 -1.979545f
+#define BPF_Fs8000_Fc55_B2 0.981393f
+#define BPF_Fs11025_Fc55_A0 0.006691f
+#define BPF_Fs11025_Fc55_A1 0.000000f
+#define BPF_Fs11025_Fc55_A2 -0.006691f
+#define BPF_Fs11025_Fc55_B1 -1.985488f
+#define BPF_Fs11025_Fc55_B2 0.986464f
+#define BPF_Fs12000_Fc55_A0 0.006150f
+#define BPF_Fs12000_Fc55_A1 0.000000f
+#define BPF_Fs12000_Fc55_A2 -0.006150f
+#define BPF_Fs12000_Fc55_B1 -1.986733f
+#define BPF_Fs12000_Fc55_B2 0.987557f
+#define BPF_Fs16000_Fc55_A0 0.004620f
+#define BPF_Fs16000_Fc55_A1 0.000000f
+#define BPF_Fs16000_Fc55_A2 -0.004620f
+#define BPF_Fs16000_Fc55_B1 -1.990189f
+#define BPF_Fs16000_Fc55_B2 0.990653f
+#define BPF_Fs22050_Fc55_A0 0.003357f
+#define BPF_Fs22050_Fc55_A1 0.000000f
+#define BPF_Fs22050_Fc55_A2 -0.003357f
+#define BPF_Fs22050_Fc55_B1 -1.992964f
+#define BPF_Fs22050_Fc55_B2 0.993209f
+#define BPF_Fs24000_Fc55_A0 0.003085f
+#define BPF_Fs24000_Fc55_A1 0.000000f
+#define BPF_Fs24000_Fc55_A2 -0.003085f
+#define BPF_Fs24000_Fc55_B1 -1.993552f
+#define BPF_Fs24000_Fc55_B2 0.993759f
+#define BPF_Fs32000_Fc55_A0 0.002315f
+#define BPF_Fs32000_Fc55_A1 0.000000f
+#define BPF_Fs32000_Fc55_A2 -0.002315f
+#define BPF_Fs32000_Fc55_B1 -1.995199f
+#define BPF_Fs32000_Fc55_B2 0.995316f
+#define BPF_Fs44100_Fc55_A0 0.001681f
+#define BPF_Fs44100_Fc55_A1 0.000000f
+#define BPF_Fs44100_Fc55_A2 -0.001681f
+#define BPF_Fs44100_Fc55_B1 -1.996537f
+#define BPF_Fs44100_Fc55_B2 0.996599f
+#define BPF_Fs48000_Fc55_A0 0.001545f
+#define BPF_Fs48000_Fc55_A1 0.000000f
+#define BPF_Fs48000_Fc55_A2 -0.001545f
+#define BPF_Fs48000_Fc55_B1 -1.996823f
+#define BPF_Fs48000_Fc55_B2 0.996875f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc55_A0 0.000762f
+#define BPF_Fs96000_Fc55_A1 0.000000f
+#define BPF_Fs96000_Fc55_A2 -0.000762f
+#define BPF_Fs96000_Fc55_B1 -1.998461f
+#define BPF_Fs96000_Fc55_B2 0.998477f
+
+#define BPF_Fs192000_Fc55_A0 0.000381f
+#define BPF_Fs192000_Fc55_A1 0.000000f
+#define BPF_Fs192000_Fc55_A2 -0.000381f
+#define BPF_Fs192000_Fc55_B1 -1.999234f
+#define BPF_Fs192000_Fc55_B2 0.999238f
+#endif
+
+/* Coefficients for centre frequency 66Hz */
+#define BPF_Fs8000_Fc66_A0 0.012648f
+#define BPF_Fs8000_Fc66_A1 0.000000f
+#define BPF_Fs8000_Fc66_A2 -0.012648f
+#define BPF_Fs8000_Fc66_B1 -1.971760f
+#define BPF_Fs8000_Fc66_B2 0.974412f
+#define BPF_Fs11025_Fc66_A0 0.009209f
+#define BPF_Fs11025_Fc66_A1 0.000000f
+#define BPF_Fs11025_Fc66_A2 -0.009209f
+#define BPF_Fs11025_Fc66_B1 -1.979966f
+#define BPF_Fs11025_Fc66_B2 0.981368f
+#define BPF_Fs12000_Fc66_A0 0.008468f
+#define BPF_Fs12000_Fc66_A1 0.000000f
+#define BPF_Fs12000_Fc66_A2 -0.008468f
+#define BPF_Fs12000_Fc66_B1 -1.981685f
+#define BPF_Fs12000_Fc66_B2 0.982869f
+#define BPF_Fs16000_Fc66_A0 0.006364f
+#define BPF_Fs16000_Fc66_A1 0.000000f
+#define BPF_Fs16000_Fc66_A2 -0.006364f
+#define BPF_Fs16000_Fc66_B1 -1.986457f
+#define BPF_Fs16000_Fc66_B2 0.987124f
+#define BPF_Fs22050_Fc66_A0 0.004626f
+#define BPF_Fs22050_Fc66_A1 0.000000f
+#define BPF_Fs22050_Fc66_A2 -0.004626f
+#define BPF_Fs22050_Fc66_B1 -1.990288f
+#define BPF_Fs22050_Fc66_B2 0.990641f
+#define BPF_Fs24000_Fc66_A0 0.004252f
+#define BPF_Fs24000_Fc66_A1 0.000000f
+#define BPF_Fs24000_Fc66_A2 -0.004252f
+#define BPF_Fs24000_Fc66_B1 -1.991100f
+#define BPF_Fs24000_Fc66_B2 0.991398f
+#define BPF_Fs32000_Fc66_A0 0.003192f
+#define BPF_Fs32000_Fc66_A1 0.000000f
+#define BPF_Fs32000_Fc66_A2 -0.003192f
+#define BPF_Fs32000_Fc66_B1 -1.993374f
+#define BPF_Fs32000_Fc66_B2 0.993541f
+#define BPF_Fs44100_Fc66_A0 0.002318f
+#define BPF_Fs44100_Fc66_A1 0.000000f
+#define BPF_Fs44100_Fc66_A2 -0.002318f
+#define BPF_Fs44100_Fc66_B1 -1.995221f
+#define BPF_Fs44100_Fc66_B2 0.995309f
+#define BPF_Fs48000_Fc66_A0 0.002131f
+#define BPF_Fs48000_Fc66_A1 0.000000f
+#define BPF_Fs48000_Fc66_A2 -0.002131f
+#define BPF_Fs48000_Fc66_B1 -1.995615f
+#define BPF_Fs48000_Fc66_B2 0.995690f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc66_A0 0.001055f
+#define BPF_Fs96000_Fc66_A1 0.000000f
+#define BPF_Fs96000_Fc66_A2 -0.001055f
+#define BPF_Fs96000_Fc66_B1 -1.997868f
+#define BPF_Fs96000_Fc66_B2 0.997891f
+
+#define BPF_Fs192000_Fc66_A0 0.000528f
+#define BPF_Fs192000_Fc66_A1 0.000000f
+#define BPF_Fs192000_Fc66_A2 -0.000528f
+#define BPF_Fs192000_Fc66_B1 -1.998939f
+#define BPF_Fs192000_Fc66_B2 0.998945f
+#endif
+
+/* Coefficients for centre frequency 78Hz */
+#define BPF_Fs8000_Fc78_A0 0.018572f
+#define BPF_Fs8000_Fc78_A1 0.000000f
+#define BPF_Fs8000_Fc78_A2 -0.018572f
+#define BPF_Fs8000_Fc78_B1 -1.958745f
+#define BPF_Fs8000_Fc78_B2 0.962427f
+#define BPF_Fs11025_Fc78_A0 0.013545f
+#define BPF_Fs11025_Fc78_A1 0.000000f
+#define BPF_Fs11025_Fc78_A2 -0.013545f
+#define BPF_Fs11025_Fc78_B1 -1.970647f
+#define BPF_Fs11025_Fc78_B2 0.972596f
+#define BPF_Fs12000_Fc78_A0 0.012458f
+#define BPF_Fs12000_Fc78_A1 0.000000f
+#define BPF_Fs12000_Fc78_A2 -0.012458f
+#define BPF_Fs12000_Fc78_B1 -1.973148f
+#define BPF_Fs12000_Fc78_B2 0.974795f
+#define BPF_Fs16000_Fc78_A0 0.009373f
+#define BPF_Fs16000_Fc78_A1 0.000000f
+#define BPF_Fs16000_Fc78_A2 -0.009373f
+#define BPF_Fs16000_Fc78_B1 -1.980108f
+#define BPF_Fs16000_Fc78_B2 0.981037f
+#define BPF_Fs22050_Fc78_A0 0.006819f
+#define BPF_Fs22050_Fc78_A1 0.000000f
+#define BPF_Fs22050_Fc78_A2 -0.006819f
+#define BPF_Fs22050_Fc78_B1 -1.985714f
+#define BPF_Fs22050_Fc78_B2 0.986204f
+#define BPF_Fs24000_Fc78_A0 0.006268f
+#define BPF_Fs24000_Fc78_A1 0.000000f
+#define BPF_Fs24000_Fc78_A2 -0.006268f
+#define BPF_Fs24000_Fc78_B1 -1.986904f
+#define BPF_Fs24000_Fc78_B2 0.987318f
+#define BPF_Fs32000_Fc78_A0 0.004709f
+#define BPF_Fs32000_Fc78_A1 0.000000f
+#define BPF_Fs32000_Fc78_A2 -0.004709f
+#define BPF_Fs32000_Fc78_B1 -1.990240f
+#define BPF_Fs32000_Fc78_B2 0.990473f
+#define BPF_Fs44100_Fc78_A0 0.003421f
+#define BPF_Fs44100_Fc78_A1 0.000000f
+#define BPF_Fs44100_Fc78_A2 -0.003421f
+#define BPF_Fs44100_Fc78_B1 -1.992955f
+#define BPF_Fs44100_Fc78_B2 0.993078f
+#define BPF_Fs48000_Fc78_A0 0.003144f
+#define BPF_Fs48000_Fc78_A1 0.000000f
+#define BPF_Fs48000_Fc78_A2 -0.003144f
+#define BPF_Fs48000_Fc78_B1 -1.993535f
+#define BPF_Fs48000_Fc78_B2 0.993639f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc78_A0 0.001555f
+#define BPF_Fs96000_Fc78_A1 0.000000f
+#define BPF_Fs96000_Fc78_A2 -0.0015555f
+#define BPF_Fs96000_Fc78_B1 -1.996860f
+#define BPF_Fs96000_Fc78_B2 0.996891f
+
+#define BPF_Fs192000_Fc78_A0 0.000778f
+#define BPF_Fs192000_Fc78_A1 0.000000f
+#define BPF_Fs192000_Fc78_A2 -0.000778f
+#define BPF_Fs192000_Fc78_B1 -1.998437f
+#define BPF_Fs192000_Fc78_B2 0.998444f
+#endif
+
+/* Coefficients for centre frequency 90Hz */
+#define BPF_Fs8000_Fc90_A0 0.022760f
+#define BPF_Fs8000_Fc90_A1 0.000000f
+#define BPF_Fs8000_Fc90_A2 -0.022760f
+#define BPF_Fs8000_Fc90_B1 -1.949073f
+#define BPF_Fs8000_Fc90_B2 0.953953f
+#define BPF_Fs11025_Fc90_A0 0.016619f
+#define BPF_Fs11025_Fc90_A1 0.000000f
+#define BPF_Fs11025_Fc90_A2 -0.016619f
+#define BPF_Fs11025_Fc90_B1 -1.963791f
+#define BPF_Fs11025_Fc90_B2 0.966377f
+#define BPF_Fs12000_Fc90_A0 0.015289f
+#define BPF_Fs12000_Fc90_A1 0.000000f
+#define BPF_Fs12000_Fc90_A2 -0.015289f
+#define BPF_Fs12000_Fc90_B1 -1.966882f
+#define BPF_Fs12000_Fc90_B2 0.969067f
+#define BPF_Fs16000_Fc90_A0 0.011511f
+#define BPF_Fs16000_Fc90_A1 0.000000f
+#define BPF_Fs16000_Fc90_A2 -0.011511f
+#define BPF_Fs16000_Fc90_B1 -1.975477f
+#define BPF_Fs16000_Fc90_B2 0.976711f
+#define BPF_Fs22050_Fc90_A0 0.008379f
+#define BPF_Fs22050_Fc90_A1 0.000000f
+#define BPF_Fs22050_Fc90_A2 -0.008379f
+#define BPF_Fs22050_Fc90_B1 -1.982395f
+#define BPF_Fs22050_Fc90_B2 0.983047f
+#define BPF_Fs24000_Fc90_A0 0.007704f
+#define BPF_Fs24000_Fc90_A1 0.000000f
+#define BPF_Fs24000_Fc90_A2 -0.007704f
+#define BPF_Fs24000_Fc90_B1 -1.983863f
+#define BPF_Fs24000_Fc90_B2 0.984414f
+#define BPF_Fs32000_Fc90_A0 0.005789f
+#define BPF_Fs32000_Fc90_A1 0.000000f
+#define BPF_Fs32000_Fc90_A2 -0.005789f
+#define BPF_Fs32000_Fc90_B1 -1.987977f
+#define BPF_Fs32000_Fc90_B2 0.988288f
+#define BPF_Fs44100_Fc90_A0 0.004207f
+#define BPF_Fs44100_Fc90_A1 0.000000f
+#define BPF_Fs44100_Fc90_A2 -0.004207f
+#define BPF_Fs44100_Fc90_B1 -1.991324f
+#define BPF_Fs44100_Fc90_B2 0.991488f
+#define BPF_Fs48000_Fc90_A0 0.003867f
+#define BPF_Fs48000_Fc90_A1 0.000000f
+#define BPF_Fs48000_Fc90_A2 -0.003867f
+#define BPF_Fs48000_Fc90_B1 -1.992038f
+#define BPF_Fs48000_Fc90_B2 0.992177f
+
+#ifdef HIGHER_FS
+#define BPF_Fs96000_Fc90_A0 0.001913f
+#define BPF_Fs96000_Fc90_A1 0.000000f
+#define BPF_Fs96000_Fc90_A2 -0.001913f
+#define BPF_Fs96000_Fc90_B1 -1.996134f
+#define BPF_Fs96000_Fc90_B2 0.996174f
+
+#define BPF_Fs192000_Fc90_A0 0.000958f
+#define BPF_Fs192000_Fc90_A1 0.000000f
+#define BPF_Fs192000_Fc90_A2 -0.000958f
+#define BPF_Fs192000_Fc90_B1 -1.998075f
+#define BPF_Fs192000_Fc90_B2 0.998085f
+#endif
+
+/************************************************************************************/
+/* */
+/* Automatic Gain Control time constants and gain settings */
+/* */
+/************************************************************************************/
+
+/* AGC Time constants */
+#define AGC_ATTACK_Fs8000 0.841395f
+#define AGC_ATTACK_Fs11025 0.882223f
+#define AGC_ATTACK_Fs12000 0.891251f
+#define AGC_ATTACK_Fs16000 0.917276f
+#define AGC_ATTACK_Fs22050 0.939267f
+#define AGC_ATTACK_Fs24000 0.944061f
+#define AGC_ATTACK_Fs32000 0.957745f
+#define AGC_ATTACK_Fs44100 0.969158f
+#define AGC_ATTACK_Fs48000 0.971628f
+
+#ifdef HIGHER_FS
+#define AGC_ATTACK_Fs96000 0.985712f
+#define AGC_ATTACK_Fs192000 0.992830f
+#endif
+
+#define DECAY_SHIFT 10
+
+#define AGC_DECAY_Fs8000 0.000042f
+#define AGC_DECAY_Fs11025 0.000030f
+#define AGC_DECAY_Fs12000 0.000028f
+#define AGC_DECAY_Fs16000 0.000021f
+#define AGC_DECAY_Fs22050 0.000015f
+#define AGC_DECAY_Fs24000 0.000014f
+#define AGC_DECAY_Fs32000 0.000010f
+#define AGC_DECAY_Fs44100 0.000008f
+#define AGC_DECAY_Fs48000 0.000007f
+
+#ifdef HIGHER_FS
+#define AGC_DECAY_FS96000 0.0000035f
+#define AGC_DECAY_FS192000 0.00000175f
+#endif
+
+/* AGC Gain settings */
+#define AGC_GAIN_SCALE 31 /* As a power of 2 */
+#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
+#define AGC_TARGETLEVEL 0.988553f
+#define AGC_HPFGAIN_0dB 0.412538f
+#define AGC_GAIN_0dB 0.000000f
+#define AGC_HPFGAIN_1dB 0.584893f
+#define AGC_GAIN_1dB 0.122018f
+#define AGC_HPFGAIN_2dB 0.778279f
+#define AGC_GAIN_2dB 0.258925f
+#define AGC_HPFGAIN_3dB 0.995262f
+#define AGC_GAIN_3dB 0.412538f
+#define AGC_HPFGAIN_4dB 1.238721f
+#define AGC_GAIN_4dB 0.584893f
+#define AGC_HPFGAIN_5dB 1.511886f
+#define AGC_GAIN_5dB 0.778279f
+#define AGC_HPFGAIN_6dB 1.818383f
+#define AGC_GAIN_6dB 0.995262f
+#define AGC_HPFGAIN_7dB 2.162278f
+#define AGC_GAIN_7dB 1.238721f
+#define AGC_HPFGAIN_8dB 2.548134f
+#define AGC_GAIN_8dB 1.511886f
+#define AGC_HPFGAIN_9dB 2.981072f
+#define AGC_GAIN_9dB 1.818383f
+#define AGC_HPFGAIN_10dB 3.466836f
+#define AGC_GAIN_10dB 2.162278f
+#define AGC_HPFGAIN_11dB 4.011872f
+#define AGC_GAIN_11dB 2.548134f
+#define AGC_HPFGAIN_12dB 4.623413f
+#define AGC_GAIN_12dB 2.981072f
+#define AGC_HPFGAIN_13dB 5.309573f
+#define AGC_GAIN_13dB 3.466836f
+#define AGC_HPFGAIN_14dB 6.079458f
+#define AGC_GAIN_14dB 4.011872f
+#define AGC_HPFGAIN_15dB 6.943282f
+#define AGC_GAIN_15dB 4.623413f
+
+/************************************************************************************/
+/* */
+/* 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 0.024690f
+#define VOL_TC_Fs11025 0.017977f
+#define VOL_TC_Fs12000 0.016529f
+#define VOL_TC_Fs16000 0.012422f
+#define VOL_TC_Fs22050 0.009029f
+#define VOL_TC_Fs24000 0.008299f
+#define VOL_TC_Fs32000 0.006231f
+#define VOL_TC_Fs44100 0.004525f
+#define VOL_TC_Fs48000 0.004158f
+#ifdef HIGHER_FS
+#define VOL_TC_Fs96000 0.002079f
+#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 */
+#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 */
+#ifdef HIGHER_FS
+#define MIX_TC_Fs96000 32456 /* Floating point value 0.990530 */
+#define MIX_TC_Fs192000 32611 /* Floating point value 0.992524 */
+#endif
+
+#endif /*BUILD_FLOAT*/
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
index b6632a3..fd4016b 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
@@ -107,35 +107,68 @@
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_48000)));
-
+ 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
*/
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+#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 */
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
+#else
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
+ no dereferencing in function*/
+ 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:\
+ (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*/
+ 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
}
@@ -175,7 +208,9 @@
{
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;
}
@@ -212,6 +247,9 @@
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
*/
@@ -237,33 +275,58 @@
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
}
@@ -309,7 +372,11 @@
{
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
/*
@@ -332,12 +399,19 @@
{
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
}
@@ -357,13 +431,23 @@
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
}
/*
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
index a3623bc..3fff2a2 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
@@ -80,7 +80,11 @@
/*
* 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;
@@ -88,7 +92,11 @@
/*
* Coef memory
*/
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
+#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;
@@ -96,7 +104,12 @@
/*
* 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;
@@ -151,10 +164,16 @@
{
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_INT16 i;
LVM_INT32 MixGain;
+#endif
+ LVM_INT16 i;
/*
@@ -235,7 +254,11 @@
// 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
@@ -245,9 +268,13 @@
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;
@@ -268,9 +295,11 @@
pBypassMixer_Instance->MixerStream[0].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[0].pCallBack = LVM_NULL;
pBypassMixer_Instance->MixerStream[0].CallbackSet=0;
+
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
+
/*
* Setup the mixer gain for the unprocessed path
*/
@@ -278,9 +307,15 @@
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 8339d3c..4e5207f 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -77,6 +77,7 @@
/****************************************************************************************/
/* Data structure */
+#ifndef BUILD_FLOAT
typedef struct
{
/* AGC parameters */
@@ -98,7 +99,29 @@
Biquad_Instance_t BPFInstance; /* Band pass filter instance */
} LVDBE_Coef_t;
+#else
+/* Data structure */
+typedef struct
+{
+ /* AGC parameters */
+ AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */
+ /* Process variables */
+ Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */
+ Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */
+ LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */
+ LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */
+
+} LVDBE_Data_FLOAT_t;
+
+/* Coefs structure */
+typedef struct
+{
+ /* Process variables */
+ 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
{
@@ -108,8 +131,13 @@
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;
@@ -136,5 +164,3 @@
#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.c
index 69d79d2..10ea700 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
@@ -27,7 +27,6 @@
#include "AGC.h"
#include "LVDBE_Coeffs.h" /* Filter coefficients */
-
/********************************************************************************************/
/* */
/* FUNCTION: LVDBE_Process */
@@ -72,136 +71,236 @@
/* 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_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,
+ 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;
+ LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+ LVM_FLOAT *pScratch_in = (LVM_FLOAT *)pInstance->MemoryTable.Region
+ [LVDBE_MEMREGION_SCRATCH].pBaseAddress;
+ LVM_FLOAT *pScratch = pScratch_in + 2 * NumSamples;
+ LVM_FLOAT *pMono;
+ LVM_INT32 ii = 0;
+ /* Scratch for Volume Control starts at offset of 4*NumSamples float values from pScratch */
+ LVM_FLOAT *pScratchVol = (LVM_FLOAT *)(&pScratch_in[4 * NumSamples]);
+// LVM_INT16 *pScratchVol_int = (LVM_INT16 *)(pScratchVol);
- /* 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 6*NumSamples 32-bit values from pScratch */
+ pMono = &pScratch_in[4 * 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);
+ }
+
+ /*
+ * Convert 16-bit samples to Float
+ */
+ Copy_Float(pInData, /* Source 16-bit data */
+ pScratch_in, /* Dest. 32-bit data */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+
+ for (ii = 0; ii < 2 * NumSamples; ii++) {
+ pScratch[ii] = pScratch_in[ii];
+ }
+ /*
+ * 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])))
+ {
/*
- * Check the number of samples is not too large
+ * Apply the high pass filter if selected
*/
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
+ if (pInstance->Params.HPFSelect == LVDBE_HPF_ON)
{
- return(LVDBE_TOOMANYSAMPLES);
+ BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
+ (LVM_FLOAT *)pScratch, /* Source */
+ (LVM_FLOAT *)pScratch, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
}
/*
- * Check if the algorithm is enabled
+ * Create the mono stream
*/
- /* 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 */
-
- }
+ From2iToMono_Float((LVM_FLOAT *)pScratch, /* Stereo source */
+ pMono, /* Mono destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
/*
- * Mix DBE processed path and bypass volume path
+ * Apply the band pass filter
*/
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
- (LVM_INT16 *) pScratch,
- pScratchVol,
- pOutData,
- (LVM_INT16)(2*NumSamples));
+ BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
+ (LVM_FLOAT *)pMono, /* Source */
+ (LVM_FLOAT *)pMono, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
- return(LVDBE_SUCCESS);
+ /*
+ * 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 */
+
+ for (ii = 0; ii < 2 * NumSamples; ii++) {
+ //TODO: replace with existing clamping function
+ if(pScratch[ii] < -1.0) {
+ pScratch[ii] = -1.0;
+ } else if(pScratch[ii] > 1.0) {
+ pScratch[ii] = 1.0;
+ }
+ }
+ }
+
+ /* 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,
+ pScratch_in,
+ pScratchVol,
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+ /*
+ * Mix DBE processed path and bypass volume path
+ */
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
+ pScratch,
+ pScratchVol,
+ pOutData,
+ (LVM_INT16)(2 * NumSamples));
+
+ 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.c
index f5d229e..c4a9b14 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
@@ -36,7 +36,11 @@
/*
* 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,
@@ -83,6 +87,18 @@
HPF_Fs48000_Fc55_A0,
-HPF_Fs48000_Fc55_B2,
-HPF_Fs48000_Fc55_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc55_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc55_A1,
+ HPF_Fs96000_Fc55_A0,
+ -HPF_Fs96000_Fc55_B2,
+ -HPF_Fs96000_Fc55_B1},
+ {HPF_Fs192000_Fc55_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc55_A1,
+ HPF_Fs192000_Fc55_A0,
+ -HPF_Fs192000_Fc55_B2,
+ -HPF_Fs192000_Fc55_B1},
+#endif
/* Coefficients for 66Hz centre frequency */
{HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
@@ -130,6 +146,19 @@
HPF_Fs48000_Fc66_A0,
-HPF_Fs48000_Fc66_B2,
-HPF_Fs48000_Fc66_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc66_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc66_A1,
+ HPF_Fs96000_Fc66_A0,
+ -HPF_Fs96000_Fc66_B2,
+ -HPF_Fs96000_Fc66_B1},
+ {HPF_Fs192000_Fc66_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc66_A1,
+ HPF_Fs192000_Fc66_A0,
+ -HPF_Fs192000_Fc66_B2,
+ -HPF_Fs192000_Fc66_B1},
+#endif
+
/* Coefficients for 78Hz centre frequency */
{HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
@@ -177,6 +206,19 @@
HPF_Fs48000_Fc78_A0,
-HPF_Fs48000_Fc78_B2,
-HPF_Fs48000_Fc78_B1},
+#ifdef HIGHER_FS
+ {HPF_Fs96000_Fc78_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc78_A1,
+ HPF_Fs96000_Fc78_A0,
+ -HPF_Fs96000_Fc78_B2,
+ -HPF_Fs96000_Fc78_B1},
+ {HPF_Fs192000_Fc78_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc78_A1,
+ HPF_Fs192000_Fc78_A0,
+ -HPF_Fs192000_Fc78_B2,
+ -HPF_Fs192000_Fc78_B1},
+#endif
+
/* Coefficients for 90Hz centre frequency */
{HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
@@ -223,12 +265,32 @@
HPF_Fs48000_Fc90_A1,
HPF_Fs48000_Fc90_A0,
-HPF_Fs48000_Fc90_B2,
- -HPF_Fs48000_Fc90_B1}};
+ -HPF_Fs48000_Fc90_B1}
+
+#ifdef HIGHER_FS
+ ,
+ {HPF_Fs96000_Fc90_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc90_A1,
+ HPF_Fs96000_Fc90_A0,
+ -HPF_Fs96000_Fc90_B2,
+ -HPF_Fs96000_Fc90_B1},
+ {HPF_Fs192000_Fc90_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc90_A1,
+ HPF_Fs192000_Fc90_A0,
+ -HPF_Fs192000_Fc90_B2,
+ -HPF_Fs192000_Fc90_B1}
+#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,
@@ -257,6 +319,14 @@
{BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc55_B2,
-BPF_Fs48000_Fc55_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc55_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc55_B2,
+ -BPF_Fs96000_Fc55_B1},
+ {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 */
@@ -286,6 +356,14 @@
{BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc66_B2,
-BPF_Fs48000_Fc66_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc66_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc66_B2,
+ -BPF_Fs96000_Fc66_B1},
+ {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 */
@@ -315,6 +393,14 @@
{BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc78_B2,
-BPF_Fs48000_Fc78_B1},
+#ifdef HIGHER_FS
+ {BPF_Fs96000_Fc78_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc78_B2,
+ -BPF_Fs96000_Fc78_B1},
+ {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 */
@@ -343,7 +429,19 @@
-BPF_Fs44100_Fc90_B1},
{BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc90_B2,
- -BPF_Fs48000_Fc90_B1}};
+ -BPF_Fs48000_Fc90_B1}
+#ifdef HIGHER_FS
+ ,
+ {BPF_Fs96000_Fc90_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc90_B2,
+ -BPF_Fs96000_Fc90_B1},
+ {BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc90_B2,
+ -BPF_Fs192000_Fc90_B1}
+#endif
+
+
+};
/************************************************************************************/
@@ -353,7 +451,11 @@
/************************************************************************************/
/* 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,
@@ -362,10 +464,20 @@
AGC_ATTACK_Fs24000,
AGC_ATTACK_Fs32000,
AGC_ATTACK_Fs44100,
- AGC_ATTACK_Fs48000};
+ AGC_ATTACK_Fs48000
+#ifdef HIGHER_FS
+ ,AGC_ATTACK_Fs96000
+ ,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,
@@ -374,10 +486,20 @@
AGC_DECAY_Fs24000,
AGC_DECAY_Fs32000,
AGC_DECAY_Fs44100,
- AGC_DECAY_Fs48000};
+ AGC_DECAY_Fs48000
+#ifdef HIGHER_FS
+ ,AGC_DECAY_FS96000
+ ,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,
@@ -396,7 +518,11 @@
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,
@@ -422,6 +548,7 @@
/************************************************************************************/
/* dB to linear conversion table */
+#ifndef BUILD_FLOAT
const LVM_INT16 LVDBE_VolumeTable[] = {
0x4000, /* -6dB */
0x47FB, /* -5dB */
@@ -430,8 +557,22 @@
0x65AD, /* -2dB */
0x7215, /* -1dB */
0x7FFF}; /* 0dB */
+#else /*BUILD_FLOAT*/
+const LVM_FLOAT LVDBE_VolumeTable[] = {
+ 0.500000f, /* -6dB */
+ 0.562341f, /* -5dB */
+ 0.630957f, /* -4dB */
+ 0.707946f, /* -3dB */
+ 0.794328f, /* -2dB */
+ 0.891251f, /* -1dB */
+ 1.000000f}; /* 0dB */
+#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,
@@ -440,9 +581,17 @@
VOL_TC_Fs24000,
VOL_TC_Fs32000,
VOL_TC_Fs44100,
- VOL_TC_Fs48000};
+ VOL_TC_Fs48000
+#ifdef HIGHER_FS
+ ,VOL_TC_Fs96000
+ ,VOL_TC_Fs192000
+#endif
+};
+
+
const LVM_INT16 LVDBE_MixerTCTable[] = {
+
MIX_TC_Fs8000,
MIX_TC_Fs11025,
MIX_TC_Fs12000,
@@ -451,6 +600,10 @@
MIX_TC_Fs24000,
MIX_TC_Fs32000,
MIX_TC_Fs44100,
- MIX_TC_Fs48000};
+ MIX_TC_Fs48000
+#ifdef HIGHER_FS
+ ,MIX_TC_Fs96000
+ ,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 476e6a0..ca46e37 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
@@ -31,6 +31,7 @@
#include "BIQUAD.h"
#include "LVM_Types.h"
+#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -76,8 +77,57 @@
extern const LVM_INT16 LVDBE_VolumeTCTable[];
+#else /*BUILD_FLOAT*/
+
+/************************************************************************************/
+/* */
+/* Coefficients constant table */
+/* */
+/************************************************************************************/
+
+/*
+ * High Pass Filter Coefficient table
+ */
+extern const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[];
+
+/*
+ * Band Pass Filter coefficient table
+ */
+extern const BP_FLOAT_Coefs_t LVDBE_BPF_Table[];
+
+/************************************************************************************/
+/* */
+/* AGC constant tables */
+/* */
+/************************************************************************************/
+
+/* Attack time (signal too large) */
+extern const LVM_FLOAT LVDBE_AGC_ATTACK_Table[];
+
+/* Decay time (signal too small) */
+extern const LVM_FLOAT LVDBE_AGC_DECAY_Table[];
+
+/* Gain for use without the high pass filter */
+extern const LVM_FLOAT LVDBE_AGC_GAIN_Table[];
+
+/* Gain for use with the high pass filter */
+extern const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[];
+
+/************************************************************************************/
+/* */
+/* Volume control gain and time constant tables */
+/* */
+/************************************************************************************/
+
+/* dB to linear conversion table */
+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 */
diff --git a/media/libeffects/lvm/lib/Bundle/lib/LVM.h b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
index 1ff2a2c..9b6da31 100644
--- a/media/libeffects/lvm/lib/Bundle/lib/LVM.h
+++ b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
@@ -514,11 +514,19 @@
/* 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
/****************************************************************************************/
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
index 6cbee7d..0a3c30e 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
@@ -48,7 +48,152 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferManagedIn(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_INT16 SampleCount; /* Number of samples to be processed this call */
+ LVM_INT16 NumSamples; /* Number of samples in scratch buffer */
+ LVM_FLOAT *pStart;
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_Buffer_t *pBuffer;
+ LVM_FLOAT *pDest;
+ LVM_INT16 NumChannels = 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_FLOAT *)pInData;
+ pBuffer->BufferState = LVM_FIRSTCALL;
+ }
+ pStart = pInstance->pInputSamples; /* Pointer to the input samples */
+ pBuffer->SamplesToOutput = 0; /* Samples to output is same as
+ number read for inplace processing */
+
+
+ /*
+ * 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_Float(&pBuffer->InDelayBuffer[0], /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NumChannels * pBuffer->InDelaySamples)); /* Number of delay \
+ samples, left and right */
+ NumSamples = (LVM_INT16)(NumSamples - pBuffer->InDelaySamples); /* Update sample count */
+ pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
+ }
+
+
+ /*
+ * Copy the rest of the samples for this call from the input buffer
+ */
+ if (NumSamples > 0)
+ {
+ Copy_Float(pStart, /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
+ pStart += NumChannels * NumSamples; /* Update the input pointer */
+
+ /*
+ * Update the input data pointer and samples to output
+ */
+ /* Update samples to output */
+ pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples);
+ }
+
+
+ /*
+ * Update the sample count and input pointer
+ */
+ /* Update the count of samples */
+ pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
+ pInstance->pInputSamples = pStart; /* Update input sample pointer */
+
+
+ /*
+ * 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_Float(pStart, /* Source */
+ &pBuffer->InDelayBuffer[0], /* Destination */
+ (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
+ }
+
+
+ /*
+ * Update the delay sample count
+ */
+ pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
+ pInstance->SamplesToProcess = 0; /* All Samples used */
+ }
+}
+#else
void LVM_BufferManagedIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -189,7 +334,7 @@
pInstance->SamplesToProcess = 0; /* All Samples used */
}
}
-
+#endif
/****************************************************************************************/
/* */
@@ -213,7 +358,47 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check if this is the first call of a block
+ */
+ if (pInstance->SamplesToProcess == 0)
+ {
+ pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples; /* Get the number of samples
+ on first call */
+ pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
+ pInstance->pOutputSamples = *pProcessed;
+
+
+ /*
+ * 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;
+}
+#else
void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
LVM_INT16 **pToProcess,
LVM_INT16 **pProcessed,
@@ -252,7 +437,7 @@
*pToProcess = pInstance->pInputSamples;
*pProcessed = pInstance->pOutputSamples;
}
-
+#endif
/****************************************************************************************/
/* */
@@ -278,6 +463,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
void LVM_BufferOptimisedIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -416,7 +602,7 @@
}
}
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferIn */
@@ -471,7 +657,37 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferIn(LVM_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT **pToProcess,
+ LVM_FLOAT **pProcessed,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check which mode, managed or unmanaged
+ */
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
+ {
+ LVM_BufferManagedIn(hInstance,
+ pInData,
+ pToProcess,
+ pProcessed,
+ pNumSamples);
+ }
+ else
+ {
+ LVM_BufferUnmanagedIn(hInstance,
+ pToProcess,
+ pProcessed,
+ pNumSamples);
+ }
+}
+#else
void LVM_BufferIn(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 **pToProcess,
@@ -501,7 +717,7 @@
pNumSamples);
}
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferManagedOut */
@@ -522,7 +738,156 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferManagedOut(LVM_Handle_t hInstance,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
+ LVM_INT16 SampleCount = (LVM_INT16)*pNumSamples;
+ LVM_INT16 NumSamples;
+ LVM_FLOAT *pStart;
+ LVM_FLOAT *pDest;
+
+
+ /*
+ * 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_Float(&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_Float(&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 */
+ /* No samples left in the buffer */
+ pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples - NumSamples);
+
+ /*
+ * Realign the delay buffer data to avoid using circular buffer management
+ */
+ Copy_Float(&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_Float(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_Float(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_Float(pStart, /* Source */
+ &pBuffer->OutDelayBuffer[2 * pBuffer->OutDelaySamples], /* Destination */
+ (LVM_INT16)(2 * SampleCount)); /* Number of processed samples */
+ /* Update the buffer count */
+ pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount);
+ }
+
+ /*
+ * 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 */
+ /* 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)
@@ -672,7 +1037,7 @@
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
/****************************************************************************************/
/* */
@@ -741,6 +1106,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
void LVM_BufferOptimisedOut(LVM_Handle_t hInstance,
LVM_UINT16 *pNumSamples)
{
@@ -805,7 +1171,7 @@
}
}
}
-
+#endif
/****************************************************************************************/
/* */
@@ -843,7 +1209,31 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+void LVM_BufferOut(LVM_Handle_t hInstance,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 *pNumSamples)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+
+
+ /*
+ * Check which mode, managed or unmanaged
+ */
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
+ {
+ LVM_BufferManagedOut(hInstance,
+ pOutData,
+ pNumSamples);
+ }
+ else
+ {
+ LVM_BufferUnmanagedOut(hInstance,
+ pNumSamples);
+ }
+}
+#else
void LVM_BufferOut(LVM_Handle_t hInstance,
LVM_INT16 *pOutData,
LVM_UINT16 *pNumSamples)
@@ -867,4 +1257,4 @@
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 2712b2c..353560c 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -26,10 +26,655 @@
/************************************************************************************/
#define TrebleBoostCorner 8000
-#define TrebleBoostMinRate 4
-#define TrebleBoostSteps 15
+#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
+#define HPF_Fs22050_Gain1_A1 0.331599
+#define HPF_Fs22050_Gain1_A2 0.000000
+#define HPF_Fs22050_Gain1_B1 0.370033
+#define HPF_Fs22050_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs22050_Gain2_A0 1.081557
+#define HPF_Fs22050_Gain2_A1 0.288475
+#define HPF_Fs22050_Gain2_A2 0.000000
+#define HPF_Fs22050_Gain2_B1 0.370033
+#define HPF_Fs22050_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs22050_Gain3_A0 1.129943
+#define HPF_Fs22050_Gain3_A1 0.240090
+#define HPF_Fs22050_Gain3_A2 0.000000
+#define HPF_Fs22050_Gain3_B1 0.370033
+#define HPF_Fs22050_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs22050_Gain4_A0 1.184232
+#define HPF_Fs22050_Gain4_A1 0.185801
+#define HPF_Fs22050_Gain4_A2 0.000000
+#define HPF_Fs22050_Gain4_B1 0.370033
+#define HPF_Fs22050_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs22050_Gain5_A0 1.245145
+#define HPF_Fs22050_Gain5_A1 0.124887
+#define HPF_Fs22050_Gain5_A2 0.000000
+#define HPF_Fs22050_Gain5_B1 0.370033
+#define HPF_Fs22050_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs22050_Gain6_A0 1.313491
+#define HPF_Fs22050_Gain6_A1 0.056541
+#define HPF_Fs22050_Gain6_A2 0.000000
+#define HPF_Fs22050_Gain6_B1 0.370033
+#define HPF_Fs22050_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs22050_Gain7_A0 1.390177
+#define HPF_Fs22050_Gain7_A1 -0.020144
+#define HPF_Fs22050_Gain7_A2 0.000000
+#define HPF_Fs22050_Gain7_B1 0.370033
+#define HPF_Fs22050_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs22050_Gain8_A0 1.476219
+#define HPF_Fs22050_Gain8_A1 -0.106187
+#define HPF_Fs22050_Gain8_A2 0.000000
+#define HPF_Fs22050_Gain8_B1 0.370033
+#define HPF_Fs22050_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs22050_Gain9_A0 1.572761
+#define HPF_Fs22050_Gain9_A1 -0.202728
+#define HPF_Fs22050_Gain9_A2 0.000000
+#define HPF_Fs22050_Gain9_B1 0.370033
+#define HPF_Fs22050_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs22050_Gain10_A0 1.681082
+#define HPF_Fs22050_Gain10_A1 -0.311049
+#define HPF_Fs22050_Gain10_A2 0.000000
+#define HPF_Fs22050_Gain10_B1 0.370033
+#define HPF_Fs22050_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs22050_Gain11_A0 1.802620
+#define HPF_Fs22050_Gain11_A1 -0.432588
+#define HPF_Fs22050_Gain11_A2 0.000000
+#define HPF_Fs22050_Gain11_B1 0.370033
+#define HPF_Fs22050_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs22050_Gain12_A0 1.938989
+#define HPF_Fs22050_Gain12_A1 -0.568956
+#define HPF_Fs22050_Gain12_A2 0.000000
+#define HPF_Fs22050_Gain12_B1 0.370033
+#define HPF_Fs22050_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs22050_Gain13_A0 2.091997
+#define HPF_Fs22050_Gain13_A1 -0.721964
+#define HPF_Fs22050_Gain13_A2 0.000000
+#define HPF_Fs22050_Gain13_B1 0.370033
+#define HPF_Fs22050_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs22050_Gain14_A0 2.263674
+#define HPF_Fs22050_Gain14_A1 -0.893641
+#define HPF_Fs22050_Gain14_A2 0.000000
+#define HPF_Fs22050_Gain14_B1 0.370033
+#define HPF_Fs22050_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs22050_Gain15_A0 2.456300
+#define HPF_Fs22050_Gain15_A1 -1.086267
+#define HPF_Fs22050_Gain15_A2 0.000000
+#define HPF_Fs22050_Gain15_B1 0.370033
+#define HPF_Fs22050_Gain15_B2 0.000000
+/* Coefficients for sample rate 24000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs24000_Gain1_A0 1.044662
+#define HPF_Fs24000_Gain1_A1 0.223287
+#define HPF_Fs24000_Gain1_A2 0.000000
+#define HPF_Fs24000_Gain1_B1 0.267949
+#define HPF_Fs24000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs24000_Gain2_A0 1.094773
+#define HPF_Fs24000_Gain2_A1 0.173176
+#define HPF_Fs24000_Gain2_A2 0.000000
+#define HPF_Fs24000_Gain2_B1 0.267949
+#define HPF_Fs24000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs24000_Gain3_A0 1.150999
+#define HPF_Fs24000_Gain3_A1 0.116950
+#define HPF_Fs24000_Gain3_A2 0.000000
+#define HPF_Fs24000_Gain3_B1 0.267949
+#define HPF_Fs24000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs24000_Gain4_A0 1.214086
+#define HPF_Fs24000_Gain4_A1 0.053863
+#define HPF_Fs24000_Gain4_A2 0.000000
+#define HPF_Fs24000_Gain4_B1 0.267949
+#define HPF_Fs24000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs24000_Gain5_A0 1.284870
+#define HPF_Fs24000_Gain5_A1 -0.016921
+#define HPF_Fs24000_Gain5_A2 0.000000
+#define HPF_Fs24000_Gain5_B1 0.267949
+#define HPF_Fs24000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs24000_Gain6_A0 1.364291
+#define HPF_Fs24000_Gain6_A1 -0.096342
+#define HPF_Fs24000_Gain6_A2 0.000000
+#define HPF_Fs24000_Gain6_B1 0.267949
+#define HPF_Fs24000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs24000_Gain7_A0 1.453403
+#define HPF_Fs24000_Gain7_A1 -0.185454
+#define HPF_Fs24000_Gain7_A2 0.000000
+#define HPF_Fs24000_Gain7_B1 0.267949
+#define HPF_Fs24000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs24000_Gain8_A0 1.553389
+#define HPF_Fs24000_Gain8_A1 -0.285440
+#define HPF_Fs24000_Gain8_A2 0.000000
+#define HPF_Fs24000_Gain8_B1 0.267949
+#define HPF_Fs24000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs24000_Gain9_A0 1.665574
+#define HPF_Fs24000_Gain9_A1 -0.397625
+#define HPF_Fs24000_Gain9_A2 0.000000
+#define HPF_Fs24000_Gain9_B1 0.267949
+#define HPF_Fs24000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs24000_Gain10_A0 1.791449
+#define HPF_Fs24000_Gain10_A1 -0.523499
+#define HPF_Fs24000_Gain10_A2 0.000000
+#define HPF_Fs24000_Gain10_B1 0.267949
+#define HPF_Fs24000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs24000_Gain11_A0 1.932682
+#define HPF_Fs24000_Gain11_A1 -0.664733
+#define HPF_Fs24000_Gain11_A2 0.000000
+#define HPF_Fs24000_Gain11_B1 0.267949
+#define HPF_Fs24000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs24000_Gain12_A0 2.091148
+#define HPF_Fs24000_Gain12_A1 -0.823199
+#define HPF_Fs24000_Gain12_A2 0.000000
+#define HPF_Fs24000_Gain12_B1 0.267949
+#define HPF_Fs24000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs24000_Gain13_A0 2.268950
+#define HPF_Fs24000_Gain13_A1 -1.001001
+#define HPF_Fs24000_Gain13_A2 0.000000
+#define HPF_Fs24000_Gain13_B1 0.267949
+#define HPF_Fs24000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs24000_Gain14_A0 2.468447
+#define HPF_Fs24000_Gain14_A1 -1.200498
+#define HPF_Fs24000_Gain14_A2 0.000000
+#define HPF_Fs24000_Gain14_B1 0.267949
+#define HPF_Fs24000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs24000_Gain15_A0 2.692287
+#define HPF_Fs24000_Gain15_A1 -1.424338
+#define HPF_Fs24000_Gain15_A2 0.000000
+#define HPF_Fs24000_Gain15_B1 0.267949
+#define HPF_Fs24000_Gain15_B2 0.000000
+/* Coefficients for sample rate 32000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs32000_Gain1_A0 1.061009
+#define HPF_Fs32000_Gain1_A1 -0.061009
+#define HPF_Fs32000_Gain1_A2 0.000000
+#define HPF_Fs32000_Gain1_B1 -0.000000
+#define HPF_Fs32000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs32000_Gain2_A0 1.129463
+#define HPF_Fs32000_Gain2_A1 -0.129463
+#define HPF_Fs32000_Gain2_A2 0.000000
+#define HPF_Fs32000_Gain2_B1 -0.000000
+#define HPF_Fs32000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs32000_Gain3_A0 1.206267
+#define HPF_Fs32000_Gain3_A1 -0.206267
+#define HPF_Fs32000_Gain3_A2 0.000000
+#define HPF_Fs32000_Gain3_B1 -0.000000
+#define HPF_Fs32000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs32000_Gain4_A0 1.292447
+#define HPF_Fs32000_Gain4_A1 -0.292447
+#define HPF_Fs32000_Gain4_A2 0.000000
+#define HPF_Fs32000_Gain4_B1 -0.000000
+#define HPF_Fs32000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs32000_Gain5_A0 1.389140
+#define HPF_Fs32000_Gain5_A1 -0.389140
+#define HPF_Fs32000_Gain5_A2 0.000000
+#define HPF_Fs32000_Gain5_B1 -0.000000
+#define HPF_Fs32000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs32000_Gain6_A0 1.497631
+#define HPF_Fs32000_Gain6_A1 -0.497631
+#define HPF_Fs32000_Gain6_A2 0.000000
+#define HPF_Fs32000_Gain6_B1 -0.000000
+#define HPF_Fs32000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs32000_Gain7_A0 1.619361
+#define HPF_Fs32000_Gain7_A1 -0.619361
+#define HPF_Fs32000_Gain7_A2 0.000000
+#define HPF_Fs32000_Gain7_B1 -0.000000
+#define HPF_Fs32000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs32000_Gain8_A0 1.755943
+#define HPF_Fs32000_Gain8_A1 -0.755943
+#define HPF_Fs32000_Gain8_A2 0.000000
+#define HPF_Fs32000_Gain8_B1 -0.000000
+#define HPF_Fs32000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs32000_Gain9_A0 1.909191
+#define HPF_Fs32000_Gain9_A1 -0.909191
+#define HPF_Fs32000_Gain9_A2 0.000000
+#define HPF_Fs32000_Gain9_B1 -0.000000
+#define HPF_Fs32000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs32000_Gain10_A0 2.081139
+#define HPF_Fs32000_Gain10_A1 -1.081139
+#define HPF_Fs32000_Gain10_A2 0.000000
+#define HPF_Fs32000_Gain10_B1 -0.000000
+#define HPF_Fs32000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs32000_Gain11_A0 2.274067
+#define HPF_Fs32000_Gain11_A1 -1.274067
+#define HPF_Fs32000_Gain11_A2 0.000000
+#define HPF_Fs32000_Gain11_B1 -0.000000
+#define HPF_Fs32000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs32000_Gain12_A0 2.490536
+#define HPF_Fs32000_Gain12_A1 -1.490536
+#define HPF_Fs32000_Gain12_A2 0.000000
+#define HPF_Fs32000_Gain12_B1 -0.000000
+#define HPF_Fs32000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs32000_Gain13_A0 2.733418
+#define HPF_Fs32000_Gain13_A1 -1.733418
+#define HPF_Fs32000_Gain13_A2 0.000000
+#define HPF_Fs32000_Gain13_B1 -0.000000
+#define HPF_Fs32000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs32000_Gain14_A0 3.005936
+#define HPF_Fs32000_Gain14_A1 -2.005936
+#define HPF_Fs32000_Gain14_A2 0.000000
+#define HPF_Fs32000_Gain14_B1 -0.000000
+#define HPF_Fs32000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs32000_Gain15_A0 3.311707
+#define HPF_Fs32000_Gain15_A1 -2.311707
+#define HPF_Fs32000_Gain15_A2 0.000000
+#define HPF_Fs32000_Gain15_B1 -0.000000
+#define HPF_Fs32000_Gain15_B2 0.000000
+/* Coefficients for sample rate 44100Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs44100_Gain1_A0 1.074364
+#define HPF_Fs44100_Gain1_A1 -0.293257
+#define HPF_Fs44100_Gain1_A2 0.000000
+#define HPF_Fs44100_Gain1_B1 -0.218894
+#define HPF_Fs44100_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs44100_Gain2_A0 1.157801
+#define HPF_Fs44100_Gain2_A1 -0.376695
+#define HPF_Fs44100_Gain2_A2 0.000000
+#define HPF_Fs44100_Gain2_B1 -0.218894
+#define HPF_Fs44100_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs44100_Gain3_A0 1.251420
+#define HPF_Fs44100_Gain3_A1 -0.470313
+#define HPF_Fs44100_Gain3_A2 0.000000
+#define HPF_Fs44100_Gain3_B1 -0.218894
+#define HPF_Fs44100_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs44100_Gain4_A0 1.356461
+#define HPF_Fs44100_Gain4_A1 -0.575355
+#define HPF_Fs44100_Gain4_A2 0.000000
+#define HPF_Fs44100_Gain4_B1 -0.218894
+#define HPF_Fs44100_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs44100_Gain5_A0 1.474320
+#define HPF_Fs44100_Gain5_A1 -0.693213
+#define HPF_Fs44100_Gain5_A2 0.000000
+#define HPF_Fs44100_Gain5_B1 -0.218894
+#define HPF_Fs44100_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs44100_Gain6_A0 1.606559
+#define HPF_Fs44100_Gain6_A1 -0.825453
+#define HPF_Fs44100_Gain6_A2 0.000000
+#define HPF_Fs44100_Gain6_B1 -0.218894
+#define HPF_Fs44100_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs44100_Gain7_A0 1.754935
+#define HPF_Fs44100_Gain7_A1 -0.973828
+#define HPF_Fs44100_Gain7_A2 0.000000
+#define HPF_Fs44100_Gain7_B1 -0.218894
+#define HPF_Fs44100_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs44100_Gain8_A0 1.921414
+#define HPF_Fs44100_Gain8_A1 -1.140308
+#define HPF_Fs44100_Gain8_A2 0.000000
+#define HPF_Fs44100_Gain8_B1 -0.218894
+#define HPF_Fs44100_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs44100_Gain9_A0 2.108208
+#define HPF_Fs44100_Gain9_A1 -1.327101
+#define HPF_Fs44100_Gain9_A2 0.000000
+#define HPF_Fs44100_Gain9_B1 -0.218894
+#define HPF_Fs44100_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs44100_Gain10_A0 2.317793
+#define HPF_Fs44100_Gain10_A1 -1.536687
+#define HPF_Fs44100_Gain10_A2 0.000000
+#define HPF_Fs44100_Gain10_B1 -0.218894
+#define HPF_Fs44100_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs44100_Gain11_A0 2.552952
+#define HPF_Fs44100_Gain11_A1 -1.771846
+#define HPF_Fs44100_Gain11_A2 0.000000
+#define HPF_Fs44100_Gain11_B1 -0.218894
+#define HPF_Fs44100_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs44100_Gain12_A0 2.816805
+#define HPF_Fs44100_Gain12_A1 -2.035698
+#define HPF_Fs44100_Gain12_A2 0.000000
+#define HPF_Fs44100_Gain12_B1 -0.218894
+#define HPF_Fs44100_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs44100_Gain13_A0 3.112852
+#define HPF_Fs44100_Gain13_A1 -2.331746
+#define HPF_Fs44100_Gain13_A2 0.000000
+#define HPF_Fs44100_Gain13_B1 -0.218894
+#define HPF_Fs44100_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs44100_Gain14_A0 3.445023
+#define HPF_Fs44100_Gain14_A1 -2.663916
+#define HPF_Fs44100_Gain14_A2 0.000000
+#define HPF_Fs44100_Gain14_B1 -0.218894
+#define HPF_Fs44100_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs44100_Gain15_A0 3.817724
+#define HPF_Fs44100_Gain15_A1 -3.036618
+#define HPF_Fs44100_Gain15_A2 0.000000
+#define HPF_Fs44100_Gain15_B1 -0.218894
+#define HPF_Fs44100_Gain15_B2 0.000000
+/* Coefficients for sample rate 48000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs48000_Gain1_A0 1.077357
+#define HPF_Fs48000_Gain1_A1 -0.345306
+#define HPF_Fs48000_Gain1_A2 0.000000
+#define HPF_Fs48000_Gain1_B1 -0.267949
+#define HPF_Fs48000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs48000_Gain2_A0 1.164152
+#define HPF_Fs48000_Gain2_A1 -0.432101
+#define HPF_Fs48000_Gain2_A2 0.000000
+#define HPF_Fs48000_Gain2_B1 -0.267949
+#define HPF_Fs48000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs48000_Gain3_A0 1.261538
+#define HPF_Fs48000_Gain3_A1 -0.529488
+#define HPF_Fs48000_Gain3_A2 0.000000
+#define HPF_Fs48000_Gain3_B1 -0.267949
+#define HPF_Fs48000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs48000_Gain4_A0 1.370807
+#define HPF_Fs48000_Gain4_A1 -0.638757
+#define HPF_Fs48000_Gain4_A2 0.000000
+#define HPF_Fs48000_Gain4_B1 -0.267949
+#define HPF_Fs48000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs48000_Gain5_A0 1.493409
+#define HPF_Fs48000_Gain5_A1 -0.761359
+#define HPF_Fs48000_Gain5_A2 0.000000
+#define HPF_Fs48000_Gain5_B1 -0.267949
+#define HPF_Fs48000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs48000_Gain6_A0 1.630971
+#define HPF_Fs48000_Gain6_A1 -0.898920
+#define HPF_Fs48000_Gain6_A2 0.000000
+#define HPF_Fs48000_Gain6_B1 -0.267949
+#define HPF_Fs48000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs48000_Gain7_A0 1.785318
+#define HPF_Fs48000_Gain7_A1 -1.053267
+#define HPF_Fs48000_Gain7_A2 0.000000
+#define HPF_Fs48000_Gain7_B1 -0.267949
+#define HPF_Fs48000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs48000_Gain8_A0 1.958498
+#define HPF_Fs48000_Gain8_A1 -1.226447
+#define HPF_Fs48000_Gain8_A2 0.000000
+#define HPF_Fs48000_Gain8_B1 -0.267949
+#define HPF_Fs48000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs48000_Gain9_A0 2.152809
+#define HPF_Fs48000_Gain9_A1 -1.420758
+#define HPF_Fs48000_Gain9_A2 0.000000
+#define HPF_Fs48000_Gain9_B1 -0.267949
+#define HPF_Fs48000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs48000_Gain10_A0 2.370829
+#define HPF_Fs48000_Gain10_A1 -1.638778
+#define HPF_Fs48000_Gain10_A2 0.000000
+#define HPF_Fs48000_Gain10_B1 -0.267949
+#define HPF_Fs48000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs48000_Gain11_A0 2.615452
+#define HPF_Fs48000_Gain11_A1 -1.883401
+#define HPF_Fs48000_Gain11_A2 0.000000
+#define HPF_Fs48000_Gain11_B1 -0.267949
+#define HPF_Fs48000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs48000_Gain12_A0 2.889924
+#define HPF_Fs48000_Gain12_A1 -2.157873
+#define HPF_Fs48000_Gain12_A2 0.000000
+#define HPF_Fs48000_Gain12_B1 -0.267949
+#define HPF_Fs48000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs48000_Gain13_A0 3.197886
+#define HPF_Fs48000_Gain13_A1 -2.465835
+#define HPF_Fs48000_Gain13_A2 0.000000
+#define HPF_Fs48000_Gain13_B1 -0.267949
+#define HPF_Fs48000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs48000_Gain14_A0 3.543425
+#define HPF_Fs48000_Gain14_A1 -2.811374
+#define HPF_Fs48000_Gain14_A2 0.000000
+#define HPF_Fs48000_Gain14_B1 -0.267949
+#define HPF_Fs48000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs48000_Gain15_A0 3.931127
+#define HPF_Fs48000_Gain15_A1 -3.199076
+#define HPF_Fs48000_Gain15_A2 0.000000
+#define HPF_Fs48000_Gain15_B1 -0.267949
+#define HPF_Fs48000_Gain15_B2 0.000000
+#ifdef HIGHER_FS
+
+/* Coefficients for sample rate 96000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs96000_Gain1_A0 1.096233
+#define HPF_Fs96000_Gain1_A1 -0.673583
+#define HPF_Fs96000_Gain1_A2 0.000000
+#define HPF_Fs96000_Gain1_B1 -0.577350
+#define HPF_Fs96000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs96000_Gain2_A0 1.204208
+#define HPF_Fs96000_Gain2_A1 -0.781558
+#define HPF_Fs96000_Gain2_A2 0.000000
+#define HPF_Fs96000_Gain2_B1 -0.577350
+#define HPF_Fs96000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs96000_Gain3_A0 1.325358
+#define HPF_Fs96000_Gain3_A1 -0.902708
+#define HPF_Fs96000_Gain3_A2 0.000000
+#define HPF_Fs96000_Gain3_B1 -0.577350
+#define HPF_Fs96000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs96000_Gain4_A0 1.461291
+#define HPF_Fs96000_Gain4_A1 -1.038641
+#define HPF_Fs96000_Gain4_A2 0.000000
+#define HPF_Fs96000_Gain4_B1 -0.577350
+#define HPF_Fs96000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs96000_Gain5_A0 1.613810
+#define HPF_Fs96000_Gain5_A1 -1.191160
+#define HPF_Fs96000_Gain5_A2 0.000000
+#define HPF_Fs96000_Gain5_B1 -0.577350
+#define HPF_Fs96000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs96000_Gain6_A0 1.784939
+#define HPF_Fs96000_Gain6_A1 -1.362289
+#define HPF_Fs96000_Gain6_A2 0.000000
+#define HPF_Fs96000_Gain6_B1 -0.577350
+#define HPF_Fs96000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs96000_Gain7_A0 1.976949
+#define HPF_Fs96000_Gain7_A1 -1.554299
+#define HPF_Fs96000_Gain7_A2 0.000000
+#define HPF_Fs96000_Gain7_B1 -0.577350
+#define HPF_Fs96000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs96000_Gain8_A0 2.192387
+#define HPF_Fs96000_Gain8_A1 -1.769738
+#define HPF_Fs96000_Gain8_A2 0.000000
+#define HPF_Fs96000_Gain8_B1 -0.577350
+#define HPF_Fs96000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs96000_Gain9_A0 2.434113
+#define HPF_Fs96000_Gain9_A1 -2.011464
+#define HPF_Fs96000_Gain9_A2 0.000000
+#define HPF_Fs96000_Gain9_B1 -0.577350
+#define HPF_Fs96000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs96000_Gain10_A0 2.705335
+#define HPF_Fs96000_Gain10_A1 -2.282685
+#define HPF_Fs96000_Gain10_A2 0.000000
+#define HPF_Fs96000_Gain10_B1 -0.577350
+#define HPF_Fs96000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs96000_Gain11_A0 3.009650
+#define HPF_Fs96000_Gain11_A1 -2.587000
+#define HPF_Fs96000_Gain11_A2 0.000000
+#define HPF_Fs96000_Gain11_B1 -0.577350
+#define HPF_Fs96000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs96000_Gain12_A0 3.351097
+#define HPF_Fs96000_Gain12_A1 -2.928447
+#define HPF_Fs96000_Gain12_A2 0.000000
+#define HPF_Fs96000_Gain12_B1 -0.577350
+#define HPF_Fs96000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs96000_Gain13_A0 3.734207
+#define HPF_Fs96000_Gain13_A1 -3.311558
+#define HPF_Fs96000_Gain13_A2 0.000000
+#define HPF_Fs96000_Gain13_B1 -0.577350
+#define HPF_Fs96000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs96000_Gain14_A0 4.164064
+#define HPF_Fs96000_Gain14_A1 -3.741414
+#define HPF_Fs96000_Gain14_A2 0.000000
+#define HPF_Fs96000_Gain14_B1 -0.577350
+#define HPF_Fs96000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs96000_Gain15_A0 4.646371
+#define HPF_Fs96000_Gain15_A1 -4.223721
+#define HPF_Fs96000_Gain15_A2 0.000000
+#define HPF_Fs96000_Gain15_B1 -0.577350
+#define HPF_Fs96000_Gain15_B2 0.000000
+
+/* Coefficients for sample rate 192000Hz */
+ /* Gain = 1.000000 dB */
+#define HPF_Fs192000_Gain1_A0 1.107823
+#define HPF_Fs192000_Gain1_A1 -0.875150
+#define HPF_Fs192000_Gain1_A2 0.000000
+#define HPF_Fs192000_Gain1_B1 -0.767327
+#define HPF_Fs192000_Gain1_B2 0.000000
+ /* Gain = 2.000000 dB */
+#define HPF_Fs192000_Gain2_A0 1.228803
+#define HPF_Fs192000_Gain2_A1 -0.996130
+#define HPF_Fs192000_Gain2_A2 0.000000
+#define HPF_Fs192000_Gain2_B1 -0.767327
+#define HPF_Fs192000_Gain2_B2 0.000000
+ /* Gain = 3.000000 dB */
+#define HPF_Fs192000_Gain3_A0 1.364544
+#define HPF_Fs192000_Gain3_A1 -1.131871
+#define HPF_Fs192000_Gain3_A2 0.000000
+#define HPF_Fs192000_Gain3_B1 -0.767327
+#define HPF_Fs192000_Gain3_B2 0.000000
+ /* Gain = 4.000000 dB */
+#define HPF_Fs192000_Gain4_A0 1.516849
+#define HPF_Fs192000_Gain4_A1 -1.284176
+#define HPF_Fs192000_Gain4_A2 0.000000
+#define HPF_Fs192000_Gain4_B1 -0.767327
+#define HPF_Fs192000_Gain4_B2 0.000000
+ /* Gain = 5.000000 dB */
+#define HPF_Fs192000_Gain5_A0 1.687737
+#define HPF_Fs192000_Gain5_A1 -1.455064
+#define HPF_Fs192000_Gain5_A2 0.000000
+#define HPF_Fs192000_Gain5_B1 -0.767327
+#define HPF_Fs192000_Gain5_B2 0.000000
+ /* Gain = 6.000000 dB */
+#define HPF_Fs192000_Gain6_A0 1.879477
+#define HPF_Fs192000_Gain6_A1 -1.646804
+#define HPF_Fs192000_Gain6_A2 0.000000
+#define HPF_Fs192000_Gain6_B1 -0.767327
+#define HPF_Fs192000_Gain6_B2 0.000000
+ /* Gain = 7.000000 dB */
+#define HPF_Fs192000_Gain7_A0 2.094613
+#define HPF_Fs192000_Gain7_A1 -1.861940
+#define HPF_Fs192000_Gain7_A2 0.000000
+#define HPF_Fs192000_Gain7_B1 -0.767327
+#define HPF_Fs192000_Gain7_B2 0.000000
+ /* Gain = 8.000000 dB */
+#define HPF_Fs192000_Gain8_A0 2.335999
+#define HPF_Fs192000_Gain8_A1 -2.103326
+#define HPF_Fs192000_Gain8_A2 0.000000
+#define HPF_Fs192000_Gain8_B1 -0.767327
+#define HPF_Fs192000_Gain8_B2 0.000000
+ /* Gain = 9.000000 dB */
+#define HPF_Fs192000_Gain9_A0 2.606839
+#define HPF_Fs192000_Gain9_A1 -2.374166
+#define HPF_Fs192000_Gain9_A2 0.000000
+#define HPF_Fs192000_Gain9_B1 -0.767327
+#define HPF_Fs192000_Gain9_B2 0.000000
+ /* Gain = 10.000000 dB */
+#define HPF_Fs192000_Gain10_A0 2.910726
+#define HPF_Fs192000_Gain10_A1 -2.678053
+#define HPF_Fs192000_Gain10_A2 0.000000
+#define HPF_Fs192000_Gain10_B1 -0.767327
+#define HPF_Fs192000_Gain10_B2 0.000000
+ /* Gain = 11.000000 dB */
+#define HPF_Fs192000_Gain11_A0 3.251693
+#define HPF_Fs192000_Gain11_A1 -3.019020
+#define HPF_Fs192000_Gain11_A2 0.000000
+#define HPF_Fs192000_Gain11_B1 -0.767327
+#define HPF_Fs192000_Gain11_B2 0.000000
+ /* Gain = 12.000000 dB */
+#define HPF_Fs192000_Gain12_A0 3.634264
+#define HPF_Fs192000_Gain12_A1 -3.401591
+#define HPF_Fs192000_Gain12_A2 0.000000
+#define HPF_Fs192000_Gain12_B1 -0.767327
+#define HPF_Fs192000_Gain12_B2 0.000000
+ /* Gain = 13.000000 dB */
+#define HPF_Fs192000_Gain13_A0 4.063516
+#define HPF_Fs192000_Gain13_A1 -3.830843
+#define HPF_Fs192000_Gain13_A2 0.000000
+#define HPF_Fs192000_Gain13_B1 -0.767327
+#define HPF_Fs192000_Gain13_B2 0.000000
+ /* Gain = 14.000000 dB */
+#define HPF_Fs192000_Gain14_A0 4.545145
+#define HPF_Fs192000_Gain14_A1 -4.312472
+#define HPF_Fs192000_Gain14_A2 0.000000
+#define HPF_Fs192000_Gain14_B1 -0.767327
+#define HPF_Fs192000_Gain14_B2 0.000000
+ /* Gain = 15.000000 dB */
+#define HPF_Fs192000_Gain15_A0 5.085542
+#define HPF_Fs192000_Gain15_A1 -4.852868
+#define HPF_Fs192000_Gain15_A2 0.000000
+#define HPF_Fs192000_Gain15_B1 -0.767327
+#define HPF_Fs192000_Gain15_B2 0.000000
+
+#endif
+
+#else
/* Coefficients for sample rate 22050Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs22050_Gain1_A0 5383 /* Floating point value 0.164291 */
@@ -571,3 +1216,4 @@
#endif
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
index 72564d4..cfe53b8 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
@@ -65,9 +65,16 @@
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_96000) && (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
((pParams->SourceFormat != LVM_STEREO) && (pParams->SourceFormat != LVM_MONOINSTEREO) && (pParams->SourceFormat != LVM_MONO)) ||
(pParams->SpeakerType > LVM_EX_HEADPHONES))
{
@@ -268,7 +275,12 @@
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;
@@ -298,6 +310,20 @@
* 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]);
+
+ /*
+ * Clear the taps
+ */
+ LoadConst_Float((LVM_FLOAT)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_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]);
@@ -309,6 +335,7 @@
(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
@@ -342,6 +369,9 @@
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
@@ -401,22 +431,46 @@
*/
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
}
}
@@ -554,8 +608,23 @@
/* 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],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+
+ Target_Float = dB_to_LinFloat((LVM_INT16)(LocalParams.VC_Balance << 4));
+ 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);
@@ -563,11 +632,27 @@
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],
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
+
+ Target_Float = LVM_MAXFLOAT;
+ 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);
@@ -575,17 +660,36 @@
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);
+
+ 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
}
}
/*
@@ -1008,18 +1112,30 @@
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.c
index 542c3c8..26c1c4f 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
@@ -232,7 +232,11 @@
/*
* 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 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_96000 | 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;
@@ -265,7 +269,11 @@
/*
* 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 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_96000 | 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;
@@ -542,10 +550,15 @@
BundleScratchSize = (LVM_INT32)(6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16));
pInstance->pBufferManagement->pScratch = InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch 1 buffer */
(LVM_UINT32)BundleScratchSize);
-
+#ifdef BUILD_FLOAT
+ LoadConst_Float(0, /* Clear the input delay buffer */
+ (LVM_FLOAT *)&pInstance->pBufferManagement->InDelayBuffer,
+ (LVM_INT16)(2 * 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 */
@@ -598,14 +611,26 @@
/* 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;
@@ -615,15 +640,24 @@
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
*/
@@ -709,7 +743,11 @@
/*
* 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 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_96000 | 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;
@@ -763,7 +801,11 @@
/*
* 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 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_96000 | 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;
@@ -868,9 +910,14 @@
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
+#ifdef BUILD_FLOAT
pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-
+ (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);
@@ -994,7 +1041,6 @@
/* DC removal filter */
DC_2I_D16_TRC_WRA_01_Init(&pInstance->DC_RemovalInstance);
-
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 2e85f77..b453222 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -138,6 +138,23 @@
/* Buffer Management */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT *pScratch; /* Bundle scratch buffer */
+
+ LVM_INT16 BufferState; /* Buffer status */
+ LVM_FLOAT InDelayBuffer[6 * MIN_INTERNAL_BLOCKSIZE]; /* Input buffer delay line, \
+ left and right */
+ LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
+
+ LVM_FLOAT 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;
+#else
typedef struct
{
LVM_INT16 *pScratch; /* Bundle scratch buffer */
@@ -150,22 +167,28 @@
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
{
/* Public parameters */
@@ -181,15 +204,24 @@
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 */
@@ -209,8 +241,16 @@
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 */
@@ -234,7 +274,11 @@
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*/
@@ -261,16 +305,28 @@
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,
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
index f5a01f3..4a19a13 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
@@ -51,7 +51,231 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#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)
+{
+ LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+ LVM_UINT16 SampleCount = NumSamples;
+ LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
+ LVM_FLOAT *pToProcess = (LVM_FLOAT *)pInData;
+ LVM_FLOAT *pProcessed = pOutData;
+ LVM_ReturnStatus_en Status;
+
+ /*
+ * 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_Float(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_Float(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_Float(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);
+}
+#else
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -273,3 +497,4 @@
return(LVM_SUCCESS);
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
index e14f909..199ddde 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
@@ -29,7 +29,342 @@
/* Treble Boost Filter Coefficients */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
+
+ /* 22kHz sampling rate */
+ {HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs22050_Gain1_A0,
+ -HPF_Fs22050_Gain1_B1},
+ {HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs22050_Gain2_A0,
+ -HPF_Fs22050_Gain2_B1},
+ {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs22050_Gain3_A0,
+ -HPF_Fs22050_Gain3_B1},
+ {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs22050_Gain4_A0,
+ -HPF_Fs22050_Gain4_B1},
+ {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs22050_Gain5_A0,
+ -HPF_Fs22050_Gain5_B1},
+ {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs22050_Gain6_A0,
+ -HPF_Fs22050_Gain6_B1},
+ {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs22050_Gain7_A0,
+ -HPF_Fs22050_Gain7_B1},
+ {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs22050_Gain8_A0,
+ -HPF_Fs22050_Gain8_B1},
+ {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs22050_Gain9_A0,
+ -HPF_Fs22050_Gain9_B1},
+ {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs22050_Gain10_A0,
+ -HPF_Fs22050_Gain10_B1},
+ {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs22050_Gain11_A0,
+ -HPF_Fs22050_Gain11_B1},
+ {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs22050_Gain12_A0,
+ -HPF_Fs22050_Gain12_B1},
+ {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs22050_Gain13_A0,
+ -HPF_Fs22050_Gain13_B1},
+ {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs22050_Gain14_A0,
+ -HPF_Fs22050_Gain14_B1},
+ {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs22050_Gain15_A0,
+ -HPF_Fs22050_Gain15_B1},
+
+ /* 24kHz sampling rate */
+ {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs24000_Gain1_A0,
+ -HPF_Fs24000_Gain1_B1},
+ {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs24000_Gain2_A0,
+ -HPF_Fs24000_Gain2_B1},
+ {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs24000_Gain3_A0,
+ -HPF_Fs24000_Gain3_B1},
+ {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs24000_Gain4_A0,
+ -HPF_Fs24000_Gain4_B1},
+ {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs24000_Gain5_A0,
+ -HPF_Fs24000_Gain5_B1},
+ {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs24000_Gain6_A0,
+ -HPF_Fs24000_Gain6_B1},
+ {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs24000_Gain7_A0,
+ -HPF_Fs24000_Gain7_B1},
+ {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs24000_Gain8_A0,
+ -HPF_Fs24000_Gain8_B1},
+ {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs24000_Gain9_A0,
+ -HPF_Fs24000_Gain9_B1},
+ {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs24000_Gain10_A0,
+ -HPF_Fs24000_Gain10_B1},
+ {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs24000_Gain11_A0,
+ -HPF_Fs24000_Gain11_B1},
+ {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs24000_Gain12_A0,
+ -HPF_Fs24000_Gain12_B1},
+ {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs24000_Gain13_A0,
+ -HPF_Fs24000_Gain13_B1},
+ {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs24000_Gain14_A0,
+ -HPF_Fs24000_Gain14_B1},
+ {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs24000_Gain15_A0,
+ -HPF_Fs24000_Gain15_B1},
+
+ /* 32kHz sampling rate */
+ {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs32000_Gain1_A0,
+ -HPF_Fs32000_Gain1_B1},
+ {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs32000_Gain2_A0,
+ -HPF_Fs32000_Gain2_B1},
+ {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs32000_Gain3_A0,
+ -HPF_Fs32000_Gain3_B1},
+ {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs32000_Gain4_A0,
+ -HPF_Fs32000_Gain4_B1},
+ {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs32000_Gain5_A0,
+ -HPF_Fs32000_Gain5_B1},
+ {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs32000_Gain6_A0,
+ -HPF_Fs32000_Gain6_B1},
+ {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs32000_Gain7_A0,
+ -HPF_Fs32000_Gain7_B1},
+ {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs32000_Gain8_A0,
+ -HPF_Fs32000_Gain8_B1},
+ {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs32000_Gain9_A0,
+ -HPF_Fs32000_Gain9_B1},
+ {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs32000_Gain10_A0,
+ -HPF_Fs32000_Gain10_B1},
+ {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs32000_Gain11_A0,
+ -HPF_Fs32000_Gain11_B1},
+ {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs32000_Gain12_A0,
+ -HPF_Fs32000_Gain12_B1},
+ {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs32000_Gain13_A0,
+ -HPF_Fs32000_Gain13_B1},
+ {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs32000_Gain14_A0,
+ -HPF_Fs32000_Gain14_B1},
+ {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs32000_Gain15_A0,
+ -HPF_Fs32000_Gain15_B1},
+
+ /* 44kHz sampling rate */
+ {HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs44100_Gain1_A0,
+ -HPF_Fs44100_Gain1_B1,},
+ {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs44100_Gain2_A0,
+ -HPF_Fs44100_Gain2_B1},
+ {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs44100_Gain3_A0,
+ -HPF_Fs44100_Gain3_B1},
+ {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs44100_Gain4_A0,
+ -HPF_Fs44100_Gain4_B1},
+ {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs44100_Gain5_A0,
+ -HPF_Fs44100_Gain5_B1},
+ {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs44100_Gain6_A0,
+ -HPF_Fs44100_Gain6_B1},
+ {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs44100_Gain7_A0,
+ -HPF_Fs44100_Gain7_B1},
+ {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs44100_Gain8_A0,
+ -HPF_Fs44100_Gain8_B1},
+ {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs44100_Gain9_A0,
+ -HPF_Fs44100_Gain9_B1},
+ {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs44100_Gain10_A0,
+ -HPF_Fs44100_Gain10_B1},
+ {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs44100_Gain11_A0,
+ -HPF_Fs44100_Gain11_B1},
+ {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs44100_Gain12_A0,
+ -HPF_Fs44100_Gain12_B1},
+ {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs44100_Gain13_A0,
+ -HPF_Fs44100_Gain13_B1},
+ {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs44100_Gain14_A0,
+ -HPF_Fs44100_Gain14_B1},
+ {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs44100_Gain15_A0,
+ -HPF_Fs44100_Gain15_B1},
+
+ /* 48kHz sampling rate */
+ {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs48000_Gain1_A0,
+ -HPF_Fs48000_Gain1_B1},
+ {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs48000_Gain2_A0,
+ -HPF_Fs48000_Gain2_B1},
+ {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs48000_Gain3_A0,
+ -HPF_Fs48000_Gain3_B1},
+ {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs48000_Gain4_A0,
+ -HPF_Fs48000_Gain4_B1},
+ {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs48000_Gain5_A0,
+ -HPF_Fs48000_Gain5_B1},
+ {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs48000_Gain6_A0,
+ -HPF_Fs48000_Gain6_B1},
+ {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs48000_Gain7_A0,
+ -HPF_Fs48000_Gain7_B1},
+ {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs48000_Gain8_A0,
+ -HPF_Fs48000_Gain8_B1},
+ {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs48000_Gain9_A0,
+ -HPF_Fs48000_Gain9_B1},
+ {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs48000_Gain10_A0,
+ -HPF_Fs48000_Gain10_B1},
+ {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs48000_Gain11_A0,
+ -HPF_Fs48000_Gain11_B1},
+ {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs48000_Gain12_A0,
+ -HPF_Fs48000_Gain12_B1},
+ {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs48000_Gain13_A0,
+ -HPF_Fs48000_Gain13_B1},
+ {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs48000_Gain14_A0,
+ -HPF_Fs48000_Gain14_B1},
+ {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs48000_Gain15_A0,
+ -HPF_Fs48000_Gain15_B1}
+#ifdef HIGHER_FS
+ ,
+ /* 96kHz sampling rate */
+ {HPF_Fs96000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs96000_Gain1_A0,
+ -HPF_Fs96000_Gain1_B1},
+ {HPF_Fs96000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs96000_Gain2_A0,
+ -HPF_Fs96000_Gain2_B1},
+ {HPF_Fs96000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs96000_Gain3_A0,
+ -HPF_Fs96000_Gain3_B1},
+ {HPF_Fs96000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs96000_Gain4_A0,
+ -HPF_Fs96000_Gain4_B1},
+ {HPF_Fs96000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs96000_Gain5_A0,
+ -HPF_Fs96000_Gain5_B1},
+ {HPF_Fs96000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs96000_Gain6_A0,
+ -HPF_Fs96000_Gain6_B1},
+ {HPF_Fs96000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs96000_Gain7_A0,
+ -HPF_Fs96000_Gain7_B1},
+ {HPF_Fs96000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs96000_Gain8_A0,
+ -HPF_Fs96000_Gain8_B1},
+ {HPF_Fs96000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs96000_Gain9_A0,
+ -HPF_Fs96000_Gain9_B1},
+ {HPF_Fs96000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs96000_Gain10_A0,
+ -HPF_Fs96000_Gain10_B1},
+ {HPF_Fs96000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs96000_Gain11_A0,
+ -HPF_Fs96000_Gain11_B1},
+ {HPF_Fs96000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs96000_Gain12_A0,
+ -HPF_Fs96000_Gain12_B1},
+ {HPF_Fs96000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs96000_Gain13_A0,
+ -HPF_Fs96000_Gain13_B1},
+ {HPF_Fs96000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs96000_Gain14_A0,
+ -HPF_Fs96000_Gain14_B1},
+ {HPF_Fs96000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs96000_Gain15_A0,
+ -HPF_Fs96000_Gain15_B1},
+
+ /* 192kHz sampling rate */
+ {HPF_Fs192000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs192000_Gain1_A0,
+ -HPF_Fs192000_Gain1_B1},
+ {HPF_Fs192000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs192000_Gain2_A0,
+ -HPF_Fs192000_Gain2_B1},
+ {HPF_Fs192000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs192000_Gain3_A0,
+ -HPF_Fs192000_Gain3_B1},
+ {HPF_Fs192000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs192000_Gain4_A0,
+ -HPF_Fs192000_Gain4_B1},
+ {HPF_Fs192000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs192000_Gain5_A0,
+ -HPF_Fs192000_Gain5_B1},
+ {HPF_Fs192000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs192000_Gain6_A0,
+ -HPF_Fs192000_Gain6_B1},
+ {HPF_Fs192000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs192000_Gain7_A0,
+ -HPF_Fs192000_Gain7_B1},
+ {HPF_Fs192000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs192000_Gain8_A0,
+ -HPF_Fs192000_Gain8_B1},
+ {HPF_Fs192000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs192000_Gain9_A0,
+ -HPF_Fs192000_Gain9_B1},
+ {HPF_Fs192000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs192000_Gain10_A0,
+ -HPF_Fs192000_Gain10_B1},
+ {HPF_Fs192000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs192000_Gain11_A0,
+ -HPF_Fs192000_Gain11_B1},
+ {HPF_Fs192000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs192000_Gain12_A0,
+ -HPF_Fs192000_Gain12_B1},
+ {HPF_Fs192000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs192000_Gain13_A0,
+ -HPF_Fs192000_Gain13_B1},
+ {HPF_Fs192000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs192000_Gain14_A0,
+ -HPF_Fs192000_Gain14_B1},
+ {HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs192000_Gain15_A0,
+ -HPF_Fs192000_Gain15_B1}
+#endif
+ };
+#else
FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
/* 22kHz sampling rate */
@@ -340,8 +675,9 @@
{HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
HPF_Fs48000_Gain15_A0,
-HPF_Fs48000_Gain15_B1,
- HPF_Fs48000_Gain15_Shift}};
-
+ HPF_Fs48000_Gain15_Shift}
+ };
+#endif
/************************************************************************************/
/* */
@@ -350,6 +686,16 @@
/************************************************************************************/
/* dB to linear conversion table */
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVM_VolumeTable[] = {
+ 1.000f, /* 0dB */
+ 0.891f, /* -1dB */
+ 0.794f, /* -2dB */
+ 0.708f, /* -3dB */
+ 0.631f, /* -4dB */
+ 0.562f, /* -5dB */
+ 0.501f}; /* -6dB */
+#else
const LVM_INT16 LVM_VolumeTable[] = {
0x7FFF, /* 0dB */
0x7215, /* -1dB */
@@ -358,6 +704,7 @@
0x50C3, /* -4dB */
0x47FB, /* -5dB */
0x4000}; /* -6dB */
+#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
index a7601ff..4cf7119 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
@@ -37,16 +37,23 @@
/* */
/************************************************************************************/
+#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[];
diff --git a/media/libeffects/lvm/lib/Common/lib/AGC.h b/media/libeffects/lvm/lib/Common/lib/AGC.h
index 2080d64..9a3d35d 100644
--- a/media/libeffects/lvm/lib/Common/lib/AGC.h
+++ b/media/libeffects/lvm/lib/Common/lib/AGC.h
@@ -37,7 +37,7 @@
/* Types */
/* */
/**********************************************************************************/
-
+#ifndef BUILD_FLOAT
typedef struct
{
LVM_INT32 AGC_Gain; /* The current AGC gain */
@@ -52,20 +52,39 @@
LVM_INT16 VolumeTC; /* Volume update time constant */
} AGC_MIX_VOL_2St1Mon_D32_t;
+#else
+typedef struct
+{
+ LVM_FLOAT AGC_Gain; /* The current AGC gain */
+ LVM_FLOAT AGC_MaxGain; /* The maximum AGC gain */
+ LVM_FLOAT Volume; /* The current volume setting */
+ LVM_FLOAT Target; /* The target volume setting */
+ LVM_FLOAT AGC_Target; /* AGC target level */
+ LVM_FLOAT AGC_Attack; /* AGC attack scaler */
+ LVM_FLOAT AGC_Decay; /* AGC decay scaler */
+ LVM_FLOAT VolumeTC; /* Volume update time constant */
+} AGC_MIX_VOL_2St1Mon_FLOAT_t;
+#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 */
+ LVM_FLOAT *pDst, /* Stereo destination */
+ LVM_UINT16 n); /* Number of samples */
+#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 */
diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
index 7ac7fbd..3ee7f63 100644
--- a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
+++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
@@ -27,19 +27,34 @@
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT Storage[6];
+} 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 */
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+} BQ_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A2; /* a2 */
@@ -57,8 +72,17 @@
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 */
@@ -72,8 +96,17 @@
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 */
@@ -81,8 +114,16 @@
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 */
@@ -96,8 +137,18 @@
LVM_INT32 B2; /* -b2! */
LVM_INT32 B1; /* -b1! */
} BP_C32_Coefs_t;
+#endif
/*** Peaking coefficients *********************************************************/
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+ LVM_FLOAT G; /* Gain */
+} PK_FLOAT_Coefs_t;
+#else
typedef struct
{
LVM_INT16 A0; /* a0 */
@@ -113,16 +164,26 @@
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 */
+} Biquad_1I_Order1_FLOAT_Taps_t;
typedef struct
{
+ LVM_FLOAT Storage[ (2 * 2) ]; /* Two channels, two taps of size LVM_INT32 */
+} 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;
@@ -130,12 +191,22 @@
{
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_INT32 */
+} Biquad_1I_Order2_FLOAT_Taps_t;
typedef struct
{
+ LVM_FLOAT Storage[ (2 * 4) ]; /* Two channels, four taps of size LVM_INT32 */
+} 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;
@@ -143,7 +214,7 @@
{
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
@@ -154,59 +225,148 @@
/*** 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);
+void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C32_Coefs_t *pCoef);
@@ -215,33 +375,66 @@
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);
+void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
Biquad_1I_Order1_Taps_t *pTaps,
FO_C32_Coefs_t *pCoef);
@@ -250,13 +443,28 @@
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);
+void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+void BP_1I_D16F32Cll_TRC_WRA_01_Init (Biquad_FLOAT_Instance_t *pInstance,
+ Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
+ BP_FLOAT_Coefs_t *pCoef);
+void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#else
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C16_Coefs_t *pCoef);
@@ -274,10 +482,17 @@
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);
+void BP_1I_D32F32C30_TRC_WRA_02( Biquad_FLOAT_Instance_t *pInstance,
+ 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);
@@ -286,42 +501,59 @@
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,
+ LVM_INT16 NrSamples);
+#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
+void DC_2I_D16_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance);
+void DC_2I_D16_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT16 NrSamples);
+#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 4cb8aa2..498faa3 100644
--- a/media/libeffects/lvm/lib/Common/lib/CompLim.h
+++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h
@@ -66,13 +66,17 @@
/* 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 */
diff --git a/media/libeffects/lvm/lib/Common/lib/Filter.h b/media/libeffects/lvm/lib/Common/lib/Filter.h
index 229701a..0c8955d 100644
--- a/media/libeffects/lvm/lib/Common/lib/Filter.h
+++ b/media/libeffects/lvm/lib/Common/lib/Filter.h
@@ -33,11 +33,32 @@
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,
+ FO_FLOAT_Coefs_t *pCoeffs);
+
+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);
@@ -52,7 +73,7 @@
LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
LVM_Fs_en SampleRate);
-
+#endif
/**********************************************************************************/
#ifdef __cplusplus
}
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 68c55f7..cb15b60 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -44,6 +44,9 @@
#define LVM_MAXINT_8 127 /* Maximum positive integer size */
#define LVM_MAXINT_16 32767
+#ifdef BUILD_FLOAT
+#define LVM_MAXFLOAT 1.0f
+#endif
#define LVM_MAXINT_32 2147483647
#define LVM_MAXENUM 2147483647
@@ -95,7 +98,9 @@
typedef int32_t LVM_INT32; /* Signed 32-bit word */
typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
-
+#ifdef BUILD_FLOAT
+typedef float LVM_FLOAT; /* single precission floating point*/
+#endif
/****************************************************************************************/
/* */
/* Standard Enumerated types */
@@ -133,6 +138,10 @@
LVM_FS_32000 = 6,
LVM_FS_44100 = 7,
LVM_FS_48000 = 8,
+#ifdef HIGHER_FS
+ LVM_FS_96000 = 9,
+ LVM_FS_192000 = 10,
+#endif
LVM_FS_INVALID = LVM_MAXENUM-1,
LVM_FS_DUMMY = LVM_MAXENUM
} LVM_Fs_en;
diff --git a/media/libeffects/lvm/lib/Common/lib/Mixer.h b/media/libeffects/lvm/lib/Common/lib/Mixer.h
index 89deb0d..07c53cd 100644
--- a/media/libeffects/lvm/lib/Common/lib/Mixer.h
+++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h
@@ -30,6 +30,43 @@
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
+#ifdef BUILD_FLOAT /* BUILD_FLOAT*/
+typedef struct
+{
+ LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT Target; /* Target value. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT Current; /* Current value. Set by the mixer function. */
+ LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \
+ each time the target value is updated */
+ LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
+ void *pCallbackHandle; /* Pointer to the instance of the callback function */
+ void *pGeneralPurpose; /* Pointer for general purpose usage */
+ LVM_Callback pCallBack; /* Pointer to the callback function */
+} Mix_1St_Cll_FLOAT_t;
+typedef struct
+{
+ LVM_FLOAT Alpha1;
+ LVM_FLOAT Target1;
+ LVM_FLOAT Current1;
+ LVM_INT16 CallbackSet1;
+ LVM_INT16 CallbackParam1;
+ void *pCallbackHandle1;
+ void *pGeneralPurpose1;
+ LVM_Callback pCallBack1;
+
+ LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \
+ pointer to Mix_1St_Cll_t in some functions */
+ LVM_FLOAT Target2;
+ LVM_FLOAT Current2;
+ LVM_INT16 CallbackSet2;
+ LVM_INT16 CallbackParam2;
+ void *pCallbackHandle2;
+ void *pGeneralPurpose2;
+ LVM_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 */
@@ -64,9 +101,35 @@
} 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,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+
+void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+
+void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ 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);
@@ -88,10 +151,26 @@
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,
+ LVM_INT16 n);
+void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src1,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#else
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -107,6 +186,7 @@
const LVM_INT32 *src,
LVM_INT32 *dst,
LVM_INT16 n);
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
@@ -115,13 +195,3 @@
/**********************************************************************************/
#endif /* __MIXER_H__ */
-
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
index 3d62704..cdb3837 100644
--- a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
@@ -34,7 +34,12 @@
/*######################################################################################*/
/* 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()
@@ -48,8 +53,11 @@
* (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
}
diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
index 2b791bd..0ba20a3 100644
--- a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
@@ -29,6 +29,11 @@
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 );
@@ -36,10 +41,17 @@
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 );
+#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 *
@@ -49,10 +61,17 @@
* 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);
+ LVM_INT16 *dst,
+ LVM_INT16 n);
+#endif
/*********************************************************************************
* note: In Mult3s_32x16() saturation of result is not taken care when *
@@ -66,20 +85,31 @@
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 );
@@ -87,7 +117,13 @@
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,
@@ -97,7 +133,7 @@
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 */
@@ -109,7 +145,12 @@
/**********************************************************************************
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,
@@ -119,11 +160,15 @@
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);
@@ -131,29 +176,52 @@
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);
+#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 );
+ LVM_INT32 *dst,
+ LVM_INT16 n );
+#endif
/**********************************************************************************
DATA TYPE CONVERSION FUNCTIONS
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.c
index 920b515..fa9f01f 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.c
@@ -33,7 +33,10 @@
#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
/****************************************************************************************/
/* */
@@ -69,7 +72,7 @@
/* 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 */
@@ -193,4 +196,113 @@
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 */
+ LVM_FLOAT *pDst, /* Stereo destination */
+ LVM_UINT16 NumSamples) /* Number of samples */
+{
+ /*
+ * General variables
+ */
+ LVM_UINT16 i; /* Sample index */
+ LVM_FLOAT Left; /* Left sample */
+ LVM_FLOAT Right; /* Right sample */
+ LVM_FLOAT Mono; /* Mono sample */
+ LVM_FLOAT AbsPeak; /* Absolute peak signal */
+ LVM_FLOAT AGC_Mult; /* Short AGC gain */
+ LVM_FLOAT Vol_Mult; /* Short volume */
+
+
+ /*
+ * Instance control variables
+ */
+ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
+ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
+ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
+ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT)));/* Decay scaler */
+ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
+ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
+ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
+ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
+
+
+ /*
+ * Process on a sample by sample basis
+ */
+ for (i = 0; i < NumSamples; i++) /* For each sample */
+ {
+
+ /*
+ * Get the short scalers
+ */
+ AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */
+ Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */
+
+
+ /*
+ * 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
+ */
+ Left += (Mono * AGC_Mult); /* Mix in the mono signal */
+ Right += (Mono * AGC_Mult);
+
+ /*
+ * Apply the volume and write to the output stream
+ */
+ Left = Left * Vol_Mult;
+ Right = Right * Vol_Mult;
+ *pDst++ = Left; /* Save the results */
+ *pDst++ = Right;
+
+ /*
+ * Update the AGC gain
+ */
+ AbsPeak = Abs_Float(Left) > Abs_Float(Right) ? Abs_Float(Left) : Abs_Float(Right);
+ if (AbsPeak > AGC_Target)
+ {
+ /*
+ * The signal is too large so decrease the gain
+ */
+ AGC_Gain = AGC_Gain * AGC_Attack;
+ }
+ else
+ {
+ /*
+ * The signal is too small so increase the gain
+ */
+ if (AGC_Gain > AGC_MaxGain)
+ {
+ AGC_Gain -= (AGC_Decay);
+ }
+ else
+ {
+ AGC_Gain += (AGC_Decay);
+ }
+ }
+
+ /*
+ * Update the gain
+ */
+ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
+ }
+
+
+ /*
+ * Update the parameters
+ */
+ pInstance->Volume = Vol_Current; /* Actual volume setting */
+ pInstance->AGC_Gain = AGC_Gain;
+
+ return;
+}
+#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/Abs_32.c b/media/libeffects/lvm/lib/Common/src/Abs_32.c
index 9128b82..84fabd8 100644
--- a/media/libeffects/lvm/lib/Common/src/Abs_32.c
+++ b/media/libeffects/lvm/lib/Common/src/Abs_32.c
@@ -47,4 +47,14 @@
}
return input;
}
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT Abs_Float(LVM_FLOAT input)
+{
+ if(input < 0)
+ {
+ /* Negative input, so invert */
+ input = (LVM_FLOAT)(-input);
+ }
+ return input;
+}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
index 69d357e..e3edccc 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
@@ -57,4 +57,33 @@
return;
}
+#ifdef BUILD_FLOAT
+void Add2_Sat_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = ((LVM_FLOAT) *src) + ((LVM_FLOAT) *dst);
+ src++;
+
+ if (Temp > 1.000000f)
+ {
+ *dst = 1.000000f;
+ }
+ else if (Temp < -1.000000f)
+ {
+ *dst = -1.000000f;
+ }
+ else
+ {
+ *dst = Temp;
+ }
+ dst++;
+ }
+ 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.c
index f4c5757..88f9986 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.c
@@ -33,7 +33,51 @@
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;
+ 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 ) )
+ ynL = pBiquadState->coefs[0] * ((*pDataIn)-pBiquadState->pDelays[1]);
+
+ // ynL+= ((-B2 * y(n-2)L ) )
+ ynL += pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+
+ // ynL+= ((-B1 * y(n-1)L ) )
+ ynL += pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++=ynL; // Write Left output
+
+ }
+
+ }
+#else
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -78,4 +122,5 @@
}
}
+#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.c
index 88914ad..27ab57a 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.c
@@ -38,6 +38,19 @@
/* 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)
+{
+ 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_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C16_Coefs_t *pCoef)
@@ -49,6 +62,7 @@
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 980539c..e194f92 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,4 +27,13 @@
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_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
index ba1a42f..3abdd43 100644
--- 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
@@ -33,7 +33,48 @@
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,
@@ -80,4 +121,4 @@
}
}
-
+#endif
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.c
index e833218..d6e047a 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.c
@@ -48,6 +48,20 @@
/* 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)
+{
+ 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)
@@ -59,6 +73,7 @@
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 9cca627..aa9e669 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,5 +26,12 @@
}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.c
index b09c1aa..abdb2f7 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.c
@@ -33,7 +33,52 @@
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,
+ 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 = (*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
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = ynL; // Write Left output in Q0
+
+ }
+
+ }
+#else
void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -78,4 +123,4 @@
}
}
-
+#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.c
index 9367912..5590c32 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.c
@@ -37,6 +37,21 @@
/* 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)
+{
+ 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_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BP_C32_Coefs_t *pCoef)
@@ -50,6 +65,7 @@
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 5cc1ce2..80c3920 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,5 +26,13 @@
}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.c
index f2f8c6b..ee9bf7a 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.c
@@ -32,7 +32,56 @@
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,
+ 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 += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[3];
+
+ // ynL+= (-B1 * y(n-1)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[2];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
+ pBiquadState->pDelays[1] = pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
+ pBiquadState->pDelays[2] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *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,
@@ -82,4 +131,4 @@
}
}
-
+#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.c
index baf0c1a..3d5befa 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.c
@@ -37,6 +37,26 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) 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;
+}
+#else
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
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 909c699..811da8b 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,4 +27,13 @@
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[5]; /* pointer to the filter coefficients */
+
+}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
index 92f6caf..c74a137 100644
--- 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
@@ -32,7 +32,54 @@
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,
@@ -81,4 +128,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
index aea10f0..9812274 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,4 +27,13 @@
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[5]; /* pointer to the filter coefficients */
+
+}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.c
index 1d6be4e..feae20d 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.c
@@ -38,6 +38,27 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *)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;
+}
+#else
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_1I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -57,6 +78,7 @@
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
index 972e704..9b0fde3 100644
--- 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
@@ -37,7 +37,81 @@
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,
@@ -112,3 +186,4 @@
}
+#endif
\ No newline at end of file
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
index e056373..f24db8f 100644
--- 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
@@ -37,7 +37,81 @@
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,
@@ -111,4 +185,4 @@
}
}
-
+#endif
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.c
index 0a8ac35..39e1bda 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.c
@@ -38,6 +38,27 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) 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;
+}
+#else
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -57,6 +78,7 @@
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 7d42ced..0691b8c 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,4 +28,14 @@
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[5]; /* pointer to the filter coefficients */
+
+}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
index 4a0cce4..61c07c7 100644
--- 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
@@ -37,7 +37,79 @@
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,
@@ -115,4 +187,4 @@
}
}
-
+#endif
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
index 052e2a0..cf19e06 100644
--- 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
@@ -36,7 +36,82 @@
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,
@@ -114,4 +189,4 @@
}
}
-
+#endif
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
index 8c741e1..2611b19 100644
--- 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
@@ -36,7 +36,84 @@
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,
@@ -114,4 +191,4 @@
}
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
index 4f0cf67..c0319c9 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,4 +28,14 @@
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[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.c
index 4591ee0..4d9bbfe 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.c
@@ -37,6 +37,26 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) 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;
+}
+#else
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C16_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
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.c
index fd8212e4..960de79 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.c
@@ -36,7 +36,94 @@
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;
+ 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 = pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+
+ /* ynL+= ( A1 * x(n-1)L )*/
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ ynL += templ;
+
+ /* ynL+= ( A0 * x(n)L ) */
+ templ = pBiquadState->coefs[2] * (*pDataIn);
+ ynL += templ;
+
+ /* ynL+= (-B2 * y(n-2)L ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+ ynL += templ;
+
+ /* ynL+= (-B1 * y(n-1)L )*/
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+ ynL += templ;
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= ( A2 * x(n-2)R ) */
+ ynR = pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+
+ /* ynR+= ( A1 * x(n-1)R ) */
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ ynR += templ;
+
+ /* ynR+= ( A0 * x(n)R ) */
+ tempd =* (pDataIn+1);
+ templ = pBiquadState->coefs[2] * tempd;
+ ynR += templ;
+
+ /* ynR+= (-B2 * y(n-2)R ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+ ynR += templ;
+
+ /* ynR+= (-B1 * y(n-1)R ) */
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+ ynR += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = (LVM_FLOAT)ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = (LVM_FLOAT)ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)ynL; /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)ynR; /* Write Right ouput */
+ pDataOut++;
+
+
+ }
+
+ }
+#else
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -123,4 +210,4 @@
}
}
-
+#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.c
index 1709f71..fff05ed 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.c
@@ -37,6 +37,26 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) 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;
+}
+#else
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
Biquad_2I_Order2_Taps_t *pTaps,
BQ_C32_Coefs_t *pCoef)
@@ -56,6 +76,7 @@
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 747af6a..c0f0dcc 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
@@ -29,4 +29,14 @@
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[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.c
index 20404ad..e489031 100644
--- a/media/libeffects/lvm/lib/Common/src/Copy_16.c
+++ b/media/libeffects/lvm/lib/Common/src/Copy_16.c
@@ -54,5 +54,35 @@
return;
}
+#ifdef BUILD_FLOAT
+void Copy_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_INT16 ii;
+ if (src > dst)
+ {
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst++;
+ src++;
+ }
+ }
+ else
+ {
+ src += n - 1;
+ dst += n - 1;
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst--;
+ src--;
+ }
+ }
+
+ return;
+}
+#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.c
index bf69e35..ea98041 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.c
@@ -25,7 +25,37 @@
/**********************************************************************************
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,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp1,Temp2,Temp3;
+ LVM_INT16 ii;
+ LVM_FLOAT Current1Short;
+ LVM_FLOAT Current2Short;
+ Current1Short = (pInstance->Current1);
+ Current2Short = (pInstance->Current2);
+
+ for (ii = n; ii != 0; ii--){
+ Temp1 = *src1++;
+ Temp3 = Temp1 * Current1Short;
+ Temp2 = *src2++;
+ Temp1 = Temp2 * Current2Short;
+ Temp2 = (Temp1 / 2.0f) + (Temp3 / 2.0f);
+ if (Temp2 > 0.5f)
+ Temp2 = 1.0f;
+ else if (Temp2 < -0.5f )
+ Temp2 = -1.0f;
+ else
+ Temp2 = (Temp2 * 2);
+ *dst++ = Temp2;
+ }
+}
+#else
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
const LVM_INT32 *src1,
const LVM_INT32 *src2,
@@ -55,6 +85,5 @@
*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
index 3471f05..2814f19 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
@@ -26,6 +26,70 @@
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,
@@ -89,6 +153,5 @@
}
}
}
-
-
+#endif
/**********************************************************************************/
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
index 709c304..814ccee 100644
--- 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
@@ -25,7 +25,79 @@
/**********************************************************************************
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,
@@ -98,6 +170,5 @@
dst++;
}
}
-
-
+#endif
/**********************************************************************************/
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.c
index 49fa184..d261c9e 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.c
@@ -18,7 +18,53 @@
#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,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT LeftDC,RightDC;
+ LVM_FLOAT Diff;
+ LVM_INT32 j;
+ PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
+ LeftDC = pBiquadState->LeftDC;
+ RightDC = pBiquadState->RightDC;
+ for(j = NrSamples-1; j >= 0; j--)
+ {
+ /* Subtract DC an saturate */
+ Diff =* (pDataIn++) - (LeftDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f; }
+ else if (Diff < -1.0f) {
+ Diff = -1.0f; }
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ LeftDC -= DC_FLOAT_STEP; }
+ else {
+ LeftDC += DC_FLOAT_STEP; }
+
+
+ /* Subtract DC an saturate */
+ Diff =* (pDataIn++) - (RightDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f; }
+ else if (Diff < -1.0f) {
+ Diff = -1.0f; }
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ RightDC -= DC_FLOAT_STEP; }
+ else {
+ RightDC += DC_FLOAT_STEP; }
+
+ }
+ pBiquadState->LeftDC = LeftDC;
+ pBiquadState->RightDC = RightDC;
+
+
+ }
+#else
void DC_2I_D16_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -64,4 +110,4 @@
}
-
+#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.c
index 468a88d..4f4fcd8 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.c
@@ -17,11 +17,18 @@
#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;
+ pBiquadState->LeftDC = 0.0f;
+ pBiquadState->RightDC = 0.0f;
+}
+#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 89a4e68..fa6b729 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,11 +18,23 @@
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
+#ifdef BUILD_FLOAT
+#define DC_FLOAT_STEP 0.0000002384f;
+#else
#define DC_D16_STEP 0x200;
+#endif
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use.*/
+#ifdef BUILD_FLOAT
+typedef struct _Filter_FLOAT_State_
+{
+ LVM_FLOAT LeftDC; /* LeftDC */
+ LVM_FLOAT RightDC; /* RightDC */
+}Filter_FLOAT_State;
+typedef Filter_FLOAT_State * PFilter_FLOAT_State ;
+#else
typedef struct _Filter_State_
{
LVM_INT32 LeftDC; /* LeftDC */
@@ -30,5 +42,5 @@
}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/DelayMix_16x16.c b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
index 7e3182d..f502716 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
@@ -36,10 +36,55 @@
LVM_INT16 Offset = *pOffset;
LVM_INT16 temp;
+ for (i = 0; i < n; i++)
+ {
+ /* Left channel */
+ temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
+ *dst = temp;
+ dst++;
+
+ delay[Offset] = *src;
+ Offset++;
+ src++;
+
+
+ /* Right channel */
+ temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
+ *dst = temp;
+ dst++;
+
+ delay[Offset] = *src;
+ Offset++;
+ src++;
+
+ /* Make the reverb delay buffer a circular buffer */
+ if (Offset >= size)
+ {
+ Offset = 0;
+ }
+ }
+
+ /* Update the offset */
+ *pOffset = Offset;
+
+ 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 */
+ LVM_FLOAT *dst, /* Source/destination */
+ LVM_INT16 *pOffset, /* Delay offset */
+ LVM_INT16 n) /* Number of stereo samples */
+{
+ LVM_INT16 i;
+ LVM_INT16 Offset = *pOffset;
+ LVM_FLOAT temp;
+
for (i=0; i<n; i++)
{
/* Left channel */
- temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst + (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
dst++;
@@ -49,7 +94,7 @@
/* Right channel */
- temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
dst++;
@@ -69,5 +114,5 @@
return;
}
-
+#endif
/**********************************************************************************/
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.c
index de77361..039c88c 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.c
@@ -31,6 +31,46 @@
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,
+ 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=A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
+
+ // ynL+= (-B1 * y(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+
+ }
+
+ }
+#else
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -71,4 +111,4 @@
}
}
-
+#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.c
index 96252cc..b21b8a4 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.c
@@ -38,6 +38,22 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *)pTaps;
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ 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)
@@ -53,6 +69,7 @@
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 516ca83..6fdb039 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,4 +28,14 @@
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 /* _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.c
index 0f1d5bc..416e8eb 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.c
@@ -31,7 +31,47 @@
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,
+ 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=A1 * x(n-1)L
+ ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+
+ // ynL+=A0 * x(n)L
+ templ = pBiquadState->coefs[1] * (*pDataIn);
+ ynL += templ;
+
+ // ynL+= (-B1 * y(n-1)L
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+ ynL += templ;
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
+ }
+
+ }
+#else
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -71,4 +111,4 @@
}
}
-
+#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.c
index 136e4f6..f33d24d 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.c
@@ -37,6 +37,23 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ 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)
@@ -52,6 +69,7 @@
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 94ad48c..fdb528b 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
@@ -29,4 +29,13 @@
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 /* _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.c
index 8388050..192927c 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.c
@@ -32,7 +32,92 @@
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,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR;
+ LVM_FLOAT Temp;
+ LVM_FLOAT NegSatValue;
+ LVM_INT16 ii;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+
+ NegSatValue = -1.0f;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+
+ // ynL =A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+ // 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;
+ // ynR += (-B1 * y(n-1)R ) )
+ Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
+ ynR += Temp;
+
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+
+ pBiquadState->pDelays[3] = ynR; // Update y(n-1)R
+ pBiquadState->pDelays[2] = (*pDataIn++); // Update x(n-1)R
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+
+ /*Saturate results*/
+ if(ynL > 1.0f)
+ {
+ ynL = 1.0f;
+ }
+ else
+ {
+ if(ynL < NegSatValue)
+ {
+ ynL = NegSatValue;
+ }
+ }
+
+ if(ynR > 1.0f)
+ {
+ ynR = 1.0f;
+ }
+ else
+ {
+ if(ynR < NegSatValue)
+ {
+ ynR = NegSatValue;
+ }
+ }
+
+ *pDataOut++ = (LVM_FLOAT)ynL;
+ *pDataOut++ = (LVM_FLOAT)ynR;
+ }
+
+ }
+#else
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
LVM_INT16 *pDataIn,
LVM_INT16 *pDataOut,
@@ -125,4 +210,4 @@
}
}
-
+#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.c
index a19c32c..33ca6cf 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.c
@@ -37,6 +37,23 @@
/* 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)
+{
+ LVM_FLOAT temp;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+
+ temp = pCoef->A1;
+ pBiquadState->coefs[0] = temp;
+ temp = pCoef->A0;
+ pBiquadState->coefs[1] = temp;
+ 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)
@@ -55,6 +72,7 @@
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 4640743..368bfce 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,6 +20,15 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_
+{
+ LVM_FLOAT *pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+}Filter_Float_State;
+
+typedef Filter_Float_State * PFilter_Float_State ;
+#else
typedef struct _Filter_State_
{
LVM_INT32 *pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -28,5 +37,5 @@
}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 4d32df1..b1fde0c 100644
--- a/media/libeffects/lvm/lib/Common/src/Filters.h
+++ b/media/libeffects/lvm/lib/Common/src/Filters.h
@@ -34,6 +34,7 @@
* 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;
@@ -43,12 +44,22 @@
LVM_INT16 B2;
LVM_UINT16 Scale;
} BiquadA012B12CoefsSP_t;
-
-
+#else
+typedef struct
+{
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT A2;
+ LVM_FLOAT B1;
+ 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;
@@ -56,8 +67,15 @@
LVM_INT16 B1;
LVM_UINT16 Scale;
} BiquadA01B1CoefsSP_t;
-
-
+#else
+typedef struct
+{
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT B1;
+ LVM_UINT16 Scale;
+} BiquadA01B1CoefsSP_t;
+#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
index 7975e8b..2c6e6c3 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
@@ -53,5 +53,34 @@
return;
}
+#ifdef BUILD_FLOAT
+void From2iToMS_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dstM,
+ LVM_FLOAT *dstS,
+ LVM_INT16 n )
+{
+ LVM_FLOAT temp1,left,right;
+ LVM_INT16 ii;
+ for (ii = n; ii != 0; ii--)
+ {
+ left = (LVM_FLOAT)*src;
+ src++;
+ right = (LVM_FLOAT)*src;
+ src++;
+
+ /* Compute M signal*/
+ temp1 = (left + right) / 2.0f;
+ *dstM = (LVM_FLOAT)temp1;
+ dstM++;
+
+ /* Compute S signal*/
+ temp1 = (left - right) / 2.0f;
+ *dstS = (LVM_FLOAT)temp1;
+ dstS++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
index 8bb292f..ac1eea8 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
@@ -46,5 +46,27 @@
return;
}
+#ifdef BUILD_FLOAT
+void From2iToMono_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT Temp;
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = (*src);
+ src++;
+
+ Temp += (*src);
+ src++;
+
+ *dst = Temp / 2.0f;
+ dst++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
index 9b938bd..ebc477e 100644
--- a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
+++ b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
@@ -49,6 +49,31 @@
return;
}
+#ifdef BUILD_FLOAT
+void JoinTo2i_Float( const LVM_FLOAT *srcL,
+ const LVM_FLOAT *srcR,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_INT16 ii;
+ srcL += n - 1;
+ srcR += n - 1;
+ dst += ((2 * n) - 1);
+
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *srcR;
+ dst--;
+ srcR--;
+
+ *dst = *srcL;
+ dst--;
+ srcL--;
+ }
+
+ 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.c
index 3d39b93..eb5755e 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.c
@@ -27,7 +27,39 @@
/**********************************************************************************
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,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+ for (ii = n; ii != 0; ii--)
+ {
+ Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance1->Current);
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance2->Current);
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+
+
+}
+#else
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
@@ -66,4 +98,5 @@
}
+#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.c
index 2daf74a..ec0baaf 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.c
@@ -24,7 +24,37 @@
/**********************************************************************************
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,
+ const LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ LVM_FLOAT Current1;
+ LVM_FLOAT Current2;
+ Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+
+ Current1 = (pInstance1->Current);
+ Current2 = (pInstance2->Current);
+
+ for (ii = n; ii != 0; ii--){
+ Temp = (((LVM_FLOAT)*(src1++) * (LVM_FLOAT)Current1)) +
+ (((LVM_FLOAT)*(src2++) * (LVM_FLOAT)Current2));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = Temp;
+ }
+}
+#else
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src1,
@@ -54,6 +84,5 @@
*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.c
index caa0951..d2694cc 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.c
@@ -25,7 +25,96 @@
/**********************************************************************************
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,
+ LVM_INT16 n)
+{
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii,jj;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = pInstance->Delta;
+ LVM_FLOAT Current = pInstance->Current;
+ LVM_FLOAT Target = pInstance->Target;
+ LVM_FLOAT Temp;
+
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if(Current < Target){
+ if (OutLoop){
+ Temp = Current + Delta;
+ Current = Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Temp = Current + Delta;
+ Current = Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (jj = 4; jj != 0 ; jj--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+ }
+ else{
+ if (OutLoop){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (jj = 4; jj != 0 ; jj--){
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ if (Temp > 1.0f)
+ *dst++ = 1.0f;
+ else if (Temp < -1.0f)
+ *dst++ = -1.0f;
+ else
+ *dst++ = (LVM_FLOAT)Temp;
+ }
+ }
+ }
+ pInstance->Current = Current;
+}
+#else
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -123,6 +212,5 @@
}
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
index 09ec427..656a117 100644
--- 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
@@ -26,7 +26,127 @@
/**********************************************************************************
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;
+
+}
+#else
void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
LVMixer3_st *ptrInstance2,
const LVM_INT16 *src,
@@ -140,4 +260,5 @@
pInstanceR->Current=CurrentR;
}
+#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.c
index f1a9ca3..b5e7f5c 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.c
@@ -26,7 +26,86 @@
/**********************************************************************************
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,
+ LVM_INT16 n)
+{
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii;
+ Mix_Private_FLOAT_st *pInstance=(Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta= (LVM_FLOAT)pInstance->Delta;
+ LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
+ LVM_FLOAT Target= (LVM_FLOAT)pInstance->Target;
+ LVM_FLOAT Temp;
+ InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
+ OutLoop = (LVM_INT16)(n - (InLoop << 2));
+
+ if(Current<Target){
+ if (OutLoop){
+
+ Temp = Current + Delta;
+ if (Temp > 1.0f)
+ Temp = 1.0f;
+ else if (Temp < -1.0f)
+ Temp = -1.0f;
+
+ Current=Temp;
+ if (Current > Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ *(dst++) = (((LVM_FLOAT)*(src++) * (LVM_FLOAT)Current));
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+
+ Temp = Current + Delta;
+
+ if (Temp > 1.0f)
+ Temp = 1.0f;
+ else if (Temp < -1.0f)
+ Temp = -1.0f;
+
+ Current=Temp;
+ if (Current > Target)
+ Current = Target;
+
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ }
+ }
+ else{
+ if (OutLoop){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ for (ii = OutLoop; ii != 0; ii--){
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ }
+ }
+
+ for (ii = InLoop; ii != 0; ii--){
+ Current -= Delta;
+ if (Current < Target)
+ Current = Target;
+
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ }
+ }
+ pInstance->Current=Current;
+}
+#else
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -101,6 +180,5 @@
}
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.c
index 0052dd7..192f126 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
@@ -33,7 +33,80 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
+ LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Delta == 1.0f){
+ pInstance->Current = pInstance->Target;
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ 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) == 1.0f){
+ Add2_Sat_Float(src, dst, n);
+ }
+ else{
+ Mac3s_Sat_Float(src, (pInstance->Target), dst, n);
+ /* In case the LVCore function would have changed the Current value */
+ pInstance->Current = pInstance->Target;
+ }
+ }
+ }
+
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (ptrInstance->MixerStream[0].CallbackSet){
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(ptrInstance->MixerStream, TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0){
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+
+}
+#else
void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
LVM_INT16 *src,
LVM_INT16 *dst,
@@ -108,5 +181,5 @@
}
}
-
+#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.c
index f443c8f..bd5a925 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.c
@@ -33,7 +33,138 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_1St_2i_D16C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance1 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
+ {
+ if(pInstance1->Delta == 1.0f)
+ {
+ pInstance1->Current = pInstance1->Target;
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }
+ else if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
+ {
+ pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }
+ else
+ {
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ }
+
+ if(HardMixing == TRUE)
+ {
+ if(pInstance2->Delta == 1.0f)
+ {
+ pInstance2->Current = pInstance2->Target;
+ TargetGain = pInstance2->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
+ }
+ else if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
+ {
+ pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance2->Target;
+ 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 == 1.0f) && (pInstance2->Target == 1.0f))
+ {
+ if(src != dst)
+ {
+ Copy_Float(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_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
+ {
+ pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance1->Target;
+ LVC_Mixer_SetTarget(&ptrInstance->MixerStream[0], TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0)
+ {
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+ if (ptrInstance->MixerStream[1].CallbackSet)
+ {
+ if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
+ {
+ pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore.
+ Make them equal. */
+ TargetGain = pInstance2->Target;
+ LVC_Mixer_SetTarget(&ptrInstance->MixerStream[1], TargetGain);
+ ptrInstance->MixerStream[1].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[1].pCallBack != 0)
+ {
+ (*ptrInstance->MixerStream[1].pCallBack) (
+ ptrInstance->MixerStream[1].pCallbackHandle,
+ ptrInstance->MixerStream[1].pGeneralPurpose,
+ ptrInstance->MixerStream[1].CallbackParam );
+ }
+ }
+ }
+}
+#else
void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -148,5 +279,5 @@
}
}
}
-
+#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.c
index c8dcad7..1017de3 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.c
@@ -33,7 +33,77 @@
/**********************************************************************************
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,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if (pInstance->Current != pInstance->Target)
+ {
+ if(pInstance->Delta == 1.0f){
+ pInstance->Current = pInstance->Target;
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
+ }else{
+ /* Soft mixing has to be applied */
+ HardMixing = FALSE;
+ LVC_Core_MixSoft_1St_D16C31_WRA(&(ptrInstance->MixerStream[0]), src, dst, n);
+ }
+ }
+
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+
+ if (HardMixing){
+ if (pInstance->Target == 0)
+ LoadConst_Float(0.0, dst, n);
+ else {
+ if ((pInstance->Target) != 1.0f)
+ Mult3s_Float(src, (pInstance->Target), dst, n);
+ else if(src != dst)
+ Copy_Float(src, dst, n);
+ }
+
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (ptrInstance->MixerStream[0].CallbackSet){
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ TargetGain = pInstance->Target;
+ LVC_Mixer_SetTarget(ptrInstance->MixerStream, TargetGain);
+ ptrInstance->MixerStream[0].CallbackSet = FALSE;
+ if (ptrInstance->MixerStream[0].pCallBack != 0){
+ (*ptrInstance->MixerStream[0].pCallBack) ( \
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam );
+ }
+ }
+ }
+}
+#else
void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -107,5 +177,5 @@
}
}
}
-
+#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.c
index 7240705..3c90071 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.c
@@ -25,7 +25,49 @@
/**********************************************************************************
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,
+ LVM_FLOAT *src2,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ Mix_Private_FLOAT_st *pInstance1 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st *pInstance2 = \
+ (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+ if(n <= 0) return;
+
+ /******************************************************************************
+ SOFT MIXING
+ *******************************************************************************/
+ if ((pInstance1->Current == pInstance1->Target) && (pInstance1->Current == 0)){
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
+ src2, dst, n);
+ }
+ else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)){
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
+ src1, dst, n);
+ }
+ else if ((pInstance1->Current != pInstance1->Target) || \
+ (pInstance2->Current != pInstance2->Target))
+ {
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
+ src1, dst, n);
+ LVC_MixInSoft_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
+ src2, dst, n);
+ }
+ else{
+ /******************************************************************************
+ HARD MIXING
+ *******************************************************************************/
+ LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0],
+ &ptrInstance->MixerStream[1],
+ src1, src2, dst, n);
+ }
+}
+#else
void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
const LVM_INT16 *src1,
LVM_INT16 *src2,
@@ -66,5 +108,5 @@
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 980c783..f904915 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
@@ -31,6 +31,19 @@
***********************************************************************************/
/* LVMixer3_st structure stores Instance parameters for one audio stream */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
+ Audio Stream shift parameter */
+ LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \
+ each time the target value is updated */
+ LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
+ void *pCallbackHandle; /* Pointer to the instance of the callback function */
+ void *pGeneralPurpose; /* Pointer for general purpose usage */
+ LVM_Callback pCallBack; /* Pointer to the callback function */
+} LVMixer3_FLOAT_st;
+#else
typedef struct
{
LVM_INT32 PrivateParams[4]; /* Private Instance params for Audio Stream */
@@ -40,22 +53,35 @@
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)
***********************************************************************************/
@@ -75,57 +101,115 @@
/* 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,
+ LVM_INT16 n);
+#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,
+ LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#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,
+ LVM_FLOAT *src2,
+ LVM_FLOAT *dst, /* dst cannot be equal to src2 */
+ LVM_INT16 n);
+#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
+void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_FLOAT_st *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst, /* dst can be equal to src */
+ LVM_INT16 n); /* Number of stereo samples */
+#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.c
index b5ae264..5990412 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.c
@@ -31,7 +31,15 @@
/* CurrentGain - CurrentGain value in Q 16.15 format */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream)
+{
+ LVM_FLOAT CurrentGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ CurrentGain = pInstance->Current; // CurrentGain
+ return CurrentGain;
+}
+#else
LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream)
{
LVM_INT32 CurrentGain;
@@ -39,3 +47,4 @@
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.c
index dc2f8e9..c67455a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.c
@@ -30,7 +30,16 @@
/* TargetGain - TargetGain value in Q 16.15 format */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream)
+{
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+
+ TargetGain = pInstance->Target; // TargetGain
+ return TargetGain;
+}
+#else
LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream)
{
LVM_INT32 TargetGain;
@@ -40,3 +49,4 @@
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.c
index 449e7b1..737e26b 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.c
@@ -44,7 +44,19 @@
/* void */
/* */
/************************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
+ LVM_FLOAT TargetGain,
+ LVM_FLOAT CurrentGain)
+{
+ LVM_FLOAT MaxGain = TargetGain;
+ Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ if(CurrentGain > MaxGain)
+ MaxGain = CurrentGain;
+ pInstance->Target = TargetGain; // Update fractional gain Target
+ pInstance->Current = CurrentGain; // Update fractional gain Current
+}
+#else
void LVC_Mixer_Init( LVMixer3_st *pStream,
LVM_INT32 TargetGain,
LVM_INT32 CurrentGain)
@@ -64,4 +76,4 @@
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 294e05c..d0d0e1f 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
@@ -26,6 +26,15 @@
#include "VectorArithmetic.h"
/* Instance parameter structure */
+#ifdef BUILD_FLOAT
+typedef struct
+{
+ /* General */
+ LVM_FLOAT Target; /*number specifying value of Target Gain */
+ LVM_FLOAT Current; /*number specifying value of Current Gain */
+ LVM_FLOAT Delta; /*number specifying value of Delta Gain */
+} Mix_Private_FLOAT_st;
+#else
typedef struct
{
/* General */
@@ -34,8 +43,7 @@
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
@@ -49,23 +57,43 @@
***********************************************************************************/
/*** 16 bit functions *************************************************************/
-
+#ifdef BUILD_FLOAT
+void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#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,
+ LVM_INT16 n);
+#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 */
@@ -73,12 +101,19 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-
+#ifdef BUILD_FLOAT
+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);
+#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 */
@@ -86,16 +121,22 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
+#ifdef BUILD_FLOAT
+void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
+ LVMixer3_FLOAT_st *ptrInstance2,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n);
+#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,
@@ -112,7 +153,7 @@
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.c
index 5efa501..577179d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.c
@@ -43,7 +43,14 @@
/* 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)
{
@@ -64,3 +71,4 @@
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.c
index 4c1c8b2..48f5d54 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.c
@@ -44,7 +44,51 @@
/* 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[11] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f,/*48000*/
+ 0.041667f,/*96000*/
+ 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];
+ Delta = Delta / (NumChannels);
+
+ if(Tc_millisec == 0)
+ Delta = 1.000000f;
+ else
+ Delta = Delta / Tc_millisec;
+
+ if(Delta == 0)
+ Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
+ assign minimum value to Delta */
+ 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,
@@ -73,3 +117,4 @@
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.c
index 8d5304e..9dc7d21 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c
@@ -45,7 +45,72 @@
/* 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[11] = {0.500000f,/*8000*/
+ 0.362812f,/*11025*/
+ 0.333333f,/*12000*/
+ 0.250000f,/*16000*/
+ 0.181406f,/*22050*/
+ 0.166666f,/*24000*/
+ 0.125000f,/*32000*/
+ 0.090703f,/*44100*/
+ 0.083333f,/*48000*/
+ 0.041666f,/*96000*/
+ 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];
+ LVM_FLOAT Current;
+ LVM_FLOAT Target;
+
+ Delta=Delta / (NumChannels);
+
+ /* Get gain values */
+ Current = pInstance->Current;
+ Target = pInstance->Target;
+
+ if (Current != Target)
+ {
+ Tc_millisec_float = (LVM_FLOAT)(Tc_millisec) / (Current - Target);
+ if (Tc_millisec_float < 0)
+ Tc_millisec_float = -Tc_millisec_float;
+
+ if(Tc_millisec == 0)
+ Delta = 1.000000f;
+ else
+ Delta = Delta / Tc_millisec_float;
+
+ if(Delta == 0)
+ Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
+ assign minimum value to Delta */
+ }
+ else
+ {
+ Delta = 0.0000000005f; /* Minimum value for proper call-backs \
+ (setting it to zero has some problems, to be corrected) */
+ }
+
+ 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,
@@ -93,3 +158,4 @@
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.c
index 6d8fe46..9094622 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.c
@@ -53,7 +53,7 @@
/* A9 194669577 */
/* A10 8 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -68,7 +68,36 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs)
+{
+ LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
+ 0.999801f,
+ -0.497824f,
+ 0.322937f,
+ -0.180880f,
+ 0.087658f,
+ -0.032102f,
+ 0.008163f,
+ -0.001252f,
+ 0.000089f,
+ 0,
+ 0,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)9, Coefficients, w);
+ pCoeffs->B1 = -Y; /* Store -B1 in filter structure instead of B1!*/
+ /* A0=(1-B1)/2= B1/2 - 0.5*/
+ Y = Y / 2.0f; /* A0=Y=B1/2*/
+ Y = Y - 0.5f; /* A0=Y=(B1/2 - 0.5)*/
+
+ pCoeffs->A0 = Y * FILTER_LOSS_FLOAT; /* Apply loss to avoid overflow*/
+ pCoeffs->A1 = -pCoeffs->A0; /* Store A1=-A0*/
+
+ return 1;
+}
+#else
LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
FO_C32_Coefs_t *pCoeffs)
{
@@ -97,4 +126,4 @@
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.c
index 86ec951..9fe67f8 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.c
@@ -53,7 +53,7 @@
/* A9 194669577 */
/* A10 8 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -68,7 +68,33 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
+#ifdef BUILD_FLOAT
+LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
+ FO_FLOAT_Coefs_t *pCoeffs)
+{
+ LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
+ 0.999801f,
+ -0.497824f,
+ 0.322937f,
+ -0.180880f,
+ 0.087658f,
+ -0.032102f,
+ 0.008163f,
+ -0.001252f,
+ 0.000089f,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)9, Coefficients, w);
+ pCoeffs->B1 = -Y; // Store -B1 in filter structure instead of B1!
+ // A0=(1+B1)/2= B1/2 + 0.5
+ Y = Y / 2.0f; // A0=Y=B1/2
+ Y = Y + 0.5f; // A0=Y=(B1/2 + 0.5)
+ pCoeffs->A0 = Y * FILTER_LOSS_FLOAT;
+ pCoeffs->A1 = pCoeffs->A0;
+
+ return 1;
+}
+#else
LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
FO_C32_Coefs_t *pCoeffs)
{
@@ -94,4 +120,4 @@
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.c
index f3b9b3c..7846ca0 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.c
@@ -32,16 +32,45 @@
#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
+#define LVVDL_2PiBy_16000_f 0.000392700f
+#define LVVDL_2PiBy_22050_f 0.000284952f
+#define LVVDL_2PiBy_24000_f 0.000261800f
+#define LVVDL_2PiBy_32000_f 0.000196350f
+#define LVVDL_2PiBy_44100_f 0.000142476f
+#define LVVDL_2PiBy_48000_f 0.000130900f
+#ifdef HIGHER_FS
+#define LVVDL_2PiBy_96000_f 0.000065450f
+#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,
+ LVVDL_2PiBy_16000_f,
+ LVVDL_2PiBy_22050_f,
+ LVVDL_2PiBy_24000_f,
+ LVVDL_2PiBy_32000_f,
+ LVVDL_2PiBy_44100_f,
+ LVVDL_2PiBy_48000_f
+#ifdef HIGHER_FS
+ ,LVVDL_2PiBy_96000_f
+ ,LVVDL_2PiBy_192000_f
+#endif
+ };
+#endif
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_GetOmega */
@@ -59,7 +88,20 @@
/* 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)
{
@@ -67,4 +109,4 @@
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 6846d49..f1e45fa 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
@@ -87,5 +87,58 @@
#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
+#define ALPHA_Float_3 0.999996f
+#define ALPHA_Float_4 0.999995f
+#define ALPHA_Float_5 0.999992f
+#define ALPHA_Float_6 0.999989f
+#define ALPHA_Float_7 0.999985f
+#define ALPHA_Float_8 0.999979f
+#define ALPHA_Float_9 0.999970f
+#define ALPHA_Float_10 0.999957f
+#define ALPHA_Float_11 0.999939f
+#define ALPHA_Float_12 0.999914f
+#define ALPHA_Float_13 0.999879f
+#define ALPHA_Float_14 0.999829f
+#define ALPHA_Float_15 0.999758f
+#define ALPHA_Float_16 0.999658f
+#define ALPHA_Float_17 0.999516f
+#define ALPHA_Float_18 0.999316f
+#define ALPHA_Float_19 0.999033f
+#define ALPHA_Float_20 0.998633f
+#define ALPHA_Float_21 0.998067f
+#define ALPHA_Float_22 0.997268f
+#define ALPHA_Float_23 0.996139f
+#define ALPHA_Float_24 0.994545f
+#define ALPHA_Float_25 0.992295f
+#define ALPHA_Float_26 0.989123f
+#define ALPHA_Float_27 0.984654f
+#define ALPHA_Float_28 0.978370f
+#define ALPHA_Float_29 0.969553f
+#define ALPHA_Float_30 0.957221f
+#define ALPHA_Float_31 0.940051f
+#define ALPHA_Float_32 0.916297f
+#define ALPHA_Float_33 0.883729f
+#define ALPHA_Float_34 0.839645f
+#define ALPHA_Float_35 0.781036f
+#define ALPHA_Float_36 0.705078f
+#define ALPHA_Float_37 0.610108f
+#define ALPHA_Float_38 0.497239f
+#define ALPHA_Float_39 0.372343f
+#define ALPHA_Float_40 0.247351f
+#define ALPHA_Float_41 0.138722f
+#define ALPHA_Float_42 0.061234f
+#define ALPHA_Float_43 0.019267f
+#define ALPHA_Float_44 0.003756f
+#define ALPHA_Float_45 0.000372f
+#define ALPHA_Float_46 0.000014f
+#define ALPHA_Float_47 0.000000f
+#define ALPHA_Float_48 0.000000f
+#define ALPHA_Float_49 0.000000f
+#define ALPHA_Float_50 0.000000f
+#endif
#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
index 809d904..18b2782 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.c
@@ -57,7 +57,110 @@
/* 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)
+{
+ LVM_UINT32 Product;
+ LVM_FLOAT ProductFloat;
+ LVM_INT16 InterpolateShort;
+ LVM_FLOAT Interpolate;
+ LVM_UINT16 Shift;
+ LVM_FLOAT Diff;
+ LVM_FLOAT Table[] = {ALPHA_Float_0, /* Log spaced look-up table */
+ ALPHA_Float_1,
+ ALPHA_Float_2,
+ ALPHA_Float_3,
+ ALPHA_Float_4,
+ ALPHA_Float_5,
+ ALPHA_Float_6,
+ ALPHA_Float_7,
+ ALPHA_Float_8,
+ ALPHA_Float_9,
+ ALPHA_Float_10,
+ ALPHA_Float_11,
+ ALPHA_Float_12,
+ ALPHA_Float_13,
+ ALPHA_Float_14,
+ ALPHA_Float_15,
+ ALPHA_Float_16,
+ ALPHA_Float_17,
+ ALPHA_Float_18,
+ ALPHA_Float_19,
+ ALPHA_Float_20,
+ ALPHA_Float_21,
+ ALPHA_Float_22,
+ ALPHA_Float_23,
+ ALPHA_Float_24,
+ ALPHA_Float_25,
+ ALPHA_Float_26,
+ ALPHA_Float_27,
+ ALPHA_Float_28,
+ ALPHA_Float_29,
+ ALPHA_Float_30,
+ ALPHA_Float_31,
+ ALPHA_Float_32,
+ ALPHA_Float_33,
+ ALPHA_Float_34,
+ ALPHA_Float_35,
+ ALPHA_Float_36,
+ ALPHA_Float_37,
+ ALPHA_Float_38,
+ ALPHA_Float_39,
+ ALPHA_Float_40,
+ ALPHA_Float_41,
+ ALPHA_Float_42,
+ ALPHA_Float_43,
+ ALPHA_Float_44,
+ ALPHA_Float_45,
+ ALPHA_Float_46,
+ ALPHA_Float_47,
+ ALPHA_Float_48,
+ ALPHA_Float_49,
+ ALPHA_Float_50};
+
+ /* Calculate the product of the time constant and the sample rate */
+ Product = ((tc >> 16) * (LVM_UINT32)Fs) << 13; /* Stereo value */
+ Product = 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++;
+ }
+
+ InterpolateShort = (LVM_INT16)((Product >> 15) & 0x00007FFF);
+ Interpolate = (LVM_FLOAT)InterpolateShort / 32768.0f;
+
+ Diff = (Table[Shift] - Table[Shift + 1]);
+ Diff = Diff * Interpolate;
+ ProductFloat = Table[Shift + 1] + Diff;
+
+ return ProductFloat;
+}
+#else
LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
LVM_UINT16 Fs,
LVM_UINT16 NumChannels)
@@ -154,3 +257,4 @@
return Product;
}
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
index a6d7db2..cd57767 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.c
@@ -25,7 +25,7 @@
/* */
/* DESCRIPTION: */
/* This function performs polynomial expansion */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* LVM_INT32 LVM_Polynomial(LVM_UINT16 N, */
/* LVM_INT32 *pCoefficients, */
@@ -40,7 +40,48 @@
/* 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)
+{
+ LVM_INT32 i;
+ LVM_FLOAT Y,A,XTemp,Temp,sign;
+ Y = *pCoefficients; /* Y=A0*/
+ pCoefficients++;
+
+ if(X == -1.0f)
+ {
+ 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++;
+
+ Temp = A * XTemp;
+ Y += Temp;
+
+ Temp = XTemp * X;
+ XTemp = Temp;
+ }
+ }
+ return Y;
+}
+#else
LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
LVM_INT32 *pCoefficients,
LVM_INT32 X)
@@ -93,4 +134,4 @@
}
return Y;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c b/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
index 6ca1077..8785594 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Power10.c
@@ -44,7 +44,7 @@
/* A11 50477244 */
/* A12 -2 */
/* */
-/* Y = (A0 + A1*X + A2*X2 + A3*X3 + Â….. + AN*xN) << AN+1 */
+/* Y = (A0 + A1*X + A2*X2 + A3*X3 + �.. + AN*xN) << AN+1 */
/* */
/* */
/* PARAMETERS: */
@@ -54,7 +54,28 @@
/* 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,
+ 2.302475f,
+ 2.652765f,
+ 2.035494f,
+ 1.165667f,
+ 0.537676f,
+ 0.213192f,
+ 0.069603f,
+ 0.016553f,
+ 0.004373f,
+ 0.001817f,
+ 0.000367f,
+ 0};
+ Y=LVM_Polynomial((LVM_UINT16)11,
+ Coefficients,
+ X);
+ return Y;
+}
+#else
LVM_INT32 LVM_Power10(LVM_INT32 X)
{
LVM_INT32 Y,Coefficients[13]={ 16775636,
@@ -75,4 +96,4 @@
X);
return Y;
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c b/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
index 2f1e591..9e14c3b 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_32.c
@@ -24,7 +24,22 @@
/**********************************************************************************
FUNCTION LoadConst_32
***********************************************************************************/
+#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 )
@@ -39,5 +54,6 @@
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.c
index 26297e7..02c906a 100644
--- a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
+++ b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.c
@@ -77,4 +77,58 @@
return;
}
+#ifdef BUILD_FLOAT
+void MSTo2i_Sat_Float(const LVM_FLOAT *srcM,
+ const LVM_FLOAT *srcS,
+ LVM_FLOAT *dst,
+ LVM_INT16 n )
+{
+ LVM_FLOAT temp,mVal,sVal;
+ LVM_INT16 ii;
+
+
+ for (ii = n; ii != 0; ii--)
+ {
+ mVal = (LVM_FLOAT)*srcM;
+ srcM++;
+
+ sVal = (LVM_FLOAT)*srcS;
+ srcS++;
+
+ temp = mVal + sVal;
+
+ if (temp > 1.0f)
+ {
+ *dst = 1.0f;
+ }
+ else if (temp < -1.0f)
+ {
+ *dst = -1.0f;
+ }
+ else
+ {
+ *dst = (LVM_FLOAT)temp;
+ }
+ dst++;
+
+ temp = mVal - sVal;
+
+ if (temp > 1.0f)
+ {
+ *dst = 1.0f;
+ }
+ else if (temp < -1.0f)
+ {
+ *dst = - 1.0f;
+ }
+ else
+ {
+ *dst = (LVM_FLOAT)temp;
+ }
+ dst++;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
index f28f366..e3fb40d 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.c
@@ -64,7 +64,44 @@
return;
}
+#ifdef BUILD_FLOAT
+void Mac3s_Sat_Float(const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT srcval;
+ LVM_FLOAT Temp,dInVal;
+ for (ii = n; ii != 0; ii--)
+ {
+ srcval = *src;
+ src++;
+
+ Temp = srcval * val;
+
+ dInVal = (LVM_FLOAT)*dst;
+ Temp = Temp + dInVal;
+
+ if (Temp > 1.000000f)
+ {
+ *dst = 1.000000f;
+ }
+ else if (Temp < -1.000000f)
+ {
+ *dst = -1.000000f;
+ }
+ else
+ {
+ *dst = Temp;
+ }
+ dst++;
+ }
+
+ 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.c
index 73c26ed..16e367b 100644
--- a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.c
@@ -32,7 +32,71 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D32C31_SAT
***********************************************************************************/
+#ifdef BUILD_FLOAT
+void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
+ const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ char HardMixing = TRUE;
+ if(n <= 0) return;
+
+ /******************************************************************************
+ 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_FLOAT) &&
+ (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ 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) == 1.0f)
+ Add2_Sat_Float(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_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ pInstance->CallbackSet = FALSE;
+ if (pInstance->pCallBack != 0){
+ (*pInstance->pCallBack) ( pInstance->pCallbackHandle,
+ pInstance->pGeneralPurpose,
+ pInstance->CallbackParam );
+ }
+ }
+ }
+}
+#else
void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -91,5 +155,5 @@
}
}
}
-
+#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.c
index ca88b04..869293b 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.c
@@ -34,7 +34,68 @@
/**********************************************************************************
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,
+ 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_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ 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_Float(0, dst, n);
+ else if ((pInstance->Target) == 1.0f){
+ if (src != dst)
+ Copy_Float((LVM_FLOAT*)src, (LVM_FLOAT*)dst, (LVM_INT16)(n));
+ }
+ else
+ Mult3s_Float(src, pInstance->Current, dst, n);
+ }
+
+ /******************************************************************************
+ CALL BACK
+ *******************************************************************************/
+
+ if (pInstance->CallbackSet){
+ if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
+ Make them equal. */
+ pInstance->CallbackSet = FALSE;
+ if (pInstance->pCallBack != 0){
+ (*pInstance->pCallBack) ( pInstance->pCallbackHandle,
+ pInstance->pGeneralPurpose,
+ pInstance->CallbackParam );
+ }
+ }
+ }
+}
+#else
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
const LVM_INT32 *src,
LVM_INT32 *dst,
@@ -91,5 +152,5 @@
}
}
}
-
+#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.c
index 2e0a099..6fc1b92 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.c
@@ -26,7 +26,44 @@
/**********************************************************************************
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,
+ LVM_FLOAT *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_FLOAT_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_FLOAT_t*) pInstance, src1, dst, n);
+ else
+ 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,
@@ -61,5 +98,6 @@
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 607073c..00d55ed 100644
--- a/media/libeffects/lvm/lib/Common/src/Mixer_private.h
+++ b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
@@ -26,6 +26,10 @@
#define POINT_ZERO_ONE_DB 2473805 /* 0.01 dB on a full scale signal = (10^(0.01/20) -1) * 2^31 */
+#ifdef BUILD_FLOAT
+#define POINT_ZERO_ONE_DB_FLOAT 0.001152 /* 0.01 dB on a full scale \
+ signal = (10^(0.01/20) -1) * 2^31 */
+#endif
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
index c09ec0f..796a15c 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.c
@@ -45,5 +45,26 @@
return;
}
+#ifdef BUILD_FLOAT
+void MonoTo2I_Float( const LVM_FLOAT *src,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ src += (n - 1);
+ dst += ((n * 2) - 1);
+ for (ii = n; ii != 0; ii--)
+ {
+ *dst = *src;
+ dst--;
+
+ *dst = *src;
+ dst--;
+ src--;
+ }
+
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
index a5dc50f..c758560 100644
--- a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
+++ b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.c
@@ -47,5 +47,23 @@
return;
}
+#ifdef BUILD_FLOAT
+void Mult3s_Float( const LVM_FLOAT *src,
+ const LVM_FLOAT val,
+ LVM_FLOAT *dst,
+ LVM_INT16 n)
+{
+ LVM_INT16 ii;
+ LVM_FLOAT temp;
+ for (ii = n; ii != 0; ii--)
+ {
+ temp = (*src) * val;
+ src++;
+ *dst = temp;
+ dst++;
+ }
+ return;
+}
+#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
index 73343cd..5156edc 100644
--- a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
+++ b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.c
@@ -114,4 +114,54 @@
}
}
+#ifdef BUILD_FLOAT
+void NonLinComp_Float(LVM_FLOAT Gain,
+ LVM_FLOAT *pDataIn,
+ LVM_FLOAT *pDataOut,
+ LVM_INT32 BlockLength)
+{
+ LVM_FLOAT Sample; /* Input samples */
+ LVM_INT32 SampleNo; /* Sample index */
+ LVM_FLOAT Temp;
+
+
+ /*
+ * Process a block of samples
+ */
+ for(SampleNo = 0; SampleNo < BlockLength; SampleNo++)
+ {
+ /*
+ * Read the input
+ */
+ Sample = *pDataIn;
+ pDataIn++;
+
+
+ /*
+ * Apply the compander, this compresses the signal at the expense of
+ * harmonic distortion. The amount of compression is control by the
+ * gain factor
+ */
+ if (Sample != -1.0f)
+ {
+ Temp = ((Sample * Sample));
+ if(Sample > 0)
+ {
+ Sample = (Sample + ((Gain * (Sample - Temp)) ));
+ }
+ else
+ {
+ Sample = (Sample + ((Gain * (Sample + Temp)) ));
+ }
+ }
+
+
+ /*
+ * Save the output
+ */
+ *pDataOut = Sample;
+ 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.c
index c8c1527..9c17a05 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.c
@@ -38,6 +38,88 @@
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,
+ LVM_INT16 NrSamples)
+ {
+ LVM_FLOAT ynL,ynR,ynLO,ynRO,templ;
+ LVM_INT16 ii;
+ PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+
+ for (ii = NrSamples; ii != 0; ii--)
+ {
+
+
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL= (A0 * (x(n)L - x(n-2)L ) )*/
+ templ = (*pDataIn) - pBiquadState->pDelays[2];
+ ynL = templ * pBiquadState->coefs[0];
+
+ /* ynL+= ((-B2 * y(n-2)L )) */
+ templ = pBiquadState->pDelays[6] * pBiquadState->coefs[1];
+ ynL += templ;
+
+ /* ynL+= ((-B1 * y(n-1)L ) ) */
+ templ = pBiquadState->pDelays[4] * pBiquadState->coefs[2];
+ ynL += templ;
+
+ /* ynLO= ((Gain * ynL )) */
+ ynLO = ynL * pBiquadState->coefs[3];
+
+ /* ynLO=( ynLO + x(n)L )*/
+ ynLO += (*pDataIn);
+
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= (A0 * (x(n)R - x(n-2)R ) ) */
+ templ = (*(pDataIn + 1)) - pBiquadState->pDelays[3];
+ ynR = templ * pBiquadState->coefs[0];
+
+ /* ynR+= ((-B2 * y(n-2)R ) ) */
+ templ = pBiquadState->pDelays[7] * pBiquadState->coefs[1];
+ ynR += templ;
+
+ /* ynR+= ((-B1 * y(n-1)R ) ) */
+ templ = pBiquadState->pDelays[5] * pBiquadState->coefs[2];
+ ynR += templ;
+
+ /* ynRO= ((Gain * ynR )) */
+ ynRO = ynR * pBiquadState->coefs[3];
+
+ /* ynRO=( ynRO + x(n)R )*/
+ ynRO += (*(pDataIn+1));
+
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[7] = pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
+ pBiquadState->pDelays[6] = pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
+ pBiquadState->pDelays[3] = pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
+ pBiquadState->pDelays[2] = pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
+ pBiquadState->pDelays[5] = ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
+
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = ynLO; /* Write Left output*/
+ pDataOut++;
+ *pDataOut = ynRO; /* Write Right ouput*/
+ pDataOut++;
+
+ }
+
+ }
+#else
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
LVM_INT32 *pDataIn,
LVM_INT32 *pDataOut,
@@ -118,4 +200,4 @@
}
}
-
+#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
index 67a570b..f705cbf 100644
--- 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
@@ -38,6 +38,7 @@
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,
@@ -116,4 +117,4 @@
}
}
-
+#endif
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
index 1d6142c..65475a3 100644
--- 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
@@ -18,7 +18,7 @@
#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)
@@ -35,4 +35,4 @@
pBiquadState->coefs[3]=pCoef->G;
}
-
+#endif
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.c
index b9f64e6..a36330e 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.c
@@ -17,7 +17,23 @@
#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)
+{
+ PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ pBiquadState->coefs[0] = pCoef->A0;
+
+ pBiquadState->coefs[1] = pCoef->B2;
+
+ pBiquadState->coefs[2] = pCoef->B1;
+
+ pBiquadState->coefs[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)
@@ -34,4 +50,4 @@
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 e2050e0..1e32062 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
@@ -21,6 +21,16 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
+
+#ifdef BUILD_FLOAT
+typedef struct _Filter_State_Float_
+{
+ LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+}Filter_State_Float;
+
+typedef Filter_State_Float * PFilter_State_Float ;
+#endif
typedef struct _Filter_State_
{
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
index 8363270..28fea65 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.c
@@ -24,7 +24,7 @@
/**********************************************************************************
FUNCTION Shift_Sat_v16xv16
***********************************************************************************/
-
+#ifndef BUILD_FLOAT
void Shift_Sat_v16xv16 (const LVM_INT16 val,
const LVM_INT16 *src,
LVM_INT16 *dst,
@@ -77,5 +77,5 @@
}
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
index fbd132e..fac9de7 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.c
@@ -24,7 +24,62 @@
/**********************************************************************************
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,
@@ -79,5 +134,5 @@
}
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.c
index ac0343f..9a726f2 100644
--- a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
+++ b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.c
@@ -29,6 +29,9 @@
/*######################################################################################*/
#include "ScalarArithmetic.h"
+#ifdef BUILD_FLOAT
+#include <math.h>
+#endif
/****************************************************************************************
@@ -64,6 +67,18 @@
#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;
+ LVM_FLOAT LinFloat;
+
+ dB_Float = (LVM_FLOAT)((LVM_FLOAT)db_fix / 16.0f);
+ LinFloat = pow(10, dB_Float / 20.0);
+
+ return LinFloat;
+}
+#else
LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix)
{
LVM_INT32 Lin_val_32;
@@ -106,4 +121,4 @@
return Lin_val_32; /* format 1.16.15 */
}
-
+#endif
diff --git a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
index db6aabe..8e0b738 100644
--- a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
+++ b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
@@ -200,6 +200,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_96000 512
+#define LVEQNB_CAP_FS_192000 1024
+#endif
typedef enum
{
@@ -212,6 +216,10 @@
LVEQNB_FS_32000 = 6,
LVEQNB_FS_44100 = 7,
LVEQNB_FS_48000 = 8,
+#ifdef HIGHER_FS
+ LVEQNB_FS_96000 = 9,
+ LVEQNB_FS_192000 = 10,
+#endif
LVEQNB_FS_MAX = LVM_MAXINT_32
} LVEQNB_Fs_en;
@@ -268,6 +276,7 @@
{
/* General parameters */
LVM_UINT16 SampleRate;
+
LVM_UINT16 SourceFormat;
LVM_UINT16 MaxBlockSize;
LVM_UINT16 MaxBands;
@@ -460,11 +469,17 @@
/* 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
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
index fddedb9..ff52b7f 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.c
@@ -22,7 +22,9 @@
/****************************************************************************************/
#include "LVEQNB_Private.h"
-
+#ifdef BUILD_FLOAT
+#include <math.h>
+#endif
/****************************************************************************************/
/* */
@@ -77,6 +79,7 @@
/****************************************************************************************/
+#ifndef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C32_Coefs_t *pCoefficients)
@@ -168,7 +171,7 @@
return(LVEQNB_SUCCESS);
}
-
+#endif
/****************************************************************************************/
/* */
@@ -205,7 +208,67 @@
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
+ LVEQNB_BandDef_t *pFilterDefinition,
+ PK_FLOAT_Coefs_t *pCoefficients)
+{
+ extern LVM_FLOAT LVEQNB_GainTable[];
+ extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVEQNB_DTable[];
+
+
+ /*
+ * Get the filter definition
+ */
+ LVM_INT16 Gain = pFilterDefinition->Gain;
+ LVM_UINT16 Frequency = pFilterDefinition->Frequency;
+ /* As mentioned in effectbundle.h */
+ LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
+
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ if (Gain >= 0)
+ {
+ D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
+ }
+ else
+ {
+ D = LVEQNB_DTable[Gain + 15]; /* D = 1 / (1 + G) if GaindB < 0 */
+ }
+
+ /*
+ * Calculate the B2,B1,A0 coefficients
+ */
+ B2 = -0.5 * (2 * QFactor - D * T0) / (2 * QFactor + D * T0);
+ B1 = (0.5 - B2) * cos(T0);
+ A0 = (0.5 + B2) / 2.0;
+
+ /*
+ * Write coeff into the data structure
+ */
+ /* all the coefficients are multiplied with 2 to make them align with fixed point values*/
+ pCoefficients->A0 = 2 * A0;
+ pCoefficients->B1 = 2 * B1;
+ pCoefficients->B2 = 2 * B2;
+ pCoefficients->G = LVEQNB_GainTable[Gain + 15];
+
+ return(LVEQNB_SUCCESS);
+}
+#else
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_C16_Coefs_t *pCoefficients)
@@ -296,3 +359,4 @@
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 95212f2..f0deb6c 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -25,7 +25,39 @@
/* 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
+#define LVEQNB_Gain_Neg12_dB -0.748811f
+#define LVEQNB_Gain_Neg11_dB -0.718162f
+#define LVEQNB_Gain_Neg10_dB -0.683772f
+#define LVEQNB_Gain_Neg9_dB -0.645187f
+#define LVEQNB_Gain_Neg8_dB -0.601893f
+#define LVEQNB_Gain_Neg7_dB -0.553316f
+#define LVEQNB_Gain_Neg6_dB -0.498813f
+#define LVEQNB_Gain_Neg5_dB -0.437659f
+#define LVEQNB_Gain_Neg4_dB -0.369043f
+#define LVEQNB_Gain_Neg3_dB -0.292054f
+#define LVEQNB_Gain_Neg2_dB -0.205672f
+#define LVEQNB_Gain_Neg1_dB -0.108749f
+#define LVEQNB_Gain_0_dB 0.000000f
+#define LVEQNB_Gain_1_dB 0.122018f
+#define LVEQNB_Gain_2_dB 0.258925f
+#define LVEQNB_Gain_3_dB 0.412538f
+#define LVEQNB_Gain_4_dB 0.584893f
+#define LVEQNB_Gain_5_dB 0.778279f
+#define LVEQNB_Gain_6_dB 0.995262f
+#define LVEQNB_Gain_7_dB 1.238721f
+#define LVEQNB_Gain_8_dB 1.511886f
+#define LVEQNB_Gain_9_dB 1.818383f
+#define LVEQNB_Gain_10_dB 2.162278f
+#define LVEQNB_Gain_11_dB 2.548134f
+#define LVEQNB_Gain_12_dB 2.981072f
+#define LVEQNB_Gain_13_dB 3.466836f
+#define LVEQNB_Gain_14_dB 4.011872f
+#define LVEQNB_Gain_15_dB 4.623413f
+#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 */
@@ -58,14 +90,30 @@
#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
+#define LVEQNB_2PiOn_16000 0.000393f
+#define LVEQNB_2PiOn_22050 0.000285f
+#define LVEQNB_2PiOn_24000 0.000262f
+#define LVEQNB_2PiOn_32000 0.000196f
+#define LVEQNB_2PiOn_44100 0.000142f
+#define LVEQNB_2PiOn_48000 0.000131f
+#ifdef HIGHER_FS
+#define LVEQNB_2PiOn_96000 0.000065f
+#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 */
@@ -76,14 +124,31 @@
#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
+#define LVEQNB_100D_Neg12_dB 3.981072f
+#define LVEQNB_100D_Neg11_dB 3.548134f
+#define LVEQNB_100D_Neg10_dB 3.162278f
+#define LVEQNB_100D_Neg9_dB 2.818383f
+#define LVEQNB_100D_Neg8_dB 2.511886f
+#define LVEQNB_100D_Neg7_dB 2.238721f
+#define LVEQNB_100D_Neg6_dB 1.995262f
+#define LVEQNB_100D_Neg5_dB 1.778279f
+#define LVEQNB_100D_Neg4_dB 1.584893f
+#define LVEQNB_100D_Neg3_dB 1.412538f
+#define LVEQNB_100D_Neg2_dB 1.258925f
+#define LVEQNB_100D_Neg1_dB 1.122018f
+#define LVEQNB_100D_0_dB 1.000000f
+#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 */
@@ -101,6 +166,6 @@
#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.c
index 10e7d74..c290aec 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.c
@@ -140,8 +140,12 @@
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 */
@@ -158,11 +162,15 @@
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))
{
/*
@@ -177,7 +185,7 @@
*/
pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
}
-
+#endif
/*
* Check for out of range frequencies
@@ -230,6 +238,25 @@
BiquadType = pInstance->pBiquadType[i];
switch (BiquadType)
{
+#ifdef BUILD_FLOAT
+ case LVEQNB_SinglePrecision_Float:
+ {
+ PK_FLOAT_Coefs_t Coefficients;
+ /*
+ * Calculate the single precision coefficients
+ */
+ LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
+ &pInstance->pBandDefinitions[i],
+ &Coefficients);
+ /*
+ * Set the coefficients
+ */
+ PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState_Float[i],
+ &pInstance->pEQNB_Taps_Float[i],
+ &Coefficients);
+ break;
+ }
+#else
case LVEQNB_DoublePrecision:
{
PK_C32_Coefs_t Coefficients;
@@ -269,6 +296,7 @@
&Coefficients);
break;
}
+#endif
default:
break;
}
@@ -288,7 +316,7 @@
/* pInstance Pointer to the instance */
/* */
/************************************************************************************/
-
+#ifndef BUILD_FLOAT
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
{
LVM_INT16 *pTapAddress;
@@ -305,8 +333,24 @@
NumTaps); /* Number of words */
}
}
+#else
+void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
+{
+ LVM_FLOAT *pTapAddress;
+ LVM_INT16 NumTaps;
+ pTapAddress = (LVM_FLOAT *)pInstance->pEQNB_Taps_Float;
+ NumTaps = (LVM_INT16)((pInstance->Capabilities.MaxBands * \
+ sizeof(Biquad_2I_Order2_FLOAT_Taps_t)) / sizeof(LVM_FLOAT));
+ if (NumTaps != 0)
+ {
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ pTapAddress, /* Destination */
+ NumTaps); /* Number of words */
+ }
+}
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -422,9 +466,13 @@
{
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;
}
@@ -432,15 +480,18 @@
{
/* Stay on the ON operating mode until the transition is done */
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;
}
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
@@ -470,8 +521,13 @@
/*
* 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);
@@ -485,9 +541,3 @@
return 1;
}
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
index e01c1c5..de1bbb7 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.c
@@ -97,6 +97,21 @@
*/
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 */
+ sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
+ /* Equaliser Biquad Taps */
+ InstAlloc_AddMember(&AllocMem,
+ (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t)));
+ /* Filter definitions */
+ InstAlloc_AddMember(&AllocMem,
+ (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t)));
+ /* 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 */
@@ -107,6 +122,7 @@
(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;
@@ -117,12 +133,22 @@
*/
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 */
+ sizeof(Biquad_FLOAT_Instance_t));
+ /* 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;
@@ -133,8 +159,14 @@
*/
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;
@@ -248,8 +280,15 @@
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
@@ -259,9 +298,15 @@
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);
@@ -279,8 +324,13 @@
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
@@ -308,15 +358,22 @@
pInstance->BypassMixer.MixerStream[0].CallbackParam = 0;
pInstance->BypassMixer.MixerStream[0].pCallbackHandle = (void*)pInstance;
pInstance->BypassMixer.MixerStream[0].pCallBack = LVEQNB_BypassMixerCallBack;
+
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],0,LVM_FS_8000,2);
+
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 9df980c..56b02e0 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
@@ -60,6 +60,9 @@
/* Filter biquad types */
typedef enum
{
+#ifdef BUILD_FLOAT
+ LVEQNB_SinglePrecision_Float = -1,
+#endif
LVEQNB_SinglePrecision = 0,
LVEQNB_DoublePrecision = 1,
LVEQNB_OutOfRange = 2,
@@ -84,11 +87,20 @@
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 */
@@ -96,7 +108,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;
@@ -114,7 +131,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);
@@ -122,6 +143,7 @@
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);
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
index 58f58ed..6328181 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
@@ -57,7 +57,121 @@
/* NOTES: */
/* */
/****************************************************************************************/
+#ifdef BUILD_FLOAT
+LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVM_UINT16 i;
+ Biquad_FLOAT_Instance_t *pBiquad;
+ LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
+ LVM_FLOAT *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_FLOAT *)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)
+ {
+ /*
+ * Copy input data in to scratch buffer
+ */
+
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ pScratch, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right */
+ /*
+ * 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_Float[i];
+
+
+ /*
+ * Select single or double precision as required
+ */
+ switch (pInstance->pBiquadType[i])
+ {
+ case LVEQNB_SinglePrecision_Float:
+ {
+ PK_2I_D32F32C14G11_TRC_WRA_01(pBiquad,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+
+ if(pInstance->bInOperatingModeTransition == LVM_TRUE){
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->BypassMixer,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pInData,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)(2 * NumSamples));
+ Copy_Float((LVM_FLOAT*)pScratch, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right samples */
+ }
+ else{
+ Copy_Float(pScratch, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16 )(2 * NumSamples)); /* Left and Right */
+ }
+ }
+ else
+ {
+ /*
+ * Mode is OFF so copy the data if necessary
+ */
+ if (pInData != pOutData)
+ {
+ Copy_Float(pInData, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and Right samples */
+ }
+ }
+ return(LVEQNB_SUCCESS);
+
+}
+#else
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -198,3 +312,4 @@
return(LVEQNB_SUCCESS);
}
+#endif
\ No newline at end of file
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
index 8e2e0e8..563181c 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.c
@@ -36,6 +36,20 @@
* 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,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000
+};
+#else
const LVM_UINT16 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
11025,
12000,
@@ -44,8 +58,9 @@
24000,
32000,
44100,
- 48000}; /* 48kS/s */
-
+ 48000
+};
+#endif
/************************************************************************************/
/* */
@@ -56,6 +71,22 @@
/*
* Table for 2 * Pi / Fs
*/
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
+ LVEQNB_2PiOn_11025,
+ LVEQNB_2PiOn_12000,
+ LVEQNB_2PiOn_16000,
+ LVEQNB_2PiOn_22050,
+ LVEQNB_2PiOn_24000,
+ LVEQNB_2PiOn_32000,
+ LVEQNB_2PiOn_44100,
+ LVEQNB_2PiOn_48000
+#ifdef HIGHER_FS
+ ,LVEQNB_2PiOn_96000
+ ,LVEQNB_2PiOn_192000
+#endif
+ };
+#else
const LVM_INT16 LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
LVEQNB_2PiOn_11025,
LVEQNB_2PiOn_12000,
@@ -65,10 +96,44 @@
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,
+ 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 */
+#else
const LVM_INT16 LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
LVEQNB_Gain_Neg14_dB,
LVEQNB_Gain_Neg13_dB,
@@ -101,10 +166,28 @@
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,
+ 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 */
+#else
const LVM_INT16 LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
LVEQNB_100D_Neg14_dB,
LVEQNB_100D_Neg13_dB,
@@ -122,7 +205,7 @@
LVEQNB_100D_Neg1_dB,
LVEQNB_100D_0_dB}; /* 0dB gain */
-
+#endif
/************************************************************************************/
/* */
/* Filter polynomial coefficients */
diff --git a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
index 28e3369..9c2e297 100644
--- a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -107,8 +107,14 @@
/* 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 */
LVM_UINT16 Damping; /* Damping */
@@ -297,11 +303,17 @@
/* 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
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
index ac2ef9d..e710844 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
@@ -41,6 +41,7 @@
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
{
@@ -593,8 +594,589 @@
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 */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
index 6bb1e88..9491016 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
@@ -61,16 +61,26 @@
* 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);
+ 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*/
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);
@@ -80,24 +90,46 @@
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);
+ LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
+ 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_GetInstanceHandle.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
index ffa5138..3366bcb 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
@@ -108,11 +108,29 @@
/*
* Zero all memory regions
*/
- 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)));
-
+#ifdef BUILD_FLOAT
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size) / \
+ sizeof(LVM_FLOAT)));
+ LoadConst_Float(0,
+ (LVM_FLOAT *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / \
+ sizeof(LVM_FLOAT)));
+#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
*/
@@ -146,7 +164,7 @@
* 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
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
@@ -190,7 +208,67 @@
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 * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] = 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,
+ sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ }
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
+ 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);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
+ {
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
+ sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] = 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,
+ sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ }
+
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
+ {
+ pLVREV_Private->pDelay_T[0] = 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,
+ 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;
@@ -200,10 +278,19 @@
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
+ /* General purpose scratch */
+ pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
+ MaxBlockSize);
+ /* Mono->stereo input save for end mix */
+ pLVREV_Private->pInputSave = 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
@@ -252,9 +339,13 @@
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
@@ -277,7 +368,11 @@
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;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
index 2012432..f6d446b 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
@@ -161,21 +161,37 @@
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);
@@ -195,14 +211,25 @@
/*
* 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
}
}
@@ -210,7 +237,12 @@
{
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
}
}
@@ -218,7 +250,12 @@
{
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
}
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
index fbfa437..ff7475e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -42,16 +42,27 @@
/* 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
@@ -61,14 +72,47 @@
#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 */
-#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/*BUILD_FLOAT*/
+#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
+
+#define LVREV_T_3_Power_0_on_4 1.0f
+#define LVREV_T_3_Power_1_on_4 1.316074f
+#define LVREV_T_3_Power_2_on_4 1.732051f
+#define LVREV_T_3_Power_3_on_4 2.279507f
+#define LVREV_T_3_Power_minus0_on_4 1.0f /* 3^(-0/4) * 2^15 */
+#define LVREV_T_3_Power_minus1_on_4 0.759836f /* 3^(-1/4) * 2^15 */
+#define LVREV_T_3_Power_minus2_on_4 0.577350f /* 3^(-2/4) * 2^15 */
+#define LVREV_T_3_Power_minus3_on_4 0.438691f /* 3^(-3/4) * 2^15 */
+#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 */
+#define LVREV_MAX_T2_DELAY 13304
+ /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T1_DELAY 17508
+ /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T0_DELAY 23040
+ /* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP3_DELAY 6740
+ /* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP2_DELAY 8872
+ /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP1_DELAY 11672
+ /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP0_DELAY 15360
+#endif
+
#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
#define LVREV_ALLPASS_TAP_TC 10000 /* All-pass filter dely tap change */
@@ -76,7 +120,12 @@
#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 11 /* Number of supported sample rates */
+#endif
+
#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
#define LVREV_MIN_LPF_CORNER 50 /* Low pass filter limits */
@@ -95,6 +144,7 @@
/* Structures */
/* */
/****************************************************************************************/
+#ifndef BUILD_FLOAT
/* Fast data structure */
typedef struct
{
@@ -161,7 +211,81 @@
} LVREV_Instance_st;
+#else /* BUILD_FLOAT */
+/* Fast data structure */
+typedef struct
+{
+ Biquad_1I_Order1_FLOAT_Taps_t HPTaps; /* High pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t LPTaps; /* Low pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
+
+} LVREV_FastData_st;
+
+
+/* Fast coefficient structure */
+typedef struct
+{
+
+ Biquad_FLOAT_Instance_t HPCoefs; /* High pass filter coefficients */
+ Biquad_FLOAT_Instance_t LPCoefs; /* Low pass filter coefficients */
+ Biquad_FLOAT_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
+
+} LVREV_FastCoef_st;
+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_FLOAT *pScratchDelayLine[4]; /* Delay line scratch memory */
+ LVM_FLOAT *pScratch; /* Multi ussge scratch */
+ LVM_FLOAT *pInputSave; /* Reverb block input save for dry/wet
+ mixing*/
+
+ /* Feedback matrix */
+ Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression \
+ caused by feedback Gain */
+
+
+ /* All-Pass Filter */
+ LVM_INT32 T[4]; /* Maximum delay size of buffer */
+ LVM_FLOAT *pDelay_T[4]; /* Pointer to delay buffers */
+ LVM_INT32 Delay_AP[4]; /* Offset to AP delay buffer start */
+ LVM_INT16 AB_Selection; /* Smooth from tap A to B when 1 \
+ otherwise B to A */
+ LVM_INT32 A_DelaySize[4]; /* A delay length in samples */
+ LVM_INT32 B_DelaySize[4]; /* B delay length in samples */
+ LVM_FLOAT *pOffsetA[4]; /* Offset for the A delay tap */
+ LVM_FLOAT *pOffsetB[4]; /* Offset for the B delay tap */
+ Mix_2St_Cll_FLOAT_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
+
+ /* Output gain */
+ Mix_2St_Cll_FLOAT_t BypassMixer; /* Dry/wet mixer */
+ LVM_FLOAT Gain; /* Gain applied to output to maintain
+ average signal power */
+ Mix_1St_Cll_FLOAT_t GainMixer; /* Gain smoothing */
+
+} LVREV_Instance_st;
+
+#endif
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -169,12 +293,17 @@
/****************************************************************************************/
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 );
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
index 5c7a8a0..566d84f 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
@@ -46,14 +46,26 @@
/* 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;
@@ -105,7 +117,7 @@
/*
* 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 {
@@ -113,6 +125,15 @@
(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 {
+ Copy_Float(pInput,
+ pOutput,
+ (LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
+ }
+#endif
}
return LVREV_SUCCESS;
@@ -143,9 +164,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)); // Always stereo output
+ pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2));
+#endif
}
return LVREV_SUCCESS;
@@ -175,7 +200,7 @@
/* 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;
@@ -479,7 +504,322 @@
return;
}
+#else
+void ReverbBlock(LVM_FLOAT *pInput, LVM_FLOAT *pOutput,
+ LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
+{
+ LVM_INT16 j, size;
+ LVM_FLOAT *pDelayLine;
+ LVM_FLOAT *pDelayLineInput = pPrivate->pScratch;
+ LVM_FLOAT *pScratch = pPrivate->pScratch;
+ LVM_FLOAT *pIn;
+ LVM_FLOAT *pTemp = pPrivate->pInputSave;
+ LVM_INT32 NumberOfDelayLines;
+
+ /******************************************************************************
+ * All calculations will go into the buffer pointed to by pTemp, this will *
+ * 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_Float(pInput,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ pIn = pTemp;
+ }
+
+ Mult3s_Float(pIn,
+ (LVM_FLOAT)LVREV_HEADROOM,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * High pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->HPCoefs,
+ pTemp,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ /*
+ * 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_Float(&pPrivate->pDelay_T[j][NumSamples],
+ pPrivate->pDelay_T[j],
+ (LVM_INT16)(pPrivate->T[j] - NumSamples)); /* 32-bit data */
+ /* Apply the smoothed feedback and save to fixed delay input (currently empty) */
+ MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
+ pDelayLine,
+ &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Sum into the AP delay line */
+ Mac3s_Sat_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ -1.0f, /* Invert since the feedback coefficient is negative */
+ &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_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ 1.0f,
+ 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_Float(pTemp,
+ pDelayLineInput,
+ (LVM_INT16)(NumSamples));
+ /*
+ * Rotation matrix mix
+ */
+ switch(j)
+ {
+ case 3:
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[2], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 2:
+
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[3], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 1:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[3], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ break;
+ case 0:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[2], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[0], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
+ pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 contribution
+ */
+
+ /* SOURCE DESTINATION*/
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[0], pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Delay samples
+ */
+ Copy_Float(pDelayLineInput,
+ &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)(NumSamples)); /* 32-bit data */
+ }
+ /*
+ * Create stereo output
+ */
+ switch(pPrivate->InstanceParams.NumDelays)
+ {
+ case LVREV_DELAYLINES_4:
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[3],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[2],
+ pPrivate->pScratchDelayLine[1],
+ (LVM_INT16)NumSamples);
+
+
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
+ pPrivate->pScratchDelayLine[1],
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+
+ break;
+ case LVREV_DELAYLINES_2:
+
+ Copy_Float(pPrivate->pScratchDelayLine[1],
+ pScratch,
+ (LVM_INT16)(NumSamples));
+
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0],
+ -1.0f,
+ pScratch,
+ (LVM_INT16)NumSamples);
+
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[1],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+
+
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
+ pScratch,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ break;
+ case LVREV_DELAYLINES_1:
+ MonoTo2I_Float(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_Float(LVREV_OUTPUTGAIN_SHIFT,
+ pOutput,
+ pOutput,
+ size);
+
+ MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
+ pOutput,
+ pOutput,
+ size);
+
+ 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.c
index f5895a7..a719053 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
@@ -61,10 +61,15 @@
* Check all new control parameters are in range
*/
if( ((pNewParams->OperatingMode != LVM_MODE_OFF) && (pNewParams->OperatingMode != LVM_MODE_ON)) ||
- ((pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
+ (
+ (pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
(pNewParams->SampleRate != LVM_FS_16000) && (pNewParams->SampleRate != LVM_FS_22050) && (pNewParams->SampleRate != LVM_FS_24000) &&
- (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) && (pNewParams->SampleRate != LVM_FS_48000)) ||
- ((pNewParams->SourceFormat != LVM_STEREO) && (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO)) )
+ (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) && (pNewParams->SampleRate != LVM_FS_48000)
+#ifdef HIGHER_FS
+ && (pNewParams->SampleRate != LVM_FS_96000) && (pNewParams->SampleRate != LVM_FS_192000)
+#endif
+ )
+ || ((pNewParams->SourceFormat != LVM_STEREO) && (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO)) )
{
return (LVREV_OUTOFRANGE);
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
index 5a6d43d..b3edc60 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
@@ -29,6 +29,7 @@
/****************************************************************************************/
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
+#ifndef HIGHER_FS
const LVM_UINT16 LVM_FsTable[] = {
8000 ,
11025,
@@ -40,14 +41,37 @@
44100,
48000
};
-
+#else
+const LVM_UINT32 LVM_FsTable[] = {
+ 8000 ,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 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
@@ -69,6 +93,7 @@
*/
/* 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,},
@@ -94,6 +119,32 @@
{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,},
+ {4,1.035927f,10.182567f,-10.346134f,4.546533f,},
+ {5,1.130313f,12.538727f,-13.627023f,6.165208f,},
+ {6,1.060743f,8.091713f,-8.588079f,3.834230f,},
+ {7,1.040381f,10.406566f,-11.176650f,5.075132f,},
+ {8,1.026944f,8.387302f,-8.689796f,3.895863f,},
+ {9,1.013312f,9.727236f,-10.534165f,4.742272f,},
+ {10,0.996095f,8.492249f,-7.947677f,3.478917f,},
+ {13,1.079346f,8.894425f,-9.641768f,4.434442f,},
+ {15,0.994327f,7.441335f,-8.003979f,3.581177f,},
+ {17,0.991067f,7.208373f,-7.257859f,3.167774f,},
+ {20,1.033445f,7.476371f,-7.546960f,3.369703f,},
+ {25,0.982830f,5.913867f,-5.638448f,2.420932f,},
+ {30,0.928782f,5.035343f,-4.492104f,1.844904f,},
+ {40,0.953714f,5.060232f,-4.472204f,1.829642f,},
+ {50,0.899258f,4.273357f,-3.537492f,1.387576f,},
+ {60,0.943584f,4.093228f,-3.469658f,1.410911f,},
+ {70,0.926021f,3.973125f,-3.331985f,1.344690f,},
+ {75,0.894853f,2.871747f,-1.438758f,0.311856f,},
+ {80,0.935122f,2.991857f,-2.038882f,0.686395f,},
+ {90,0.953872f,2.880315f,-2.122365f,0.784032f,},
+ {100,0.951005f,2.894294f,-2.009086f,0.698316f,},
+};
+#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 5f993bd..0658186 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -37,10 +37,19 @@
/* */
/****************************************************************************************/
+#ifndef HIGHER_FS
extern const LVM_UINT16 LVM_FsTable[];
extern LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-extern LVM_INT32 LVREV_GainPolyTable[24][5];
+#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
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
index a675cb2..2038fbb 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
@@ -216,11 +216,17 @@
/* 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 */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
index cd5f69c..f6c4ea7 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.c
@@ -28,6 +28,15 @@
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);
+
+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);
@@ -39,7 +48,7 @@
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 );
@@ -179,7 +188,11 @@
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[];
@@ -267,8 +280,11 @@
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 */
@@ -342,26 +358,42 @@
{
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);
-
+ &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
+ */
+ 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);
+#endif
break;
}
case LVPSA_SimplePrecisionFilter:
{
+#ifndef BUILD_FLOAT
BP_C16_Coefs_t Coefficients;
/*
@@ -374,9 +406,26 @@
/*
* Set the coefficients
*/
- BP_1I_D16F16Css_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
+ BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
+#else
+ BP_FLOAT_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);
+#endif
break;
}
}
@@ -409,18 +458,31 @@
{
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++)
{
- LVPSA_QPD_Init (&pInst->pQPD_States[ii],
- &pInst->pQPD_Taps[ii],
- pCoefficients );
+#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);
@@ -460,6 +522,87 @@
/* 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)
+{
+
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_CosCoef[];
+
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT COS_T0;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
+
+
+ /*
+ * Get the filter definition
+ */
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVPSA_Float_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
+ /* Force D = 1 : the function was originally used for a peaking filter.
+ The D parameter do not exist for a BandPass filter coefficients */
+
+ /*
+ * Calculate the B2 coefficient
+ */
+ Dt0 = T0 / 2048 ;
+ B2_Den = QFactor + Dt0;
+ B2_Num = Dt0 - QFactor;
+ B2 = B2_Num / (2 * B2_Den);
+
+ /*
+ * Calculate the cosine by a polynomial expansion using the equation:
+ *
+ * Cos += coef(n) * t0^n For n = 0 to 6
+ */
+ T0 = (T0 / 2048) * 0.63658558f; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
+ t0 = T0 ;
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ COS_T0 = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 7; i++)
+ {
+ coef = LVPSA_Float_CosCoef[i]; /* Get the nth coefficient */
+ COS_T0 += (factor * coef); /* The nth partial sum */
+ factor = (factor * t0) ; /* Calculate t0^n */
+ }
+ 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 */
+
+ /*
+ * Write coeff into the data structure
+ */
+ pCoefficients->A0 = A0 * 2;
+ pCoefficients->B1 = B1 * 2;
+ pCoefficients->B2 = B2 * 2;
+
+ return(LVPSA_OK);
+}
+#else
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C16_Coefs_t *pCoefficients)
@@ -541,7 +684,7 @@
return(LVPSA_OK);
}
-
+#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVPSA_BPDoublePrecCoefs */
@@ -584,6 +727,90 @@
/* 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)
+{
+
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_DPCosCoef[];
+
+ /*
+ * Intermediate variables and temporary values
+ */
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT CosErr;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
+
+ /*
+ * Get the filter definition
+ */
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+
+
+ /*
+ * Calculating the intermediate values
+ */
+ T0 = Frequency * LVPSA_Float_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
+ D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
+ /* Force D = 1 : the function was originally used for a peaking filter.
+ The D parameter do not exist for a BandPass filter coefficients */
+
+ /*
+ * Calculate the B2 coefficient
+ */
+ Dt0 = T0 / 2048 ;
+ B2_Den = QFactor + Dt0;
+ B2_Num = Dt0 - QFactor;
+ B2 = B2_Num / (2 * B2_Den);
+
+ /*
+ * Calculate the cosine error by a polynomial expansion using the equation:
+ *
+ * CosErr += coef(n) * t0^n For n = 0 to 4
+ */
+ T0 = T0 * 0.994750f; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
+ t0 = T0;
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ CosErr = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 5; i++)
+ {
+ coef = LVPSA_Float_DPCosCoef[i]; /* Get the nth coefficient */
+ CosErr += factor * coef; /* The nth partial sum */
+ factor = factor * t0; /* Calculate t0^n */
+ }
+ CosErr = CosErr * 2; /* Correct the scaling */
+
+ /*
+ * Calculate the B1 and A0 coefficients
+ */
+ B1 = ((LVM_FLOAT)0.5 - B2); /* B1 = (0.5 - b2) */
+ A0 = B1 * CosErr ; /* Temporary storage for (0.5 - b2) * coserr(t0) */
+ B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
+ A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
+
+ /*
+ * Write coeff into the data structure
+ */
+ pCoefficients->A0 = A0;
+ pCoefficients->B1 = B1;
+ pCoefficients->B2 = B2;
+
+ return(LVPSA_OK);
+}
+#else
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_C32_Coefs_t *pCoefficients)
@@ -666,7 +893,7 @@
return(LVPSA_OK);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ClearFilterHistory */
@@ -690,11 +917,17 @@
/* 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.c
index 27a4bc3..1c26860 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.c
@@ -47,7 +47,11 @@
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 */
@@ -141,19 +145,37 @@
/* 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
+#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
/* Copy filters parameters in the private instance */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
@@ -164,7 +186,12 @@
/* 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;
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
index 0984b10..06a8f9d 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.c
@@ -106,7 +106,11 @@
*/
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) );
{
@@ -134,7 +138,11 @@
/*
* 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;
@@ -142,8 +150,13 @@
/*
* 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;
@@ -151,8 +164,13 @@
/*
* 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 03522fb..a750bb0 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -43,8 +43,11 @@
#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 */
-
-#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz */
+#ifndef HIGHER_FS
+#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz*/
+#else
+#define LVPSA_NR_SUPPORTED_RATE 11 /* 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 */
@@ -93,12 +96,27 @@
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 */
- LVM_UINT16 *pPostGains; /* Points a nBands elements array that contains the post-filter gains 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;
+ /* Points a nBands elements array that contains the QPD filter instance for each band */
+ 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 */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
index 9e29f68..ea5f74a 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.c
@@ -43,6 +43,96 @@
/* 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 )
+
+{
+ LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ LVM_FLOAT *pScratch;
+ LVM_INT16 ii;
+ LVM_INT32 AudioTimeInc;
+ extern LVM_UINT32 LVPSA_SampleRateInvTab[];
+ LVM_UINT8 *pWrite_Save; /* Position of the write pointer
+ at the beginning of the process */
+
+ /******************************************************************************
+ CHECK PARAMETERS
+ *******************************************************************************/
+ if(hInstance == LVM_NULL || pLVPSA_InputSamples == LVM_NULL)
+ {
+ return(LVPSA_ERROR_NULLADDRESS);
+ }
+ if(InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize)
+ {
+ return(LVPSA_ERROR_INVALIDPARAM);
+ }
+
+ pScratch = (LVM_FLOAT*)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_Float(pLVPSA_InputSamples, pScratch, (LVM_INT16)InputBlockSize);
+ Shift_Sat_Float(-1, pScratch, pScratch, (LVM_INT16)InputBlockSize);
+
+ for (ii = 0; ii < pLVPSA_Inst->nRelevantFilters; ii++)
+ {
+ switch(pLVPSA_Inst->pBPFiltersPrecision[ii])
+ {
+ 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_Float ( 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);
+}
+#else
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_INT16 *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
@@ -130,7 +220,7 @@
return(LVPSA_OK);
}
-
+#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
index 836bfd7..99d844b 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
@@ -31,6 +31,15 @@
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
{
LVM_INT32 KP; /*should store a0*/
@@ -38,12 +47,30 @@
} 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
{
LVM_INT32 Storage[1];
} 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 */
@@ -62,6 +89,12 @@
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 */
@@ -80,8 +113,12 @@
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 */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
index 50e0a80..2cc32ab 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.c
@@ -40,3 +40,14 @@
pQPD_State->Coefs[0] = pCoef->KP;
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 )
+{
+ pQPD_State->pDelay = pTaps->Storage;
+ 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.c
index 67197c1..e233172 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.c
@@ -35,12 +35,16 @@
/* */
/************************************************************************************/
void LVPSA_QPD_WritePeak( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_INT16 Value );
+ LVM_UINT8 **ppWrite,
+ 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 */
@@ -54,6 +58,7 @@
/* RETURNS: void */
/* */
/************************************************************************************/
+#ifndef BUILD_FLOAT
void LVPSA_QPD_Process ( void *hInstance,
LVM_INT16 *pInSamps,
LVM_INT16 numSamples,
@@ -173,7 +178,131 @@
pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
}
}
+#else
+void LVPSA_QPD_Process_Float ( void *hInstance,
+ LVM_FLOAT *pInSamps,
+ LVM_INT16 numSamples,
+ LVM_INT16 BandIndex)
+{
+ /******************************************************************************
+ PARAMETERS
+ *******************************************************************************/
+ LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ QPD_FLOAT_State_t *pQPDState = (QPD_FLOAT_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
+
+ /* Pointer to taps */
+ LVM_FLOAT* pDelay = pQPDState->pDelay;
+
+ /* Parameters needed during quasi peak calculations */
+ LVM_FLOAT X0;
+ LVM_FLOAT temp,temp2;
+ LVM_FLOAT accu;
+ LVM_FLOAT Xg0;
+ LVM_FLOAT D0;
+ LVM_FLOAT V0 = (LVM_FLOAT)(*pDelay);
+
+ /* Filter's coef */
+ LVM_FLOAT Kp = ((LVM_FLOAT)(pQPDState->Coefs[0]));
+ LVM_FLOAT Km = ((LVM_FLOAT)(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 */
+ /* - 1 to compensate scaling in process function*/
+ X0 = (*pInSamps) * pLVPSA_Inst->pPostGains[BandIndex];
+ pInSamps = pInSamps + DownSamplingFactor;
+
+ /* Saturate and take absolute value */
+ if(X0 < 0.0f)
+ X0 = -X0;
+ if (X0 > 1.0f)
+ Xg0 = 1.0f;
+ else
+ Xg0 =X0;
+
+
+ /* Quasi peak filter calculation */
+ D0 = Xg0 - V0;
+
+ temp2 = D0;
+
+ accu = temp2 * Kp;
+ D0 = D0 / 2.0f;
+ if (D0 < 0.0f){
+ D0 = -D0;
+ }
+
+ temp2 = D0;
+
+ temp = D0 * Km;
+ accu += temp + Xg0;
+
+ if (accu > 1.0f)
+ accu = 1.0f;
+ else if(accu < 0.0f)
+ accu = 0.0f;
+
+ V0 = accu;
+
+ if(((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor))
+ {
+ LVPSA_QPD_WritePeak_Float( pLVPSA_Inst,
+ &pWrite,
+ BandIndex,
+ V0);
+
+ BufferUpdateSamplesCount -= pLVPSA_Inst->nSamplesBufferUpdate;
+ pLVPSA_Inst->LocalSamplesCount = (LVM_UINT16)(numSamples - ii);
+ }
+ BufferUpdateSamplesCount += DownSamplingFactor;
+
+ ii = (LVM_INT16)(ii - DownSamplingFactor);
+
+ }
+
+ /* Store last taps in memory */
+ *pDelay = 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);
+ }
+}
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_WritePeak */
@@ -209,4 +338,23 @@
*ppWrite = pWrite;
}
+#ifdef BUILD_FLOAT
+void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
+ LVM_UINT8 **ppWrite,
+ LVM_INT16 BandIndex,
+ LVM_FLOAT Value )
+{
+ LVM_UINT8 *pWrite = *ppWrite;
+ /* Write the value and update the write pointer */
+ *(pWrite + BandIndex) = (LVM_UINT8)(Value * 256);
+ pWrite += pLVPSA_Inst->nBands;
+ if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart + pLVPSA_Inst->nBands * \
+ pLVPSA_Inst->SpectralDataBufferLength))
+ {
+ pWrite = pLVPSA_Inst->pSpectralDataBufferStart;
+ }
+
+ *ppWrite = pWrite;
+}
+#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
index 21a5d8d..1287503 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.c
@@ -34,6 +34,7 @@
* 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,
@@ -43,6 +44,19 @@
32000,
44100,
48000}; /* 48kS/s */
+#else
+const LVM_UINT32 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000}; /* 192kS/s */
+#endif
/************************************************************************************/
/* */
@@ -62,7 +76,12 @@
89478,
67109,
48696,
- 44739}; /* 48kS/s */
+ 44739
+#ifdef HIGHER_FS
+ ,22369
+ ,11185 /* 192kS/s */
+#endif
+ };
@@ -84,7 +103,12 @@
480,
640,
882,
- 960}; /* 48kS/s */
+ 960
+#ifdef HIGHER_FS
+ ,1920
+ ,3840 /* 192kS/s */
+#endif
+ };
/************************************************************************************/
/* */
/* Down sampling factors */
@@ -102,7 +126,12 @@
16, /* 24000 S/s */
21, /* 32000 S/s */
30, /* 44100 S/s */
- 32}; /* 48000 S/s */
+ 32 /* 48000 S/s */
+#ifdef HIGHER_FS
+ ,64 /* 96000 S/s */
+ ,128 /*192000 S/s */
+#endif
+ };
/************************************************************************************/
@@ -122,8 +151,30 @@
8785,
6588,
4781,
- 4392}; /* 48kS/s */
+ 4392
+#ifdef HIGHER_FS
+ ,2196
+ ,1098 /* 192kS/s */
+#endif
+ };
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = { 0.8042847f, /* 8kS/s */
+ 0.5836054f,
+ 0.5361796f,
+ 0.4021423f,
+ 0.2917874f,
+ 0.2681051f,
+ 0.2010559f,
+ 0.1459089f,
+ 0.1340372f
+#ifdef HIGHER_FS
+ ,0.0670186f
+ ,0.0335093f /* 192kS/s */
+#endif
+ };
+
+#endif
/*
* Gain table
*/
@@ -159,6 +210,39 @@
10264,
11576}; /* +15dB gain */
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_GainTable[]={ 0.177734375f, /* -15dB gain */
+ 0.199218750f,
+ 0.223632812f,
+ 0.250976562f,
+ 0.281738281f,
+ 0.315917968f,
+ 0.354492187f,
+ 0.397949218f,
+ 0.446289062f,
+ 0.500976562f,
+ 0.562011718f,
+ 0.630859375f,
+ 0.707519531f,
+ 0.793945312f,
+ 0.891113281f,
+ 1.000000000f, /* 0dB gain */
+ 1.121582031f,
+ 1.258789062f,
+ 1.412109375f,
+ 1.584472656f,
+ 1.777832031f,
+ 2.000000000f,
+ 2.238281250f,
+ 2.511718750f,
+ 2.818359375f,
+ 3.162109375f,
+ 3.547851562f,
+ 3.980957031f,
+ 4.466796875f,
+ 5.011718750f,
+ 5.652343750f}; /* +15dB gain */
+#endif
/************************************************************************************/
/* */
/* Cosone polynomial coefficients */
@@ -181,7 +265,15 @@
-2671, /* a3 */
23730, /* a4 */
-9490}; /* a5 */
-
+#ifdef BUILD_FLOAT
+const LVM_FLOAT LVPSA_Float_CosCoef[] = { 3, /* Shifts */
+ 0.1250038f, /* a0 */
+ -0.0010986f, /* a1 */
+ -0.6019775f, /* a2 */
+ -0.0815149f, /* a3 */
+ 0.7242042f, /* a4 */
+ -0.2896206f}; /* a5 */
+#endif
/*
* Coefficients for calculating the cosine error with the equation:
*
@@ -201,7 +293,13 @@
-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 */
@@ -239,3 +337,54 @@
{0xA375B2C6,0x1E943BBC},
{0xA2E1E950,0x1E2A532E}}; /* 48kS/s */
+#ifdef BUILD_FLOAT
+const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
+
+ /* 8kS/s */ /* LVPSA_SPEED_LOW */
+ {-0.9936831989325583f,0.0062135565094650f},
+ {-0.9935833332128823f,0.0063115493394434f},
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9936831989325583f,0.0062135565094650f},
+ {-0.9931269618682563f,0.0067592649720609f},
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9933686633594334f,0.0065221670083702f},
+ {-0.9931269618682563f,0.0067592649720609f},
+ /* 48kS/s */
+ {-0.9932638457976282f,0.0066249934025109f},
+#ifdef HIGHER_FS
+ {-0.9932638457976282f,0.0066249934025109f},
+ {-0.9932638457976282f,0.0066249934025109f},
+#endif
+ /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
+ {-0.9568079425953329f,0.0418742666952312f},
+ {-0.9561413046903908f,0.0425090822391212f},
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9568079425953329f,0.0418742666952312f},
+ {-0.9531011912040412f,0.0453995238058269f},
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9547099955379963f,0.0438708555884659f},
+ //{0x8600C7B9,0x05CFA6CF},
+ {-0.9531011912040412f,0.0453995238058269f},
+ /* 48kS/s */
+ {-0.9540119562298059f,0.0445343819446862f},
+#ifdef HIGHER_FS
+ {-0.9540119562298059f,0.0445343819446862f},
+ {-0.9540119562298059f,0.0445343819446862f},
+#endif
+ /* 8kS/s */ /* LVPSA_SPEED_HIGH */
+ {-0.7415186790749431f,0.2254409026354551f},
+ {-0.7381451204419136f,0.2279209652915597f},
+ {-0.7274807319045067f,0.2356666540727019f},
+ {-0.7415186790749431f,0.2254409026354551f},
+ {-0.7229706319049001f,0.2388987224549055f},
+ {-0.7274807319045067f,0.2356666540727019f},
+ {-0.7309581353329122f,0.2331568226218224f},
+ {-0.7229706319049001f,0.2388987224549055f},
+ /* 48kS/s */
+ {-0.7274807319045067f,0.2356666540727019f}
+#ifdef HIGHER_FS
+ ,{-0.7274807319045067f,0.2356666540727019f}
+ ,{-0.7274807319045067f,0.2356666540727019f}
+#endif
+ };
+#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
index 0d62274..e75695e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
+++ b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
@@ -374,12 +374,17 @@
/* 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
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
index 3e48c7e..29e3c9e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.c
@@ -70,11 +70,17 @@
{
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;
- LVM_INT32 Current;
+
/*
@@ -85,7 +91,11 @@
&& (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
{
@@ -102,23 +112,46 @@
/*
* 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;
+ Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
+ 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;
@@ -134,7 +167,7 @@
* Correct gain for the effect level
*/
{
-
+#ifndef BUILD_FLOAT
LVM_INT16 GainCorrect;
LVM_INT32 Gain1;
LVM_INT32 Gain2;
@@ -172,6 +205,43 @@
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;
+
+ Gain1 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[0]);
+ Gain2 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[1]);
+ /*
+ * Calculate the gain correction
+ */
+ if (pInstance->Params.CompressorMode == LVM_MODE_ON)
+ {
+ GainCorrect = (LVM_FLOAT)( pInstance->VolCorrect.GainMin
+ - (((LVM_FLOAT)pInstance->VolCorrect.GainMin * \
+ ((LVM_FLOAT)pInstance->TransitionGain)))
+ + (((LVM_FLOAT)pInstance->VolCorrect.GainFull * \
+ ((LVM_FLOAT)pInstance->TransitionGain))));
+
+ /*
+ * Apply the gain correction
+ */
+ Gain1 = (Gain1 * GainCorrect);
+ Gain2 = (Gain2 * GainCorrect);
+
+ }
+
+ /*
+ * Set the gain values
+ */
+ pConfig->Output_Shift = pConfig->Output_Shift;
+ LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0],Gain1);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+ LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+#endif
}
return(LVCS_SUCCESS);
@@ -206,9 +276,15 @@
/************************************************************************************/
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)
{
@@ -223,6 +299,7 @@
/*
* Apply the bypass mix
*/
+#ifndef BUILD_FLOAT
LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
pProcessed,
(LVM_INT16 *) pUnprocessed,
@@ -236,6 +313,20 @@
(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,
+ pOutData,
+ (LVM_INT16)(2 * NumSamples));
+ /*
+ * Apply output gain correction shift
+ */
+ Shift_Sat_Float((LVM_INT16)pConfig->Output_Shift,
+ (LVM_FLOAT*)pOutData,
+ (LVM_FLOAT*)pOutData,
+ (LVM_INT16)(2 * NumSamples)); /* Left and right*/
+#endif
}
return(LVCS_SUCCESS);
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
index d1ef70a..f69ba38 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
@@ -42,12 +42,16 @@
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
{
@@ -56,8 +60,15 @@
LVM_UINT16 Loss; /* Loss required */
LVM_UINT16 UnprocLoss; /* Unprocessed path loss */
} Gain_t;
-
-
+#else
+typedef struct
+{
+ /* Output gain settings, Gain = (Loss/32768) * 2^Shift */
+ LVM_UINT16 Shift; /* Left shifts required */
+ LVM_FLOAT Loss; /* Loss required */
+ LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
+} Gain_t;
+#endif
/************************************************************************************/
/* */
/* Function prototypes */
@@ -67,13 +78,19 @@
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);
-
+ 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 */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
index ce6d410..3bf6ec6 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
@@ -120,11 +120,13 @@
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);
@@ -140,7 +142,23 @@
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);
+ Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * (Gain);
+ /*
+ * Apply the gain correction
+ */
+ Gain = (Gain * pInstance->VolCorrect.GainMin);
+
+ 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);
+#endif
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
index 25b0d86..ec5312e 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
@@ -53,7 +53,72 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
+ LVCS_Params_t *pParams)
+{
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t *pEqualiserCoefTable;
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficients = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+ /*
+ * 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_FLOAT) pEqualiserCoefTable[Offset].A0;
+ Coeffs.A1 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A1;
+ Coeffs.A2 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A2;
+ Coeffs.B1 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B1;
+ Coeffs.B2 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B2;
+
+ LoadConst_Float((LVM_INT16)0, /* Value */
+ (void *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps) / sizeof(LVM_FLOAT)));
+
+ 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);
+}
+#else
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -112,7 +177,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Equaliser */
@@ -132,7 +197,37 @@
/* 1. Always processes in place. */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
+ LVM_FLOAT *pInputOutput,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
+ LVCS_Coefficient_t *pCoefficients;
+
+
+ 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_FLOAT_Instance_t*) \
+ &pCoefficients->EqualiserBiquadInstance,
+ (LVM_FLOAT *)pInputOutput,
+ (LVM_FLOAT *)pInputOutput,
+ (LVM_INT16)NumSamples);
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_INT16 *pInputOutput,
LVM_UINT16 NumSamples)
@@ -157,4 +252,4 @@
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 cf96f5b..0e756e7 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
@@ -32,8 +32,11 @@
/* 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;
@@ -45,12 +48,15 @@
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 */
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 3e640cb..4f5221a 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -24,7 +24,463 @@
/* 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
+#define CS_MIDDLE_8000_A2 0.000000
+#define CS_MIDDLE_8000_B1 -0.921899
+#define CS_MIDDLE_8000_B2 0.000000
+#define CS_MIDDLE_8000_SCALE 15
+#define CS_SIDE_8000_A0 0.611441
+#define CS_SIDE_8000_A1 -0.380344
+#define CS_SIDE_8000_A2 -0.231097
+#define CS_SIDE_8000_B1 -0.622470
+#define CS_SIDE_8000_B2 -0.130759
+#define CS_SIDE_8000_SCALE 15
+/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
+#define CS_MIDDLE_11025_A0 0.230838
+#define CS_MIDDLE_11025_A1 -0.221559
+#define CS_MIDDLE_11025_A2 0.000000
+#define CS_MIDDLE_11025_B1 -0.943056
+#define CS_MIDDLE_11025_B2 0.000000
+#define CS_MIDDLE_11025_SCALE 15
+#define CS_SIDE_11025_A0 0.557372
+#define CS_SIDE_11025_A1 -0.391490
+#define CS_SIDE_11025_A2 -0.165881
+#define CS_SIDE_11025_B1 -0.880608
+#define CS_SIDE_11025_B2 0.032397
+#define CS_SIDE_11025_SCALE 15
+
+/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
+#define CS_MIDDLE_12000_A0 0.229932
+#define CS_MIDDLE_12000_A1 -0.221436
+#define CS_MIDDLE_12000_A2 0.000000
+#define CS_MIDDLE_12000_B1 -0.947616
+#define CS_MIDDLE_12000_B2 0.000000
+#define CS_MIDDLE_12000_SCALE 15
+#define CS_SIDE_12000_A0 0.558398
+#define CS_SIDE_12000_A1 -0.392211
+#define CS_SIDE_12000_A2 -0.166187
+#define CS_SIDE_12000_B1 -0.892550
+#define CS_SIDE_12000_B2 0.032856
+#define CS_SIDE_12000_SCALE 15
+
+/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
+#define CS_MIDDLE_16000_A0 0.230638
+#define CS_MIDDLE_16000_A1 -0.224232
+#define CS_MIDDLE_16000_A2 0.000000
+#define CS_MIDDLE_16000_B1 -0.960550
+#define CS_MIDDLE_16000_B2 0.000000
+#define CS_MIDDLE_16000_SCALE 15
+#define CS_SIDE_16000_A0 0.499695
+#define CS_SIDE_16000_A1 -0.355543
+#define CS_SIDE_16000_A2 -0.144152
+#define CS_SIDE_16000_B1 -1.050788
+#define CS_SIDE_16000_B2 0.144104
+#define CS_SIDE_16000_SCALE 14
+
+/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
+#define CS_MIDDLE_22050_A0 0.228749
+#define CS_MIDDLE_22050_A1 -0.224128
+#define CS_MIDDLE_22050_A2 0.000000
+#define CS_MIDDLE_22050_B1 -0.971262
+#define CS_MIDDLE_22050_B2 0.000000
+#define CS_MIDDLE_22050_SCALE 15
+#define CS_SIDE_22050_A0 0.440112
+#define CS_SIDE_22050_A1 -0.261096
+#define CS_SIDE_22050_A2 -0.179016
+#define CS_SIDE_22050_B1 -1.116786
+#define CS_SIDE_22050_B2 0.182507
+#define CS_SIDE_22050_SCALE 14
+
+/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
+#define CS_MIDDLE_24000_A0 0.230395
+#define CS_MIDDLE_24000_A1 -0.226117
+#define CS_MIDDLE_24000_A2 0.000000
+#define CS_MIDDLE_24000_B1 -0.973573
+#define CS_MIDDLE_24000_B2 0.000000
+#define CS_MIDDLE_24000_SCALE 15
+#define CS_SIDE_24000_A0 0.414770
+#define CS_SIDE_24000_A1 -0.287182
+#define CS_SIDE_24000_A2 -0.127588
+#define CS_SIDE_24000_B1 -1.229648
+#define CS_SIDE_24000_B2 0.282177
+#define CS_SIDE_24000_SCALE 14
+
+/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
+#define CS_MIDDLE_32000_A0 0.228400
+#define CS_MIDDLE_32000_A1 -0.225214
+#define CS_MIDDLE_32000_A2 0.000000
+#define CS_MIDDLE_32000_B1 -0.980126
+#define CS_MIDDLE_32000_B2 0.000000
+#define CS_MIDDLE_32000_SCALE 15
+#define CS_SIDE_32000_A0 0.364579
+#define CS_SIDE_32000_A1 -0.207355
+#define CS_SIDE_32000_A2 -0.157224
+#define CS_SIDE_32000_B1 -1.274231
+#define CS_SIDE_32000_B2 0.312495
+#define CS_SIDE_32000_SCALE 14
+
+/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
+#define CS_MIDDLE_44100_A0 0.233593
+#define CS_MIDDLE_44100_A1 -0.231225
+#define CS_MIDDLE_44100_A2 0.000000
+#define CS_MIDDLE_44100_B1 -0.985545
+#define CS_MIDDLE_44100_B2 0.000000
+#define CS_MIDDLE_44100_SCALE 15
+#define CS_SIDE_44100_A0 0.284573
+#define CS_SIDE_44100_A1 -0.258910
+#define CS_SIDE_44100_A2 -0.025662
+#define CS_SIDE_44100_B1 -1.572248
+#define CS_SIDE_44100_B2 0.588399
+#define CS_SIDE_44100_SCALE 14
+
+/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
+#define CS_MIDDLE_48000_A0 0.234445
+#define CS_MIDDLE_48000_A1 -0.232261
+#define CS_MIDDLE_48000_A2 0.000000
+#define CS_MIDDLE_48000_B1 -0.986713
+#define CS_MIDDLE_48000_B2 0.000000
+#define CS_MIDDLE_48000_SCALE 15
+#define CS_SIDE_48000_A0 0.272606
+#define CS_SIDE_48000_A1 -0.266952
+#define CS_SIDE_48000_A2 -0.005654
+#define CS_SIDE_48000_B1 -1.617141
+#define CS_SIDE_48000_B2 0.630405
+#define CS_SIDE_48000_SCALE 14
+
+#ifdef HIGHER_FS
+/* Stereo Enhancer coefficients for 96000Hz sample rate, scaled with 0.165*/
+/* high pass filter with cutoff frequency 102.18 Hz*/
+#define CS_MIDDLE_96000_A0 0.235532
+#define CS_MIDDLE_96000_A1 -0.234432
+#define CS_MIDDLE_96000_A2 0.000000
+#define CS_MIDDLE_96000_B1 -0.993334
+#define CS_MIDDLE_96000_B2 0.000000
+#define CS_MIDDLE_96000_SCALE 15
+/* bandpass filter with fc1 270 and fc2 3703, designed using 2nd order butterworth */
+#define CS_SIDE_96000_A0 0.016727
+#define CS_SIDE_96000_A1 0.000000
+#define CS_SIDE_96000_A2 -0.016727
+#define CS_SIDE_96000_B1 -1.793372
+#define CS_SIDE_96000_B2 0.797236
+#define CS_SIDE_96000_SCALE 14
+
+/* Stereo Enhancer coefficients for 192000Hz sample rate, scaled with 0.1689*/
+#define CS_MIDDLE_192000_A0 0.241219
+#define CS_MIDDLE_192000_A1 -0.240656
+#define CS_MIDDLE_192000_A2 0.000000
+#define CS_MIDDLE_192000_B1 -0.996661
+#define CS_MIDDLE_192000_B2 0.000000
+#define CS_MIDDLE_192000_SCALE 15
+/* bandpass filter with fc1 270 and fc2 3703, designed using 2nd order butterworth */
+#define CS_SIDE_192000_A0 0.008991
+#define CS_SIDE_192000_A1 -0.000000
+#define CS_SIDE_192000_A2 -0.008991
+#define CS_SIDE_192000_B1 -1.892509
+#define CS_SIDE_192000_B2 0.893524
+#define CS_SIDE_192000_SCALE 14
+#endif
+
+/************************************************************************************/
+/* */
+/* 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 0.667271
+#define CS_REVERB_8000_A1 -0.667271
+#define CS_REVERB_8000_A2 0.000000
+#define CS_REVERB_8000_B1 -0.668179
+#define CS_REVERB_8000_B2 0.000000
+#define CS_REVERB_8000_SCALE 15
+
+/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_11025_A0 0.699638
+#define CS_REVERB_11025_A1 -0.699638
+#define CS_REVERB_11025_A2 0.000000
+#define CS_REVERB_11025_B1 -0.749096
+#define CS_REVERB_11025_B2 0.000000
+#define CS_REVERB_11025_SCALE 15
+
+/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_12000_A0 0.706931
+#define CS_REVERB_12000_A1 -0.706931
+#define CS_REVERB_12000_A2 0.000000
+#define CS_REVERB_12000_B1 -0.767327
+#define CS_REVERB_12000_B2 0.000000
+#define CS_REVERB_12000_SCALE 15
+
+/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_16000_A0 0.728272
+#define CS_REVERB_16000_A1 -0.728272
+#define CS_REVERB_16000_A2 0.000000
+#define CS_REVERB_16000_B1 -0.820679
+#define CS_REVERB_16000_B2 0.000000
+#define CS_REVERB_16000_SCALE 15
+
+/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_22050_A0 0.516396
+#define CS_REVERB_22050_A1 0.000000
+#define CS_REVERB_22050_A2 -0.516396
+#define CS_REVERB_22050_B1 -0.518512
+#define CS_REVERB_22050_B2 -0.290990
+#define CS_REVERB_22050_SCALE 15
+
+
+/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_24000_A0 0.479565
+#define CS_REVERB_24000_A1 0.000000
+#define CS_REVERB_24000_A2 -0.479565
+#define CS_REVERB_24000_B1 -0.637745
+#define CS_REVERB_24000_B2 -0.198912
+#define CS_REVERB_24000_SCALE 15
+
+/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_32000_A0 0.380349
+#define CS_REVERB_32000_A1 0.000000
+#define CS_REVERB_32000_A2 -0.380349
+#define CS_REVERB_32000_B1 -0.950873
+#define CS_REVERB_32000_B2 0.049127
+#define CS_REVERB_32000_SCALE 15
+
+/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_44100_A0 0.297389
+#define CS_REVERB_44100_A1 0.000000
+#define CS_REVERB_44100_A2 -0.297389
+#define CS_REVERB_44100_B1 -1.200423
+#define CS_REVERB_44100_B2 0.256529
+#define CS_REVERB_44100_SCALE 14
+
+/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
+#define CS_REVERB_48000_A0 0.278661
+#define CS_REVERB_48000_A1 0.000000
+#define CS_REVERB_48000_A2 -0.278661
+#define CS_REVERB_48000_B1 -1.254993
+#define CS_REVERB_48000_B2 0.303347
+#define CS_REVERB_48000_SCALE 14
+
+#ifdef HIGHER_FS
+/* Reverb coefficients for 96000Hz sample rate, scaled with 0.8 */
+/* Band pass filter with fc1=500 and fc2=8000*/
+#define CS_REVERB_96000_A0 0.1602488
+#define CS_REVERB_96000_A1 0.000000
+#define CS_REVERB_96000_A2 -0.1602488
+#define CS_REVERB_96000_B1 -1.585413
+#define CS_REVERB_96000_B2 0.599377
+#define CS_REVERB_96000_SCALE 14
+
+/* Reverb coefficients for 192000Hz sample rate, scaled with 0.8 */
+/* Band pass filter with fc1=500 and fc2=8000*/
+#define CS_REVERB_192000_A0 0.0878369
+#define CS_REVERB_192000_A1 0.000000
+#define CS_REVERB_192000_A2 -0.0878369
+#define CS_REVERB_192000_B1 -1.7765764
+#define CS_REVERB_192000_B2 0.7804076
+#define CS_REVERB_192000_SCALE 14
+
+#endif
+
+
+/* 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 1.263312
+#define CS_EQUALISER_8000_A1 -0.601748
+#define CS_EQUALISER_8000_A2 -0.280681
+#define CS_EQUALISER_8000_B1 -0.475865
+#define CS_EQUALISER_8000_B2 -0.408154
+#define CS_EQUALISER_8000_SCALE 14
+#define CSEX_EQUALISER_8000_A0 0.943357
+#define CSEX_EQUALISER_8000_A1 -0.449345
+#define CSEX_EQUALISER_8000_A2 -0.209594
+#define CSEX_EQUALISER_8000_B1 -0.475865
+#define CSEX_EQUALISER_8000_B2 -0.408154
+#define CSEX_EQUALISER_8000_SCALE 15
+
+/* Equaliser coefficients for 11025Hz sample rate, \
+ CS scaled with 1.027761 and CSEX scaled with 0.767463 */
+#define CS_EQUALISER_11025_A0 1.101145
+#define CS_EQUALISER_11025_A1 0.139020
+#define CS_EQUALISER_11025_A2 -0.864423
+#define CS_EQUALISER_11025_B1 0.024541
+#define CS_EQUALISER_11025_B2 -0.908930
+#define CS_EQUALISER_11025_SCALE 14
+#define CSEX_EQUALISER_11025_A0 0.976058
+#define CSEX_EQUALISER_11025_A1 -0.695326
+#define CSEX_EQUALISER_11025_A2 -0.090809
+#define CSEX_EQUALISER_11025_B1 -0.610594
+#define CSEX_EQUALISER_11025_B2 -0.311149
+#define CSEX_EQUALISER_11025_SCALE 15
+
+/* Equaliser coefficients for 12000Hz sample rate, \
+ CS scaled with 1.032521 and CSEX scaled with 0.771017 */
+#define CS_EQUALISER_12000_A0 1.276661
+#define CS_EQUALISER_12000_A1 -1.017519
+#define CS_EQUALISER_12000_A2 -0.044128
+#define CS_EQUALISER_12000_B1 -0.729616
+#define CS_EQUALISER_12000_B2 -0.204532
+#define CS_EQUALISER_12000_SCALE 14
+#define CSEX_EQUALISER_12000_A0 1.007095
+#define CSEX_EQUALISER_12000_A1 -0.871912
+#define CSEX_EQUALISER_12000_A2 0.023232
+#define CSEX_EQUALISER_12000_B1 -0.745857
+#define CSEX_EQUALISER_12000_B2 -0.189171
+#define CSEX_EQUALISER_12000_SCALE 14
+
+/* Equaliser coefficients for 16000Hz sample rate, \
+ CS scaled with 1.031378 and CSEX scaled with 0.770164 */
+#define CS_EQUALISER_16000_A0 1.281629
+#define CS_EQUALISER_16000_A1 -1.075872
+#define CS_EQUALISER_16000_A2 -0.041365
+#define CS_EQUALISER_16000_B1 -0.725239
+#define CS_EQUALISER_16000_B2 -0.224358
+#define CS_EQUALISER_16000_SCALE 14
+#define CSEX_EQUALISER_16000_A0 1.081091
+#define CSEX_EQUALISER_16000_A1 -0.867183
+#define CSEX_EQUALISER_16000_A2 -0.070247
+#define CSEX_EQUALISER_16000_B1 -0.515121
+#define CSEX_EQUALISER_16000_B2 -0.425893
+#define CSEX_EQUALISER_16000_SCALE 14
+
+/* Equaliser coefficients for 22050Hz sample rate, \
+ CS scaled with 1.041576 and CSEX scaled with 0.777779 */
+#define CS_EQUALISER_22050_A0 1.388605
+#define CS_EQUALISER_22050_A1 -1.305799
+#define CS_EQUALISER_22050_A2 0.039922
+#define CS_EQUALISER_22050_B1 -0.719494
+#define CS_EQUALISER_22050_B2 -0.243245
+#define CS_EQUALISER_22050_SCALE 14
+#define CSEX_EQUALISER_22050_A0 1.272910
+#define CSEX_EQUALISER_22050_A1 -1.341014
+#define CSEX_EQUALISER_22050_A2 0.167462
+#define CSEX_EQUALISER_22050_B1 -0.614219
+#define CSEX_EQUALISER_22050_B2 -0.345384
+#define CSEX_EQUALISER_22050_SCALE 14
+
+/* Equaliser coefficients for 24000Hz sample rate, \
+ CS scaled with 1.034495 and CSEX scaled with 0.772491 */
+#define CS_EQUALISER_24000_A0 1.409832
+#define CS_EQUALISER_24000_A1 -1.456506
+#define CS_EQUALISER_24000_A2 0.151410
+#define CS_EQUALISER_24000_B1 -0.804201
+#define CS_EQUALISER_24000_B2 -0.163783
+#define CS_EQUALISER_24000_SCALE 14
+#define CSEX_EQUALISER_24000_A0 1.299198
+#define CSEX_EQUALISER_24000_A1 -1.452447
+#define CSEX_EQUALISER_24000_A2 0.240489
+#define CSEX_EQUALISER_24000_B1 -0.669303
+#define CSEX_EQUALISER_24000_B2 -0.294984
+#define CSEX_EQUALISER_24000_SCALE 14
+
+/* Equaliser coefficients for 32000Hz sample rate, \
+ CS scaled with 1.044559 and CSEX scaled with 0.780006 */
+#define CS_EQUALISER_32000_A0 1.560988
+#define CS_EQUALISER_32000_A1 -1.877724
+#define CS_EQUALISER_32000_A2 0.389741
+#define CS_EQUALISER_32000_B1 -0.907410
+#define CS_EQUALISER_32000_B2 -0.070489
+#define CS_EQUALISER_32000_SCALE 14
+#define CSEX_EQUALISER_32000_A0 1.785049
+#define CSEX_EQUALISER_32000_A1 -2.233497
+#define CSEX_EQUALISER_32000_A2 0.526431
+#define CSEX_EQUALISER_32000_B1 -0.445939
+#define CSEX_EQUALISER_32000_B2 -0.522446
+#define CSEX_EQUALISER_32000_SCALE 13
+
+/* Equaliser coefficients for 44100Hz sample rate, \
+ CS scaled with 1.022170 and CSEX scaled with 0.763288 */
+#define CS_EQUALISER_44100_A0 1.623993
+#define CS_EQUALISER_44100_A1 -2.270743
+#define CS_EQUALISER_44100_A2 0.688829
+#define CS_EQUALISER_44100_B1 -1.117190
+#define CS_EQUALISER_44100_B2 0.130208
+#define CS_EQUALISER_44100_SCALE 13
+#define CSEX_EQUALISER_44100_A0 2.028315
+#define CSEX_EQUALISER_44100_A1 -2.882459
+#define CSEX_EQUALISER_44100_A2 0.904535
+#define CSEX_EQUALISER_44100_B1 -0.593308
+#define CSEX_EQUALISER_44100_B2 -0.385816
+#define CSEX_EQUALISER_44100_SCALE 13
+
+/* Equaliser coefficients for 48000Hz sample rate, \
+ CS scaled with 1.018635 and CSEX scaled with 0.760648 */
+#define CS_EQUALISER_48000_A0 1.641177
+#define CS_EQUALISER_48000_A1 -2.364687
+#define CS_EQUALISER_48000_A2 0.759910
+#define CS_EQUALISER_48000_B1 -1.166774
+#define CS_EQUALISER_48000_B2 0.178074
+#define CS_EQUALISER_48000_SCALE 13
+#define CSEX_EQUALISER_48000_A0 2.099655
+#define CSEX_EQUALISER_48000_A1 -3.065220
+#define CSEX_EQUALISER_48000_A2 1.010417
+#define CSEX_EQUALISER_48000_B1 -0.634021
+#define CSEX_EQUALISER_48000_B2 -0.347332
+#define CSEX_EQUALISER_48000_SCALE 13
+
+
+#ifdef HIGHER_FS
+#define CS_EQUALISER_96000_A0 1.784497
+#define CS_EQUALISER_96000_A1 -3.001435
+#define CS_EQUALISER_96000_A2 1.228422
+#define CS_EQUALISER_96000_B1 -1.477804
+#define CS_EQUALISER_96000_B2 0.481369
+#define CS_EQUALISER_96000_SCALE 13
+#define CSEX_EQUALISER_96000_A0 2.7573
+#define CSEX_EQUALISER_96000_A1 -4.6721
+#define CSEX_EQUALISER_96000_A2 1.9317
+#define CSEX_EQUALISER_96000_B1 -0.971718
+#define CSEX_EQUALISER_96000_B2 -0.021216
+#define CSEX_EQUALISER_96000_SCALE 13
+
+#define CS_EQUALISER_192000_A0 1.889582
+#define CS_EQUALISER_192000_A1 -3.456140
+#define CS_EQUALISER_192000_A2 1.569864
+#define CS_EQUALISER_192000_B1 -1.700798
+#define CS_EQUALISER_192000_B2 0.701824
+#define CS_EQUALISER_192000_SCALE 13
+#define CSEX_EQUALISER_192000_A0 3.4273
+#define CSEX_EQUALISER_192000_A1 -6.2936
+#define CSEX_EQUALISER_192000_A2 2.8720
+#define CSEX_EQUALISER_192000_B1 -1.31074
+#define CSEX_EQUALISER_192000_B2 0.31312
+#define CSEX_EQUALISER_192000_SCALE 13
+#endif
+
+
+#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
+#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
+#define LVCS_HEADPHONE_GAIN 0.2087465 /* Unprocessed path gain */
+#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
+#define LVCS_EX_HEADPHONE_SHIFTLOSS 0.569225 /* EX Output Shift loss */
+#define LVCS_EX_HEADPHONE_GAIN 0.07794425 /* EX Unprocessed path gain */
+#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 */
@@ -394,5 +850,6 @@
#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.c
index 1904e46..d4c7627 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
@@ -98,7 +98,13 @@
/*
* 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;
@@ -190,6 +196,7 @@
pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
pInstance->VolCorrect = pLVCS_VolCorrectTable[0];
pInstance->TransitionGain = 0;
+
/* These current and target values are intialized again in LVCS_Control.c */
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
/* These current and target values are intialized again in LVCS_Control.c */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
index f3adb8d..a97e4f0 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
@@ -95,10 +95,17 @@
/* 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 */
@@ -112,8 +119,13 @@
/* 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 */
@@ -134,24 +146,35 @@
/* 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);
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
index 5d99461..3956d4d 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.c
@@ -66,7 +66,77 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ const LVM_FLOAT *pInput;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVM_FLOAT *pScratch;
+ LVCS_ReturnStatus_en err;
+ pScratch = (LVM_FLOAT *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
+
+ /*
+ * Check if the processing is inplace
+ */
+ if (pInData == pOutData)
+ {
+ /* Processing inplace */
+ pInput = pScratch + (2 * NumSamples);
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)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);
+}
+#else
LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -133,7 +203,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -160,7 +230,170 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
+ const LVM_FLOAT *pInData,
+ LVM_FLOAT *pOutData,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReturnStatus_en err;
+
+ /*
+ * 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_FLOAT Gain = pInstance->VolCorrect.CompMin;
+ LVM_FLOAT Current1;
+
+ Current1 = LVC_Mixer_GetCurrent(&pInstance->BypassMix.Mixer_Instance.MixerStream[0]);
+ Gain = (LVM_FLOAT)( pInstance->VolCorrect.CompMin
+ - (((LVM_FLOAT)pInstance->VolCorrect.CompMin * (Current1)))
+ + (((LVM_FLOAT)pInstance->VolCorrect.CompFull * (Current1))));
+
+ if(NumSamples < LVCS_COMPGAINFRAME)
+ {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutData,
+ pOutData,
+ (LVM_INT32)(2 * NumSamples));
+ }
+ else
+ {
+ LVM_FLOAT GainStep;
+ LVM_FLOAT FinalGain;
+ LVM_INT16 SampleToProcess = NumSamples;
+ LVM_FLOAT *pOutPtr;
+
+ /* Large changes in Gain can cause clicks in output
+ Split data into small blocks and use interpolated gain values */
+
+ GainStep = (LVM_FLOAT)(((Gain-pInstance->CompressGain) * \
+ LVCS_COMPGAINFRAME) / NumSamples);
+
+ 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_FLOAT)(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_Float(Gain, /* Compressor gain setting */
+ pOutPtr,
+ pOutPtr,
+ (LVM_INT32)(2 * LVCS_COMPGAINFRAME));
+ pOutPtr += (2 * LVCS_COMPGAINFRAME);
+ SampleToProcess = (LVM_INT16)(SampleToProcess - LVCS_COMPGAINFRAME);
+ }
+ else
+ {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutPtr,
+ pOutPtr,
+ (LVM_INT32)(2 * SampleToProcess));
+ 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_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+ }
+
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -321,13 +554,4 @@
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.c
index ee257b8..1085101 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.c
@@ -57,7 +57,98 @@
/* 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)
+{
+ LVM_UINT16 Delay;
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t *pReverbCoefTable;
+
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficients = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ /*
+ * 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_Float(0, /* Value */
+ (LVM_FLOAT *)&pConfig->StereoSamples[0], /* Destination */
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pConfig->StereoSamples) / sizeof(LVM_FLOAT)));
+ /*
+ * 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_FLOAT)pReverbCoefTable[Offset].A0;
+ Coeffs.A1 = (LVM_FLOAT)pReverbCoefTable[Offset].A1;
+ Coeffs.A2 = (LVM_FLOAT)pReverbCoefTable[Offset].A2;
+ Coeffs.B1 = (LVM_FLOAT)-pReverbCoefTable[Offset].B1;
+ Coeffs.B2 = (LVM_FLOAT)-pReverbCoefTable[Offset].B2;
+
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->ReverbBiquadTaps, /* Destination Cast to void:
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->ReverbBiquadTaps) / sizeof(LVM_FLOAT)));
+
+ 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_FLOAT)(ReverbPercentage>>8)) / 32767.0f;
+ }
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -140,7 +231,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Reverb */
@@ -179,7 +270,91 @@
/* 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,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
+ LVCS_Coefficient_t *pCoefficients;
+ LVM_FLOAT *pScratch;
+
+ pCoefficients = (LVCS_Coefficient_t *)\
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ pScratch = (LVM_FLOAT *)\
+ 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_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+
+ /*
+ * Check if the reverb is required
+ */
+ /* Disable when CS4MS in stereo mode */
+ if (((pInstance->Params.SpeakerType == LVCS_HEADPHONE) || \
+ (pInstance->Params.SpeakerType == LVCS_EX_HEADPHONES) ||
+ (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
+ /* For validation testing */
+ ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) !=0))
+ {
+ /********************************************************************************/
+ /* */
+ /* Copy the input data to scratch memory and filter it */
+ /* */
+ /********************************************************************************/
+
+ /*
+ * Copy the input data to the scratch memory
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pScratch, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+
+ /*
+ * Filter the data
+ */
+ (pConfig->pBiquadCallBack)((Biquad_FLOAT_Instance_t*)&pCoefficients->ReverbBiquadInstance,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+
+ Mult3s_Float( (LVM_FLOAT *)pScratch,
+ pConfig->ReverbLevel,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)(2 * NumSamples));
+
+
+ /*
+ * Apply the delay mix
+ */
+ DelayMix_Float((LVM_FLOAT *)pScratch,
+ &pConfig->StereoSamples[0],
+ pConfig->DelaySize,
+ pOutData,
+ &pConfig->DelayOffset,
+ (LVM_INT16)NumSamples);
+
+
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -257,8 +432,4 @@
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 6e026ff..69892b6 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
@@ -58,14 +58,20 @@
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_48KHZ];
+ /* Reverb Level */
+ LVM_FLOAT ReverbLevel;
+ /* Filter */
+ void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*,
+ LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+#endif
} LVCS_ReverbGenerator_t;
@@ -77,12 +83,17 @@
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 */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
index b9b8b05..2992c35 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
@@ -49,7 +49,103 @@
/* NOTES: */
/* */
/************************************************************************************/
+#ifdef BUILD_FLOAT
+LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
+ LVCS_Params_t *pParams)
+{
+ LVM_UINT16 Offset;
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
+ LVCS_Data_t *pData;
+ LVCS_Coefficient_t *pCoefficient;
+ FO_FLOAT_Coefs_t CoeffsMid;
+ BQ_FLOAT_Coefs_t CoeffsSide;
+ const BiquadA012B12CoefsSP_t *pSESideCoefs;
+
+
+ pData = (LVCS_Data_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
+
+ pCoefficient = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ /*
+ * 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_FLOAT) LVCS_SEMidCoefTable[Offset].A0;
+ CoeffsMid.A1 = (LVM_FLOAT) LVCS_SEMidCoefTable[Offset].A1;
+ CoeffsMid.B1 = (LVM_FLOAT)-LVCS_SEMidCoefTable[Offset].B1;
+
+ /* Clear the taps */
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->SEBiquadTapsMid) / sizeof(LVM_FLOAT)));
+
+ 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_FLOAT) pSESideCoefs[Offset].A0;
+ CoeffsSide.A1 = (LVM_FLOAT) pSESideCoefs[Offset].A1;
+ CoeffsSide.A2 = (LVM_FLOAT) pSESideCoefs[Offset].A2;
+ CoeffsSide.B1 = (LVM_FLOAT)-pSESideCoefs[Offset].B1;
+ CoeffsSide.B2 = (LVM_FLOAT)-pSESideCoefs[Offset].B2;
+
+ /* Clear the taps */
+ LoadConst_Float(0, /* Value */
+ (void *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
+ no dereferencing in function*/
+ /* Number of words */
+ (LVM_UINT16)(sizeof(pData->SEBiquadTapsSide) / sizeof(LVM_FLOAT)));
+ /* 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);
+}
+#else
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -138,7 +234,7 @@
return(LVCS_SUCCESS);
}
-
+#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_StereoEnhance */
@@ -177,7 +273,90 @@
/* 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,
+ LVM_UINT16 NumSamples)
+{
+ LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+ LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
+ LVCS_Coefficient_t *pCoefficient;
+ LVM_FLOAT *pScratch;
+
+ pCoefficient = (LVCS_Coefficient_t *) \
+ pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
+
+ pScratch = (LVM_FLOAT *) \
+ 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_Float(pInData,
+ pScratch,
+ pScratch + NumSamples,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Apply filter to the middle signal
+ */
+ if (pInstance->OutputDevice == LVCS_HEADPHONE)
+ {
+ (pConfig->pBiquadCallBack_Mid)((Biquad_FLOAT_Instance_t*)\
+ &pCoefficient->SEBiquadInstanceMid,
+ (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT *)pScratch,
+ (LVM_INT16)NumSamples);
+ }
+ else
+ {
+ Mult3s_Float(pScratch, /* Source */
+ (LVM_FLOAT)pConfig->MidGain, /* Gain */
+ pScratch, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of samples */
+ }
+
+ /*
+ * Apply the filter the side signal only in stereo mode for headphones
+ * and in all modes for mobile speakers
+ */
+ if (pInstance->Params.SourceFormat == LVCS_STEREO)
+ {
+ (pConfig->pBiquadCallBack_Side)((Biquad_FLOAT_Instance_t*) \
+ &pCoefficient->SEBiquadInstanceSide,
+ (LVM_FLOAT *)(pScratch + NumSamples),
+ (LVM_FLOAT *)(pScratch + NumSamples),
+ (LVM_INT16)NumSamples);
+ }
+
+ /*
+ * Convert from middle and side to stereo
+ */
+ MSTo2i_Sat_Float(pScratch,
+ pScratch + NumSamples,
+ pOutData,
+ (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * The stereo enhancer is disabled so just copy the data
+ */
+ Copy_Float((LVM_FLOAT *)pInData, /* Source */
+ (LVM_FLOAT *)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ }
+
+ return(LVCS_SUCCESS);
+}
+#else
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_INT16 *pInData,
LVM_INT16 *pOutData,
@@ -254,7 +433,4 @@
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 15bc407..4125f24 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
@@ -43,18 +43,31 @@
/* Stereo enhancer structure */
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
+ */
+ void (*pBiquadCallBack_Mid)(Biquad_FLOAT_Instance_t*,
+ LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
- LVM_UINT16 MidGain; /* Middle gain in mobile speaker mode */
-
+ /*
+ * Side filter
+ */
+ 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;
@@ -67,12 +80,17 @@
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 */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
index 974de21..e154e29 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.c
@@ -71,7 +71,19 @@
{CS_MIDDLE_48000_A0, /* 48kS/s coefficients */
CS_MIDDLE_48000_A1,
CS_MIDDLE_48000_B1,
- (LVM_UINT16 )CS_MIDDLE_48000_SCALE}};
+ (LVM_UINT16 )CS_MIDDLE_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_MIDDLE_96000_A0, /* 96kS/s coefficients */
+ CS_MIDDLE_96000_A1,
+ CS_MIDDLE_96000_B1,
+ (LVM_UINT16 )CS_MIDDLE_96000_SCALE},
+ {CS_MIDDLE_192000_A0, /* 192kS/s coefficients */
+ CS_MIDDLE_192000_A1,
+ CS_MIDDLE_192000_B1,
+ (LVM_UINT16 )CS_MIDDLE_192000_SCALE}
+#endif
+ };
/* Coefficient table for the side filter */
const BiquadA012B12CoefsSP_t LVCS_SESideCoefTable[] = {
@@ -130,6 +142,21 @@
CS_SIDE_48000_B1,
CS_SIDE_48000_B2,
(LVM_UINT16 )CS_SIDE_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_SIDE_96000_A0, /* 96kS/s coefficients */
+ CS_SIDE_96000_A1,
+ CS_SIDE_96000_A2,
+ CS_SIDE_96000_B1,
+ CS_SIDE_96000_B2,
+ (LVM_UINT16 )CS_SIDE_96000_SCALE},
+ {CS_SIDE_192000_A0, /* 192kS/s coefficients */
+ CS_SIDE_192000_A1,
+ CS_SIDE_192000_A2,
+ CS_SIDE_192000_B1,
+ CS_SIDE_192000_B2,
+ (LVM_UINT16 )CS_SIDE_192000_SCALE}
+#endif
};
@@ -195,6 +222,20 @@
CS_EQUALISER_48000_B1,
CS_EQUALISER_48000_B2,
(LVM_UINT16 )CS_EQUALISER_48000_SCALE},
+#ifdef HIGHER_FS
+ {CS_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CS_EQUALISER_96000_A1,
+ CS_EQUALISER_96000_A2,
+ CS_EQUALISER_96000_B1,
+ CS_EQUALISER_96000_B2,
+ (LVM_UINT16 )CS_EQUALISER_96000_SCALE},
+ {CS_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CS_EQUALISER_192000_A1,
+ CS_EQUALISER_192000_A2,
+ CS_EQUALISER_192000_B1,
+ CS_EQUALISER_192000_B2,
+ (LVM_UINT16 )CS_EQUALISER_192000_SCALE},
+#endif
/* Concert Sound EX Headphone coefficients */
{CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
@@ -251,6 +292,21 @@
CSEX_EQUALISER_48000_B1,
CSEX_EQUALISER_48000_B2,
(LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CSEX_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CSEX_EQUALISER_96000_A1,
+ CSEX_EQUALISER_96000_A2,
+ CSEX_EQUALISER_96000_B1,
+ CSEX_EQUALISER_96000_B2,
+ (LVM_UINT16 )CSEX_EQUALISER_96000_SCALE},
+ {CSEX_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CSEX_EQUALISER_192000_A1,
+ CSEX_EQUALISER_192000_A2,
+ CSEX_EQUALISER_192000_B1,
+ CSEX_EQUALISER_192000_B2,
+ (LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
+#endif
};
@@ -334,6 +390,21 @@
CS_REVERB_48000_B1,
CS_REVERB_48000_B2,
(LVM_UINT16 )CS_REVERB_48000_SCALE}
+#ifdef HIGHER_FS
+ ,
+ {CS_REVERB_96000_A0, /* 96kS/s coefficients */
+ CS_REVERB_96000_A1,
+ CS_REVERB_96000_A2,
+ CS_REVERB_96000_B1,
+ CS_REVERB_96000_B2,
+ (LVM_UINT16 )CS_REVERB_96000_SCALE},
+ {CS_REVERB_192000_A0, /* 192kS/s coefficients */
+ CS_REVERB_192000_A1,
+ CS_REVERB_192000_A2,
+ CS_REVERB_192000_B1,
+ CS_REVERB_192000_B2,
+ (LVM_UINT16 )CS_REVERB_192000_SCALE}
+#endif
};
@@ -385,6 +456,24 @@
/* */
/************************************************************************************/
const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
+#ifdef BUILD_FLOAT
+ {0.433362f, /* Headphone, stereo mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {0.433362f, /* EX Headphone, stereo mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {1.000000f, /* Headphone, mono mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f},
+ {1.000000f, /* EX Headphone, mono mode */
+ 0.000000f,
+ 1.000024f,
+ 1.412640f}
+#else
{14200, /* Headphone, stereo mode */
0,
4096,
@@ -401,6 +490,7 @@
0,
4096,
5786}
+#endif
};
/************************************************************************************/
@@ -418,8 +508,25 @@
#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_Fs96000 32751 /* Floating point value 0.999511703 */ /* Todo @ need to re check this value*/
+#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[11] = {LVCS_VOL_TC_Fs8000,
+ LVCS_VOL_TC_Fs11025,
+ LVCS_VOL_TC_Fs12000,
+ LVCS_VOL_TC_Fs16000,
+ LVCS_VOL_TC_Fs22050,
+ LVCS_VOL_TC_Fs24000,
+ LVCS_VOL_TC_Fs32000,
+ LVCS_VOL_TC_Fs44100,
+ LVCS_VOL_TC_Fs48000,
+ LVCS_VOL_TC_Fs96000,
+ LVCS_VOL_TC_Fs192000
+};
+#else
const LVM_INT16 LVCS_VolumeTCTable[9] = {LVCS_VOL_TC_Fs8000,
LVCS_VOL_TC_Fs11025,
LVCS_VOL_TC_Fs12000,
@@ -428,15 +535,30 @@
LVCS_VOL_TC_Fs24000,
LVCS_VOL_TC_Fs32000,
LVCS_VOL_TC_Fs44100,
- LVCS_VOL_TC_Fs48000};
+ LVCS_VOL_TC_Fs48000
+};
+#endif
/************************************************************************************/
/* */
/* Sample rate table */
/* */
/************************************************************************************/
-
-const LVM_INT32 LVCS_SampleRateTable[9] = {8000,
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+const LVM_INT32 LVCS_SampleRateTable[11] = {8000,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 96000,
+ 192000
+};
+#else
+const LVM_INT16 LVCS_SampleRateTable[9] = {8000,
11025,
12000,
16000,
@@ -444,5 +566,6 @@
24000,
32000,
44100,
- 48000};
-
+ 48000
+};
+#endif
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index f92fb95..d7427b0 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -10,7 +10,7 @@
LOCAL_SRC_FILES:= \
Bundle/EffectBundle.cpp
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
LOCAL_MODULE:= libbundlewrapper
@@ -42,7 +42,7 @@
LOCAL_SRC_FILES:= \
Reverb/EffectReverb.cpp
-LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -fvisibility=hidden -DBUILD_FLOAT -DHIGHER_FS
LOCAL_CFLAGS += -Wall -Werror
LOCAL_MODULE:= libreverbwrapper
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index df6501b..4f1fed5 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#ifndef LVM_FLOAT
+typedef float LVM_FLOAT;
+#endif
#define LOG_TAG "Bundle"
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
@@ -271,7 +273,10 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-
+#ifdef BUILD_FLOAT
+ pContext->pBundledContext->pInputBuffer = NULL;
+ pContext->pBundledContext->pOutputBuffer = NULL;
+#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
@@ -439,6 +444,14 @@
if (pContext->pBundledContext->workBuffer != NULL) {
free(pContext->pBundledContext->workBuffer);
}
+#ifdef BUILD_FLOAT
+ if (pContext->pBundledContext->pInputBuffer != NULL) {
+ free(pContext->pBundledContext->pInputBuffer);
+ }
+ if (pContext->pBundledContext->pOutputBuffer != NULL) {
+ free(pContext->pBundledContext->pOutputBuffer);
+ }
+#endif
delete pContext->pBundledContext;
pContext->pBundledContext = LVM_NULL;
}
@@ -695,7 +708,47 @@
return 0;
} /* end LvmBundle_init */
+#ifdef BUILD_FLOAT
+/**********************************************************************************
+ FUNCTION INT16LTOFLOAT
+***********************************************************************************/
+// Todo: need to write function descriptor
+static void Int16ToFloat(const LVM_INT16 *src, LVM_FLOAT *dst, size_t n) {
+ size_t ii;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ *dst = ((LVM_FLOAT)((LVM_INT16)*src)) / 32768.0f;
+ src--;
+ dst--;
+ }
+ return;
+}
+/**********************************************************************************
+ FUNCTION FLOATTOINT16_SAT
+***********************************************************************************/
+// Todo : Need to write function descriptor
+static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
+ size_t ii;
+ LVM_INT32 temp;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ temp = (LVM_INT32)((*src) * 32768.0f);
+ if (temp >= 32767) {
+ *dst = 32767;
+ } else if (temp <= -32768) {
+ *dst = -32768;
+ } else {
+ *dst = (LVM_INT16)temp;
+ }
+ src--;
+ dst--;
+ }
+ return;
+}
+#endif
//----------------------------------------------------------------------------
// LvmBundle_process()
//----------------------------------------------------------------------------
@@ -713,7 +766,99 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
+#ifdef BUILD_FLOAT
+int LvmBundle_process(LVM_INT16 *pIn,
+ LVM_INT16 *pOut,
+ int frameCount,
+ EffectContext *pContext){
+
+ //LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_INT16 *pOutTmp;
+ LVM_FLOAT *pInputBuff;
+ LVM_FLOAT *pOutputBuff;
+
+ if (pContext->pBundledContext->pInputBuffer == NULL ||
+ pContext->pBundledContext->frameCount < frameCount) {
+ if (pContext->pBundledContext->pInputBuffer != NULL) {
+ free(pContext->pBundledContext->pInputBuffer);
+ }
+ pContext->pBundledContext->pInputBuffer = (LVM_FLOAT *)malloc(frameCount * \
+ sizeof(LVM_FLOAT) * FCC_2);
+ }
+
+ if (pContext->pBundledContext->pOutputBuffer == NULL ||
+ pContext->pBundledContext->frameCount < frameCount) {
+ if (pContext->pBundledContext->pOutputBuffer != NULL) {
+ free(pContext->pBundledContext->pOutputBuffer);
+ }
+ pContext->pBundledContext->pOutputBuffer = (LVM_FLOAT *)malloc(frameCount * \
+ sizeof(LVM_FLOAT) * FCC_2);
+ }
+
+ if ((pContext->pBundledContext->pInputBuffer == NULL) ||
+ (pContext->pBundledContext->pOutputBuffer == NULL)) {
+ ALOGV("LVM_ERROR : LvmBundle_process memory allocation for float buffer's failed");
+ return -EINVAL;
+ }
+
+ pInputBuff = pContext->pBundledContext->pInputBuffer;
+ pOutputBuff = pContext->pBundledContext->pOutputBuffer;
+
+ 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 =
+ (LVM_INT16 *)calloc(frameCount, sizeof(LVM_INT16) * 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(LVM_INT16) * FCC_2, 1, pContext->pBundledContext->PcmInPtr);
+ fflush(pContext->pBundledContext->PcmInPtr);
+ #endif
+
+ /* Converting input data from fixed point to float point */
+ Int16ToFloat(pIn, pInputBuff, frameCount * 2);
+
+ /* 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); /* Audo Time */
+
+ LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
+ if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+
+ /* Converting output data from float point to fixed point */
+ FloatToInt16_SAT(pOutputBuff, pOutTmp, (LVM_UINT16)frameCount * 2);
+ #ifdef LVM_PCM
+ fwrite(pOutTmp, frameCount*sizeof(LVM_INT16) * FCC_2, 1, 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 */
+#else
int LvmBundle_process(LVM_INT16 *pIn,
LVM_INT16 *pOut,
int frameCount,
@@ -771,7 +916,7 @@
}
return 0;
} /* end LvmBundle_process */
-
+#endif
//----------------------------------------------------------------------------
// EqualizerUpdateActiveParams()
@@ -1126,6 +1271,16 @@
SampleRate = LVM_FS_48000;
pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
break;
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ pContext->pBundledContext->SamplesPerSecond = 96000*2; // 2 secs Stereo
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ pContext->pBundledContext->SamplesPerSecond = 192000*2; // 2 secs Stereo
+ break;
+#endif
default:
ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index ee604eb..cad89fd 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -103,6 +103,10 @@
FILE *PcmInPtr;
FILE *PcmOutPtr;
#endif
+ #ifdef BUILD_FLOAT
+ LVM_FLOAT *pInputBuffer;
+ LVM_FLOAT *pOutputBuffer;
+ #endif
};
/* SessionContext : One session */
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 12a038f..ab6b63c 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#ifndef LVM_FLOAT
+typedef float LVM_FLOAT;
+#endif
#define LOG_TAG "Reverb"
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
//#define LOG_NDEBUG 0
@@ -152,6 +154,8 @@
LVM_Fs_en SampleRate;
LVM_INT32 *InFrames32;
LVM_INT32 *OutFrames32;
+ size_t bufferSizeIn;
+ size_t bufferSizeOut;
bool auxiliary;
bool preset;
uint16_t curPreset;
@@ -172,8 +176,11 @@
#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,8 +276,15 @@
// Allocate memory for reverb process (*2 is for STEREO)
- pContext->InFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
- pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
+#ifdef BUILD_FLOAT
+ pContext->bufferSizeIn = LVREV_MAX_FRAME_SIZE * sizeof(float) * 2;
+ pContext->bufferSizeOut = pContext->bufferSizeIn;
+#else
+ pContext->bufferSizeIn = LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2;
+ pContext->bufferSizeOut = pContext->bufferSizeIn;
+#endif
+ pContext->InFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeIn);
+ pContext->OutFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeOut);
ALOGV("\tEffectCreate %p, size %zu", pContext, sizeof(ReverbContext));
ALOGV("\tEffectCreate end\n");
@@ -292,6 +306,8 @@
#endif
free(pContext->InFrames32);
free(pContext->OutFrames32);
+ pContext->bufferSizeIn = 0;
+ pContext->bufferSizeOut = 0;
Reverb_free(pContext);
delete pContext;
return 0;
@@ -388,6 +404,48 @@
}
#endif
+#ifdef BUILD_FLOAT
+/**********************************************************************************
+ FUNCTION INT16LTOFLOAT
+***********************************************************************************/
+// Todo: need to write function descriptor
+static void Int16ToFloat(const LVM_INT16 *src, LVM_FLOAT *dst, size_t n) {
+ size_t ii;
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ *dst = ((LVM_FLOAT)((LVM_INT16)*src)) / 32768.0f;
+ src--;
+ dst--;
+ }
+ return;
+}
+/**********************************************************************************
+ FUNCTION FLOATTOINT16_SAT
+***********************************************************************************/
+// Todo : Need to write function descriptor
+static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
+ size_t ii;
+ LVM_INT32 temp;
+
+ src += n-1;
+ dst += n-1;
+ for (ii = n; ii != 0; ii--) {
+ temp = (LVM_INT32)((*src) * 32768.0f);
+ if (temp >= 32767) {
+ *dst = 32767;
+ } else if (temp <= -32768) {
+ *dst = -32768;
+ } else {
+ *dst = (LVM_INT16)temp;
+ }
+ src--;
+ dst--;
+ }
+ return;
+}
+#endif
+
static inline int16_t clamp16(int32_t sample)
{
if ((sample>>15) ^ (sample>>31))
@@ -421,8 +479,31 @@
LVM_INT16 samplesPerFrame = 1;
LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
LVM_INT16 *OutFrames16;
+#ifdef BUILD_FLOAT
+ LVM_FLOAT *pInputBuff;
+ LVM_FLOAT *pOutputBuff;
+#endif
-
+#ifdef BUILD_FLOAT
+ if (pContext->InFrames32 == NULL ||
+ pContext->bufferSizeIn < frameCount * sizeof(float) * 2) {
+ if (pContext->InFrames32 != NULL) {
+ free(pContext->InFrames32);
+ }
+ pContext->bufferSizeIn = frameCount * sizeof(float) * 2;
+ pContext->InFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeIn);
+ }
+ if (pContext->OutFrames32 == NULL ||
+ pContext->bufferSizeOut < frameCount * sizeof(float) * 2) {
+ if (pContext->OutFrames32 != NULL) {
+ free(pContext->OutFrames32);
+ }
+ pContext->bufferSizeOut = frameCount * sizeof(float) * 2;
+ pContext->OutFrames32 = (LVM_INT32 *)malloc(pContext->bufferSizeOut);
+ }
+ pInputBuff = (float *)pContext->InFrames32;
+ pOutputBuff = (float *)pContext->OutFrames32;
+#endif
// Check that the input is either mono or stereo
if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO) {
samplesPerFrame = 2;
@@ -448,49 +529,84 @@
Reverb_LoadPreset(pContext);
}
-
-
// Convert to Input 32 bits
if (pContext->auxiliary) {
+#ifdef BUILD_FLOAT
+ Int16ToFloat(pIn, pInputBuff, frameCount * samplesPerFrame);
+#else
for(int i=0; i<frameCount*samplesPerFrame; i++){
pContext->InFrames32[i] = (LVM_INT32)pIn[i]<<8;
}
- } else {
+#endif
+ } else {
// insert reverb input is always stereo
for (int i = 0; i < frameCount; i++) {
+#ifndef BUILD_FLOAT
pContext->InFrames32[2*i] = (pIn[2*i] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
pContext->InFrames32[2*i+1] = (pIn[2*i+1] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
+#else
+ pInputBuff[2 * i] = (LVM_FLOAT)pIn[2 * i] * REVERB_SEND_LEVEL / 32768.0f;
+ pInputBuff[2 * i + 1] = (LVM_FLOAT)pIn[2 * i + 1] * REVERB_SEND_LEVEL / 32768.0f;
+#endif
}
}
if (pContext->preset && pContext->curPreset == REVERB_PRESET_NONE) {
+#ifdef BUILD_FLOAT
+ memset(pOutputBuff, 0, frameCount * sizeof(LVM_FLOAT) * 2); //always stereo here
+#else
memset(pContext->OutFrames32, 0, frameCount * sizeof(LVM_INT32) * 2); //always stereo here
+#endif
} else {
if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
+#ifdef BUILD_FLOAT
+ memset(pInputBuff, 0, frameCount * sizeof(LVM_FLOAT) * samplesPerFrame);
+#else
memset(pContext->InFrames32,0,frameCount * sizeof(LVM_INT32) * samplesPerFrame);
+#endif
ALOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
}
/* Process the samples, producing a stereo output */
+#ifdef BUILD_FLOAT
+ LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
+ pInputBuff, /* Input buffer */
+ pOutputBuff, /* Output buffer */
+ frameCount); /* Number of samples to read */
+#else
LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
pContext->InFrames32, /* Input buffer */
pContext->OutFrames32, /* Output buffer */
frameCount); /* Number of samples to read */
- }
+#endif
+ }
LVM_ERROR_CHECK(LvmStatus, "LVREV_Process", "process")
if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
// Convert to 16 bits
if (pContext->auxiliary) {
+#ifdef BUILD_FLOAT
+ FloatToInt16_SAT(pOutputBuff, OutFrames16, (size_t)frameCount * 2);
+#else
for (int i=0; i < frameCount*2; i++) { //always stereo here
OutFrames16[i] = clamp16(pContext->OutFrames32[i]>>8);
}
- } else {
- for (int i=0; i < frameCount*2; i++) { //always stereo here
- OutFrames16[i] = clamp16((pContext->OutFrames32[i]>>8) + (LVM_INT32)pIn[i]);
- }
+#endif
+ } else {
+#ifdef BUILD_FLOAT
+ for (int i = 0; i < frameCount * 2; i++) {//always stereo here
+ //pOutputBuff and OutFrames16 point to the same buffer, so better to
+ //accumulate in pInputBuff, which is available
+ pInputBuff[i] = pOutputBuff[i] + (LVM_FLOAT)pIn[i] / 32768.0f;
+ }
+ FloatToInt16_SAT(pInputBuff, OutFrames16, (size_t)frameCount * 2);
+#else
+ for (int i=0; i < frameCount*2; i++) { //always stereo here
+ OutFrames16[i] = clamp16((pContext->OutFrames32[i]>>8) + (LVM_INT32)pIn[i]);
+ }
+#endif
// apply volume with ramp if needed
if ((pContext->leftVolume != pContext->prevLeftVolume ||
pContext->rightVolume != pContext->prevRightVolume) &&
@@ -643,6 +759,14 @@
case 48000:
SampleRate = LVM_FS_48000;
break;
+#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ break;
+#endif
default:
ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -1010,7 +1134,7 @@
//ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
// "converted level: %d\n", ActiveParams.LPF, pContext->SavedHfLevel, level);
- if(ActiveParams.LPF != level){
+ if((int16_t)ActiveParams.LPF != level){
ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
ActiveParams.Level, level);
}