History log of /frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5e58b0abe5b6c8f5bd96a8f78bbeeeb4d3892020 24-Jun-2014 Andy Hung <hunga@google.com> Add floating point volume handling to AudioMixer

Use floating point volume in AudioMixer mixing when floating
point input is used with the new mixer engine.
AudioResampler is updated to take floating point volume to match.
Both legacy integer and floating point mixer engines work.

For now, integer volume is used when the new mixer engine
runs in integer input mode, for backward compatibility with
the legacy mixer. The new mixer engine will generally run in
floating point input mode. When the legacy path is removed,
the integer volumes will be removed.

Change-Id: I79e80c292ae7c8b8bdd0aa371a1b2c3a1b618290
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
3348e36c51e91e78020bcc6578eda83d97c31bec 07-Jul-2014 Andy Hung <hunga@google.com> Replace int bitDepth with audio_format_t in Resampler

Remove mBitDepth from class (not used).
Replace with audio_format_t in factory method to distinguish
between float and pcm 16-bit.

Change-Id: I166860796c68285077ef4458d8758d19b82523f9
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
e273141263e988ab086a8d41e0e4fc75c00f1b86 24-Apr-2014 Glenn Kasten <gkasten@android.com> am 7e5c6351: am 4513aa2c: Merge "AArch64: rewrite audioflinger\'s sinc resample by intrinsics."

* commit '7e5c635114a7762ad44581300021667a0da97389':
AArch64: rewrite audioflinger's sinc resample by intrinsics.
12b44bd5fe3069cd3450d05b6c446b600e0553d3 10-Apr-2014 Zhongwei Yao <zhongwei.yao@arm.com> AArch64: rewrite audioflinger's sinc resample by intrinsics.

Pass conformance test on armv7 and aarch64, performance test is done on armv7.
Compared with original armv7 assembly version, this version has similar
result. Here is performance data on pandaboard android4.4 (input: random wave
file, unit: Mspl/s, toolchain:gcc 4.8):

| | origin(assembly) | current(intrinsics) | C version |
|----------------+------------------+---------------------+-----------|
| single channel | 6.17 | 7.14 | 3.43 |
| double channel | 5.24 | 5.63 | 3.50 |

Change-Id: If5670218e1586e9dfd2b8d9c66a6880f3e4808ca
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
24781fff62a4cf7279d3dac83c33e2ac612712ba 19-Feb-2014 Andy Hung <hunga@google.com> Fix resampler to allow output of single frame

Bug: 13073201
Change-Id: If7818a3389a191a37277bbd8e96a59ef8ce68509
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
92b1343f5fbc2fc43198a0a1252fe023cc9a5061 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
c4974312e5a1e2ab94eca56045f991baf1508d73 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
bc9ea63daaad764d242ce0eadfeb697abb9ce34e 20-Nov-2012 Mathias Agopian <mathias@google.com> fix a typo in SINC resampler that prevented tracks to be mixed

we were always erasing the current mix instead of mixing into it.

Change-Id: Ib229245f9e5a0d384f1727640a59e9f0469211a2
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
d6864faccd19096b72d32481a3cc475e6d36e50d 20-Nov-2012 Mathias Agopian <mathias@google.com> fix a typo in SINC resampler that prevented tracks to be mixed

we were always erasing the current mix instead of mixing into it.

Change-Id: Ib229245f9e5a0d384f1727640a59e9f0469211a2
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
5d3370d0db4dc97fa413a302e426fb24e87462be 10-Nov-2012 Mathias Agopian <mathias@google.com> more optimizations...

calculate the offsets from the phase differently, this happens
to reduce the register pressure in the main loop, which in turns
allows the compiler to generate much better code (doesn't need
to spill a lot of stuff on the stack).

this gives another 15% performance increase

Change-Id: I2ce3479dd48b9e6941adb80e6d443d6e14d64d96
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
7492a7ff46a75b5d8e10ae11d4ad50429cf945ce 10-Nov-2012 Mathias Agopian <mathias@google.com> more optimizations...

