Merge "Use ALOGVV instead of commented ALOGV"
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index 95ca6fd..3052ad9 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -25,4 +25,6 @@
 
 LOCAL_PRELINK_MODULE := false
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/downmix/EffectDownmix.c b/media/libeffects/downmix/EffectDownmix.c
index 5bf052a..f17a6e8 100644
--- a/media/libeffects/downmix/EffectDownmix.c
+++ b/media/libeffects/downmix/EffectDownmix.c
@@ -58,13 +58,13 @@
         NULL /* no process_reverse function, no reference stream needed */
 };
 
+// This is the only symbol that needs to be exported
+__attribute__ ((visibility ("default")))
 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
     tag : AUDIO_EFFECT_LIBRARY_TAG,
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Downmix Library",
     implementor : "The Android Open Source Project",
-    query_num_effects : DownmixLib_QueryNumberEffects,
-    query_effect : DownmixLib_QueryEffect,
     create_effect : DownmixLib_Create,
     release_effect : DownmixLib_Release,
     get_descriptor : DownmixLib_GetDescriptor,
@@ -159,25 +159,6 @@
 
 /*--- Effect Library Interface Implementation ---*/
 
-int32_t DownmixLib_QueryNumberEffects(uint32_t *pNumEffects) {
-    ALOGV("DownmixLib_QueryNumberEffects()");
-    *pNumEffects = kNbEffects;
-    return 0;
-}
-
-int32_t DownmixLib_QueryEffect(uint32_t index, effect_descriptor_t *pDescriptor) {
-    ALOGV("DownmixLib_QueryEffect() index=%d", index);
-    if (pDescriptor == NULL) {
-        return -EINVAL;
-    }
-    if (index >= (uint32_t)kNbEffects) {
-        return -EINVAL;
-    }
-    memcpy(pDescriptor, gDescriptors[index], sizeof(effect_descriptor_t));
-    return 0;
-}
-
-
 int32_t DownmixLib_Create(const effect_uuid_t *uuid,
         int32_t sessionId,
         int32_t ioId,
diff --git a/media/libeffects/downmix/EffectDownmix.h b/media/libeffects/downmix/EffectDownmix.h
index be3ca3f..cb6b957 100644
--- a/media/libeffects/downmix/EffectDownmix.h
+++ b/media/libeffects/downmix/EffectDownmix.h
@@ -65,9 +65,6 @@
  * Effect API
  *------------------------------------
 */
-int32_t DownmixLib_QueryNumberEffects(uint32_t *pNumEffects);
-int32_t DownmixLib_QueryEffect(uint32_t index,
-        effect_descriptor_t *pDescriptor);
 int32_t DownmixLib_Create(const effect_uuid_t *uuid,
         int32_t sessionId,
         int32_t ioId,
diff --git a/media/libeffects/lvm/lib/Android.mk b/media/libeffects/lvm/lib/Android.mk
index f49267e..bb56c75 100644
--- a/media/libeffects/lvm/lib/Android.mk
+++ b/media/libeffects/lvm/lib/Android.mk
@@ -105,8 +105,6 @@
 
 LOCAL_MODULE:= libmusicbundle
 
-
-
 LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/Eq/lib \
     $(LOCAL_PATH)/Eq/src \
@@ -121,8 +119,12 @@
     $(LOCAL_PATH)/StereoWidening/src \
     $(LOCAL_PATH)/StereoWidening/lib
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 include $(BUILD_STATIC_LIBRARY)
 
+
+
 # Reverb library
 include $(CLEAR_VARS)
 
@@ -168,12 +170,11 @@
 
 LOCAL_MODULE:= libreverb
 
-
-
 LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/Reverb/lib \
     $(LOCAL_PATH)/Reverb/src \
     $(LOCAL_PATH)/Common/lib \
     $(LOCAL_PATH)/Common/src
 
+LOCAL_CFLAGS += -fvisibility=hidden
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index 4313424..f1af389 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -9,28 +9,27 @@
 LOCAL_SRC_FILES:= \
 	Bundle/EffectBundle.cpp
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 LOCAL_MODULE:= libbundlewrapper
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
 
-
-
 LOCAL_STATIC_LIBRARIES += libmusicbundle
 
 LOCAL_SHARED_LIBRARIES := \
      libcutils \
      libdl
 
-
 LOCAL_C_INCLUDES += \
 	$(LOCAL_PATH)/Bundle \
 	$(LOCAL_PATH)/../lib/Common/lib/ \
 	$(LOCAL_PATH)/../lib/Bundle/lib/ \
 	$(call include-path-for, audio-effects)
 
-
 include $(BUILD_SHARED_LIBRARY)
 
+
 # reverb wrapper
 include $(CLEAR_VARS)
 
@@ -39,12 +38,12 @@
 LOCAL_SRC_FILES:= \
     Reverb/EffectReverb.cpp
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 LOCAL_MODULE:= libreverbwrapper
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
 
-
-
 LOCAL_STATIC_LIBRARIES += libreverb
 
 LOCAL_SHARED_LIBRARIES := \
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index d706c2d..94b9acf 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -158,42 +158,6 @@
 int Effect_setEnabled(EffectContext *pContext, bool enabled);
 
 /* Effect Library Interface Implementation */
-extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    ALOGV("\n\tEffectQueryNumberEffects start");
-    *pNumEffects = 4;
-    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    ALOGV("\tEffectQueryNumberEffects end\n");
-    return 0;
-}     /* end EffectQueryNumberEffects */
-
-extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor){
-    ALOGV("\n\tEffectQueryEffect start");
-    ALOGV("\tEffectQueryEffect processing index %d", index);
-
-    if (pDescriptor == NULL){
-        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
-        return -EINVAL;
-    }
-    if (index > 3){
-        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
-        return -ENOENT;
-    }
-    if(index == LVM_BASS_BOOST){
-        ALOGV("\tEffectQueryEffect processing LVM_BASS_BOOST");
-        *pDescriptor = gBassBoostDescriptor;
-    }else if(index == LVM_VIRTUALIZER){
-        ALOGV("\tEffectQueryEffect processing LVM_VIRTUALIZER");
-        *pDescriptor = gVirtualizerDescriptor;
-    } else if(index == LVM_EQUALIZER){
-        ALOGV("\tEffectQueryEffect processing LVM_EQUALIZER");
-        *pDescriptor = gEqualizerDescriptor;
-    } else if(index == LVM_VOLUME){
-        ALOGV("\tEffectQueryEffect processing LVM_VOLUME");
-        *pDescriptor = gVolumeDescriptor;
-    }
-    ALOGV("\tEffectQueryEffect end\n");
-    return 0;
-}     /* end EffectQueryEffect */
 
 extern "C" int EffectCreate(const effect_uuid_t *uuid,
                             int32_t             sessionId,
@@ -3299,13 +3263,13 @@
     NULL,
 };    /* end gLvmEffectInterface */
 
+// This is the only symbol that needs to be exported
+__attribute__ ((visibility ("default")))
 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
     tag : AUDIO_EFFECT_LIBRARY_TAG,
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Effect Bundle Library",
     implementor : "NXP Software Ltd.",
-    query_num_effects : android::EffectQueryNumberEffects,
-    query_effect : android::EffectQueryEffect,
     create_effect : android::EffectCreate,
     release_effect : android::EffectRelease,
     get_descriptor : android::EffectGetDescriptor,
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 941d651..87e2c85 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -186,30 +186,6 @@
 int Reverb_LoadPreset       (ReverbContext   *pContext);
 
 /* Effect Library Interface Implementation */
-extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    ALOGV("\n\tEffectQueryNumberEffects start");
-    *pNumEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    ALOGV("\tEffectQueryNumberEffects end\n");
-    return 0;
-}     /* end EffectQueryNumberEffects */
-
-extern "C" int EffectQueryEffect(uint32_t index,
-                                 effect_descriptor_t *pDescriptor){
-    ALOGV("\n\tEffectQueryEffect start");
-    ALOGV("\tEffectQueryEffect processing index %d", index);
-    if (pDescriptor == NULL){
-        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
-        return -EINVAL;
-    }
-    if (index >= sizeof(gDescriptors) / sizeof(const effect_descriptor_t *)) {
-        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
-        return -ENOENT;
-    }
-    *pDescriptor = *gDescriptors[index];
-    ALOGV("\tEffectQueryEffect end\n");
-    return 0;
-}     /* end EffectQueryEffect */
 
 extern "C" int EffectCreate(const effect_uuid_t *uuid,
                             int32_t             sessionId,
@@ -2170,13 +2146,13 @@
     NULL,
 };    /* end gReverbInterface */
 
+// This is the only symbol that needs to be exported
+__attribute__ ((visibility ("default")))
 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
     tag : AUDIO_EFFECT_LIBRARY_TAG,
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Reverb Library",
     implementor : "NXP Software Ltd.",
-    query_num_effects : android::EffectQueryNumberEffects,
-    query_effect : android::EffectQueryEffect,
     create_effect : android::EffectCreate,
     release_effect : android::EffectRelease,
     get_descriptor : android::EffectGetDescriptor,
diff --git a/media/libeffects/preprocessing/Android.mk b/media/libeffects/preprocessing/Android.mk
index c13b9d4..dfa1711 100755
--- a/media/libeffects/preprocessing/Android.mk
+++ b/media/libeffects/preprocessing/Android.mk
@@ -29,4 +29,6 @@
 LOCAL_SHARED_LIBRARIES += libdl
 endif
 
+LOCAL_CFLAGS += -fvisibility=hidden
+
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index 597866a..25586e8 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -1818,30 +1818,6 @@
 // Effect Library Interface Implementation
 //------------------------------------------------------------------------------
 
-int PreProcessingLib_QueryNumberEffects(uint32_t *pNumEffects)
-{
-    if (PreProc_Init() != 0) {
-        return sInitStatus;
-    }
-    if (pNumEffects == NULL) {
-        return -EINVAL;
-    }
-    *pNumEffects = PREPROC_NUM_EFFECTS;
-    return sInitStatus;
-}
-
-int PreProcessingLib_QueryEffect(uint32_t index, effect_descriptor_t *pDescriptor)
-{
-    if (PreProc_Init() != 0) {
-        return sInitStatus;
-    }
-    if (index >= PREPROC_NUM_EFFECTS) {
-        return -EINVAL;
-    }
-    *pDescriptor = *sDescriptors[index];
-    return 0;
-}
-
 int PreProcessingLib_Create(const effect_uuid_t *uuid,
                             int32_t             sessionId,
                             int32_t             ioId,
@@ -1913,13 +1889,13 @@
     return 0;
 }
 
+// This is the only symbol that needs to be exported
+__attribute__ ((visibility ("default")))
 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
     tag : AUDIO_EFFECT_LIBRARY_TAG,
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Audio Preprocessing Library",
     implementor : "The Android Open Source Project",
-    query_num_effects : PreProcessingLib_QueryNumberEffects,
-    query_effect : PreProcessingLib_QueryEffect,
     create_effect : PreProcessingLib_Create,
     release_effect : PreProcessingLib_Release,
     get_descriptor : PreProcessingLib_GetDescriptor
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index 90ebe1f..c35453b 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -123,23 +123,6 @@
 //--- Effect Library Interface Implementation
 //
 
-extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects) {
-    *pNumEffects = 1;
-    return 0;
-} /* end EffectQueryNumberEffects */
-
-extern "C" int EffectQueryEffect(uint32_t index,
-                                 effect_descriptor_t *pDescriptor) {
-    if (pDescriptor == NULL) {
-        return -EINVAL;
-    }
-    if (index > 0) {
-        return -EINVAL;
-    }
-    *pDescriptor = gEqualizerDescriptor;
-    return 0;
-} /* end EffectQueryNext */
-
 extern "C" int EffectCreate(const effect_uuid_t *uuid,
                             int32_t sessionId,
                             int32_t ioId,
@@ -771,8 +754,6 @@
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Test Equalizer Library",
     implementor : "The Android Open Source Project",
-    query_num_effects : android::EffectQueryNumberEffects,
-    query_effect : android::EffectQueryEffect,
     create_effect : android::EffectCreate,
     release_effect : android::EffectRelease,
     get_descriptor : android::EffectGetDescriptor,
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index a87a834..c37f392 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -94,23 +94,6 @@
 
 /*--- Effect Library Interface Implementation ---*/
 
-int EffectQueryNumberEffects(uint32_t *pNumEffects) {
-    *pNumEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-    return 0;
-}
-
-int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor) {
-    if (pDescriptor == NULL) {
-        return -EINVAL;
-    }
-    if (index >= sizeof(gDescriptors) / sizeof(const effect_descriptor_t *)) {
-        return -EINVAL;
-    }
-    memcpy(pDescriptor, gDescriptors[index],
-            sizeof(effect_descriptor_t));
-    return 0;
-}
-
 int EffectCreate(const effect_uuid_t *uuid,
         int32_t sessionId,
         int32_t ioId,
@@ -2222,8 +2205,6 @@
     .version = EFFECT_LIBRARY_API_VERSION,
     .name = "Test Equalizer Library",
     .implementor = "The Android Open Source Project",
-    .query_num_effects = EffectQueryNumberEffects,
-    .query_effect = EffectQueryEffect,
     .create_effect = EffectCreate,
     .release_effect = EffectRelease,
     .get_descriptor = EffectGetDescriptor,
diff --git a/media/libeffects/testlibs/EffectReverb.h b/media/libeffects/testlibs/EffectReverb.h
index 1fb14a7..e5248fe 100644
--- a/media/libeffects/testlibs/EffectReverb.h
+++ b/media/libeffects/testlibs/EffectReverb.h
@@ -300,9 +300,6 @@
  * Effect API
  *------------------------------------
 */
-int EffectQueryNumberEffects(uint32_t *pNumEffects);
-int EffectQueryEffect(uint32_t index,
-                      effect_descriptor_t *pDescriptor);
 int EffectCreate(const effect_uuid_t *effectUID,
                  int32_t sessionId,
                  int32_t ioId,
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index 76b5110..49cf4fa 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -6,7 +6,7 @@
 LOCAL_SRC_FILES:= \
 	EffectVisualizer.cpp
 
-LOCAL_CFLAGS+= -O2
+LOCAL_CFLAGS+= -O2 -fvisibility=hidden
 
 LOCAL_SHARED_LIBRARIES := \
 	libcutils \
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 44baf93..e7eccf1 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -177,23 +177,6 @@
 //--- Effect Library Interface Implementation
 //
 
-int VisualizerLib_QueryNumberEffects(uint32_t *pNumEffects) {
-    *pNumEffects = 1;
-    return 0;
-}
-
-int VisualizerLib_QueryEffect(uint32_t index,
-                              effect_descriptor_t *pDescriptor) {
-    if (pDescriptor == NULL) {
-        return -EINVAL;
-    }
-    if (index > 0) {
-        return -EINVAL;
-    }
-    *pDescriptor = gVisualizerDescriptor;
-    return 0;
-}
-
 int VisualizerLib_Create(const effect_uuid_t *uuid,
                          int32_t sessionId,
                          int32_t ioId,
@@ -574,14 +557,13 @@
         NULL,
 };
 
-
+// This is the only symbol that needs to be exported
+__attribute__ ((visibility ("default")))
 audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
     tag : AUDIO_EFFECT_LIBRARY_TAG,
     version : EFFECT_LIBRARY_API_VERSION,
     name : "Visualizer Library",
     implementor : "The Android Open Source Project",
-    query_num_effects : VisualizerLib_QueryNumberEffects,
-    query_effect : VisualizerLib_QueryEffect,
     create_effect : VisualizerLib_Create,
     release_effect : VisualizerLib_Release,
     get_descriptor : VisualizerLib_GetDescriptor,
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 207f96f..0e5c149 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -510,7 +510,7 @@
 sp<AudioSystem::AudioPolicyServiceClient> AudioSystem::gAudioPolicyServiceClient;
 
 
-// establish binder interface to AudioFlinger service
+// establish binder interface to AudioPolicy service
 const sp<IAudioPolicyService>& AudioSystem::get_audio_policy_service()
 {
     gLock.lock();
diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp
index a4a6f07..7a8dd7c 100644
--- a/media/libstagefright/wifi-display/source/Converter.cpp
+++ b/media/libstagefright/wifi-display/source/Converter.cpp
@@ -143,7 +143,7 @@
     mOutputFormat->setString("mime", outputMIME.c_str());
 
     int32_t audioBitrate = getBitrate("media.wfd.audio-bitrate", 128000);
-    int32_t videoBitrate = getBitrate("media.wfd.video-bitrate", 2500000);
+    int32_t videoBitrate = getBitrate("media.wfd.video-bitrate", 5000000);
 
     ALOGI("using audio bitrate of %d bps, video bitrate of %d bps",
           audioBitrate, videoBitrate);
diff --git a/media/libstagefright/wifi-display/source/Converter.h b/media/libstagefright/wifi-display/source/Converter.h
index 8dfff3d..2cdeda3 100644
--- a/media/libstagefright/wifi-display/source/Converter.h
+++ b/media/libstagefright/wifi-display/source/Converter.h
@@ -27,7 +27,7 @@
 struct ABuffer;
 struct MediaCodec;
 
-#define ENABLE_SILENCE_DETECTION        1
+#define ENABLE_SILENCE_DETECTION        0
 
 // Utility class that receives media access units and converts them into
 // media access unit of a different format.
@@ -120,4 +120,3 @@
 }  // namespace android
 
 #endif  // CONVERTER_H_
-
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index bd9421c..2899953 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -19,11 +19,9 @@
     AudioResampler.cpp.arm      \
     AudioPolicyService.cpp      \
     ServiceUtilities.cpp        \
+	AudioResamplerCubic.cpp.arm \
     AudioResamplerSinc.cpp.arm
 
-# uncomment to enable AudioResampler::MED_QUALITY
-# LOCAL_SRC_FILES += AudioResamplerCubic.cpp.arm
-
 LOCAL_SRC_FILES += StateQueue.cpp
 
 # uncomment for debugging timing problems related to StateQueue::push()
@@ -80,4 +78,27 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
+#
+# build audio resampler test tool
+#
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=               \
+	test-resample.cpp 			\
+    AudioResampler.cpp.arm      \
+	AudioResamplerCubic.cpp.arm \
+    AudioResamplerSinc.cpp.arm
+
+LOCAL_SHARED_LIBRARIES := \
+	libdl \
+    libcutils \
+    libutils
+
+LOCAL_MODULE:= test-resample
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_EXECUTABLE)
+
+
 include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 49e2b2c..8c55f7c 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -356,7 +356,7 @@
             RECORD              // Thread class is RecordThread
         };
 
-        ThreadBase (const sp<AudioFlinger>& audioFlinger, audio_io_handle_t id,
+        ThreadBase(const sp<AudioFlinger>& audioFlinger, audio_io_handle_t id,
                     audio_devices_t outDevice, audio_devices_t inDevice, type_t type);
         virtual             ~ThreadBase();
 
@@ -810,6 +810,7 @@
 
         // implement FastMixerState::VolumeProvider interface
             virtual uint32_t    getVolumeLR();
+
             virtual status_t    setSyncEvent(const sp<SyncEvent>& event);
 
         protected:
@@ -986,7 +987,7 @@
         class OutputTrack : public Track {
         public:
 
-            class Buffer: public AudioBufferProvider::Buffer {
+            class Buffer : public AudioBufferProvider::Buffer {
             public:
                 int16_t *mBuffer;
             };
@@ -1025,8 +1026,8 @@
             DuplicatingThread* const mSourceThread; // for waitTimeMs() in write()
         };  // end of OutputTrack
 
-        PlaybackThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
-                        audio_io_handle_t id, audio_devices_t device, type_t type);
+        PlaybackThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
+                       audio_io_handle_t id, audio_devices_t device, type_t type);
         virtual             ~PlaybackThread();
 
                     void        dump(int fd, const Vector<String16>& args);
@@ -1248,11 +1249,11 @@
 
     class MixerThread : public PlaybackThread {
     public:
-        MixerThread (const sp<AudioFlinger>& audioFlinger,
-                     AudioStreamOut* output,
-                     audio_io_handle_t id,
-                     audio_devices_t device,
-                     type_t type = MIXER);
+        MixerThread(const sp<AudioFlinger>& audioFlinger,
+                    AudioStreamOut* output,
+                    audio_io_handle_t id,
+                    audio_devices_t device,
+                    type_t type = MIXER);
         virtual             ~MixerThread();
 
         // Thread virtuals
@@ -1305,8 +1306,8 @@
     class DirectOutputThread : public PlaybackThread {
     public:
 
-        DirectOutputThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
-                            audio_io_handle_t id, audio_devices_t device);
+        DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
+                           audio_io_handle_t id, audio_devices_t device);
         virtual                 ~DirectOutputThread();
 
         // Thread virtuals
@@ -1326,11 +1327,11 @@
         virtual     void        threadLoop_mix();
         virtual     void        threadLoop_sleepTime();
 
+    private:
         // volumes last sent to audio HAL with stream->set_volume()
         float mLeftVolFloat;
         float mRightVolFloat;
 
-private:
         // prepareTracks_l() tells threadLoop_mix() the name of the single active track
         sp<Track>               mActiveTrack;
     public:
