Mike J. Chen 7bce396226 Media framework changes for Tungsten.
Squashed merge from master-tungsten of the following changes:

commit 73d09e18c4557e583a1684d44d598a1a02fd0cf2
Author: John Grossman <johngro@google.com>
Date:   Mon Jun 20 13:57:44 2011 -0700

    Remove TungstenMisc and rename LinearTransform

    Change-Id: Ie8aa3e24e09fdbf6ef8996c26deb9c5640e20d1b

commit 3114aabe76ad733b59929d87e49c68229f5ae2e8
Author: John Grossman <johngro@google.com>
Date:   Fri Jun 3 10:47:16 2011 -0700

    Name changes and spelling fixes.

    + Replace the term TungstenTime with the Eugene-approved term CommonTime.
    + Fix a spelling error in a comment I noticed.

    Change-Id: I8c10d618206826d16055f78c7724e24443bb03fd

commit cbf2903ab6893b6e662514e2f6d670e268a419df
Author: John Grossman <johngro@google.com>
Date:   Fri Apr 15 09:27:54 2011 -0700

    Migrate Tungsten code from the HC-Tungsten to the Master-Tungsten branch.

    Change-Id: I95372d913a0761d90168edb4016f5ece0ea74502

commit bc7c46aa629f9883e959ef23de8da297f9eb508b
Author: Jason Simmons <jsimmons@google.com>
Date:   Mon Jun 20 13:59:17 2011 -0700

    Create a separate class for timed AudioTracks

commit 43be3231034ff8537fdd84422a7954780038671f
Author: John Grossman <johngro@google.com>
Date:   Mon Jun 27 18:59:12 2011 -0700

    Move libaah_rtp over from the vendor directory.

    Also move factor PipeEvent out into utils.

    Change-Id: Id3877c66efe22d771cf3ef4877107e431b828e37

commit 17526eb3148c9c3d4365b6d5b47e8dc13bca71b6
Author: John Grossman <johngro@google.com>
Date:   Mon Jun 27 17:06:49 2011 -0700

    Name changes for the TRTP Players s/tungsten/aah/g

    Change-Id: I55e9ad13003f6aa6a36955b54426a7efbe31ac51

commit 423fc1bfc0fda799c421a650c83c4b9293b1a08c
Author: Jason Simmons <jsimmons@google.com>
Date:   Mon Jun 20 17:56:09 2011 -0700

    More timed AudioFlinger changes requested by code review:
    * change trimTimedBufferQueue to trimTimedBufferQueue_l
    * create one timed audio buffer heap per client process instead of one per track
    * grow the silence buffer on demand
    * some error handling fixes in timed getNextBuffer
    * calculate the next output PTS in all mixer and track hooks

    Change-Id: Ifc51a08b55029b7c48902ab2f22933ad7bafe1ad

commit a148e2674b1d3cb73289b82b85c333f0a66824a9
Author: John Grossman <johngro@google.com>
Date:   Mon Jun 20 17:02:24 2011 -0700

    Move the A@H time service into frameworks/base

    Change-Id: I5c570cde70e8931e205516cb33517585804ce841

commit dfa438fa49bdaeeb2ec5fd0d17b30d881608b6b1
Author: John Grossman <johngro@google.com>
Date:   Mon Jun 20 11:55:36 2011 -0700

    Fix the build after Mike's code moving.

    Change-Id: Ia883643ded252168bcc5a70584ab6ce97bb05266

