AudioFlinger: Add resampler using Speex library

In addition to earlier quality settings there is a new setting, which
uses libspeexresampler from external/speex directory. The output
quality with SPEEX_QUALITY is better than with HIGH_QUALITY
setting due to a proper anti-aliasing filter.
Cherry-pick from ICS.

Change-Id: I64aef1fbf3f0802d9f1948328b9864c603c878a0
Signed-off-by: Daniel Levin <dendy@ti.com>

[Ported to JB MR2 and squashed with the following changes]

[Daniel Levin <dendy@ti.com>]
    AudioFlinger: Move sample-rate conversion check to resampler class
    AudioFlinger: AudioResamplerSpeex: Do not overwrite output buffer
    AudioFlinger: Prevent invalid free()'s in Speex resampler

MW: Port to Lollipop, add OMAP_TUNA support.
AudioFlinger: Use AudioResampler::SPEEX_QUALITY by default

The bad audio resampling in AudioFlinger ruins the audio quality of
all media that does not have 44.1kHz sample-rate. Most video files
have 48kHz sample-rate audio track and this change improves playback
audio quality of those files.

Downside of this change is increased MPU usage when playing audio with
something else than 44.1kHz sample-rate. On OMAP 4430 the over all
load increase in comparison to linear interpolation resampler is
around 1-1.5 MHz of a single ARM A9 core, when playing 48 kHz
sample-rate stereo wav file.

Cherry-pick from ICS.

Change-Id: I7a54c281279e74b8f9e8615056c4a193d6e0f203
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Daniel Levin <dendy@ti.com>

MW: Port to Lollipop, add OMAP_TUNA support.
test-resample: fix speex resampler usage

In case of OMAP_ENCHANCEMENT is enabled speex resampler will be used.
Add necessary build rules for this case.

Change-Id: Idc341dfc7037db25bea47d5b42124f6906ee6913
Signed-off-by: Andrii Beregovenko <a.beregovenko@ti.com>
Fix build.
af/as: REALLY fix the build.
Merge remote-tracking branch 'mw/aosp-5.0' into HEAD