summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-02-12 19:53:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-12 19:53:08 +0000
commitc6d7ab74962bfd24d105277b28248b4819763abd (patch)
tree2cf257b2bb4259cf667f2789f498939fe985a44c /services
parent39a7ae62fd17182f9338f2d08647df3c248be682 (diff)
parenta3bb9a3a25b58669d75da4f73764ac4c2bf34158 (diff)
downloadframeworks_av-c6d7ab74962bfd24d105277b28248b4819763abd.zip
frameworks_av-c6d7ab74962bfd24d105277b28248b4819763abd.tar.gz
frameworks_av-c6d7ab74962bfd24d105277b28248b4819763abd.tar.bz2
Merge "Proper adjustment of filterlength for downsampling"
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioResamplerDyn.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/services/audioflinger/AudioResamplerDyn.cpp b/services/audioflinger/AudioResamplerDyn.cpp
index cd67df5..54c2309 100644
--- a/services/audioflinger/AudioResamplerDyn.cpp
+++ b/services/audioflinger/AudioResamplerDyn.cpp
@@ -283,17 +283,25 @@ void AudioResamplerDyn::setSampleRate(int32_t inSampleRate) {
// 32b coefficients, 64 length
useS32 = true;
stopBandAtten = 98.;
- halfLength = 32;
+ if (inSampleRate >= mSampleRate * 4) {
+ halfLength = 48;
+ } else if (inSampleRate >= mSampleRate * 2) {
+ halfLength = 40;
+ } else {
+ halfLength = 32;
+ }
} else if (mFilterQuality == DYN_LOW_QUALITY) {
// 16b coefficients, 16-32 length
useS32 = false;
stopBandAtten = 80.;
- if (mSampleRate >= inSampleRate * 2) {
+ if (inSampleRate >= mSampleRate * 4) {
+ halfLength = 24;
+ } else if (inSampleRate >= mSampleRate * 2) {
halfLength = 16;
} else {
halfLength = 8;
}
- if (mSampleRate >= inSampleRate) {
+ if (inSampleRate <= mSampleRate) {
tbwCheat = 1.05;
} else {
tbwCheat = 1.03;
@@ -303,14 +311,14 @@ void AudioResamplerDyn::setSampleRate(int32_t inSampleRate) {
// note: > 64 length filters with 16b coefs can have quantization noise problems
useS32 = false;
stopBandAtten = 84.;
- if (mSampleRate >= inSampleRate * 4) {
+ if (inSampleRate >= mSampleRate * 4) {
halfLength = 32;
- } else if (mSampleRate >= inSampleRate * 2) {
+ } else if (inSampleRate >= mSampleRate * 2) {
halfLength = 24;
} else {
halfLength = 16;
}
- if (mSampleRate >= inSampleRate) {
+ if (inSampleRate <= mSampleRate) {
tbwCheat = 1.03;
} else {
tbwCheat = 1.01;