calculate the offsets from the phase differently, this happens
to reduce the register pressure in the main loop, which in turns
allows the compiler to generate much better code (doesn't need
to spill a lot of stuff on the stack).

this gives another 15% performance increase

Change-Id: I2ce3479dd48b9e6941adb80e6d443d6e14d64d96
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
3c11ff2f409a0abb5b9d8ffd5e13cc42cda67fdc 10-Nov-2012 Mathias Agopian <mathias@google.com> refactor code to improve neon code

we want to make sure we don't transfer data from the
neon unit to the arm register file, as this can be quite
slow. instead we do all the calculation on the neon side
and write the result directly to main memory.

Change-Id: Ibb56664d3ab03098ae2798b75e2b6927ac900187
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
0d585c85524eb5d398fadff5ca8dd43939ed9cb4 10-Nov-2012 Mathias Agopian <mathias@google.com> refactor code to improve neon code

we want to make sure we don't transfer data from the
neon unit to the arm register file, as this can be quite
slow. instead we do all the calculation on the neon side
and write the result directly to main memory.

Change-Id: Ibb56664d3ab03098ae2798b75e2b6927ac900187
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
c6ccbabd2800e749bc86a34d2ae233f99102ba51 05-Nov-2012 Mathias Agopian <mathias@google.com> NEON optimized SINC resampler

this currently gives us a 60% to 80% boost depending
on the quality level selected.

Change-Id: I7db385007e811ed7bffe5fd3403b44e300894f5b
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
ad9af03c4b491912239fc8c97a3ad0d342a33303 05-Nov-2012 Mathias Agopian <mathias@google.com> NEON optimized SINC resampler

this currently gives us a 60% to 80% boost depending
on the quality level selected.

Change-Id: I7db385007e811ed7bffe5fd3403b44e300894f5b
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
af03dfb73d05dfabdf55640aff8b2256fdd78663 05-Nov-2012 Mathias Agopian <mathias@google.com> minor cleanups

Change-Id: Ia12ee4fb59e90221761bec85e6450db29197591f
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
7aa7ed773040ea60bbe0a2a6ea949d62802304a4 05-Nov-2012 Mathias Agopian <mathias@google.com> minor cleanups

Change-Id: Ia12ee4fb59e90221761bec85e6450db29197591f
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
e8299af5665bf9c396466c33b9b16a84fe78c7f6 04-Nov-2012 Mathias Agopian <mathias@google.com> change how we store the FIR coefficients

The coefficient table is now transposed and shows
much better its polyphase nature: we now have a FIR
per line, each line corresponding to a phase.

This doesn't change at all the results produced by
the filter, but allows us to make slightly better
use of the data cache and improves performance a bit
(although not as much as I thought it would).

The main benefit is that it is the first step
before we can make much larger optimizations
(like using NEON).

Change-Id: Iebf7695825dcbd41f25861efcaefbaa3365ecb43
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
46afbec3743f1d799f185273ff897d1f8e0175dd 04-Nov-2012 Mathias Agopian <mathias@google.com> change how we store the FIR coefficients

The coefficient table is now transposed and shows
much better its polyphase nature: we now have a FIR
per line, each line corresponding to a phase.

This doesn't change at all the results produced by
the filter, but allows us to make slightly better
use of the data cache and improves performance a bit
(although not as much as I thought it would).

The main benefit is that it is the first step
before we can make much larger optimizations
(like using NEON).

Change-Id: Iebf7695825dcbd41f25861efcaefbaa3365ecb43
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
50ebdf2086b645b9b703a6d489238767a9afb34f 04-Nov-2012 Mathias Agopian <mathias@google.com> improve SINC resampler performance

The improvement is about 60% by just tweaking a few
things to help the compiler generate better code.
It turns out that inlining too much stuff manually was hurting us.

Change-Id: I8068f0f75051f95ac600e50ce552572dd1e8c304
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
a798c97386a842d06d290797ba5dce95d031332a 04-Nov-2012 Mathias Agopian <mathias@google.com> improve SINC resampler performance

