Wraparound distortion in Opus

This CL solves the wraparound distortion in Opus.

In the Opus decoder-wrapper we are downsampling the signal from 48 kHz to 32 kHz. This is done in two steps, using the following functions from the signal processing library:
WebRtcSpl_Resample48khzTo32khz() and WebRtcSpl_VectorBitShiftW32ToW16

The latter does not have a saturation check, and the signal can suffer from wraparound. I've added saturation control to the function.

BUG=issue1089

Review URL: https://webrtc-codereview.appspot.com/967004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3103 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tina.legrand@webrtc.org
2012-11-15 08:34:38 +00:00
parent 23ec30bdfc
commit 53a8be20f1
3 changed files with 65 additions and 25 deletions

View File

@ -377,11 +377,10 @@ void WebRtcSpl_VectorBitShiftW32(WebRtc_Word32* out_vector,
WebRtc_Word16 vector_length,
G_CONST WebRtc_Word32* in_vector,
WebRtc_Word16 right_shifts);
void WebRtcSpl_VectorBitShiftW32ToW16(WebRtc_Word16* out_vector,
WebRtc_Word16 vector_length,
G_CONST WebRtc_Word32* in_vector,
WebRtc_Word16 right_shifts);
void WebRtcSpl_VectorBitShiftW32ToW16(int16_t* out_vector,
int vector_length,
const int32_t* in_vector,
int right_shifts);
void WebRtcSpl_ScaleVector(G_CONST WebRtc_Word16* in_vector,
WebRtc_Word16* out_vector,
WebRtc_Word16 gain,
@ -1180,7 +1179,8 @@ void WebRtcSpl_SynthesisQMF(const WebRtc_Word16* low_band,
// WebRtcSpl_VectorBitShiftW32ToW16(...)
//
// Bit shifts all the values in a WebRtc_Word32 vector up or downwards and
// stores the result as a WebRtc_Word16 vector
// stores the result as an int16_t vector. The function will saturate the
// signal if needed, before storing in the output vector.
//
// Input:
// - vector_length : Length of vector