@@ -1339,8 +1340,8 @@
 
     class DuplicatingThread : public MixerThread {
     public:
-        DuplicatingThread (const sp<AudioFlinger>& audioFlinger, MixerThread* mainThread,
-                           audio_io_handle_t id);
+        DuplicatingThread(const sp<AudioFlinger>& audioFlinger, MixerThread* mainThread,
+                          audio_io_handle_t id);
         virtual                 ~DuplicatingThread();
 
         // Thread virtuals
@@ -1607,7 +1608,7 @@
     // ramping when effects are activated/deactivated.
     // When controlling an auxiliary effect, the EffectModule also provides an input buffer used by
     // the attached track(s) to accumulate their auxiliary channel.
-    class EffectModule: public RefBase {
+    class EffectModule : public RefBase {
     public:
         EffectModule(ThreadBase *thread,
                         const wp<AudioFlinger::EffectChain>& chain,
@@ -1798,7 +1799,7 @@
     // are insert only. The EffectChain maintains an ordered list of effect module, the order corresponding
     // in the effect process order. When attached to a track (session ID != 0), it also provide it's own
     // input buffer used by the track as accumulation buffer.
-    class EffectChain: public RefBase {
+    class EffectChain : public RefBase {
     public:
         EffectChain(const wp<ThreadBase>& wThread, int sessionId);
         EffectChain(ThreadBase *thread, int sessionId);
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index ffea9b9..2c3c719 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -82,10 +82,8 @@
     switch (quality) {
     case DEFAULT_QUALITY:
     case LOW_QUALITY:
-#if 0   // these have not been qualified recently so are not supported unless explicitly requested
     case MED_QUALITY:
     case HIGH_QUALITY:
-#endif
     case VERY_HIGH_QUALITY:
         return true;
     default:
@@ -190,12 +188,10 @@
         ALOGV("Create linear Resampler");
         resampler = new AudioResamplerOrder1(bitDepth, inChannelCount, sampleRate);
         break;
-#if 0   // disabled because it has not been qualified recently, if requested will use default:
     case MED_QUALITY:
         ALOGV("Create cubic Resampler");
         resampler = new AudioResamplerCubic(bitDepth, inChannelCount, sampleRate);
         break;
-#endif
     case HIGH_QUALITY:
         ALOGV("Create HIGH_QUALITY sinc Resampler");
         resampler = new AudioResamplerSinc(bitDepth, inChannelCount, sampleRate);
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp
index 9e8447a..0e1acb4 100644
--- a/services/audioflinger/AudioResamplerSinc.cpp
+++ b/services/audioflinger/AudioResamplerSinc.cpp
@@ -31,36 +31,33 @@
 /*
  * 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.
+ * cmd-line: fir -v 1.3 -l 7 -s 48000 -c 20478
  */
 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,
+        0x6e350b14, 0x6e32e1de, 0x6e2c6665, 0x6e219925, 0x6e127aed, 0x6dff0cdf, 0x6de7506d, 0x6dcb475f, 0x6daaf3cd, 0x6d865820, 0x6d5d7714, 0x6d3053b9, 0x6cfef16b, 0x6cc953db, 0x6c8f7f09, 0x6c517746, 0x6c0f4131, 0x6bc8e1ba, 0x6b7e5e1f, 0x6b2fbbee, 0x6add0100, 0x6a86337e, 0x6a2b59dc, 0x69cc7adc, 0x69699d89, 0x6902c93b, 0x68980593, 0x68295a7c, 0x67b6d02a, 0x67406f18, 0x66c64009, 0x66484c06, 0x65c69c5e, 0x65413aa3, 0x64b830ad, 0x642b8896, 0x639b4cb9, 0x630787b3, 0x62704460, 0x61d58ddd, 0x61376f83, 0x6095f4e8, 0x5ff129de, 0x5f491a73, 0x5e9dd2ed, 0x5def5fcc, 0x5d3dcdc4, 0x5c8929c4, 0x5bd180ec, 0x5b16e092, 0x5a59563d, 0x5998efa7, 0x58d5bab8, 0x580fc589, 0x57471e5f, 0x567bd3ac, 0x55adf40b, 0x54dd8e43, 0x540ab142, 0x53356c1d, 0x525dce0d, 0x5183e672, 0x50a7c4cd, 0x4fc978c0, 0x4ee9120c, 0x4e06a094, 0x4d223454, 0x4c3bdd65, 0x4b53abfc, 0x4a69b064, 0x497dfb00, 0x48909c49, 0x47a1a4cd, 0x46b1252c, 0x45bf2e16, 0x44cbd04d, 0x43d71ca1, 0x42e123ed, 0x41e9f71a, 0x40f1a71a, 0x3ff844e5, 0x3efde17e, 0x3e028dea, 0x3d065b33, 0x3c095a67, 0x3b0b9c92, 0x3a0d32c2, 0x390e2e01, 0x380e9f57, 0x370e97c6, 0x360e284c, 0x350d61da, 0x340c555d, 0x330b13b5, 0x3209adb4, 0x31083422, 0x3006b7b5, 0x2f054914, 0x2e03f8d4, 0x2d02d775, 0x2c01f564, 0x2b0162f9, 0x2a013072, 0x29016df5, 0x28022b90, 0x27037934, 0x260566b4, 0x250803c7, 0x240b6004, 0x230f8ae2, 0x221493b5, 0x211a89b0, 0x20217be0, 0x1f29792e, 0x1e32905a, 0x1d3ccfff, 0x1c48468e, 0x1b55024e, 0x1a63115b, 0x197281a5, 0x188360ef, 0x1795bccc, 0x16a9a2a1, 0x15bf1fa4, 0x14d640d8, 0x13ef130e, 0x1309a2e4, 0x1225fcc4,
+        0x11442ce3, 0x10643f3f, 0x0f863fa3, 0x0eaa399d, 0x0dd03888, 0x0cf84782, 0x0c227171, 0x0b4ec101, 0x0a7d40a1, 0x09adfa86, 0x08e0f8a7, 0x081644be, 0x074de849, 0x0687ec84, 0x05c45a70, 0x05033acc, 0x04449618, 0x03887494, 0x02cede3e, 0x0217dad5, 0x016371d3, 0x00b1aa73, 0x00028bac, 0xff561c34, 0xfeac627c, 0xfe0564b3, 0xfd6128c4, 0xfcbfb457, 0xfc210cd1, 0xfb853752, 0xfaec38b4, 0xfa561591, 0xf9c2d23c, 0xf93272c4, 0xf8a4faf4, 0xf81a6e54, 0xf792d025, 0xf70e2367, 0xf68c6ad3, 0xf60da8df, 0xf591dfbf, 0xf5191161, 0xf4a33f70, 0xf4306b54, 0xf3c09632, 0xf353c0ed, 0xf2e9ec23, 0xf2831834, 0xf21f4539, 0xf1be730e, 0xf160a14c, 0xf105cf4a, 0xf0adfc22, 0xf05926ab, 0xf0074d7e, 0xefb86ef7, 0xef6c892f, 0xef239a07, 0xeedd9f1e, 0xee9a95d8, 0xee5a7b5f, 0xee1d4c9f, 0xede3064a, 0xedaba4d8, 0xed772488, 0xed458160, 0xed16b72d, 0xeceac186, 0xecc19bcc, 0xec9b4129, 0xec77ac93, 0xec56d8cb, 0xec38c05f, 0xec1d5dac, 0xec04aadb, 0xebeea1e6, 0xebdb3c96, 0xebca7487, 0xebbc4325, 0xebb0a1af, 0xeba78939, 0xeba0f2ab, 0xeb9cd6c3, 0xeb9b2e16, 0xeb9bf110, 0xeb9f17f7, 0xeba49ae9, 0xebac71df, 0xebb694b0, 0xebc2fb0d, 0xebd19c85, 0xebe27089, 0xebf56e66, 0xec0a8d4c, 0xec21c44d, 0xec3b0a5e, 0xec565658, 0xec739ef9, 0xec92dae5, 0xecb400aa, 0xecd706bc, 0xecfbe378, 0xed228d2a, 0xed4afa04, 0xed75202a, 0xeda0f5ab, 0xedce7087, 0xedfd86ac, 0xee2e2dfd, 0xee605c4c, 0xee940760, 0xeec924f5, 0xeeffaabc, 0xef378e5d, 0xef70c579, 0xefab45a8, 0xefe7047f, 0xf023f78b, 0xf0621459, 0xf0a1506f, 0xf0e1a155, 0xf122fc90, 0xf16557a8, 0xf1a8a824, 0xf1ece390, 0xf231ff7a, 0xf277f176, 0xf2beaf1b,
+        0xf3062e09, 0xf34e63e8, 0xf3974666, 0xf3e0cb3f, 0xf42ae835, 0xf4759318, 0xf4c0c1c3, 0xf50c6a21, 0xf5588229, 0xf5a4ffe1, 0xf5f1d961, 0xf63f04d0, 0xf68c7868, 0xf6da2a76, 0xf7281159, 0xf7762387, 0xf7c45788, 0xf812a3fd, 0xf860ff9b, 0xf8af6130, 0xf8fdbfa2, 0xf94c11f0, 0xf99a4f34, 0xf9e86ea0, 0xfa366783, 0xfa843147, 0xfad1c372, 0xfb1f15a8, 0xfb6c1fab, 0xfbb8d95a, 0xfc053ab4, 0xfc513bd7, 0xfc9cd501, 0xfce7fe91, 0xfd32b105, 0xfd7ce501, 0xfdc69347, 0xfe0fb4bc, 0xfe58426a, 0xfea0357e, 0xfee78746, 0xff2e3137, 0xff742ceb, 0xffb9741e, 0xfffe00b5, 0x0041ccb6, 0x0084d252, 0x00c70bdc, 0x010873cf, 0x014904ce, 0x0188b9a0, 0x01c78d36, 0x02057aa6, 0x02427d2e, 0x027e9035, 0x02b9af49, 0x02f3d61f, 0x032d0094, 0x03652aae, 0x039c509c, 0x03d26eb2, 0x0407816e, 0x043b8577, 0x046e779c, 0x04a054d1, 0x04d11a37, 0x0500c513, 0x052f52d5, 0x055cc111, 0x05890d88, 0x05b4361d, 0x05de38df, 0x06071402, 0x062ec5e2, 0x06554d01, 0x067aa809, 0x069ed5ca, 0x06c1d539, 0x06e3a573, 0x070445ba, 0x0723b575, 0x0741f431, 0x075f01a0, 0x077add97, 0x07958811, 0x07af012c, 0x07c7492a, 0x07de606f, 0x07f44784, 0x0808ff11, 0x081c87e3, 0x082ee2e6, 0x0840112b, 0x085013de, 0x085eec50, 0x086c9bf0, 0x0879244c, 0x08848710, 0x088ec607, 0x0897e31b, 0x089fe052, 0x08a6bfcd, 0x08ac83ce, 0x08b12eac, 0x08b4c2e0, 0x08b742f8, 0x08b8b19f, 0x08b91198, 0x08b865bf, 0x08b6b10a, 0x08b3f685, 0x08b03952, 0x08ab7cac, 0x08a5c3e1, 0x089f1258, 0x08976b89, 0x088ed303, 0x08854c65, 0x087adb64, 0x086f83c5, 0x0863495f, 0x0856301c, 0x08483bf4, 0x083970ee, 0x0829d322, 0x081966b5, 0x08082fdb, 0x07f632d4,
+        0x07e373ec, 0x07cff77c, 0x07bbc1e7, 0x07a6d79d, 0x07913d14, 0x077af6ce, 0x07640956, 0x074c793d, 0x07344b1b, 0x071b8393, 0x07022749, 0x06e83ae8, 0x06cdc322, 0x06b2c4ac, 0x0697443c, 0x067b4690, 0x065ed064, 0x0641e678, 0x06248d8e, 0x0606ca65, 0x05e8a1c1, 0x05ca1862, 0x05ab3308, 0x058bf671, 0x056c675a, 0x054c8a7b, 0x052c648a, 0x050bfa3b, 0x04eb5039, 0x04ca6b2f, 0x04a94fbf, 0x04880288, 0x0466881f, 0x0444e515, 0x04231df2, 0x04013738, 0x03df355d, 0x03bd1cd3, 0x039af1fe, 0x0378b93c, 0x035676dd, 0x03342f2b, 0x0311e661, 0x02efa0b0, 0x02cd623e, 0x02ab2f23, 0x02890b6c, 0x0266fb19, 0x0245021b, 0x02232456, 0x020165a2, 0x01dfc9c5, 0x01be547a, 0x019d096b, 0x017bec31, 0x015b005a, 0x013a4960, 0x0119caaf, 0x00f987a2, 0x00d98384, 0x00b9c18c, 0x009a44e6, 0x007b10a6, 0x005c27d3, 0x003d8d61, 0x001f4432, 0x00014f15, 0xffe3b0c9, 0xffc66bf8, 0xffa9833b, 0xff8cf919, 0xff70d004, 0xff550a5e, 0xff39aa73, 0xff1eb27e, 0xff0424a6, 0xfeea02ff, 0xfed04f89, 0xfeb70c33, 0xfe9e3ad6, 0xfe85dd38, 0xfe6df50d, 0xfe5683f5, 0xfe3f8b7b, 0xfe290d18, 0xfe130a32, 0xfdfd841c, 0xfde87c13, 0xfdd3f344, 0xfdbfeac5, 0xfdac639e, 0xfd995ebf, 0xfd86dd07, 0xfd74df43, 0xfd63662b, 0xfd527267, 0xfd42048a, 0xfd321d16, 0xfd22bc79, 0xfd13e312, 0xfd05912a, 0xfcf7c6fb, 0xfcea84ac, 0xfcddca53, 0xfcd197f5, 0xfcc5ed84, 0xfcbacae2, 0xfcb02fe3, 0xfca61c45, 0xfc9c8fba, 0xfc9389e1, 0xfc8b0a4c, 0xfc83107b, 0xfc7b9bdf, 0xfc74abda, 0xfc6e3fbf, 0xfc6856d2, 0xfc62f049, 0xfc5e0b4b, 0xfc59a6f2, 0xfc55c249, 0xfc525c50, 0xfc4f73f6, 0xfc4d0822, 0xfc4b17a9, 0xfc49a159, 0xfc48a3ef, 0xfc481e21,
+        0xfc480e96, 0xfc4873eb, 0xfc494cb3, 0xfc4a9776, 0xfc4c52b2, 0xfc4e7cd9, 0xfc511457, 0xfc54178c, 0xfc5784d0, 0xfc5b5a72, 0xfc5f96ba, 0xfc6437e5, 0xfc693c2c, 0xfc6ea1be, 0xfc7466c4, 0xfc7a895f, 0xfc8107ac, 0xfc87dfbf, 0xfc8f0fa9, 0xfc969573, 0xfc9e6f23, 0xfca69ab8, 0xfcaf162e, 0xfcb7df7d, 0xfcc0f498, 0xfcca536e, 0xfcd3f9ed, 0xfcdde5fe, 0xfce81587, 0xfcf2866f, 0xfcfd3696, 0xfd0823de, 0xfd134c26, 0xfd1ead4c, 0xfd2a452e, 0xfd3611a8, 0xfd421096, 0xfd4e3fd4, 0xfd5a9d41, 0xfd6726b7, 0xfd73da17, 0xfd80b53d, 0xfd8db60c, 0xfd9ada65, 0xfda8202c, 0xfdb58547, 0xfdc3079e, 0xfdd0a51d, 0xfdde5bb2, 0xfdec294d, 0xfdfa0be4, 0xfe08016e, 0xfe1607e7, 0xfe241d50, 0xfe323fac, 0xfe406d04, 0xfe4ea365, 0xfe5ce0e3, 0xfe6b2393, 0xfe796993, 0xfe87b104, 0xfe95f80f, 0xfea43ce1, 0xfeb27dae, 0xfec0b8af, 0xfeceec25, 0xfedd1655, 0xfeeb358e, 0xfef94823, 0xff074c6f, 0xff1540d4, 0xff2323bc, 0xff30f397, 0xff3eaedd, 0xff4c540e, 0xff59e1b1, 0xff675655, 0xff74b091, 0xff81ef04, 0xff8f1056, 0xff9c1334, 0xffa8f658, 0xffb5b87f, 0xffc25874, 0xffced505, 0xffdb2d0d, 0xffe75f6c, 0xfff36b0d, 0xffff4ee4, 0x000b09ea, 0x00169b25, 0x002201a1, 0x002d3c75, 0x00384abe, 0x00432ba4, 0x004dde58, 0x00586211, 0x0062b611, 0x006cd9a4, 0x0076cc1c, 0x00808cd5, 0x008a1b34, 0x009376a6, 0x009c9ea1, 0x00a592a5, 0x00ae5238, 0x00b6dcea, 0x00bf3254, 0x00c75217, 0x00cf3bdd, 0x00d6ef55, 0x00de6c3c, 0x00e5b252, 0x00ecc163, 0x00f39941, 0x00fa39c5, 0x0100a2d4, 0x0106d456, 0x010cce3d, 0x01129084, 0x01181b2c, 0x011d6e3c, 0x012289c6, 0x01276de1, 0x012c1aab, 0x01309049, 0x0134cee8, 0x0138d6bc,
+        0x013ca7ff, 0x014042f1, 0x0143a7d9, 0x0146d705, 0x0149d0c8, 0x014c957d, 0x014f2584, 0x01518141, 0x0153a922, 0x01559d96, 0x01575f14, 0x0158ee18, 0x015a4b23, 0x015b76bb, 0x015c716b, 0x015d3bc3, 0x015dd658, 0x015e41c1, 0x015e7e9d, 0x015e8d8e, 0x015e6f37, 0x015e2444, 0x015dad61, 0x015d0b3e, 0x015c3e92, 0x015b4812, 0x015a287a, 0x0158e089, 0x015770fe, 0x0155da9d, 0x01541e2e, 0x01523c78, 0x01503646, 0x014e0c67, 0x014bbfa8, 0x014950dc, 0x0146c0d5, 0x01441068, 0x0141406b, 0x013e51b5, 0x013b4520, 0x01381b84, 0x0134d5bd, 0x013174a6, 0x012df91b, 0x012a63f9, 0x0126b61d, 0x0122f065, 0x011f13ad, 0x011b20d4, 0x011718b7, 0x0112fc33, 0x010ecc25, 0x010a896b, 0x010634df, 0x0101cf5d, 0x00fd59bf, 0x00f8d4df, 0x00f44196, 0x00efa0ba, 0x00eaf323, 0x00e639a4, 0x00e17512, 0x00dca63d, 0x00d7cdf8, 0x00d2ed0f, 0x00ce044f, 0x00c91484, 0x00c41e76, 0x00bf22ec, 0x00ba22ab, 0x00b51e74, 0x00b01708, 0x00ab0d25, 0x00a60185, 0x00a0f4e1, 0x009be7f0, 0x0096db64, 0x0091cfed, 0x008cc63b, 0x0087bef8, 0x0082bacb, 0x007dba5a, 0x0078be46, 0x0073c72f, 0x006ed5b1, 0x0069ea64, 0x006505de, 0x006028b0, 0x005b536b, 0x00568698, 0x0051c2c2, 0x004d086c, 0x00485818, 0x0043b244, 0x003f176c, 0x003a8805, 0x00360484, 0x00318d58, 0x002d22ef, 0x0028c5b2, 0x00247606, 0x0020344d, 0x001c00e5, 0x0017dc2b, 0x0013c674, 0x000fc015, 0x000bc95f, 0x0007e29d, 0x00040c1a, 0x0000461a, 0xfffc90e1, 0xfff8ecac, 0xfff559b7, 0xfff1d83a, 0xffee686a, 0xffeb0a76, 0xffe7be8d, 0xffe484d8, 0xffe15d7f, 0xffde48a4, 0xffdb4669, 0xffd856ea, 0xffd57a40, 0xffd2b083, 0xffcff9c5, 0xffcd5617, 0xffcac586,
+        0xffc8481c, 0xffc5dde0, 0xffc386d6, 0xffc142ff, 0xffbf125a, 0xffbcf4e3, 0xffbaea92, 0xffb8f35c, 0xffb70f36, 0xffb53e10, 0xffb37fd9, 0xffb1d47b, 0xffb03be0, 0xffaeb5ee, 0xffad428a, 0xffabe196, 0xffaa92f1, 0xffa95679, 0xffa82c09, 0xffa7137b, 0xffa60ca5, 0xffa5175d, 0xffa43376, 0xffa360c1, 0xffa29f0e, 0xffa1ee2b, 0xffa14de4, 0xffa0be03, 0xffa03e51, 0xff9fce96, 0xff9f6e98, 0xff9f1e1a, 0xff9edce1, 0xff9eaaae, 0xff9e8741, 0xff9e725b, 0xff9e6bb9, 0xff9e7319, 0xff9e8837, 0xff9eaace, 0xff9eda9a, 0xff9f1753, 0xff9f60b3, 0xff9fb672, 0xffa01848, 0xffa085ea, 0xffa0ff11, 0xffa18371, 0xffa212c1, 0xffa2acb5, 0xffa35102, 0xffa3ff5d, 0xffa4b779, 0xffa5790c, 0xffa643ca, 0xffa71765, 0xffa7f392, 0xffa8d805, 0xffa9c472, 0xffaab88d, 0xffabb40a, 0xffacb69e, 0xffadbffe, 0xffaecfde, 0xffafe5f5, 0xffb101f7, 0xffb2239b, 0xffb34a98, 0xffb476a5, 0xffb5a779, 0xffb6dccd, 0xffb8165a, 0xffb953d8, 0xffba9503, 0xffbbd996, 0xffbd214b, 0xffbe6bdf, 0xffbfb910, 0xffc1089c, 0xffc25a41, 0xffc3adbf, 0xffc502d8, 0xffc6594c, 0xffc7b0df, 0xffc90953, 0xffca626e, 0xffcbbbf5, 0xffcd15b0, 0xffce6f64, 0xffcfc8dd, 0xffd121e3, 0xffd27a41, 0xffd3d1c4, 0xffd52839, 0xffd67d6f, 0xffd7d135, 0xffd9235c, 0xffda73b6, 0xffdbc216, 0xffdd0e51, 0xffde583d, 0xffdf9fb0, 0xffe0e483, 0xffe2268e, 0xffe365ad, 0xffe4a1bb, 0xffe5da95, 0xffe7101a, 0xffe84229, 0xffe970a2, 0xffea9b69, 0xffebc25f, 0xffece56a, 0xffee046f, 0xffef1f56, 0xfff03605, 0xfff14867, 0xfff25666, 0xfff35fee, 0xfff464ec, 0xfff5654e, 0xfff66102, 0xfff757fa, 0xfff84a27, 0xfff9377c, 0xfffa1fed, 0xfffb036e, 0xfffbe1f5,
+        0xfffcbb7a, 0xfffd8ff5, 0xfffe5f5f, 0xffff29b1, 0xffffeee9, 0x0000af01, 0x000169f7, 0x00021fca, 0x0002d077, 0x00037c01, 0x00042267, 0x0004c3ab, 0x00055fd1, 0x0005f6dc, 0x000688d1, 0x000715b4, 0x00079d8d, 0x00082061, 0x00089e39, 0x0009171e, 0x00098b17, 0x0009fa30, 0x000a6472, 0x000ac9ea, 0x000b2aa2, 0x000b86a7, 0x000bde06, 0x000c30cd, 0x000c7f0a, 0x000cc8cc, 0x000d0e21, 0x000d4f1a, 0x000d8bc7, 0x000dc438, 0x000df87f, 0x000e28ac, 0x000e54d2, 0x000e7d03, 0x000ea151, 0x000ec1cf, 0x000ede91, 0x000ef7a9, 0x000f0d2c, 0x000f1f2d, 0x000f2dc1, 0x000f38fb, 0x000f40f1, 0x000f45b7, 0x000f4762, 0x000f4606, 0x000f41ba, 0x000f3a91, 0x000f30a2, 0x000f2401, 0x000f14c4, 0x000f0300, 0x000eeeca, 0x000ed838, 0x000ebf60, 0x000ea455, 0x000e872d, 0x000e67fe, 0x000e46dd, 0x000e23dd, 0x000dff15, 0x000dd898, 0x000db07b, 0x000d86d3, 0x000d5bb3, 0x000d2f30, 0x000d015d, 0x000cd24d, 0x000ca215, 0x000c70c7, 0x000c3e76, 0x000c0b34, 0x000bd715, 0x000ba229, 0x000b6c83, 0x000b3634, 0x000aff4e, 0x000ac7e1, 0x000a8ffe, 0x000a57b5, 0x000a1f17, 0x0009e632, 0x0009ad16, 0x000973d2, 0x00093a74, 0x0009010b, 0x0008c7a5, 0x00088e4f, 0x00085517, 0x00081c09, 0x0007e331, 0x0007aa9c, 0x00077255, 0x00073a68, 0x000702e0, 0x0006cbc7, 0x00069527, 0x00065f0b, 0x0006297b, 0x0005f481, 0x0005c026, 0x00058c71, 0x0005596b, 0x0005271b, 0x0004f588, 0x0004c4ba, 0x000494b7, 0x00046585, 0x00043729, 0x000409aa, 0x0003dd0b, 0x0003b152, 0x00038683, 0x00035ca3, 0x000333b4, 0x00030bba, 0x0002e4b8, 0x0002beb1, 0x000299a7, 0x0002759c, 0x00025292, 0x0002308a, 0x00020f86, 0x0001ef85,
         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).
+ * These coefficients are optimized for 48KHz -> 44.1KHz
+ * cmd-line: fir -v 0.3 -l 7 -s 48000 -c 16600
  */
 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,
+        0x6e350b14, 0x6e3396e0, 0x6e2f3a59, 0x6e27f5b7, 0x6e1dc95c, 0x6e10b5cc, 0x6e00bbb6, 0x6deddbeb, 0x6dd81765, 0x6dbf6f44, 0x6da3e4cd, 0x6d85796c, 0x6d642eb2, 0x6d400656, 0x6d190235, 0x6cef2453, 0x6cc26ed6, 0x6c92e40c, 0x6c608668, 0x6c2b5882, 0x6bf35d14, 0x6bb89701, 0x6b7b094e, 0x6b3ab724, 0x6af7a3d1, 0x6ab1d2c7, 0x6a69479a, 0x6a1e0603, 0x69d011df, 0x697f6f2a, 0x692c2207, 0x68d62eb9, 0x687d99a6, 0x68226753, 0x67c49c6c, 0x67643db8, 0x67015023, 0x669bd8b9, 0x6633dca5, 0x65c96131, 0x655c6bca, 0x64ed01f9, 0x647b2967, 0x6406e7dc, 0x6390433c, 0x6317418a, 0x629be8e8, 0x621e3f92, 0x619e4be2, 0x611c144d, 0x60979f66, 0x6010f3d8, 0x5f88186c, 0x5efd1402, 0x5e6fed97, 0x5de0ac3f, 0x5d4f5729, 0x5cbbf59c, 0x5c268ef6, 0x5b8f2aad, 0x5af5d04f, 0x5a5a8780, 0x59bd57fa, 0x591e498d, 0x587d641d, 0x57daafa5, 0x57363432, 0x568ff9e4, 0x55e808f2, 0x553e69a1, 0x5493244a, 0x53e64158, 0x5337c946, 0x5287c4a0, 0x51d63c02, 0x51233816, 0x506ec197, 0x4fb8e14d, 0x4f01a00d, 0x4e4906ba, 0x4d8f1e43, 0x4cd3efa4, 0x4c1783e5, 0x4b59e415, 0x4a9b1952, 0x49db2cc2, 0x491a2792, 0x485812fb, 0x4794f83d, 0x46d0e09d, 0x460bd56a, 0x4545dff9, 0x447f09a2, 0x43b75bc5, 0x42eedfc5, 0x42259f0a, 0x415ba2fe, 0x4090f510, 0x3fc59eaf, 0x3ef9a94d, 0x3e2d1e5c, 0x3d600751, 0x3c926d9d, 0x3bc45ab4, 0x3af5d807, 0x3a26ef05, 0x3957a91c, 0x38880fb6, 0x37b82c3b, 0x36e8080c, 0x3617ac89, 0x3547230a, 0x347674e3, 0x33a5ab62, 0x32d4cfcc, 0x3203eb61, 0x31330758, 0x30622ce0, 0x2f91651f, 0x2ec0b931, 0x2df03228, 0x2d1fd90d, 0x2c4fb6dd, 0x2b7fd488, 0x2ab03af3, 0x29e0f2f8, 0x29120562, 0x28437aef,
+        0x27755c4f, 0x26a7b223, 0x25da84fc, 0x250ddd60, 0x2441c3bf, 0x2376407c, 0x22ab5be9, 0x21e11e45, 0x21178fc0, 0x204eb874, 0x1f86a06c, 0x1ebf4f9d, 0x1df8cdea, 0x1d332322, 0x1c6e56ff, 0x1baa7127, 0x1ae77929, 0x1a257682, 0x19647094, 0x18a46eb0, 0x17e5780d, 0x172793cc, 0x166ac8f6, 0x15af1e7c, 0x14f49b39, 0x143b45ed, 0x13832540, 0x12cc3fc3, 0x12169bea, 0x11624012, 0x10af327e, 0x0ffd7955, 0x0f4d1aa4, 0x0e9e1c5e, 0x0df0845b, 0x0d445856, 0x0c999df2, 0x0bf05ab1, 0x0b4893fd, 0x0aa24f23, 0x09fd9152, 0x095a5f9d, 0x08b8befc, 0x0818b447, 0x077a443b, 0x06dd7376, 0x0642467a, 0x05a8c1a9, 0x0510e949, 0x047ac182, 0x03e64e5e, 0x035393c6, 0x02c29588, 0x02335752, 0x01a5dcb3, 0x011a291e, 0x00903fe2, 0x00082435, 0xff81d92b, 0xfefd61b9, 0xfe7ac0b7, 0xfdf9f8da, 0xfd7b0cbe, 0xfcfdfeda, 0xfc82d18a, 0xfc098709, 0xfb922173, 0xfb1ca2c7, 0xfaa90ce2, 0xfa376185, 0xf9c7a24e, 0xf959d0c2, 0xf8edee41, 0xf883fc11, 0xf81bfb56, 0xf7b5ed19, 0xf751d240, 0xf6efab96, 0xf68f79c7, 0xf6313d60, 0xf5d4f6d0, 0xf57aa669, 0xf5224c5f, 0xf4cbe8c7, 0xf4777b9a, 0xf42504b2, 0xf3d483cf, 0xf385f890, 0xf339627b, 0xf2eec0f5, 0xf2a6134a, 0xf25f58aa, 0xf21a9025, 0xf1d7b8b4, 0xf196d132, 0xf157d85d, 0xf11accdc, 0xf0dfad37, 0xf0a677de, 0xf06f2b25, 0xf039c548, 0xf0064466, 0xefd4a686, 0xefa4e997, 0xef770b6c, 0xef4b09c2, 0xef20e23d, 0xeef89266, 0xeed217b2, 0xeead6f7d, 0xee8a9709, 0xee698b87, 0xee4a4a0b, 0xee2ccf97, 0xee111915, 0xedf7235b, 0xeddeeb29, 0xedc86d28, 0xedb3a5ef, 0xeda09201, 0xed8f2dcb, 0xed7f75a8, 0xed7165e0, 0xed64faa7, 0xed5a301f, 0xed510259, 0xed496d53, 0xed436cfb,
+        0xed3efd2c, 0xed3c19b3, 0xed3abe4b, 0xed3ae6a1, 0xed3c8e50, 0xed3fb0e7, 0xed4449e5, 0xed4a54ba, 0xed51ccca, 0xed5aad6a, 0xed64f1e4, 0xed709574, 0xed7d934a, 0xed8be68a, 0xed9b8a4d, 0xedac79a2, 0xedbeaf8c, 0xedd22705, 0xede6dafd, 0xedfcc65a, 0xee13e3f9, 0xee2c2eb1, 0xee45a14f, 0xee603697, 0xee7be949, 0xee98b41b, 0xeeb691c0, 0xeed57ce1, 0xeef57025, 0xef16662c, 0xef385992, 0xef5b44ed, 0xef7f22d2, 0xefa3edcf, 0xefc9a072, 0xeff03543, 0xf017a6cb, 0xf03fef90, 0xf0690a14, 0xf092f0da, 0xf0bd9e66, 0xf0e90d37, 0xf11537d0, 0xf14218b3, 0xf16faa62, 0xf19de762, 0xf1ccca37, 0xf1fc4d68, 0xf22c6b80, 0xf25d1f0a, 0xf28e6296, 0xf2c030b5, 0xf2f283fe, 0xf325570c, 0xf358a47c, 0xf38c66f3, 0xf3c09918, 0xf3f5359a, 0xf42a372c, 0xf45f9888, 0xf495546e, 0xf4cb65a6, 0xf501c6fd, 0xf5387349, 0xf56f6567, 0xf5a6983c, 0xf5de06b6, 0xf615abcb, 0xf64d827a, 0xf68585cb, 0xf6bdb0d0, 0xf6f5fea5, 0xf72e6a6e, 0xf766ef5c, 0xf79f88a9, 0xf7d8319a, 0xf810e580, 0xf8499fb6, 0xf8825ba4, 0xf8bb14bc, 0xf8f3c67e, 0xf92c6c75, 0xf9650239, 0xf99d836f, 0xf9d5ebc7, 0xfa0e3702, 0xfa4660ea, 0xfa7e6559, 0xfab64038, 0xfaeded7a, 0xfb256924, 0xfb5caf47, 0xfb93bc03, 0xfbca8b87, 0xfc011a11, 0xfc3763ec, 0xfc6d6574, 0xfca31b14, 0xfcd88147, 0xfd0d9494, 0xfd425197, 0xfd76b4f7, 0xfdaabb6d, 0xfdde61c2, 0xfe11a4ce, 0xfe44817b, 0xfe76f4c2, 0xfea8fbab, 0xfeda9350, 0xff0bb8dd, 0xff3c698b, 0xff6ca2a6, 0xff9c618a, 0xffcba3a4, 0xfffa6672, 0x0028a781, 0x00566471, 0x00839af2, 0x00b048c5, 0x00dc6bbc, 0x010801b9, 0x013308b1, 0x015d7ea7, 0x018761b2, 0x01b0aff7, 0x01d967af, 0x02018722, 0x02290ca8,
+        0x024ff6ac, 0x027643a9, 0x029bf22a, 0x02c100cc, 0x02e56e3b, 0x03093935, 0x032c608a, 0x034ee316, 0x0370bfca, 0x0391f5a5, 0x03b283b7, 0x03d26920, 0x03f1a510, 0x041036c8, 0x042e1d98, 0x044b58e0, 0x0467e810, 0x0483caa7, 0x049f0035, 0x04b98858, 0x04d362bd, 0x04ec8f23, 0x05050d54, 0x051cdd2c, 0x0533fe94, 0x054a7186, 0x05603607, 0x05754c2f, 0x0589b41f, 0x059d6e0a, 0x05b07a30, 0x05c2d8dd, 0x05d48a6e, 0x05e58f49, 0x05f5e7e6, 0x060594c8, 0x0614967d, 0x0622eda3, 0x06309ae3, 0x063d9ef2, 0x0649fa93, 0x0655ae94, 0x0660bbce, 0x066b2327, 0x0674e591, 0x067e0406, 0x06867f90, 0x068e5940, 0x06959234, 0x069c2b92, 0x06a2268e, 0x06a78463, 0x06ac4657, 0x06b06dba, 0x06b3fbe5, 0x06b6f23a, 0x06b95226, 0x06bb1d1c, 0x06bc549a, 0x06bcfa25, 0x06bd0f4b, 0x06bc95a2, 0x06bb8ec8, 0x06b9fc61, 0x06b7e01a, 0x06b53ba8, 0x06b210c4, 0x06ae6130, 0x06aa2eb4, 0x06a57b1f, 0x06a04844, 0x069a97fe, 0x06946c2c, 0x068dc6b3, 0x0686a97f, 0x067f167e, 0x06770fa5, 0x066e96eb, 0x0665ae50, 0x065c57d2, 0x06529578, 0x0648694a, 0x063dd555, 0x0632dba8, 0x06277e55, 0x061bbf72, 0x060fa118, 0x0603255f, 0x05f64e66, 0x05e91e4b, 0x05db972f, 0x05cdbb32, 0x05bf8c7a, 0x05b10d2b, 0x05a23f6a, 0x0593255f, 0x0583c12f, 0x05741504, 0x05642304, 0x0553ed58, 0x05437626, 0x0532bf98, 0x0521cbd2, 0x05109cfc, 0x04ff353b, 0x04ed96b2, 0x04dbc386, 0x04c9bdd6, 0x04b787c3, 0x04a5236c, 0x049292eb, 0x047fd85d, 0x046cf5d7, 0x0459ed70, 0x0446c13b, 0x04337347, 0x042005a1, 0x040c7a55, 0x03f8d368, 0x03e512de, 0x03d13ab8, 0x03bd4cf2, 0x03a94b85, 0x03953865, 0x03811584, 0x036ce4cd, 0x0358a82a, 0x0344617e,
+        0x033012a8, 0x031bbd84, 0x030763e8, 0x02f307a3, 0x02deaa84, 0x02ca4e50, 0x02b5f4c9, 0x02a19fac, 0x028d50b0, 0x02790987, 0x0264cbdc, 0x02509956, 0x023c7395, 0x02285c34, 0x021454c8, 0x02005edf, 0x01ec7c02, 0x01d8adb3, 0x01c4f56f, 0x01b154ab, 0x019dccd7, 0x018a5f5c, 0x01770d9d, 0x0163d8f6, 0x0150c2bb, 0x013dcc3d, 0x012af6c3, 0x0118438f, 0x0105b3da, 0x00f348da, 0x00e103ba, 0x00cee5a2, 0x00bcefb0, 0x00ab22fc, 0x00998098, 0x0088098e, 0x0076bee2, 0x0065a18f, 0x0054b28b, 0x0043f2c4, 0x00336322, 0x00230484, 0x0012d7c4, 0x0002ddb3, 0xfff3171d, 0xffe384c5, 0xffd42769, 0xffc4ffbe, 0xffb60e73, 0xffa75430, 0xff98d197, 0xff8a8740, 0xff7c75bf, 0xff6e9da0, 0xff60ff68, 0xff539b96, 0xff4672a1, 0xff3984fa, 0xff2cd30a, 0xff205d36, 0xff1423d9, 0xff08274a, 0xfefc67d8, 0xfef0e5cb, 0xfee5a167, 0xfeda9ae7, 0xfecfd280, 0xfec54861, 0xfebafcb4, 0xfeb0ef9c, 0xfea72133, 0xfe9d9192, 0xfe9440c8, 0xfe8b2edf, 0xfe825bdc, 0xfe79c7bd, 0xfe71727b, 0xfe695c0a, 0xfe618456, 0xfe59eb47, 0xfe5290bf, 0xfe4b749d, 0xfe4496b6, 0xfe3df6dd, 0xfe3794e0, 0xfe317085, 0xfe2b8991, 0xfe25dfc1, 0xfe2072ce, 0xfe1b426d, 0xfe164e4c, 0xfe119618, 0xfe0d1976, 0xfe08d808, 0xfe04d16d, 0xfe01053d, 0xfdfd730d, 0xfdfa1a6f, 0xfdf6faf0, 0xfdf41419, 0xfdf1656f, 0xfdeeee74, 0xfdecaea5, 0xfdeaa57e, 0xfde8d275, 0xfde734fe, 0xfde5cc89, 0xfde49884, 0xfde39857, 0xfde2cb6c, 0xfde23124, 0xfde1c8e3, 0xfde19207, 0xfde18beb, 0xfde1b5ea, 0xfde20f5a, 0xfde29790, 0xfde34dde, 0xfde43196, 0xfde54205, 0xfde67e78, 0xfde7e638, 0xfde97890, 0xfdeb34c5, 0xfded1a1e, 0xfdef27de, 0xfdf15d47, 0xfdf3b99b,
+        0xfdf63c19, 0xfdf8e401, 0xfdfbb090, 0xfdfea102, 0xfe01b494, 0xfe04ea81, 0xfe084202, 0xfe0bba52, 0xfe0f52a9, 0xfe130a40, 0xfe16e050, 0xfe1ad410, 0xfe1ee4b9, 0xfe231181, 0xfe2759a0, 0xfe2bbc4e, 0xfe3038c2, 0xfe34ce35, 0xfe397bdd, 0xfe3e40f4, 0xfe431cb3, 0xfe480e52, 0xfe4d150b, 0xfe523019, 0xfe575eb6, 0xfe5ca01f, 0xfe61f390, 0xfe675846, 0xfe6ccd7f, 0xfe72527c, 0xfe77e67d, 0xfe7d88c3, 0xfe833890, 0xfe88f52a, 0xfe8ebdd5, 0xfe9491d7, 0xfe9a707a, 0xfea05906, 0xfea64ac7, 0xfeac4509, 0xfeb2471b, 0xfeb8504c, 0xfebe5fee, 0xfec47555, 0xfeca8fd6, 0xfed0aec7, 0xfed6d183, 0xfedcf763, 0xfee31fc4, 0xfee94a07, 0xfeef758b, 0xfef5a1b3, 0xfefbcde6, 0xff01f989, 0xff082408, 0xff0e4ccd, 0xff147346, 0xff1a96e4, 0xff20b71a, 0xff26d35c, 0xff2ceb21, 0xff32fde4, 0xff390b21, 0xff3f1255, 0xff451303, 0xff4b0cac, 0xff50fed8, 0xff56e90f, 0xff5ccadb, 0xff62a3ca, 0xff68736c, 0xff6e3954, 0xff73f516, 0xff79a64a, 0xff7f4c8b, 0xff84e775, 0xff8a76a7, 0xff8ff9c4, 0xff957070, 0xff9ada53, 0xffa03716, 0xffa58665, 0xffaac7ef, 0xffaffb66, 0xffb5207e, 0xffba36ee, 0xffbf3e6f, 0xffc436bd, 0xffc91f96, 0xffcdf8bc, 0xffd2c1f1, 0xffd77afc, 0xffdc23a6, 0xffe0bbb9, 0xffe54303, 0xffe9b954, 0xffee1e7f, 0xfff27259, 0xfff6b4b9, 0xfffae579, 0xffff0475, 0x0003118c, 0x00070ca0, 0x000af592, 0x000ecc4a, 0x001290ae, 0x001642aa, 0x0019e22a, 0x001d6f1c, 0x0020e971, 0x0024511d, 0x0027a615, 0x002ae850, 0x002e17c8, 0x00313479, 0x00343e5f, 0x0037357c, 0x003a19cf, 0x003ceb5e, 0x003faa2d, 0x00425644, 0x0044efac, 0x00477671, 0x0049ea9f, 0x004c4c45, 0x004e9b74, 0x0050d83e, 0x005302b6,
+        0x00551af3, 0x0057210c, 0x00591518, 0x005af733, 0x005cc777, 0x005e8604, 0x006032f6, 0x0061ce6f, 0x0063588f, 0x0064d17a, 0x00663953, 0x00679041, 0x0068d669, 0x006a0bf4, 0x006b310a, 0x006c45d6, 0x006d4a83, 0x006e3f3d, 0x006f2431, 0x006ff98f, 0x0070bf84, 0x00717641, 0x00721df8, 0x0072b6da, 0x00734119, 0x0073bcea, 0x00742a81, 0x00748a12, 0x0074dbd4, 0x00751ffc, 0x007556c1, 0x0075805b, 0x00759d03, 0x0075acef, 0x0075b05a, 0x0075a77d, 0x00759291, 0x007571d1, 0x00754578, 0x00750dc0, 0x0074cae5, 0x00747d22, 0x007424b3, 0x0073c1d3, 0x007354bf, 0x0072ddb2, 0x00725cea, 0x0071d2a2, 0x00713f16, 0x0070a284, 0x006ffd28, 0x006f4f3d, 0x006e9901, 0x006ddaaf, 0x006d1484, 0x006c46bc, 0x006b7192, 0x006a9542, 0x0069b208, 0x0068c81e, 0x0067d7c0, 0x0066e128, 0x0065e490, 0x0064e233, 0x0063da4a, 0x0062cd0f, 0x0061baba, 0x0060a384, 0x005f87a5, 0x005e6754, 0x005d42c9, 0x005c1a3b, 0x005aeddf, 0x0059bdeb, 0x00588a94, 0x00575410, 0x00561a91, 0x0054de4b, 0x00539f71, 0x00525e36, 0x00511acb, 0x004fd560, 0x004e8e26, 0x004d454d, 0x004bfb04, 0x004aaf78, 0x004962d9, 0x00481551, 0x0046c70e, 0x0045783b, 0x00442903, 0x0042d990, 0x00418a0a, 0x00403a9b, 0x003eeb6a, 0x003d9c9e, 0x003c4e5d, 0x003b00cc, 0x0039b411, 0x0038684f, 0x00371da9, 0x0035d441, 0x00348c38, 0x003345b0, 0x003200c9, 0x0030bda0, 0x002f7c55, 0x002e3d04, 0x002cffcb, 0x002bc4c5, 0x002a8c0d, 0x002955be, 0x002821f0, 0x0026f0bc, 0x0025c23b, 0x00249683, 0x00236daa, 0x002247c5, 0x002124ea, 0x0020052b, 0x001ee89d, 0x001dcf51, 0x001cb958, 0x001ba6c4, 0x001a97a5, 0x00198c08, 0x001883fe, 0x00177f93,
+        0x00167ed5, 0x001581cf, 0x0014888e, 0x0013931b, 0x0012a181, 0x0011b3ca, 0x0010c9fd, 0x000fe423, 0x000f0244, 0x000e2465, 0x000d4a8c, 0x000c74bf, 0x000ba303, 0x000ad55c, 0x000a0bcc, 0x00094656, 0x000884fe, 0x0007c7c3, 0x00070ea8, 0x000659ad, 0x0005a8d0, 0x0004fc13, 0x00045373, 0x0003aeee, 0x00030e82, 0x0002722d, 0x0001d9eb, 0x000145b8, 0x0000b58f, 0x0000296d, 0xffffa14b, 0xffff1d24, 0xfffe9cf2, 0xfffe20ae, 0xfffda852, 0xfffd33d5, 0xfffcc331, 0xfffc565d, 0xfffbed50, 0xfffb8802, 0xfffb2669, 0xfffac87d, 0xfffa6e32, 0xfffa1780, 0xfff9c45a, 0xfff974b8, 0xfff9288e, 0xfff8dfcf, 0xfff89a72, 0xfff8586a, 0xfff819ac, 0xfff7de2a, 0xfff7a5d9, 0xfff770ab, 0xfff73e95, 0xfff70f89, 0xfff6e37b, 0xfff6ba5c, 0xfff6941f, 0xfff670b7, 0xfff65016, 0xfff6322f, 0xfff616f3, 0xfff5fe55, 0xfff5e846, 0xfff5d4b8, 0xfff5c39d, 0xfff5b4e7, 0xfff5a888, 0xfff59e71, 0xfff59694, 0xfff590e2, 0xfff58d4d, 0xfff58bc8, 0xfff58c42, 0xfff58eaf, 0xfff592ff, 0xfff59925, 0xfff5a112, 0xfff5aab7, 0xfff5b608, 0xfff5c2f6, 0xfff5d172, 0xfff5e16f, 0xfff5f2df, 0xfff605b5, 0xfff619e2, 0xfff62f59, 0xfff6460d, 0xfff65df0, 0xfff676f6, 0xfff69110, 0xfff6ac32, 0xfff6c850, 0xfff6e55d, 0xfff7034b, 0xfff72210, 0xfff7419e, 0xfff761ea, 0xfff782e7, 0xfff7a48b, 0xfff7c6c9, 0xfff7e996, 0xfff80ce7, 0xfff830b1, 0xfff854ea, 0xfff87986, 0xfff89e7c, 0xfff8c3c0, 0xfff8e949, 0xfff90f0e, 0xfff93504, 0xfff95b23, 0xfff98160, 0xfff9a7b4, 0xfff9ce14, 0xfff9f47a, 0xfffa1adc, 0xfffa4131, 0xfffa6774, 0xfffa8d9a, 0xfffab39e, 0xfffad977, 0xfffaff1f, 0xfffb248f, 0xfffb49c1, 0xfffb6eac, 0xfffb934d,
         0x00000000 // this one is needed for lerping the last coefficient
 };
 
diff --git a/services/audioflinger/AudioResamplerSinc.h b/services/audioflinger/AudioResamplerSinc.h
index 25fc025..48bc747 100644
--- a/services/audioflinger/AudioResamplerSinc.h
+++ b/services/audioflinger/AudioResamplerSinc.h
@@ -71,7 +71,7 @@
 
     // ----------------------------------------------------------------------------
     static const int32_t RESAMPLE_FIR_NUM_COEF       = 8;
-    static const int32_t RESAMPLE_FIR_LERP_INT_BITS  = 4;
+    static const int32_t RESAMPLE_FIR_LERP_INT_BITS  = 7;
 
     struct Constants {
         // we have 16 coefs samples per zero-crossing
diff --git a/services/audioflinger/test-resample.cpp b/services/audioflinger/test-resample.cpp
new file mode 100644
index 0000000..a8e23e4
--- /dev/null
+++ b/services/audioflinger/test-resample.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2012 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 "AudioResampler.h"
+#include <media/AudioBufferProvider.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <time.h>
+
+using namespace android;
+
+struct HeaderWav {
+    HeaderWav(size_t size, int nc, int sr, int bits) {
+        strncpy(RIFF, "RIFF", 4);
+        chunkSize = size + sizeof(HeaderWav);
+        strncpy(WAVE, "WAVE", 4);
+        strncpy(fmt,  "fmt ", 4);
+        fmtSize = 16;
+        audioFormat = 1;
+        numChannels = nc;
+        samplesRate = sr;
+        byteRate = sr * numChannels * (bits/8);
+        align = nc*(bits/8);
+        bitsPerSample = bits;
+        strncpy(data, "data", 4);
+        dataSize = size;
+    }
+
+    char RIFF[4];           // RIFF
+    uint32_t chunkSize;     // File size
+    char WAVE[4];        // WAVE
+    char fmt[4];            // fmt\0
+    uint32_t fmtSize;       // fmt size
+    uint16_t audioFormat;   // 1=PCM
+    uint16_t numChannels;   // num channels
+    uint32_t samplesRate;   // sample rate in hz
+    uint32_t byteRate;      // Bps
+    uint16_t align;         // 2=16-bit mono, 4=16-bit stereo
+    uint16_t bitsPerSample; // bits per sample
+    char data[4];           // "data"
+    uint32_t dataSize;      // size
+};
+
+static int usage(const char* name) {
+    fprintf(stderr,"Usage: %s [-p] [-h] [-q <dq|lq|mq|hq|vhq>] [-i <input-sample-rate>] [-o <output-sample-rate>] <input-file> <output-file>\n", name);
+    fprintf(stderr,"-p              - enable profiling\n");
+    fprintf(stderr,"-h              - create wav file\n");
+    fprintf(stderr,"-q              - resampler quality\n");
+    fprintf(stderr,"                  dq  : default quality\n");
+    fprintf(stderr,"                  lq  : low quality\n");
+    fprintf(stderr,"                  mq  : medium quality\n");
+    fprintf(stderr,"                  hq  : high quality\n");
+    fprintf(stderr,"                  vhq : very high quality\n");
+    fprintf(stderr,"-i              - input file sample rate\n");
+    fprintf(stderr,"-o              - output file sample rate\n");
+    return -1;
+}
+
+int main(int argc, char* argv[]) {
+
+    bool profiling = false;
+    bool writeHeader = false;
+    int input_freq = 0;
+    int output_freq = 0;
+    AudioResampler::src_quality quality = AudioResampler::DEFAULT_QUALITY;
+
+    int ch;
+    while ((ch = getopt(argc, argv, "phq:i:o:")) != -1) {
+        switch (ch) {
+        case 'p':
+            profiling = true;
+            break;
+        case 'h':
+            writeHeader = true;
+            break;
+        case 'q':
+            if (!strcmp(optarg, "dq"))
+                quality = AudioResampler::DEFAULT_QUALITY;
+            else if (!strcmp(optarg, "lq"))
+                quality = AudioResampler::LOW_QUALITY;
+            else if (!strcmp(optarg, "mq"))
+                quality = AudioResampler::MED_QUALITY;
+            else if (!strcmp(optarg, "hq"))
+                quality = AudioResampler::HIGH_QUALITY;
+            else if (!strcmp(optarg, "vhq"))
+                quality = AudioResampler::VERY_HIGH_QUALITY;
+            else {
+                usage(argv[0]);
+                return -1;
+            }
+            break;
+        case 'i':
+            input_freq = atoi(optarg);
+            break;
+        case 'o':
+            output_freq = atoi(optarg);
+            break;
+        case '?':
+        default:
+            usage(argv[0]);
+            return -1;
+        }
+    }
+    argc -= optind;
+
+    if (argc != 2) {
+        usage(argv[0]);
+        return -1;
+    }
+
+    argv += optind;
+
+    // ----------------------------------------------------------
+
+    struct stat st;
+    if (stat(argv[0], &st) < 0) {
+        fprintf(stderr, "stat: %s\n", strerror(errno));
+        return -1;
+    }
+
+    int input_fd = open(argv[0], O_RDONLY);
+    if (input_fd < 0) {
+        fprintf(stderr, "open: %s\n", strerror(errno));
+        return -1;
+    }
+
+    size_t input_size = st.st_size;
+    void* input_vaddr = mmap(0, input_size, PROT_READ, MAP_PRIVATE, input_fd,
+            0);
+    if (input_vaddr == MAP_FAILED ) {
+        fprintf(stderr, "mmap: %s\n", strerror(errno));
+        return -1;
+    }
+
+//    printf("input  sample rate: %d Hz\n", input_freq);
+//    printf("output sample rate: %d Hz\n", output_freq);
+//    printf("input mmap: %p, size=%u\n", input_vaddr, input_size);
+
+    // ----------------------------------------------------------
+
+    class Provider: public AudioBufferProvider {
+        int16_t* mAddr;
+        size_t mNumFrames;
+    public:
+        Provider(const void* addr, size_t size) {
+            mAddr = (int16_t*) addr;
+            mNumFrames = size / sizeof(int16_t);
+        }
+        virtual status_t getNextBuffer(Buffer* buffer,
+                int64_t pts = kInvalidPTS) {
+            buffer->frameCount = mNumFrames;
+            buffer->i16 = mAddr;
+            return NO_ERROR;
+        }
+        virtual void releaseBuffer(Buffer* buffer) {
+        }
+    } provider(input_vaddr, input_size);
+
+    size_t output_size = 2 * 2 * ((int64_t) input_size * output_freq)
+            / input_freq;
+    output_size &= ~7; // always stereo, 32-bits
+
+    void* output_vaddr = malloc(output_size);
+    memset(output_vaddr, 0, output_size);
+
+    AudioResampler* resampler = AudioResampler::create(16, 1, output_freq,
+            quality);
+
+    size_t out_frames = output_size/8;
+    resampler->setSampleRate(input_freq);
+    resampler->setVolume(0x1000, 0x1000);
+    resampler->resample((int*) output_vaddr, out_frames, &provider);
+
+    if (profiling) {
+        memset(output_vaddr, 0, output_size);
+        timespec start, end;
+        clock_gettime(CLOCK_MONOTONIC_HR, &start);
+        resampler->resample((int*) output_vaddr, out_frames, &provider);
+        clock_gettime(CLOCK_MONOTONIC_HR, &end);
+        int64_t start_ns = start.tv_sec * 1000000000LL + start.tv_nsec;
+        int64_t end_ns = end.tv_sec * 1000000000LL + end.tv_nsec;
+        int64_t time = end_ns - start_ns;
+        printf("%f Mspl/s\n", out_frames/(time/1e9)/1e6);
+    }
+
+    // down-mix (we just truncate and keep the left channel)
+    int32_t* out = (int32_t*) output_vaddr;
+    int16_t* convert = (int16_t*) malloc(out_frames * sizeof(int16_t));
+    for (size_t i = 0; i < out_frames; i++) {
+        int32_t s = out[i * 2] >> 12;
+        if (s > 32767)       s =  32767;
+        else if (s < -32768) s = -32768;
+        convert[i] = int16_t(s);
+    }
+
+    // write output to disk
+    int output_fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC,
+            S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+    if (output_fd < 0) {
+        fprintf(stderr, "open: %s\n", strerror(errno));
+        return -1;
+    }
+
+    if (writeHeader) {
+        HeaderWav wav(out_frames*sizeof(int16_t), 1, output_freq, 16);
+        write(output_fd, &wav, sizeof(wav));
+    }
+
+    write(output_fd, convert, out_frames * sizeof(int16_t));
+    close(output_fd);
+
+    return 0;
+}
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index eff47c8..801afe9 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -40,6 +40,9 @@
     system/media/camera/include \
     external/jpeg
 
+
+LOCAL_CFLAGS += -Wall -Wextra
+
 LOCAL_MODULE:= libcameraservice
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index e59a240..9627416 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -37,10 +37,6 @@
     return IPCThreadState::self()->getCallingPid();
 }
 
-static int getCallingUid() {
-    return IPCThreadState::self()->getCallingUid();
-}
-
 // Interface used by CameraService
 
 Camera2Client::Camera2Client(const sp<CameraService>& cameraService,
@@ -370,7 +366,6 @@
 void Camera2Client::disconnect() {
     ATRACE_CALL();
     Mutex::Autolock icl(mICameraLock);
-    status_t res;
 
     // Allow both client and the media server to disconnect at all times
     int callingPid = getCallingPid();
@@ -575,7 +570,7 @@
     ATRACE_CALL();
     ALOGV("%s: Camera %d: Flag 0x%x", __FUNCTION__, mCameraId, flag);
     Mutex::Autolock icl(mICameraLock);
-    status_t res;
+
     if ( checkPid(__FUNCTION__) != OK) return;
 
     SharedParameters::Lock l(mParameters);
@@ -1062,7 +1057,7 @@
     return OK;
 }
 
-status_t Camera2Client::takePicture(int msgType) {
+status_t Camera2Client::takePicture(int /*msgType*/) {
     ATRACE_CALL();
     Mutex::Autolock icl(mICameraLock);
     status_t res;
@@ -1244,7 +1239,7 @@
     return OK;
 }
 
-status_t Camera2Client::commandStartFaceDetectionL(int type) {
+status_t Camera2Client::commandStartFaceDetectionL(int /*type*/) {
     ALOGV("%s: Camera %d: Starting face detection",
           __FUNCTION__, mCameraId);
     status_t res;
@@ -1331,6 +1326,8 @@
 }
 
 void Camera2Client::notifyShutter(int frameNumber, nsecs_t timestamp) {
+    (void)frameNumber;
+    (void)timestamp;
     ALOGV("%s: Shutter notification for frame %d at time %lld", __FUNCTION__,
             frameNumber, timestamp);
 }
@@ -1452,6 +1449,8 @@
 }
 
 void Camera2Client::notifyAutoWhitebalance(uint8_t newState, int triggerId) {
+    (void)newState;
+    (void)triggerId;
     ALOGV("%s: Auto-whitebalance state now %d, last trigger %d",
             __FUNCTION__, newState, triggerId);
 }
diff --git a/services/camera/libcameraservice/Camera2Device.cpp b/services/camera/libcameraservice/Camera2Device.cpp
index d6445c1..5bfa085 100644
--- a/services/camera/libcameraservice/Camera2Device.cpp
+++ b/services/camera/libcameraservice/Camera2Device.cpp
@@ -765,7 +765,6 @@
     ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     Mutex::Autolock l(mMutex);
-    status_t res;
 
     if (mStreamSlotCount > 0) {
         freeBuffers(mStreamSlot.begin(), mStreamSlot.end());
@@ -785,7 +784,7 @@
 }
 
 status_t Camera2Device::MetadataQueue::dump(int fd,
-        const Vector<String16>& args) {
+        const Vector<String16>& /*args*/) {
     ATRACE_CALL();
     String8 result;
     status_t notLocked;
@@ -894,12 +893,13 @@
 {
     ATRACE_CALL();
     MetadataQueue *queue = getInstance(q);
+    (void)queue;
     free_camera_metadata(old_buffer);
     return OK;
 }
 
 int Camera2Device::MetadataQueue::producer_dequeue(
-        const camera2_frame_queue_dst_ops_t *q,
+        const camera2_frame_queue_dst_ops_t * /*q*/,
         size_t entries, size_t bytes,
         camera_metadata_t **buffer)
 {
@@ -912,7 +912,7 @@
 }
 
 int Camera2Device::MetadataQueue::producer_cancel(
-        const camera2_frame_queue_dst_ops_t *q,
+        const camera2_frame_queue_dst_ops_t * /*q*/,
         camera_metadata_t *old_buffer)
 {
     ATRACE_CALL();
@@ -1184,7 +1184,7 @@
 }
 
 status_t Camera2Device::StreamAdapter::dump(int fd,
-        const Vector<String16>& args) {
+        const Vector<String16>& /*args*/) {
     ATRACE_CALL();
     String8 result = String8::format("      Stream %d: %d x %d, format 0x%x\n",
             mId, mWidth, mHeight, mFormat);
@@ -1423,7 +1423,7 @@
 }
 
 status_t Camera2Device::ReprocessStreamAdapter::dump(int fd,
-        const Vector<String16>& args) {
+        const Vector<String16>& /*args*/) {
     ATRACE_CALL();
     String8 result =
             String8::format("      Reprocess stream %d: %d x %d, fmt 0x%x\n",
@@ -1444,7 +1444,7 @@
     const camera2_stream_in_ops_t *w,
         buffer_handle_t** buffer) {
     ATRACE_CALL();
-    int res;
+
     ReprocessStreamAdapter* stream =
             const_cast<ReprocessStreamAdapter*>(
                 static_cast<const ReprocessStreamAdapter*>(w));
diff --git a/services/camera/libcameraservice/CameraClient.cpp b/services/camera/libcameraservice/CameraClient.cpp
index b930c02..006a9c9 100644
--- a/services/camera/libcameraservice/CameraClient.cpp
+++ b/services/camera/libcameraservice/CameraClient.cpp
@@ -34,10 +34,6 @@
     return IPCThreadState::self()->getCallingPid();
 }
 
-static int getCallingUid() {
-    return IPCThreadState::self()->getCallingUid();
-}
-
 CameraClient::CameraClient(const sp<CameraService>& cameraService,
         const sp<ICameraClient>& cameraClient,
         int cameraId, int cameraFacing, int clientPid, int servicePid):
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 05ac9fa..167b37c 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -427,7 +427,7 @@
     /**
      * Dump state of the camera hardware
      */
-    status_t dump(int fd, const Vector<String16>& args) const
+    status_t dump(int fd, const Vector<String16>& /*args*/) const
     {
         ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->dump)
@@ -584,9 +584,10 @@
 #endif
 
     static int __lock_buffer(struct preview_stream_ops* w,
-                      buffer_handle_t* buffer)
+                      buffer_handle_t* /*buffer*/)
     {
         ANativeWindow *a = anw(w);
+        (void)a;
         return 0;
     }
 
diff --git a/services/camera/libcameraservice/camera2/BurstCapture.cpp b/services/camera/libcameraservice/camera2/BurstCapture.cpp
index f56c50c..192d419 100644
--- a/services/camera/libcameraservice/camera2/BurstCapture.cpp
+++ b/services/camera/libcameraservice/camera2/BurstCapture.cpp
@@ -38,7 +38,8 @@
 BurstCapture::~BurstCapture() {
 }
 
-status_t BurstCapture::start(Vector<CameraMetadata> &metadatas, int32_t firstCaptureId) {
+status_t BurstCapture::start(Vector<CameraMetadata> &/*metadatas*/,
+                             int32_t /*firstCaptureId*/) {
     ALOGE("Not completely implemented");
     return INVALID_OPERATION;
 }
@@ -75,7 +76,7 @@
 
 CpuConsumer::LockedBuffer* BurstCapture::jpegEncode(
     CpuConsumer::LockedBuffer *imgBuffer,
-    int quality)
+    int /*quality*/)
 {
     ALOGV("%s", __FUNCTION__);
 
@@ -91,7 +92,7 @@
     buffers.push_back(imgEncoded);
 
     sp<JpegCompressor> jpeg = new JpegCompressor();
-    status_t res = jpeg->start(buffers, 1);
+    jpeg->start(buffers, 1);
 
     bool success = jpeg->waitForDone(10 * 1e9);
     if(success) {
@@ -103,7 +104,7 @@
     }
 }
 
-status_t BurstCapture::processFrameAvailable(sp<Camera2Client> &client) {
+status_t BurstCapture::processFrameAvailable(sp<Camera2Client> &/*client*/) {
     ALOGE("Not implemented");
     return INVALID_OPERATION;
 }
diff --git a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
index 3e9c255..307cfab 100644
--- a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
@@ -119,7 +119,6 @@
 
 status_t CallbackProcessor::deleteStream() {
     ATRACE_CALL();
-    status_t res;
 
     Mutex::Autolock l(mInputMutex);
 
@@ -144,7 +143,7 @@
     return mCallbackStreamId;
 }
 
-void CallbackProcessor::dump(int fd, const Vector<String16>& args) const {
+void CallbackProcessor::dump(int /*fd*/, const Vector<String16>& /*args*/) const {
 }
 
 bool CallbackProcessor::threadLoop() {
@@ -173,7 +172,6 @@
     ATRACE_CALL();
     status_t res;
 
-    int callbackHeapId;
     sp<Camera2Heap> callbackHeap;
     size_t heapIdx;
 
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index fe4abc0..b228faf 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -128,7 +128,7 @@
 }
 
 
-void CaptureSequencer::dump(int fd, const Vector<String16>& args) {
+void CaptureSequencer::dump(int fd, const Vector<String16>& /*args*/) {
     String8 result;
     if (mCaptureRequest.entryCount() != 0) {
         result = "    Capture request:\n";
@@ -182,7 +182,6 @@
 };
 
 bool CaptureSequencer::threadLoop() {
-    status_t res;
 
     sp<Camera2Client> client = mClient.promote();
     if (client == 0) return false;
@@ -213,7 +212,8 @@
     return true;
 }
 
-CaptureSequencer::CaptureState CaptureSequencer::manageIdle(sp<Camera2Client> &client) {
+CaptureSequencer::CaptureState CaptureSequencer::manageIdle(
+        sp<Camera2Client> &/*client*/) {
     status_t res;
     Mutex::Autolock l(mInputMutex);
     while (!mStartCapture) {
@@ -350,13 +350,13 @@
 }
 
 CaptureSequencer::CaptureState CaptureSequencer::manageZslWaiting(
-        sp<Camera2Client> &client) {
+        sp<Camera2Client> &/*client*/) {
     ALOGV("%s", __FUNCTION__);
     return DONE;
 }
 
 CaptureSequencer::CaptureState CaptureSequencer::manageZslReprocessing(
-        sp<Camera2Client> &client) {
+        sp<Camera2Client> &/*client*/) {
     ALOGV("%s", __FUNCTION__);
     return START;
 }
@@ -378,7 +378,7 @@
 }
 
 CaptureSequencer::CaptureState CaptureSequencer::manageStandardPrecaptureWait(
-        sp<Camera2Client> &client) {
+        sp<Camera2Client> &/*client*/) {
     status_t res;
     ATRACE_CALL();
     Mutex::Autolock l(mInputMutex);
@@ -578,7 +578,7 @@
 }
 
 CaptureSequencer::CaptureState CaptureSequencer::manageBurstCaptureWait(
-        sp<Camera2Client> &client) {
+        sp<Camera2Client> &/*client*/) {
     status_t res;
     ATRACE_CALL();
 
diff --git a/services/camera/libcameraservice/camera2/FrameProcessor.cpp b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
index 064607c..e032522 100644
--- a/services/camera/libcameraservice/camera2/FrameProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
@@ -62,7 +62,7 @@
     return OK;
 }
 
-void FrameProcessor::dump(int fd, const Vector<String16>& args) {
+void FrameProcessor::dump(int fd, const Vector<String16>& /*args*/) {
     String8 result("    Latest received frame:\n");
     write(fd, result.string(), result.size());
     mLastFrame.dump(fd, 2, 6);
@@ -128,7 +128,6 @@
 
 status_t FrameProcessor::processListeners(const CameraMetadata &frame,
         sp<Camera2Client> &client) {
-    status_t res;
     ATRACE_CALL();
     camera_metadata_ro_entry_t entry;
 
@@ -173,7 +172,7 @@
     ATRACE_CALL();
     camera_metadata_ro_entry_t entry;
     bool enableFaceDetect;
-    int maxFaces;
+
     {
         SharedParameters::Lock l(client->getParameters());
         enableFaceDetect = l.mParameters.enableFaceDetect;
diff --git a/services/camera/libcameraservice/camera2/JpegCompressor.cpp b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
index 702ef58..c9af71e 100644
--- a/services/camera/libcameraservice/camera2/JpegCompressor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
@@ -144,7 +144,7 @@
 }
 
 // old function -- TODO: update for new buffer type
-bool JpegCompressor::isStreamInUse(uint32_t id) {
+bool JpegCompressor::isStreamInUse(uint32_t /*id*/) {
     ALOGV("%s", __FUNCTION__);
     Mutex::Autolock lock(mBusyMutex);
 
@@ -203,14 +203,14 @@
     dest->free_in_buffer = kMaxJpegSize;
 }
 
-boolean JpegCompressor::jpegEmptyOutputBuffer(j_compress_ptr cinfo) {
+boolean JpegCompressor::jpegEmptyOutputBuffer(j_compress_ptr /*cinfo*/) {
     ALOGV("%s", __FUNCTION__);
     ALOGE("%s: JPEG destination buffer overflow!",
             __FUNCTION__);
     return true;
 }
 
-void JpegCompressor::jpegTermDestination(j_compress_ptr cinfo) {
+void JpegCompressor::jpegTermDestination(j_compress_ptr /*cinfo*/) {
     ALOGV("%s", __FUNCTION__);
     ALOGV("%s: Done writing JPEG data. %d bytes left in buffer",
             __FUNCTION__, cinfo->dest->free_in_buffer);
diff --git a/services/camera/libcameraservice/camera2/JpegProcessor.cpp b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
index ffc072b..6280f83 100644
--- a/services/camera/libcameraservice/camera2/JpegProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
@@ -139,7 +139,6 @@
 
 status_t JpegProcessor::deleteStream() {
     ATRACE_CALL();
-    status_t res;
 
     Mutex::Autolock l(mInputMutex);
 
@@ -164,7 +163,7 @@
     return mCaptureStreamId;
 }
 
-void JpegProcessor::dump(int fd, const Vector<String16>& args) const {
+void JpegProcessor::dump(int /*fd*/, const Vector<String16>& /*args*/) const {
 }
 
 bool JpegProcessor::threadLoop() {
@@ -356,7 +355,7 @@
     // Find End of Image
     // Scan JPEG buffer until End of Image (EOI)
     bool foundEnd = false;
-    for (size; size <= maxSize - MARKER_LENGTH; size++) {
+    for ( ; size <= maxSize - MARKER_LENGTH; size++) {
         if ( checkJpegEnd(jpegBuffer + size) ) {
             foundEnd = true;
             size += MARKER_LENGTH;
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index e9e5e79..93927e6 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -951,7 +951,6 @@
 
 camera_metadata_ro_entry_t Parameters::staticInfo(uint32_t tag,
         size_t minCount, size_t maxCount) const {
-    status_t res;
     camera_metadata_ro_entry_t entry = info->find(tag);
 
     if (CC_UNLIKELY( entry.count == 0 )) {
@@ -2430,7 +2429,7 @@
     return crop;
 }
 
-int32_t Parameters::fpsFromRange(int32_t min, int32_t max) const {
+int32_t Parameters::fpsFromRange(int32_t /*min*/, int32_t max) const {
     return max;
 }
 
diff --git a/services/camera/libcameraservice/camera2/StreamingProcessor.cpp b/services/camera/libcameraservice/camera2/StreamingProcessor.cpp
index 207f780..6ea27b2 100644
--- a/services/camera/libcameraservice/camera2/StreamingProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/StreamingProcessor.cpp
@@ -447,7 +447,6 @@
     ATRACE_CALL();
     Mutex::Autolock m(mMutex);
 
-    status_t res;
     mPreviewRequestId++;
     if (mPreviewRequestId >= Camera2Client::kPreviewRequestIdEnd) {
         mPreviewRequestId = Camera2Client::kPreviewRequestIdStart;
@@ -628,7 +627,7 @@
 }
 
 
-status_t StreamingProcessor::dump(int fd, const Vector<String16>& args) {
+status_t StreamingProcessor::dump(int fd, const Vector<String16>& /*args*/) {
     String8 result;
 
     result.append("  Current requests:\n");
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index 1937955..9584028 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -69,11 +69,12 @@
     }
 }
 
-void ZslProcessor::onFrameAvailable(int32_t frameId, const CameraMetadata &frame) {
+void ZslProcessor::onFrameAvailable(int32_t /*frameId*/, const CameraMetadata &frame) {
     Mutex::Autolock l(mInputMutex);
     camera_metadata_ro_entry_t entry;
     entry = frame.find(ANDROID_SENSOR_TIMESTAMP);
     nsecs_t timestamp = entry.data.i64[0];
+    (void)timestamp;
     ALOGVV("Got preview frame for timestamp %lld", timestamp);
 
     if (mState != RUNNING) return;
@@ -367,7 +368,7 @@
     return OK;
 }
 
-void ZslProcessor::dump(int fd, const Vector<String16>& args) const {
+void ZslProcessor::dump(int fd, const Vector<String16>& /*args*/) const {
     Mutex::Autolock l(mInputMutex);
     if (!mLatestCapturedRequest.isEmpty()) {
         String8 result("    Latest ZSL capture request:\n");
diff --git a/tools/resampler_tools/fir.cpp b/tools/resampler_tools/fir.cpp
index 377814f..acd9911 100644
--- a/tools/resampler_tools/fir.cpp
+++ b/tools/resampler_tools/fir.cpp
@@ -16,6 +16,9 @@
 
 #include <math.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 
 static double sinc(double x) {
     if (fabs(x) == 0.0f) return 1.0f;
@@ -34,44 +37,82 @@
         y=x/3.75;
         y*=y;
         ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492
-            +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
+                +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
     } else {
         y=3.75/ax;
         ans=(exp(ax)/sqrt(ax))*(0.39894228+y*(0.1328592e-1
-            +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
-            +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
-            +y*0.392377e-2))))))));
+                +y*(0.225319e-2+y*(-0.157565e-2+y*(0.916281e-2
+                        +y*(-0.2057706e-1+y*(0.2635537e-1+y*(-0.1647633e-1
+                                +y*0.392377e-2))))))));
     }
     return ans;
 }
 
-static double kaiser(int k, int N, double alpha) {
+static double kaiser(int k, int N, double beta) {
     if (k < 0 || k > N)
         return 0;
-    return I0(M_PI*alpha * sqrt(1.0 - sqr((2.0*k)/N - 1.0))) / I0(M_PI*alpha);
+    return I0(beta * sqrt(1.0 - sqr((2.0*k)/N - 1.0))) / I0(beta);
+}
+
+
+static void usage(char* name) {
+    fprintf(stderr,
+            "usage: %s [-h] [-d] [-s sample_rate] [-c cut-off_frequency] [-n half_zero_crossings] [-f {float|fixed}] [-b beta] [-v dBFS] [-l lerp]\n"
+            "       %s [-h] [-d] [-s sample_rate] [-c cut-off_frequency] [-n half_zero_crossings] [-f {float|fixed}] [-b beta] [-v dBFS] -p M/N\n"
+            "    -h    this help message\n"
+            "    -d    debug, print comma-separated coefficient table\n"
+            "    -p    generate poly-phase filter coefficients, with sample increment M/N\n"
+            "    -s    sample rate (48000)\n"
+            "    -c    cut-off frequency (20478)\n"
+            "    -n    number of zero-crossings on one side (8)\n"
+            "    -l    number of lerping bits (4)\n"
+            "    -f    output format, can be fixed-point or floating-point (fixed)\n"
+            "    -b    kaiser window parameter beta (7.865 [-80dB])\n"
+            "    -v    attenuation in dBFS (0)\n",
+            name, name
+    );
+    exit(0);
 }
 
 int main(int argc, char** argv)
 {
     // nc is the number of bits to store the coefficients
-    int nc = 32;
+    const int nc = 32;
 
-    // ni is the minimum number of bits needed for interpolation
-    // (not used for generating the coefficients)
-    const int ni = nc / 2;
+    bool polyphase = false;
+    unsigned int polyM = 160;
+    unsigned int polyN = 147;
+    bool debug = false;
+    double Fs = 48000;
+    double Fc = 20478;
+    double atten = 1;
+    int format = 0;
 
-    // cut off frequency ratio Fc/Fs
-    // The bigger the stop-band, the less coefficients we'll need.
-    double Fcr = 20000.0 / 48000.0;
 
-    // nzc is the number of zero-crossing on one half of the filter
-    int nzc = 8;
-    
-    // alpha parameter of the kaiser window
-    // Larger numbers reduce ripples in the rejection band but increase
-    // the width of the transition band. 
-    // the table below gives some value of alpha for a given
-    // stop-band attenuation.
+    // in order to keep the errors associated with the linear
+    // interpolation of the coefficients below the quantization error
+    // we must satisfy:
+    //   2^nz >= 2^(nc/2)
+    //
+    // for 16 bit coefficients that would be 256
+    //
+    // note that increasing nz only increases memory requirements,
+    // but doesn't increase the amount of computation to do.
+    //
+    //
+    // see:
+    // Smith, J.O. Digital Audio Resampling Home Page
+    // https://ccrma.stanford.edu/~jos/resample/, 2011-03-29
+    //
+    int nz = 4;
+
+    //         | 0.1102*(A - 8.7)                         A > 50
+    //  beta = | 0.5842*(A - 21)^0.4 + 0.07886*(A - 21)   21 <= A <= 50
+    //         | 0                                        A < 21
+    //   with A is the desired stop-band attenuation in dBFS
+    //
+    // for eg:
+    //
     //    30 dB    2.210
     //    40 dB    3.384
     //    50 dB    4.538
@@ -80,42 +121,162 @@
     //    80 dB    7.865
     //    90 dB    8.960
     //   100 dB   10.056
-    double alpha = 7.865;	// -80dB stop-band attenuation
-    
-    // 2^nz is the number coefficients per zero-crossing
-    // (int theory this should be 1<<(nc/2))
-    const int nz = 4;
+    double beta = 7.865;
 
-    // total number of coefficients
+
+    // 2*nzc = (A - 8) / (2.285 * dw)
+    //      with dw the transition width = 2*pi*dF/Fs
+    //
+    int nzc = 8;
+
+    //
+    // Example:
+    // 44.1 KHz to 48 KHz resampling
+    // 100 dB rejection above 28 KHz
+    //   (the spectrum will fold around 24 KHz and we want 100 dB rejection
+    //    at the point where the folding reaches 20 KHz)
+    //  ...___|_____
+    //        |     \|
+    //        | ____/|\____
+    //        |/alias|     \
+    //  ------/------+------\---------> KHz
+    //       20     24     28
+
+    // Transition band 8 KHz, or dw = 1.0472
+    //
+    // beta = 10.056
+    // nzc  = 20
+    //
+
+    int ch;
+    while ((ch = getopt(argc, argv, ":hds:c:n:f:l:b:p:v:")) != -1) {
+        switch (ch) {
+            case 'd':
+                debug = true;
+                break;
+            case 'p':
+                if (sscanf(optarg, "%u/%u", &polyM, &polyN) != 2) {
+                    usage(argv[0]);
+                }
+                polyphase = true;
+                break;
+            case 's':
+                Fs = atof(optarg);
+                break;
+            case 'c':
+                Fc = atof(optarg);
+                break;
+            case 'n':
+                nzc = atoi(optarg);
+                break;
+            case 'l':
+                nz = atoi(optarg);
+                break;
+            case 'f':
+                if (!strcmp(optarg,"fixed")) format = 0;
+                else if (!strcmp(optarg,"float")) format = 1;
+                else usage(argv[0]);
+                break;
+            case 'b':
+                beta = atof(optarg);
+                break;
+            case 'v':
+                atten = pow(10, -fabs(atof(optarg))*0.05 );
+                break;
+            case 'h':
+            default:
+                usage(argv[0]);
+                break;
+        }
+    }
+
+    // cut off frequency ratio Fc/Fs
+    double Fcr = Fc / Fs;
+
+
+    // total number of coefficients (one side)
     const int N = (1 << nz) * nzc;
 
     // generate the right half of the filter
-    printf("const int32_t RESAMPLE_FIR_SIZE           = %d;\n", N);
-    printf("const int32_t RESAMPLE_FIR_NUM_COEF       = %d;\n", nzc);
-    printf("const int32_t RESAMPLE_FIR_COEF_BITS      = %d;\n", nc);
-    printf("const int32_t RESAMPLE_FIR_LERP_FRAC_BITS = %d;\n", ni);
-    printf("const int32_t RESAMPLE_FIR_LERP_INT_BITS  = %d;\n", nz);
-    printf("\n");
-    printf("static int16_t resampleFIR[%d] = {", N);
-    for (int i=0 ; i<N ; i++)
-    {
-        double x = (2.0 * M_PI * i * Fcr) / (1 << nz);
-        double y = kaiser(i+N, 2*N, alpha) * sinc(x);
-
-        long yi = floor(y * ((1ULL<<(nc-1))) + 0.5);
-        if (yi >= (1LL<<(nc-1))) yi = (1LL<<(nc-1))-1;        
-
-        if ((i % (1 << 4)) == 0) printf("\n    ");
-        if (nc > 16)
-        	printf("0x%08x, ", int(yi));
-        else 
-        	printf("0x%04x, ", int(yi)&0xFFFF);
+    if (!debug) {
+        printf("// cmd-line: ");
+        for (int i=1 ; i<argc ; i++) {
+            printf("%s ", argv[i]);
+        }
+        printf("\n");
+        if (!polyphase) {
+            printf("const int32_t RESAMPLE_FIR_SIZE           = %d;\n", N);
+            printf("const int32_t RESAMPLE_FIR_LERP_INT_BITS  = %d;\n", nz);
+            printf("const int32_t RESAMPLE_FIR_NUM_COEF       = %d;\n", nzc);
+        } else {
+            printf("const int32_t RESAMPLE_FIR_SIZE           = %d;\n", 2*nzc*polyN);
+            printf("const int32_t RESAMPLE_FIR_NUM_COEF       = %d;\n", 2*nzc);
+        }
+        if (!format) {
+            printf("const int32_t RESAMPLE_FIR_COEF_BITS      = %d;\n", nc);
+        }
+        printf("\n");
+        printf("static %s resampleFIR[] = {", !format ? "int32_t" : "float");
     }
-    printf("\n};\n");
-    return 0;
- }
 
-// http://www.dsptutor.freeuk.com/KaiserFilterDesign/KaiserFilterDesign.html
+    if (!polyphase) {
+        for (int i=0 ; i<N ; i++) {
+            double x = (2.0 * M_PI * i * Fcr) / (1 << nz);
+            double y = kaiser(i+N, 2*N, beta) * sinc(x);
+            y *= atten;
+
+            if (!debug) {
+                if ((i % (1<<nz)) == 0)
+                    printf("\n    ");
+            }
+
+            if (!format) {
+                int64_t yi = floor(y * ((1ULL<<(nc-1))) + 0.5);
+                if (yi >= (1LL<<(nc-1))) yi = (1LL<<(nc-1))-1;
+                printf("0x%08x, ", int32_t(yi));
+            } else {
+                printf("%.9g%s ", y, debug ? "," : "f,");
+            }
+        }
+    } else {
+        for (int j=0 ; j<polyN ; j++) {
+            // calculate the phase
+            double p = ((polyM*j) % polyN) / double(polyN);
+            if (!debug) printf("\n    ");
+            else        printf("\n");
+            // generate a FIR per phase
+            for (int i=-nzc ; i<nzc ; i++) {
+                double x = 2.0 * M_PI * Fcr * (i + p);
+                double y = kaiser(i+N, 2*N, beta) * sinc(x);
+                y *= atten;
+                if (!format) {
+                    int64_t yi = floor(y * ((1ULL<<(nc-1))) + 0.5);
+                    if (yi >= (1LL<<(nc-1))) yi = (1LL<<(nc-1))-1;
+                    printf("0x%08x", int32_t(yi));
+                } else {
+                    printf("%.9g%s", y, debug ? "" : "f");
+                }
+
+                if (debug && (i==nzc-1)) {
+                } else {
+                    printf(", ");
+                }
+            }
+        }
+    }
+
+    if (!debug) {
+        if (!format) {
+            printf("\n    0x%08x ", 0);
+        } else {
+            printf("\n    %.9g ", 0.0f);
+        }
+        printf("\n};");
+    }
+    printf("\n");
+    return 0;
+}
+
 // http://www.csee.umbc.edu/help/sound/AFsp-V2R1/html/audio/ResampAudio.html
 
- 
+