The improvement is about 60% by just tweaking a few
things to help the compiler generate better code.
It turns out that inlining too much stuff manually was hurting us.

Change-Id: I8068f0f75051f95ac600e50ce552572dd1e8c304
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
c5b0b9a13a29be483173f092663ed17ea306ac0d 02-Nov-2012 Mathias Agopian <mathias@google.com> new coefficients for the vhq resampler

previous coefficients were provided by a 3rd party and didn't have a
way to re-generate them. we're now using the 'fir' utility.

the performance of the filter is virtually identical, except for
the down-sampling case which seems slightly better now:
It looks like both the previous and new coefficients are generating
some sort of clipping for full-scale signals in the down-sampling case
(although the new ones seem better), the reason for that is
unknown (see bug: 7453062)

Also updated the HQ coefficients for the down-samplers, previous ones
were a little bit too conservative -- the new ones push the cut-off
frequency up by about 1 KHz.

Change-Id: I54a827b5c707c7cc41268ed01283758dce1d7647
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
4ed475d3ad4231370371e14a94779c5d300eb3c5 02-Nov-2012 Mathias Agopian <mathias@google.com> new coefficients for the vhq resampler

previous coefficients were provided by a 3rd party and didn't have a
way to re-generate them. we're now using the 'fir' utility.

the performance of the filter is virtually identical, except for
the down-sampling case which seems slightly better now:
It looks like both the previous and new coefficients are generating
some sort of clipping for full-scale signals in the down-sampling case
(although the new ones seem better), the reason for that is
unknown (see bug: 7453062)

Also updated the HQ coefficients for the down-samplers, previous ones
were a little bit too conservative -- the new ones push the cut-off
frequency up by about 1 KHz.

Change-Id: I54a827b5c707c7cc41268ed01283758dce1d7647
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
d7a3c142b3ce4ed26e025533f57bef9e4ec58740 30-Oct-2012 Mathias Agopian <mathias@google.com> fix SINC resampler on non ARM architectures

make sure the C version of the code generates the same
output than the ARM assemply version.

Change-Id: Ide218785c35d02598b2d7278e646b1b178148698
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
1f09b4ada212d259b531228db67ca160d280275c 30-Oct-2012 Mathias Agopian <mathias@google.com> fix SINC resampler on non ARM architectures

make sure the C version of the code generates the same
output than the ARM assemply version.

Change-Id: Ide218785c35d02598b2d7278e646b1b178148698
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
cca56d5784c02a5f02ce5e47c3d6583d71a2469b 30-Oct-2012 Mathias Agopian <mathias@google.com> fix another issue with generating FIR coefficients

the impulse response of a low-pass is 2*f*sinc(2*pi*f*k), we were
missing the 2*f scale factor. This explains why we were seeing
clipping and had to manually scale the filter down.

Change-Id: I86d0bb82ecdd99681c8ba5a8112a8257bf6f0186
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
d88a051aff15fdf5c57e1e5a4083bbd9635af3ad 30-Oct-2012 Mathias Agopian <mathias@google.com> fix another issue with generating FIR coefficients

the impulse response of a low-pass is 2*f*sinc(2*pi*f*k), we were
missing the 2*f scale factor. This explains why we were seeing
clipping and had to manually scale the filter down.

Change-Id: I86d0bb82ecdd99681c8ba5a8112a8257bf6f0186
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
7c4349fe6e1e4faaa0c0db40a74f2ccbac46f57e 30-Oct-2012 Mathias Agopian <mathias@google.com> fir a typo that caused up-sampling coefficiens to be wrong

up-sample coefficient were generated with a cut-off frequency of 24KHz
intead of ~20KHz, which caused more aliasing in the audible band.

also increased the attenuation to 1.3 dB on both up and down
sampling coefficient to avoid clipping.