commit 04489474ec8e73efe1bf52918831f41659033162
Author: John Grossman <johngro@google.com>
Date:   Fri Jun 17 14:19:50 2011 -0700

    Refactor the local/common clock services.

    This change is one of a set of 5 changes made to different repositories.  Look
    for this comment in all of them.

    Refactor the local/common clock services in tungsten to match android best
    practice.  Notable changes include

    + The kernel no longer knows anything about common time.  Common time has been
      moved completely up into user land.  This has an impact on the accuracy of the
      timesync debugging code, and the netfilter assisted approach to network based
      timesync is going to have to be modified.
    + The timesync driver used by A@H is now just local time driver.
    + The kernel no longer needs access to the linear transform math code, and it
      has been removed.
    + A new HAL has been introduced to expose the concept of local time to the
      system.
    + A non-slewable stub implementation of the local time HAL based on
      CLOCK_MONOTONIC has been added.
    + The TungstenTime library has been eliminated.  Its functionality has been
      distributed among the common time binder service, the local time hal and the
      linear transform utility code.
    + All clients of the old TungstenTime library have been changed to be clients of
      the binder service, the hal and the utility code.
    + The reset_tt utilities have been removed, they no longer have a purpose in the
      system.
    + more progress has been made in eliminating the word "tungsten" from the code.

    Things left to do include
    + Finish getting rid of tungsten from the time service.
    + Move the time service into the framework; AudioFlinger's new timed mode
      depends on it and the service cannot continue to live in vendor tungsten.

    Change-Id: I999b6cfb4a9d267818a86d747c35eecfc6693101

commit d48194545eed1116a84d81e2fb53315d2b0701a7
Author: Jason Simmons <jsimmons@google.com>
Date:   Thu Jun 16 14:22:46 2011 -0700

    Change the interface of the AudioMixer and AudioBufferProvider to accept a presentation timestamp

    Change-Id: Ice2df5628d45a7f77100e7008103b35b3d3160a4

commit 02561419db82b01ffb28df38000716c612988427
Author: John Grossman <johngro@google.com>
Date:   Tue May 10 14:00:21 2011 -0700

    Put in a hack for controling master volume in the policy manager.
    Fix initial master volume reporting.

    Change-Id: Ia6caf2bbc6083c5f99fab852baa40fff10fc5fc7

commit 549cdc3ba115dc654cdade261fb055c72c6cdb79
Author: John Grossman <johngro@google.com>
Date:   Wed May 4 11:46:17 2011 -0700

    Make certain the logic for computing the output stream mixing point is hardened
    against underflow and overflow when input and output sample rates don't match.

    Change-Id: I5ebea07c9938107b435bec7413418622767e4e16

commit 8043d8ed63f51e76d452d22be7d453d4a7794530
Author: Jason Simmons <jsimmons@google.com>
Date:   Wed Apr 27 18:06:27 2011 -0700

    Add the patch for timed audio support to the mono resampler

    Change-Id: I526f34ae9d1e8e3b0ed2fb05af3d024d5c5fe711

commit 2be89486ef23f0b0b0cc2dc25a4c0ee691043f00
Author: John Grossman <johngro@google.com>
Date:   Wed Apr 27 10:38:57 2011 -0700

    Extend the AudioHWInterface to allow it to specify the initial master volume used by AudioFlinger.

    Change-Id: I8823330801c927494cf7ca31a6b8f9264fbfbb26

commit ff89a4d5e37e6a05a2b03f79ab4e97833dd66393
Author: John Grossman <johngro@google.com>
Date:   Wed Apr 27 09:07:14 2011 -0700

    Fix an issue with inconsistent volume reporting.

    Changed masterVolume() to return the same value as the last call
    to setMasterVolume when the HW layer is implementing master
    volume control.  The masterVolume/setMasterVolume API seems to be
    an idea which was abandonded a long time ago; as of today the
    system only ever sets it to 1.0 at startup and then never changes
    it.  Until we can figure out how the concept of external
    amplifier gain control fits into the Android audio framework,
    Tungsten is exposing this API via a hack-tastic invoke back door
    in the TungstenRXPlayer and needs the getter/setter results to be
    consistent.

    Change-Id: I2ac730fa8fc9ee28c88f1a8e6f2e493eb5b65544

commit 086511b2d19cceb976747ac23e12b73fc7c28bea
Author: Jason Simmons <jsimmons@google.com>
Date:   Mon Apr 25 16:07:19 2011 -0700

    Add handling of timed audio tracks in the generic resampling mixer

    Change-Id: Ic3be1d21b1117f1b233808be543c28a0dcec4792

Change-Id: I6ec5d2bca9b8ebc0acd395a7dd92e1a48fcdfa9b
Signed-off-by: Mike J. Chen <mjchen@google.com>
Signed-off-by: John Grossman <johngro@google.com>
Signed-off-by: Jason Simmons <jsimmons@google.com>
2011-10-28 10:14:48 -04:00

359 lines
14 KiB
C++

