diff options
author | Eric Laurent <elaurent@google.com> | 2011-11-04 15:29:44 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-11-04 15:29:44 +0000 |
commit | 86a464557ddc297c4509cef72edd1d1620e4d03e (patch) | |
tree | 5e31c64eea967a58e0fbd986d5474e07a7a97a87 /media | |
parent | bb45f15eacb02f3c310c7dfc9020c18e9a297cc2 (diff) | |
parent | 79178b8b3da8f69f34a72be13f2a374afbec4f40 (diff) | |
download | frameworks_base-86a464557ddc297c4509cef72edd1d1620e4d03e.zip frameworks_base-86a464557ddc297c4509cef72edd1d1620e4d03e.tar.gz frameworks_base-86a464557ddc297c4509cef72edd1d1620e4d03e.tar.bz2 |
am 79178b8b: Merge "Fix problem in lvm effect bundle wrapper." into ics-mr1
* commit '79178b8b3da8f69f34a72be13f2a374afbec4f40':
Fix problem in lvm effect bundle wrapper.
Diffstat (limited to 'media')
-rw-r--r-- | media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index efa1c45..fb48c51 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -49,6 +49,16 @@ extern "C" const struct effect_interface_s gLvmEffectInterface; }\ } + +static inline int16_t clamp16(int32_t sample) +{ + // check overflow for both positive and negative values: + // all bits above short range must me equal to sign bit + if ((sample>>15) ^ (sample>>31)) + sample = 0x7FFF ^ (sample>>31); + return sample; +} + // Namespaces namespace android { namespace { @@ -707,13 +717,6 @@ int LvmBundle_init(EffectContext *pContext){ } /* end LvmBundle_init */ -static inline int16_t clamp16(int32_t sample) -{ - if ((sample>>15) ^ (sample>>31)) - sample = 0x7FFF ^ (sample>>31); - return sample; -} - //---------------------------------------------------------------------------- // LvmBundle_process() //---------------------------------------------------------------------------- @@ -2683,12 +2686,19 @@ int Effect_process(effect_handle_t self, LOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus); return lvmStatus; } - }else{ + } else { //LOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d", //pContext->pBundledContext->NumberEffectsEnabled, //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType); // 2 is for stereo input - memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount*sizeof(LVM_INT16)*2); + if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { + for (size_t i=0; i < outBuffer->frameCount*2; i++){ + outBuffer->s16[i] = + clamp16((LVM_INT32)outBuffer->s16[i] + (LVM_INT32)inBuffer->s16[i]); + } + } else { + memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount*sizeof(LVM_INT16)*2); + } } return status; |