Change-Id: Ie8aeecf1429190541b656810c6716b6aae5ece2e
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
b4b75b47c2a4248e60bbc3229d6acc4d5f872431 30-Oct-2012 Mathias Agopian <mathias@google.com> fir a typo that caused up-sampling coefficiens to be wrong

up-sample coefficient were generated with a cut-off frequency of 24KHz
intead of ~20KHz, which caused more aliasing in the audible band.

also increased the attenuation to 1.3 dB on both up and down
sampling coefficient to avoid clipping.

Change-Id: Ie8aeecf1429190541b656810c6716b6aae5ece2e
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
3bd72cc23f74e750069a2943ad3d5c9af3be4b55 26-Oct-2012 Mathias Agopian <mathias@google.com> improve SINC resampler coefficients

- we increase the interpolation precision from 4 to 7 bits
this doesn't increase CPU power required, it only increases the
size of the filter table but significantly reduces the noise
introduced by the quantization of the impulse response.

- the parameters of the filter are set such that aliasing is
rejected at 80 dB below 20 KHz. Because we don't use a lot of
coefficient (to save compute power), there are quite a bit of
attenuation in the pass-band: starting at 9KHz for the
down-sampler (48 to 44.1), and starting at 13 KHz for the
up-sampler (44.1 to 48) -- the transition band is about 15 KHz.

Change-Id: I855548d2aab8a0fb0d2a2da3a364b6842d7d3838
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
443e69625d598ea578e2c838960778ce498fd773 26-Oct-2012 Mathias Agopian <mathias@google.com> improve SINC resampler coefficients

- we increase the interpolation precision from 4 to 7 bits
this doesn't increase CPU power required, it only increases the
size of the filter table but significantly reduces the noise
introduced by the quantization of the impulse response.

- the parameters of the filter are set such that aliasing is
rejected at 80 dB below 20 KHz. Because we don't use a lot of
coefficient (to save compute power), there are quite a bit of
attenuation in the pass-band: starting at 9KHz for the
down-sampler (48 to 44.1), and starting at 13 KHz for the
up-sampler (44.1 to 48) -- the transition band is about 15 KHz.

Change-Id: I855548d2aab8a0fb0d2a2da3a364b6842d7d3838
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
ebed918320bdacdb225f679a8d7135d1acd3fe51 21-Oct-2012 Mathias Agopian <mathias@google.com> Fix a typo that caused the high quality resampler to produce garbage

the problem is that if libaudio_resampler is present, it is those
coefficients that will always be selected, but the correct
meta-data.

Bug: 7385994
Change-Id: Ieebeb37b4dfb62a1a051bc29fae2ce056dbc6621
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
61ea117b03b53382b5ecbc33004c7d37ea70ea8b 21-Oct-2012 Mathias Agopian <mathias@google.com> Fix a typo that caused the high quality resampler to produce garbage

the problem is that if libaudio_resampler is present, it is those
coefficients that will always be selected, but the correct
meta-data.

Bug: 7385994
Change-Id: Ieebeb37b4dfb62a1a051bc29fae2ce056dbc6621
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
a6d41334d25ffde12484eb28301352560a063ef6 01-Oct-2012 Glenn Kasten <gkasten@google.com> Integrate improved coefficient sinc resampler: VHQ

Summary:
Very high quality is enabled only for 44.1 -> 48 or 48 -> 44.1,
and uses low quality for all other use cases.
Track estimated CPU load and throttles the quality based on load;
as currently configured it should allow up to 2 instances of very high quality.
Medium quality and high quality are currently disabled unless explicitly requested.

Details:
Only load .so the first time it is needed.
Cleanup code style: formatting, indentation, whitespace.
Restore medium quality resampler, but it is not used (see next line).
Fix memory leak for sinc resampler.
Check sample rate in resampler constructor.
Add logs for debugging.
Rename DEFAULT to DEFAULT_QUALITY for consistency with other quality levels.
Renumber VERY_HIGH_QUALITY from 255 to 4.
Use enum src_quality consistently.
Improve parsing of property af.resampler.quality.
Fix reentrancy bug - allow an instance of high quality and an instance
of very high quality to both be active concurrently.