/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include "AudioResamplerSinc.h"
namespace android {
// ----------------------------------------------------------------------------
/*
* These coeficients are computed with the "fir" utility found in
* tools/resampler_tools
* TODO: A good optimization would be to transpose this matrix, to take
* better advantage of the data-cache.
*/
const int32_t AudioResamplerSinc::mFirCoefsUp[] = {
0x7fffffff, 0x7f15d078, 0x7c5e0da6, 0x77ecd867, 0x71e2e251, 0x6a6c304a, 0x61be7269, 0x58170412, 0x4db8ab05, 0x42e92ea6, 0x37eee214, 0x2d0e3bb1, 0x22879366, 0x18951e95, 0x0f693d0d, 0x072d2621,
0x00000000, 0xf9f66655, 0xf51a5fd7, 0xf16bbd84, 0xeee0d9ac, 0xed67a922, 0xece70de6, 0xed405897, 0xee50e505, 0xeff3be30, 0xf203370f, 0xf45a6741, 0xf6d67d53, 0xf957db66, 0xfbc2f647, 0xfe00f2b9,
0x00000000, 0x01b37218, 0x0313a0c6, 0x041d930d, 0x04d28057, 0x053731b0, 0x05534dff, 0x05309bfd, 0x04da440d, 0x045c1aee, 0x03c1fcdd, 0x03173ef5, 0x02663ae8, 0x01b7f736, 0x0113ec79, 0x007fe6a9,
0x00000000, 0xff96b229, 0xff44f99f, 0xff0a86be, 0xfee5f803, 0xfed518fd, 0xfed521fd, 0xfee2f4fd, 0xfefb54f8, 0xff1b159b, 0xff3f4203, 0xff6539e0, 0xff8ac502, 0xffae1ddd, 0xffcdf3f9, 0xffe96798,
0x00000000, 0x00119de6, 0x001e6b7e, 0x0026cb7a, 0x002b4830, 0x002c83d6, 0x002b2a82, 0x0027e67a, 0x002356f9, 0x001e098e, 0x001875e4, 0x0012fbbe, 0x000de2d1, 0x00095c10, 0x00058414, 0x00026636,
0x00000000, 0xfffe44a9, 0xfffd206d, 0xfffc7b7f, 0xfffc3c8f, 0xfffc4ac2, 0xfffc8f2b, 0xfffcf5c4, 0xfffd6df3, 0xfffdeab2, 0xfffe6275, 0xfffececf, 0xffff2c07, 0xffff788c, 0xffffb471, 0xffffe0f2,
0x00000000, 0x000013e6, 0x00001f03, 0x00002396, 0x00002399, 0x000020b6, 0x00001c3c, 0x00001722, 0x00001216, 0x00000d81, 0x0000099c, 0x0000067c, 0x00000419, 0x0000025f, 0x00000131, 0x00000070,
0x00000000, 0xffffffc7, 0xffffffb3, 0xffffffb3, 0xffffffbe, 0xffffffcd, 0xffffffdb, 0xffffffe7, 0xfffffff0, 0xfffffff7, 0xfffffffb, 0xfffffffe, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000 // this one is needed for lerping the last coefficient
};
/*
* These coefficients are optimized for 48KHz -> 44.1KHz (stop-band at 22.050KHz)
* It's possible to use the above coefficient for any down-sampling
* at the expense of a slower processing loop (we can interpolate
* these coefficient from the above by "Stretching" them in time).
*/
const int32_t AudioResamplerSinc::mFirCoefsDown[] = {
0x7fffffff, 0x7f55e46d, 0x7d5b4c60, 0x7a1b4b98, 0x75a7fb14, 0x7019f0bd, 0x698f875a, 0x622bfd59, 0x5a167256, 0x5178cc54, 0x487e8e6c, 0x3f53aae8, 0x36235ad4, 0x2d17047b, 0x245539ab, 0x1c00d540,
0x14383e57, 0x0d14d5ca, 0x06aa910b, 0x0107c38b, 0xfc351654, 0xf835abae, 0xf5076b45, 0xf2a37202, 0xf0fe9faa, 0xf00a3bbd, 0xefb4aa81, 0xefea2b05, 0xf0959716, 0xf1a11e83, 0xf2f6f7a0, 0xf481fff4,
0xf62e48ce, 0xf7e98ca5, 0xf9a38b4c, 0xfb4e4bfa, 0xfcde456f, 0xfe4a6d30, 0xff8c2fdf, 0x009f5555, 0x0181d393, 0x0233940f, 0x02b62f06, 0x030ca07d, 0x033afa62, 0x03461725, 0x03334f83, 0x030835fa,
0x02ca59cc, 0x027f12d1, 0x022b570d, 0x01d39a49, 0x017bb78f, 0x0126e414, 0x00d7aaaf, 0x008feec7, 0x0050f584, 0x001b73e3, 0xffefa063, 0xffcd46ed, 0xffb3ddcd, 0xffa29aaa, 0xff988691, 0xff949066,
0xff959d24, 0xff9a959e, 0xffa27195, 0xffac4011, 0xffb72d2b, 0xffc28569, 0xffcdb706, 0xffd85171, 0xffe20364, 0xffea97e9, 0xfff1f2b2, 0xfff80c06, 0xfffcec92, 0x0000a955, 0x00035fd8, 0x000532cf,
0x00064735, 0x0006c1f9, 0x0006c62d, 0x000673ba, 0x0005e68f, 0x00053630, 0x000475a3, 0x0003b397, 0x0002fac1, 0x00025257, 0x0001be9e, 0x0001417a, 0x0000dafd, 0x000089eb, 0x00004c28, 0x00001f1d,
0x00000000, 0xffffec10, 0xffffe0be, 0xffffdbc5, 0xffffdb39, 0xffffdd8b, 0xffffe182, 0xffffe638, 0xffffeb0a, 0xffffef8f, 0xfffff38b, 0xfffff6e3, 0xfffff993, 0xfffffba6, 0xfffffd30, 0xfffffe4a,
0xffffff09, 0xffffff85, 0xffffffd1, 0xfffffffb, 0x0000000f, 0x00000016, 0x00000015, 0x00000012, 0x0000000d, 0x00000009, 0x00000006, 0x00000003, 0x00000002, 0x00000001, 0x00000000, 0x00000000,
0x00000000 // this one is needed for lerping the last coefficient
};
// ----------------------------------------------------------------------------
static inline
int32_t mulRL(int left, int32_t in, uint32_t vRL)
{
#if defined(__arm__) && !defined(__thumb__)
int32_t out;
if (left) {
asm( "smultb %[out], %[in], %[vRL] \n"
: [out]"=r"(out)
: [in]"%r"(in), [vRL]"r"(vRL)
: );
} else {
asm( "smultt %[out], %[in], %[vRL] \n"
: [out]"=r"(out)
: [in]"%r"(in), [vRL]"r"(vRL)
: );
}
return out;
#else
if (left) {
return int16_t(in>>16) * int16_t(vRL&0xFFFF);
} else {
return int16_t(in>>16) * int16_t(vRL>>16);
}
#endif
}
static inline
int32_t mulAdd(int16_t in, int32_t v, int32_t a)
{
#if defined(__arm__) && !defined(__thumb__)
int32_t out;
asm( "smlawb %[out], %[v], %[in], %[a] \n"
: [out]"=r"(out)
: [in]"%r"(in), [v]"r"(v), [a]"r"(a)
: );
return out;
#else
return a + in * (v>>16);
// improved precision
// return a + in * (v>>16) + ((in * (v & 0xffff)) >> 16);
#endif
}
static inline
int32_t mulAddRL(int left, uint32_t inRL, int32_t v, int32_t a)
{
#if defined(__arm__) && !defined(__thumb__)
int32_t out;
if (left) {
asm( "smlawb %[out], %[v], %[inRL], %[a] \n"
: [out]"=r"(out)
: [inRL]"%r"(inRL), [v]"r"(v), [a]"r"(a)
: );
} else {
asm( "smlawt %[out], %[v], %[inRL], %[a] \n"
: [out]"=r"(out)
: [inRL]"%r"(inRL), [v]"r"(v), [a]"r"(a)
: );
}
return out;
#else
if (left) {
return a + (int16_t(inRL&0xFFFF) * (v>>16));
//improved precision
// return a + (int16_t(inRL&0xFFFF) * (v>>16)) + ((int16_t(inRL&0xFFFF) * (v & 0xffff)) >> 16);
} else {
return a + (int16_t(inRL>>16) * (v>>16));
}
#endif
}
// ----------------------------------------------------------------------------
AudioResamplerSinc::AudioResamplerSinc(int bitDepth,
int inChannelCount, int32_t sampleRate)
: AudioResampler(bitDepth, inChannelCount, sampleRate),
mState(0)
{
/*
* Layout of the state buffer for 32 tap:
*
* "present" sample beginning of 2nd buffer
* v v
* 0 01 2 23 3
* 0 F0 0 F0 F
* [pppppppppppppppInnnnnnnnnnnnnnnnpppppppppppppppInnnnnnnnnnnnnnnn]
* ^ ^ head
*
* p = past samples, convoluted with the (p)ositive side of sinc()
* n = future samples, convoluted with the (n)egative side of sinc()
* r = extra space for implementing the ring buffer
*
*/
const size_t numCoefs = 2*halfNumCoefs;
const size_t stateSize = numCoefs * inChannelCount * 2;
mState = new int16_t[stateSize];
memset(mState, 0, sizeof(int16_t)*stateSize);
mImpulse = mState + (halfNumCoefs-1)*inChannelCount;
mRingFull = mImpulse + (numCoefs+1)*inChannelCount;
}
AudioResamplerSinc::~AudioResamplerSinc()
{
delete [] mState;
}
void AudioResamplerSinc::init() {
}
void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount,
AudioBufferProvider* provider)
{
mFirCoefs = (mInSampleRate <= mSampleRate) ? mFirCoefsUp : mFirCoefsDown;
// select the appropriate resampler
switch (mChannelCount) {
case 1:
resample<1>(out, outFrameCount, provider);
break;
case 2:
resample<2>(out, outFrameCount, provider);
break;
}
}
template<int CHANNELS>
void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount,
AudioBufferProvider* provider)
{
int16_t* impulse = mImpulse;
uint32_t vRL = mVolumeRL;
size_t inputIndex = mInputIndex;
uint32_t phaseFraction = mPhaseFraction;
uint32_t phaseIncrement = mPhaseIncrement;
size_t outputIndex = 0;
size_t outputSampleCount = outFrameCount * 2;
size_t inFrameCount = (outFrameCount*mInSampleRate)/mSampleRate;
AudioBufferProvider::Buffer& buffer(mBuffer);
while (outputIndex < outputSampleCount) {
// buffer is empty, fetch a new one
while (buffer.frameCount == 0) {
buffer.frameCount = inFrameCount;
provider->getNextBuffer(&buffer,
calculateOutputPTS(outputIndex / 2));
if (buffer.raw == NULL) {
goto resample_exit;
}
const uint32_t phaseIndex = phaseFraction >> kNumPhaseBits;
if (phaseIndex == 1) {
// read one frame
read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex);
} else if (phaseIndex == 2) {
// read 2 frames
read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex);
inputIndex++;
if (inputIndex >= mBuffer.frameCount) {
inputIndex -= mBuffer.frameCount;
provider->releaseBuffer(&buffer);
} else {
read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex);
}
}
}
int16_t *in = buffer.i16;
const size_t frameCount = buffer.frameCount;
// Always read-in the first samples from the input buffer
int16_t* head = impulse + halfNumCoefs*CHANNELS;
head[0] = in[inputIndex*CHANNELS + 0];
if (CHANNELS == 2)
head[1] = in[inputIndex*CHANNELS + 1];
// handle boundary case
int32_t l, r;
while (outputIndex < outputSampleCount) {
filterCoefficient<CHANNELS>(l, r, phaseFraction, impulse);
out[outputIndex++] += 2 * mulRL(1, l, vRL);
out[outputIndex++] += 2 * mulRL(0, r, vRL);
phaseFraction += phaseIncrement;
const uint32_t phaseIndex = phaseFraction >> kNumPhaseBits;
if (phaseIndex == 1) {
inputIndex++;
if (inputIndex >= frameCount)
break; // need a new buffer
read<CHANNELS>(impulse, phaseFraction, in, inputIndex);
} else if(phaseIndex == 2) { // maximum value
inputIndex++;
if (inputIndex >= frameCount)
break; // 0 frame available, 2 frames needed
// read first frame
read<CHANNELS>(impulse, phaseFraction, in, inputIndex);
inputIndex++;
if (inputIndex >= frameCount)
break; // 0 frame available, 1 frame needed
// read second frame
read<CHANNELS>(impulse, phaseFraction, in, inputIndex);
}
}
// if done with buffer, save samples
if (inputIndex >= frameCount) {
inputIndex -= frameCount;
provider->releaseBuffer(&buffer);
}
}
resample_exit:
mImpulse = impulse;
mInputIndex = inputIndex;
mPhaseFraction = phaseFraction;
}
template<int CHANNELS>
/***
* read()
*
* This function reads only one frame from input buffer and writes it in
* state buffer
*
**/
void AudioResamplerSinc::read(
int16_t*& impulse, uint32_t& phaseFraction,
int16_t const* in, size_t inputIndex)
{
const uint32_t phaseIndex = phaseFraction >> kNumPhaseBits;
impulse += CHANNELS;
phaseFraction -= 1LU<<kNumPhaseBits;
if (impulse >= mRingFull) {
const size_t stateSize = (halfNumCoefs*2)*CHANNELS;
memcpy(mState, mState+stateSize, sizeof(int16_t)*stateSize);
impulse -= stateSize;
}
int16_t* head = impulse + halfNumCoefs*CHANNELS;
head[0] = in[inputIndex*CHANNELS + 0];
if (CHANNELS == 2)
head[1] = in[inputIndex*CHANNELS + 1];
}
template<int CHANNELS>
void AudioResamplerSinc::filterCoefficient(
int32_t& l, int32_t& r, uint32_t phase, int16_t const *samples)
{
// compute the index of the coefficient on the positive side and
// negative side
uint32_t indexP = (phase & cMask) >> cShift;
uint16_t lerpP = (phase & pMask) >> pShift;
uint32_t indexN = (-phase & cMask) >> cShift;
uint16_t lerpN = (-phase & pMask) >> pShift;
if ((indexP == 0) && (lerpP == 0)) {
indexN = cMask >> cShift;
lerpN = pMask >> pShift;
}
l = 0;
r = 0;
int32_t const* coefs = mFirCoefs;
int16_t const *sP = samples;
int16_t const *sN = samples+CHANNELS;
for (unsigned int i=0 ; i<halfNumCoefs/4 ; i++) {
interpolate<CHANNELS>(l, r, coefs+indexP, lerpP, sP);
interpolate<CHANNELS>(l, r, coefs+indexN, lerpN, sN);
sP -= CHANNELS; sN += CHANNELS; coefs += 1<<coefsBits;
interpolate<CHANNELS>(l, r, coefs+indexP, lerpP, sP);
interpolate<CHANNELS>(l, r, coefs+indexN, lerpN, sN);
sP -= CHANNELS; sN += CHANNELS; coefs += 1<<coefsBits;
interpolate<CHANNELS>(l, r, coefs+indexP, lerpP, sP);
interpolate<CHANNELS>(l, r, coefs+indexN, lerpN, sN);
sP -= CHANNELS; sN += CHANNELS; coefs += 1<<coefsBits;
interpolate<CHANNELS>(l, r, coefs+indexP, lerpP, sP);
interpolate<CHANNELS>(l, r, coefs+indexN, lerpN, sN);
sP -= CHANNELS; sN += CHANNELS; coefs += 1<<coefsBits;
}
}
template<int CHANNELS>
void AudioResamplerSinc::interpolate(
int32_t& l, int32_t& r,
int32_t const* coefs, int16_t lerp, int16_t const* samples)
{
int32_t c0 = coefs[0];
int32_t c1 = coefs[1];
int32_t sinc = mulAdd(lerp, (c1-c0)<<1, c0);
if (CHANNELS == 2) {
uint32_t rl = *reinterpret_cast<uint32_t const*>(samples);
l = mulAddRL(1, rl, sinc, l);
r = mulAddRL(0, rl, sinc, r);
} else {
r = l = mulAdd(samples[0], sinc, l);
}
}
// ----------------------------------------------------------------------------
}; // namespace android