Bug: 7229644
Change-Id: I0ce6b913b05038889f50462a38830b61a602a9f7
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
ac6020508acedd316391dee42329040bf45f8d90 01-Oct-2012 Glenn Kasten <gkasten@google.com> Integrate improved coefficient sinc resampler: VHQ

Summary:
Very high quality is enabled only for 44.1 -> 48 or 48 -> 44.1,
and uses low quality for all other use cases.
Track estimated CPU load and throttles the quality based on load;
as currently configured it should allow up to 2 instances of very high quality.
Medium quality and high quality are currently disabled unless explicitly requested.

Details:
Only load .so the first time it is needed.
Cleanup code style: formatting, indentation, whitespace.
Restore medium quality resampler, but it is not used (see next line).
Fix memory leak for sinc resampler.
Check sample rate in resampler constructor.
Add logs for debugging.
Rename DEFAULT to DEFAULT_QUALITY for consistency with other quality levels.
Renumber VERY_HIGH_QUALITY from 255 to 4.
Use enum src_quality consistently.
Improve parsing of property af.resampler.quality.
Fix reentrancy bug - allow an instance of high quality and an instance
of very high quality to both be active concurrently.

Bug: 7229644
Change-Id: I0ce6b913b05038889f50462a38830b61a602a9f7
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
41dfd129a181a5b0b62628733cf96e0ce11d64d7 17-Jan-2012 SathishKumar Mani <smani@codeaurora.org> audioflinger: use resample coefficients from audio-resampler library.

-Add a separate quality VERY_HIGH_QUALITY in resampler
-Use resample coefficients audio-resampler library for
quality VERY_HIGH_QUALITY.
-This improves the quality of resampled output.

Bug: 7024293
Change-Id: Ia44142413bed5f5963d7eab7846eec877a2415e4
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
76b111685010e1fea7c0a865c038aee35507fde4 17-Jan-2012 SathishKumar Mani <smani@codeaurora.org> audioflinger: use resample coefficients from audio-resampler library.

-Add a separate quality VERY_HIGH_QUALITY in resampler
-Use resample coefficients audio-resampler library for
quality VERY_HIGH_QUALITY.
-This improves the quality of resampled output.

Bug: 7024293
Change-Id: Ia44142413bed5f5963d7eab7846eec877a2415e4
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
e53b9ead781c36e96d6b6f012ddffc93a3d80f0d 13-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace and indentation

Fix indentation to be multiple of 4.
Make it easier to search:
sp< not sp < to
"switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
4ff14bae91075eb274eb1c2975982358946e7e63 09-Feb-2012 John Grossman <johngro@google.com> Upintegrate Audio Flinger changes from ICS_AAH

Bring in changes to audio flinger made to support timed audio tracks
and HW master volume control.

Change-Id: Ide52d48809bdbed13acf35fd59b24637e35064ae
Signed-off-by: John Grossman <johngro@google.com>
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
d198b61603d5fa9298edea4ddb5852ea45159906 02-Feb-2012 Glenn Kasten <gkasten@google.com> Remove aliasing

Code was aliasing mBuffer as buffer, but continuing to use both buffer
and mBuffer after that point. This was at best misleading, and at worst
could confuse the compiler into generating bad code. There was no
performance advantage to the alias, in fact removing it saves 16 bytes.

Change-Id: I55023ddba465d9be82f66745b088d18af658ac60
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
54c3b66444ebfb9f2265ee70ac3b76ccefa0506a 06-Jan-2012 Glenn Kasten <gkasten@google.com> By convention const goes before the type specifier

Change-Id: I70203abd6a6f54e5bd9f1412800cc01212157e58
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp
65ab47156e1c7dfcd8cc4266253a5ff30219e7f0 15-Jul-2010 Mathias Agopian <mathias@google.com> move native services under services/

moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8
/frameworks/av/services/audioflinger/AudioResamplerSinc.cpp