Re-deleting files that reappeared when moved to webrtc.

git-svn-id: http://webrtc.googlecode.com/svn/trunk@73 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@google.com 2011-06-14 08:48:02 +00:00
parent 5af7a804ea
commit 0c08ed1ef9
79 changed files with 0 additions and 3187 deletions

View File

@ -1,26 +0,0 @@
/*
* add_affine_vector_to_vector.c
*
* This file contains the function WebRtcSpl_AddAffineVectorToVector().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_AddAffineVectorToVector(WebRtc_Word16 *out, WebRtc_Word16 *in,
WebRtc_Word16 gain, WebRtc_Word32 add_constant,
WebRtc_Word16 right_shifts, int vector_length)
{
WebRtc_Word16 *inPtr;
WebRtc_Word16 *outPtr;
int i;
inPtr = in;
outPtr = out;
for (i = 0; i < vector_length; i++)
{
(*outPtr++) += (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16((*inPtr++), gain)
+ (WebRtc_Word32)add_constant) >> right_shifts);
}
}

View File

@ -1,23 +0,0 @@
/*
* add_vectors_and_shift.c
*
* This file contains the function WebRtcSpl_AddVectorsAndShift().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_AddVectorsAndShift(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in1,
G_CONST WebRtc_Word16 *in2, WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *in1ptr = in1;
G_CONST WebRtc_Word16 *in2ptr = in2;
for (i = vector_length; i > 0; i--)
{
(*outptr++) = (WebRtc_Word16)(((*in1ptr++) + (*in2ptr++)) >> right_shifts);
}
}

View File

@ -1,26 +0,0 @@
/*
* affine_transform_vector.c
*
* This file contains the function WebRtcSpl_AffineTransformVector().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_AffineTransformVector(WebRtc_Word16 *out, WebRtc_Word16 *in,
WebRtc_Word16 gain, WebRtc_Word32 constAdd,
WebRtc_Word16 Rshifts, int length)
{
WebRtc_Word16 *inPtr;
WebRtc_Word16 *outPtr;
int i;
inPtr = in;
outPtr = out;
for (i = 0; i < length; i++)
{
(*outPtr++) = (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16((*inPtr++), gain)
+ (WebRtc_Word32)constAdd) >> Rshifts);
}
}

View File

@ -1,31 +0,0 @@
/*
* array_shift_w16.c
*
* This file contains the function WebRtcSpl_ArrayShiftW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ArrayShiftW16(WebRtc_Word16 *res,
WebRtc_Word16 length,
G_CONST WebRtc_Word16 *in,
WebRtc_Word16 right_shifts)
{
int i;
if (right_shifts > 0)
{
for (i = length; i > 0; i--)
{
(*res++) = ((*in++) >> right_shifts);
}
} else
{
for (i = length; i > 0; i--)
{
(*res++) = ((*in++) << (-right_shifts));
}
}
}

View File

@ -1,31 +0,0 @@
/*
* array_shift_w32.c
*
* This file contains the function WebRtcSpl_ArrayShiftW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ArrayShiftW32(WebRtc_Word32 *out_vector, // (o) Output vector
WebRtc_Word16 vector_length, // (i) Number of samples
G_CONST WebRtc_Word32 *in_vector, // (i) Input vector
WebRtc_Word16 right_shifts) // (i) Number of right shifts
{
int i;
if (right_shifts > 0)
{
for (i = vector_length; i > 0; i--)
{
(*out_vector++) = ((*in_vector++) >> right_shifts);
}
} else
{
for (i = vector_length; i > 0; i--)
{
(*out_vector++) = ((*in_vector++) << (-right_shifts));
}
}
}

View File

@ -1,32 +0,0 @@
/*
* array_shift_w32_to_w16.c
*
* This file contains the function WebRtcSpl_ArrayShiftW32ToW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ArrayShiftW32ToW16(WebRtc_Word16 *res, // (o) Output vector
WebRtc_Word16 length, // (i) Number of samples
G_CONST WebRtc_Word32 *in, // (i) Input vector
WebRtc_Word16 right_shifts) // (i) Number of right shifts
{
int i;
if (right_shifts >= 0)
{
for (i = length; i > 0; i--)
{
(*res++) = (WebRtc_Word16)((*in++) >> right_shifts);
}
} else
{
WebRtc_Word16 left_shifts = -right_shifts;
for (i = length; i > 0; i--)
{
(*res++) = (WebRtc_Word16)((*in++) << left_shifts);
}
}
}

View File

@ -1,111 +0,0 @@
/*
* auto_corr_to_k_returns_pred_gain.c
*
* This file contains the function WebRtcSpl_AutoCorrToKReturnsPredGain().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_AutoCorrToKReturnsPredGain(G_CONST WebRtc_Word32 *R, int use_order,
WebRtc_Word16 *K)
{
int i, n;
WebRtc_Word16 tmp, err, gain;
G_CONST WebRtc_Word32 *rptr;
WebRtc_Word32 L_num, L_den;
WebRtc_Word16 *acfptr, *pptr, *wptr, *p1ptr, *w1ptr, ACF[WEBRTC_SPL_MAX_LPC_ORDER],
P[WEBRTC_SPL_MAX_LPC_ORDER], W[WEBRTC_SPL_MAX_LPC_ORDER];
/* In the special case of R[0]==0, return K[i]=0. */
/* This should never happen; right? It doesn't */
/* if called from the LPC... */
/*
if( *R==0 )
{
for( i=use_order; i--; *K++ = 0 );
return;
}
*/
/* Initialize loop and pointers. */
acfptr = ACF;
rptr = R;
pptr = P;
p1ptr = &P[1];
w1ptr = &W[1];
wptr = w1ptr;
/* First loop; n=0. Determine shifting. */
tmp = WebRtcSpl_NormW32( *R);
*acfptr = (WebRtc_Word16)(( *rptr++ << tmp) >> 16);
*pptr++ = *acfptr++;
/* Initialize ACF, P and W. */
for (i = 1; i <= use_order; i++)
{
*acfptr = (WebRtc_Word16)(( *rptr++ << tmp) >> 16);
*wptr++ = *acfptr;
*pptr++ = *acfptr++;
}
/* Compute reflection coefficients. */
for (n = 1; n <= use_order; n++, K++)
{
tmp = WEBRTC_SPL_ABS_W16( *p1ptr );
if ( *P < tmp)
{
for (i = n; i <= use_order; i++)
*K++ = 0;
return 0;
}
// Division: WebRtcSpl_div(tmp, *P)
*K = 0;
if (tmp != 0)
{
L_num = tmp;
L_den = *P;
i = 15;
while (i--)
{
( *K) <<= 1;
L_num <<= 1;
if (L_num >= L_den)
{
L_num -= L_den;
( *K)++;
}
}
if ( *p1ptr > 0)
*K = - *K;
}
/* Schur recursion. */
pptr = P;
wptr = w1ptr;
tmp = (WebRtc_Word16)(((WebRtc_Word32) *p1ptr * (WebRtc_Word32) *K + 16384) >> 15);
*pptr = WEBRTC_SPL_ADD_SAT_W16( *pptr, tmp );
err = *pptr;
pptr++;
/* Last iteration; don't do Schur recursion. */
if (n == use_order)
{
gain = (WebRtc_Word16)WebRtcSpl_DivW32W16((WebRtc_Word32)ACF[0], err);
tmp = (14 - WebRtcSpl_NormW16(gain)) >> 1;
return tmp;
}
for (i = 1; i <= use_order - n; i++)
{
tmp = (WebRtc_Word16)(((WebRtc_Word32) *wptr * (WebRtc_Word32) *K + 16384) >> 15);
*pptr = WEBRTC_SPL_ADD_SAT_W16( *(pptr+1), tmp );
pptr++;
tmp = (WebRtc_Word16)(((WebRtc_Word32) *pptr * (WebRtc_Word32) *K + 16384) >> 15);
*wptr = WEBRTC_SPL_ADD_SAT_W16( *wptr, tmp );
wptr++;
}
}
return 0;
}

View File

@ -1,36 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CatArraysU8(G_CONST unsigned char *vector1, WebRtc_Word16 len1,
G_CONST unsigned char *vector2, WebRtc_Word16 len2,
unsigned char *outvector, WebRtc_Word16 maxlen)
{
#ifdef _DEBUG
if (maxlen < len1 + len2)
{
printf("chcatarr : out vector is too short\n");
exit(0);
}
if ((len1 != len2) || (len2 < 0))
{
printf("chcatarr : input vectors are not of equal length\n");
exit(0);
}
#endif
/* Unused input variable */
maxlen = maxlen;
/* Concat the two vectors */
/* A unsigned char is bytes long */
WEBRTC_SPL_MEMCPY_W8(outvector, vector1, len1);
WEBRTC_SPL_MEMCPY_W8(&outvector[len1], vector2, len2);
return (len1 + len2);
}

View File

@ -1,36 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CatArraysW16(G_CONST WebRtc_Word16 *vector1, WebRtc_Word16 len1,
G_CONST WebRtc_Word16 *vector2, WebRtc_Word16 len2,
WebRtc_Word16 *outvector, WebRtc_Word16 maxlen)
{
#ifdef _DEBUG
if (maxlen < len1 + len2)
{
printf("w16catarr : out vector is too short\n");
exit(0);
}
if ((len1 != len2) || (len2 < 0))
{
printf("w16catarr : input vectors are not of equal length\n");
exit(0);
}
#endif
/* Unused input variable */
maxlen = maxlen;
/* Concat the two vectors */
/* A word16 is 2 bytes long */
WEBRTC_SPL_MEMCPY_W16(outvector, vector1, len1);
WEBRTC_SPL_MEMCPY_W16(&outvector[len1], vector2, len2);
return (len1 + len2);
}

View File

@ -1,38 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CatArraysW32(G_CONST WebRtc_Word32 *vector1, WebRtc_Word16 len1,
G_CONST WebRtc_Word32 *vector2, WebRtc_Word16 len2,
WebRtc_Word32 *outvector, WebRtc_Word16 maxlen)
{
#ifdef _DEBUG
if (maxlen < len1 + len2)
{
printf("w32catarr : out vector is too short\n");
exit(0);
}
if ((len1 != len2) || (len2 < 0))
{
printf("w32catarr : input vectors are not of equal length\n");
exit(0);
}
#endif
/* Unused input variable */
maxlen = maxlen;
/* Concat the two vectors */
/* A word32 is 4 bytes long */
WEBRTC_SPL_MEMCPY_W32(outvector, vector1, len1);
WEBRTC_SPL_MEMCPY_W32(&outvector[len1], vector2, len2);
return (len1 + len2);
}

View File

@ -1,45 +0,0 @@
/*
* copy_from_begin_u8.c
*
* This file contains the function WebRtcSpl_CopyFromBeginU8().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromBeginU8(G_CONST unsigned char *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
unsigned char *vector_out,
WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples)
{
printf("CopyFromBeginU8 : vector_in shorter than requested length\n");
exit(0);
}
if (max_length < samples)
{
printf("CopyFromBeginU8 : vector_out shorter than requested length\n");
exit(0);
}
#endif
// Unused input variable
max_length = max_length;
length = length;
// Copy the first <samples> of the input vector to vector_out
// A unsigned char is 1 bytes long
WEBRTC_SPL_MEMCPY_W8(vector_out, vector_in, samples);
return samples;
}

View File

@ -1,44 +0,0 @@
/*
* copy_from_begin_w16.c
*
* This file contains the function WebRtcSpl_CopyFromBeginW16().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromBeginW16(G_CONST WebRtc_Word16 *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
WebRtc_Word16 *vector_out,
WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples)
{
printf(" CopyFromBeginW16 : vector_in shorter than requested length\n");
exit(0);
}
if (max_length < samples)
{
printf(" CopyFromBeginW16 : vector_out shorter than requested length\n");
exit(0);
}
#endif
// Unused input variable
length = length;
max_length = max_length;
// Copy the first <samples> of the input vector to vector_out
// A WebRtc_Word16 is 2 bytes long
WEBRTC_SPL_MEMCPY_W16(vector_out, vector_in, samples);
return samples;
}

View File

@ -1,45 +0,0 @@
/*
* copy_from_begin_w32.c
*
* This file contains the function WebRtcSpl_CopyFromBeginW32().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromBeginW32(G_CONST WebRtc_Word32 *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
WebRtc_Word32 *vector_out,
WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples)
{
printf(" CopyFromBeginW32 : invector shorter than requested length\n");
exit(0);
}
if (max_length < samples)
{
printf(" CopyFromBeginW32 : outvector shorter than requested length\n");
exit(0);
}
#endif
// Unused input variable
max_length = max_length;
length = length;
// Copy the first <samples> of the input vector to vector_out
// A WebRtc_Word32 is 4 bytes long
WEBRTC_SPL_MEMCPY_W32(vector_out, vector_in, samples);
return samples;
}

View File

@ -1,45 +0,0 @@
/*
* copy_from_end_u8.c
*
* This file contains the function WebRtcSpl_CopyFromEndU8().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
WebRtc_Word16 WebRtcSpl_CopyFromEndU8(G_CONST unsigned char *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
unsigned char *vector_out,
WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples)
{
printf("CopyFromEndU8 : vector_in shorter than requested length\n");
exit(0);
}
if (max_length < samples)
{
printf("CopyFromEndU8 : vector_out shorter than requested length\n");
exit(0);
}
#endif
// Unused input variable
max_length = max_length;
// Copy the last <samples> of the input vector to vector_out
// An unsigned char is 1 bytes long
WEBRTC_SPL_MEMCPY_W8(vector_out, &vector_in[length - samples], samples);
return samples;
}

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_CopyFromEndW16().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromEndW16(G_CONST WebRtc_Word16 *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
WebRtc_Word16 *vector_out,
WebRtc_Word16 max_length)
{
// Unused input variable
max_length = max_length;
// Copy the last <samples> of the input vector to vector_out
WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[length - samples], samples);
return samples;
}

View File

@ -1,44 +0,0 @@
/*
* copy_from_end_w32.c
*
* This file contains the function WebRtcSpl_CopyFromEndW32().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
WebRtc_Word16 WebRtcSpl_CopyFromEndW32(G_CONST WebRtc_Word32 *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
WebRtc_Word32 *vector_out,
WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples)
{
printf("CopyFromEndW32 : vector_in shorter than requested length\n");
exit(0);
}
if (max_length < samples)
{
printf("CopyFromEndW32 : vector_out shorter than requested length\n");
exit(0);
}
#endif
// Unused input variable
max_length = max_length;
// Copy the last <samples> of the input vector to vector_out
// A WebRtc_Word32 is 4 bytes long
WEBRTC_SPL_MEMCPY_W32(vector_out, &vector_in[length - samples], samples);
return samples;
}

View File

@ -1,42 +0,0 @@
/*
* copy_from_mid_u8.c
*
* This file contains the function WebRtcSpl_CopyFromMidU8().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromMidU8(unsigned char *vector_in, WebRtc_Word16 length,
WebRtc_Word16 startpos, WebRtc_Word16 samples,
unsigned char *vector_out, WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples + startpos)
{
printf("chmid : invector copy out of bounds\n");
exit(0);
}
if (max_length < samples)
{
printf("chmid : outvector shorter than requested length\n");
exit(0);
}
#endif
/* Unused input variable */
max_length = max_length;
length = length;
/* Copy the <samples> from pos <start> of the input vector to vector_out */
/* A unsigned char is 1 bytes long */
WEBRTC_SPL_MEMCPY_W8(vector_out,&vector_in[startpos],samples);
return (samples);
}

View File

@ -1,36 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromMidW16(G_CONST WebRtc_Word16 *vector_in, WebRtc_Word16 length,
WebRtc_Word16 startpos, WebRtc_Word16 samples,
WebRtc_Word16 *vector_out, WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples + startpos)
{
printf("w16mid : invector copy out of bounds\n");
exit(0);
}
if (max_length < samples)
{
printf("w16mid : outvector shorter than requested length\n");
exit(0);
}
#endif
/* Unused input variable */
length = length;
max_length = max_length;
/* Copy the <samples> from pos <start> of the input vector to vector_out */
/* A WebRtc_Word16 is 2 bytes long */
WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[startpos], samples);
return (samples);
}

View File

@ -1,37 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_CopyFromMidW32(G_CONST WebRtc_Word32 *vector_in, WebRtc_Word16 length,
WebRtc_Word16 startpos, WebRtc_Word16 samples,
WebRtc_Word32 *vector_out, WebRtc_Word16 max_length)
{
#ifdef _DEBUG
if (length < samples + startpos)
{
printf("w32mid : invector copy out of bounds\n");
exit(0);
}
if (max_length < samples)
{
printf("w32mid : outvector shorter than requested length\n");
exit(0);
}
#endif
/* Unused input variable */
max_length = max_length;
length = length;
/* Copy the <samples> from pos <start> of the input vector to vector_out */
/* A WebRtc_Word32 is 4 bytes long */
WEBRTC_SPL_MEMCPY_W32(vector_out,&vector_in[startpos],samples);
return (samples);
}

View File

@ -1,48 +0,0 @@
/*
* div_result_in_q31.c
*
* This file contains the function WebRtcSpl_DivResultInQ31().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_DivResultInQ31(WebRtc_Word32 num, WebRtc_Word32 den)
{
WebRtc_Word32 L_num = num;
WebRtc_Word32 L_den = den;
WebRtc_Word32 div = 0;
int k = 31;
int change_sign = 0;
if (num == 0)
return 0;
if (num < 0)
{
change_sign++;
L_num = -num;
}
if (den < 0)
{
change_sign++;
L_den = -den;
}
while (k--)
{
div <<= 1;
//L_den <<= 1;
L_num <<= 1;
if (L_num >= L_den)
{
L_num -= L_den;
div++;
}
}
if (change_sign == 1)
{
div = -div;
}
return div;
}

View File

@ -1,21 +0,0 @@
/*
* div_u32_u16.c
*
* This file contains the function WebRtcSpl_DivU32U16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_UWord32 WebRtcSpl_DivU32U16(WebRtc_UWord32 num, WebRtc_UWord16 den)
{
// Guard against division with 0
if (den != 0)
{
return ((WebRtc_UWord32)(num / den));
} else
{
return ((WebRtc_UWord32)0xFFFFFFFF);
}
}

View File

@ -1,55 +0,0 @@
/*
* div_w32_hi_low.c
*
* This file contains the function WebRtcSpl_DivW32HiLow().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_DivW32HiLow(WebRtc_Word32 num, WebRtc_Word16 den_hi,
WebRtc_Word16 den_low)
{
WebRtc_Word16 approx, tmp_hi, tmp_low, num_hi, num_low;
WebRtc_Word32 tmpW32;
approx = (WebRtc_Word16)WebRtcSpl_DivW32W16((WebRtc_Word32)0x1FFFFFFF, den_hi);
// result in Q14 (Note: 3FFFFFFF = 0.5 in Q30)
// tmpW32 = 1/den = approx * (2.0 - den * approx) (in Q30)
tmpW32 = (WEBRTC_SPL_MUL_16_16(den_hi, approx) << 1)
+ ((WEBRTC_SPL_MUL_16_16(den_low, approx) >> 15) << 1);
// tmpW32 = den * approx
tmpW32 = (WebRtc_Word32)0x7fffffffL - tmpW32; // result in Q30 (tmpW32 = 2.0-(den*approx))
// Store tmpW32 in hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// tmpW32 = 1/den in Q29
tmpW32 = ((WEBRTC_SPL_MUL_16_16(tmp_hi, approx) + (WEBRTC_SPL_MUL_16_16(tmp_low, approx)
>> 15)) << 1);
// 1/den in hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// Store num in hi and low format
num_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(num, 16);
num_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((num
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)num_hi, 16)), 1);
// num * (1/den) by 32 bit multiplication (result in Q28)
tmpW32 = (WEBRTC_SPL_MUL_16_16(num_hi, tmp_hi) + (WEBRTC_SPL_MUL_16_16(num_hi, tmp_low)
>> 15) + (WEBRTC_SPL_MUL_16_16(num_low, tmp_hi) >> 15));
// Put result in Q31 (convert from Q28)
tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
return tmpW32;
}

View File

@ -1,21 +0,0 @@
/*
* div_w32_w16.c
*
* This file contains the function WebRtcSpl_DivW32W16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_DivW32W16(WebRtc_Word32 num, WebRtc_Word16 den)
{
// Guard against division with 0
if (den != 0)
{
return ((WebRtc_Word32)(num / den));
} else
{
return ((WebRtc_Word32)0x7FFFFFFF);
}
}

View File

@ -1,21 +0,0 @@
/*
* div_w32_w16_res_w16.c
*
* This file contains the function WebRtcSpl_DivW32W16ResW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_DivW32W16ResW16(WebRtc_Word32 num, WebRtc_Word16 den)
{
// Guard against division with 0
if (den != 0)
{
return (WebRtc_Word16)(num / den);
} else
{
return (WebRtc_Word16)0x7FFF;
}
}

View File

@ -1,23 +0,0 @@
/*
* dot_product.c
*
* This file contains the function WebRtcSpl_DotProduct().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_DotProduct(WebRtc_Word16 *vector1, WebRtc_Word16 *vector2, int length)
{
WebRtc_Word32 sum;
int i;
sum = 0;
for (i = 0; i < length; i++)
{
sum += WEBRTC_SPL_MUL_16_16(*vector1++, *vector2++);
}
return sum;
}

View File

@ -1,93 +0,0 @@
/*
* downsample.c
*
* This file contains the function WebRtcSpl_Downsample().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_Downsample(G_CONST WebRtc_Word16 *b, int b_length,
G_CONST WebRtc_Word16 *signal_in, int signal_length,
WebRtc_Word16 *state, int state_length,
WebRtc_Word16 *signal_downsampled, int max_length, int factor,
int delay)
{
WebRtc_Word32 o;
int i, j, stop;
WebRtc_Word16 *signal_downsampled_ptr = signal_downsampled;
G_CONST WebRtc_Word16 *b_ptr;
G_CONST WebRtc_Word16 *signal_in_ptr;
WebRtc_Word16 *state_ptr;
WebRtc_Word16 inc = 1 << factor;
// Unused input variable
max_length = max_length;
for (i = delay; i < signal_length; i += inc)
{
b_ptr = &b[0];
signal_in_ptr = &signal_in[i];
state_ptr = &state[state_length - 1];
o = (WebRtc_Word32)0;
stop = (i < b_length) ? i + 1 : b_length;
for (j = 0; j < stop; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *signal_in_ptr--);
}
for (j = i + 1; j < b_length; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
}
// If output is higher than 32768, saturate it. Same with negative side
// 2^27 = 134217728, which corresponds to 32768
if (o < (WebRtc_Word32)-134217728)
o = (WebRtc_Word32)-134217728;
if (o > (WebRtc_Word32)(134217727 - 2048))
o = (WebRtc_Word32)(134217727 - 2048);
*signal_downsampled_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); //Q12 ops
}
// Get the last delay part.
for (i = ((signal_length >> factor) << factor) + inc; i < signal_length + delay; i += inc)
{
o = 0;
if (i < signal_length)
{
b_ptr = &b[0];
signal_in_ptr = &signal_in[i];
for (j = 0; j < b_length; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *signal_in_ptr--);
}
} else
{
b_ptr = &b[i - signal_length];
signal_in_ptr = &signal_in[signal_length - 1];
for (j = 0; j < b_length - (i - signal_length); j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *signal_in_ptr--);
}
}
/* If output is higher than 32768, saturate it. Same with negative side
2^27 = 134217728, which corresponds to 32768
*/
if (o < (WebRtc_Word32)-134217728)
o = (WebRtc_Word32)-134217728;
if (o > (WebRtc_Word32)(134217727 - 2048))
o = (WebRtc_Word32)(134217727 - 2048);
*signal_downsampled_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); //Q12 ops
}
return (signal_length >> factor);
}

View File

@ -1,24 +0,0 @@
/*
* elementwise_vector_mult.c
*
* This file contains the function WebRtcSpl_ElementwiseVectorMult().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ElementwiseVectorMult(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in,
G_CONST WebRtc_Word16 *win, WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *inptr = in;
G_CONST WebRtc_Word16 *winptr = win;
for (i = 0; i < vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(*inptr++,
*winptr++, right_shifts);
}
}

View File

@ -1,130 +0,0 @@
/*
* filter_ar4.c
*
* This file contains the function WebRtcSpl_FilterAR4().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
int WebRtcSpl_FilterAR4(G_CONST WebRtc_Word16 *a, int a_length, G_CONST WebRtc_Word16 *x,
int x_length, WebRtc_Word16 *state, int state_length,
WebRtc_Word16 *state_low, int state_low_length,
WebRtc_Word16 *filtered, int max_length, WebRtc_Word16 *filtered_low,
int filtered_low_length)
{
WebRtc_Word32 o;
WebRtc_Word32 oLOW;
int i;
int j;
int stop;
G_CONST WebRtc_Word16 *a_ptr;
WebRtc_Word16 *filtered_ptr;
WebRtc_Word16 *filtered_low_ptr;
WebRtc_Word16 *state_ptr;
WebRtc_Word16 *state_low_ptr;
G_CONST WebRtc_Word16 *x_ptr = &x[0];
WebRtc_Word16 *filteredFINAL_ptr = filtered;
WebRtc_Word16 *filteredFINAL_LOW_ptr = filtered_low;
#ifdef _DEBUG
if (max_length < x_length)
{
printf(" FilterAR4 : out vector is shorter than in vector\n");
exit(0);
}
if (state_length != a_length - 1)
{
printf(" FilterAR4 : state vector does not have the correct length\n");
exit(0);
}
#endif
/* Unused input variable */
max_length = max_length;
state_low_length = state_low_length;
filtered_low_length = filtered_low_length;
for (i = 0; i < 4; i++)
{
a_ptr = &a[1];
filtered_ptr = &filtered[i - 1];
filtered_low_ptr = &filtered_low[i - 1];
state_ptr = &state[state_length - 1];
state_low_ptr = &state_low[state_length - 1];
o = (WebRtc_Word32)(*x_ptr++) << 12; // Q12 operations
oLOW = (WebRtc_Word32)0;
stop = (i < a_length) ? i + 1 : a_length;
for (j = 1; j < stop; j++)
{
o -= WEBRTC_SPL_MUL_16_16(*a_ptr,*filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++,*filtered_low_ptr--);
}
for (j = i + 1; j < a_length; j++)
{
o -= WEBRTC_SPL_MUL_16_16(*a_ptr,*state_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++,*state_low_ptr--);
}
o += (oLOW >> 12); // Q12 operations
*filteredFINAL_ptr = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);// Q12 operations
*filteredFINAL_LOW_ptr++ = (WebRtc_Word16)(o - ((WebRtc_Word32)(*filteredFINAL_ptr++)
<< 12));
}
for (i = 4; i < x_length; i++)
{
/* Calculate filtered[0] */
a_ptr = &a[1];
filtered_ptr = &filtered[i - 1];
filtered_low_ptr = &filtered_low[i - 1];
o = (WebRtc_Word32)(*x_ptr++) << 12; // Q12 operations
oLOW = 0;
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *filtered_low_ptr--);
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *filtered_low_ptr--);
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *filtered_low_ptr--);
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *filtered_low_ptr--);
o += (oLOW >> 12); // Q12 operations
*filteredFINAL_ptr = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);// Q12 operations
*filteredFINAL_LOW_ptr++ = (WebRtc_Word16)(o - ((WebRtc_Word32)(*filteredFINAL_ptr++)
<< 12));
}
if (x_length >= state_length)
{
WebRtcSpl_CopyFromEndW16(filtered, x_length, a_length - 1, state, state_length);
WebRtcSpl_CopyFromEndW16(filtered_low, x_length, a_length - 1, state_low, state_length);
} else
{
for (i = 0; i < state_length - x_length; i++)
{
state[i] = state[i + x_length];
state_low[i] = state_low[i + x_length];
}
for (i = 0; i < x_length; i++)
{
state[state_length - x_length + i] = filtered[i];
state[state_length - x_length + i] = filtered_low[i];
}
}
return x_length;
}

View File

@ -1,48 +0,0 @@
/*
* filter_ar_sample_based.c
*
* This file contains the function WebRtcSpl_FilterARSampleBased().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_FilterARSampleBased(WebRtc_Word16 *InOut, WebRtc_Word16 *InOutLOW,
WebRtc_Word16 *Coef, WebRtc_Word16 orderCoef)
{
int k;
WebRtc_Word32 temp, tempLOW;
WebRtc_Word16 *ptrIn, *ptrInLOW, *ptrCoef;
temp = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)*InOut, 12);
tempLOW = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)*InOutLOW, 12);
// Filter integer part
ptrIn = InOut - 1;
ptrCoef = Coef + 1;
for (k = 0; k < orderCoef; k++)
{
temp -= WEBRTC_SPL_MUL_16_16((*ptrCoef), (*ptrIn));
ptrCoef++;
ptrIn--;
}
// Filter lower part (Q12)
ptrInLOW = InOutLOW - 1;
ptrCoef = Coef + 1;
for (k = 0; k < orderCoef; k++)
{
tempLOW -= WEBRTC_SPL_MUL_16_16((*ptrCoef), (*ptrInLOW));
ptrCoef++;
ptrInLOW--;
}
temp += WEBRTC_SPL_RSHIFT_W32(tempLOW, 12); // build WebRtc_Word32 result in Q12
// 2048 == (0.5 << 12) for rounding, InOut is in (Q0)
*InOut = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp+2048), 12);
// InOutLOW is in Q12
*InOutLOW = (WebRtc_Word16)(temp - (WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)(*InOut), 12)));
}

View File

@ -1,68 +0,0 @@
/*
* filter_ma.c
*
* This file contains the function WebRtcSpl_FilterMA().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_FilterMA(G_CONST WebRtc_Word16 *b, int b_length, G_CONST WebRtc_Word16 *x,
int x_length, WebRtc_Word16 *state, int state_length,
WebRtc_Word16 *filtered, int max_length)
{
WebRtc_Word32 o;
int i, j, stop;
WebRtc_Word16 *filtered_ptr = filtered;
/* Unused input variable */
max_length = max_length;
for (i = 0; i < x_length; i++)
{
G_CONST WebRtc_Word16 *b_ptr = &b[0];
G_CONST WebRtc_Word16 *x_ptr = &x[i];
WebRtc_Word16 *state_ptr = &state[state_length - 1];
o = (WebRtc_Word32)0;
stop = (i < b_length) ? i + 1 : b_length;
for (j = 0; j < stop; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
}
for (j = i + 1; j < b_length; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
}
/* If output is higher than 32768, saturate it. Same with negative side
2^27 = 134217728, which corresponds to 32768 in Q12 */
if (o < (WebRtc_Word32)-134217728)
o = (WebRtc_Word32)-134217728;
if (o > (WebRtc_Word32)(134217727 - 2048))
o = (WebRtc_Word32)(134217727 - 2048);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);
}
/* Save filter state */
if (x_length >= state_length)
{
WebRtcSpl_CopyFromEndW16(x, x_length, b_length - 1, state, state_length);
} else
{
for (i = 0; i < state_length - x_length; i++)
{
state[i] = state[i + x_length];
}
for (i = 0; i < x_length; i++)
{
state[state_length - x_length + i] = x[i];
}
}
return x_length;
}

View File

@ -1,120 +0,0 @@
/*
* filter_ma4.c
*
* This file contains the function WebRtcSpl_FilterMA4().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
int WebRtcSpl_FilterMA4(G_CONST WebRtc_Word16 *b, int b_length, G_CONST WebRtc_Word16 *x,
int x_length, WebRtc_Word16 *state, int state_length,
WebRtc_Word16 *filtered, int max_length)
{
WebRtc_Word32 o;
int i;
WebRtc_Word16 *filtered_ptr = filtered;
/* Calculate filtered[0] */G_CONST WebRtc_Word16 *b_ptr = &b[0];
G_CONST WebRtc_Word16 *x_ptr = &x[0];
WebRtc_Word16 *state_ptr = &state[state_length - 1];
/* Unused input variable */
max_length = max_length;
o = (WebRtc_Word32)0;
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); // Q12 operations
#ifdef _DEBUG
if (max_length < x_length)
{
printf("FilterMA4: out vector is shorter than in vector\n");
exit(0);
}
if ((state_length != 4) || (b_length != 5))
{
printf("FilterMA4: state or coefficient vector does not have the correct length\n");
exit(0);
}
#endif
/* Calculate filtered[1] */
b_ptr = &b[0];
x_ptr = &x[1];
state_ptr = &state[state_length - 1];
o = (WebRtc_Word32)0;
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); // Q12 operations
/* Calculate filtered[2] */
b_ptr = &b[0];
x_ptr = &x[2];
state_ptr = &state[state_length - 1];
o = (WebRtc_Word32)0;
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); // Q12 operations
/* Calculate filtered[3] */
b_ptr = &b[0];
x_ptr = &x[3];
state_ptr = &state[state_length - 1];
o = (WebRtc_Word32)0;
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *state_ptr--);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); // Q12 operations
for (i = 4; i < x_length; i++)
{
o = (WebRtc_Word32)0;
b_ptr = &b[0];
x_ptr = &x[i];
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12); // Q12 operations
}
if (x_length >= state_length)
{
WebRtcSpl_CopyFromEndW16(x, x_length, b_length - 1, state, state_length);
} else
{
for (i = 0; i < state_length - x_length; i++)
{
state[i] = state[i + x_length];
}
for (i = 0; i < x_length; i++)
{
state[state_length - x_length + i] = x[i];
}
}
return x_length;
}

View File

@ -1,46 +0,0 @@
/*
* get_column.c
*
* This file contains the function WebRtcSpl_GetColumn().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
WebRtc_Word16 WebRtcSpl_GetColumn(G_CONST WebRtc_Word32 *matrix, WebRtc_Word16 number_of_rows,
WebRtc_Word16 number_of_cols, WebRtc_Word16 column_chosen,
WebRtc_Word32 *column_out, WebRtc_Word16 max_length)
{
WebRtc_Word16 i;
WebRtc_Word32 *outarrptr = column_out;
G_CONST WebRtc_Word32 *matptr = &matrix[column_chosen];
#ifdef _DEBUG
if (max_length < number_of_rows)
{
printf(" GetColumn : out vector is shorter than the column length\n");
exit(0);
}
if ((column_chosen < 0) || (column_chosen >= number_of_cols))
{
printf(" GetColumn : selected column is negative or larger than the dimension of the matrix\n");
exit(0);
}
#endif
/* Unused input variable */
max_length = max_length;
for (i = 0; i < number_of_rows; i++)
{
(*outarrptr++) = (*matptr);
matptr += number_of_cols;
}
return number_of_rows;
}

View File

@ -1,45 +0,0 @@
/*
* get_rows.c
*
* This file contains the function WebRtcSpl_GetRow().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
WebRtc_Word16 WebRtcSpl_GetRow(G_CONST WebRtc_Word32 *matrix, WebRtc_Word16 number_of_rows,
WebRtc_Word16 number_of_cols, WebRtc_Word16 row_chosen,
WebRtc_Word32 *row_out, WebRtc_Word16 max_length)
{
WebRtc_Word16 i;
WebRtc_Word32 *outarrptr = row_out;
G_CONST WebRtc_Word32 *matptr = &matrix[row_chosen * number_of_cols];
#ifdef _DEBUG
if (max_length < number_of_cols)
{
printf(" GetRow : out vector is shorter than the row length\n");
exit(0);
}
if ((row_chosen < 0) || (row_chosen >= number_of_rows))
{
printf(" GetRow : selected row is negative or larger than the dimension of the matrix\n");
exit(0);
}
#endif
/* Unused input variable */
max_length = max_length;
number_of_rows = number_of_rows;
for (i = 0; i < number_of_cols; i++)
{
(*outarrptr++) = (*matptr++);
}
return number_of_cols;
}

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_GetScaling().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_GetScaling(WebRtc_Word16 *in_vector, int in_vector_length, int times)
{
int nbits = WebRtcSpl_GetSizeInBits(times);
int i;
WebRtc_Word16 sabs;
int t;
WebRtc_Word16 *sptr = in_vector;
WebRtc_Word16 smax = *sptr++;
for (i = in_vector_length - 1; i > 0; i--)
{
sabs = WEBRTC_SPL_ABS_W16 (*sptr);
sptr++;
if (sabs > smax)
smax = sabs;
}
t = WebRtcSpl_NormW32((WebRtc_Word32)smax << 16);
if (smax == 0)
{
return 0; // Since norm(0) returns 0
} else
{
return (t > nbits) ? 0 : nbits - t;
}
}

View File

@ -1,24 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_IncreaseSeed().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_UWord32 WebRtcSpl_IncreaseSeed(WebRtc_UWord32 *seed)
{
seed[0] = (seed[0] * ((WebRtc_Word32)69069) + 1) & (WEBRTC_SPL_MAX_SEED_USED - 1);
return seed[0];
}

View File

@ -1,51 +0,0 @@
/*
* refl_coef_to_lpc.c
*
* This file contains the function WebRtcSpl_ReflCoefToLpc().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ReflCoefToLpc(G_CONST WebRtc_Word16 *k, int use_order, WebRtc_Word16 *a)
{
WebRtc_Word16 any[WEBRTC_SPL_MAX_LPC_ORDER + 1];
WebRtc_Word16 *aptr, *aptr2, *anyptr;
G_CONST WebRtc_Word16 *kptr;
int m, i;
kptr = k;
*a = 4096; // i.e., (Word16_MAX >> 3)+1.
*any = *a;
a[1] = WEBRTC_SPL_RSHIFT_W16((*k), 3);
for (m = 1; m < use_order; m++)
{
kptr++;
aptr = a;
aptr++;
aptr2 = &a[m];
anyptr = any;
anyptr++;
any[m + 1] = WEBRTC_SPL_RSHIFT_W16((*kptr), 3);
for (i = 0; i < m; i++)
{
*anyptr = (*aptr)
+ (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT((*aptr2), (*kptr), 15);
anyptr++;
aptr++;
aptr2--;
}
aptr = a;
anyptr = any;
for (i = 0; i < (m + 2); i++)
{
*aptr = *anyptr;
aptr++;
anyptr++;
}
}
}

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_KToAQScale().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_KToAQScale(WebRtc_Word16* k, int use_order, int Q, WebRtc_Word16* a)
{
WebRtc_Word16 any[WEBRTC_SPL_MAX_LPC_ORDER];
WebRtc_Word16* aptr;
WebRtc_Word16* aptr2;
WebRtc_Word16* anyptr;
WebRtc_Word16* kptr;
int m, i, Qscale;
Qscale = 15 - Q; // Q-domain for A-coeff
kptr = k;
*a = *k >> Qscale;
for (m = 0; m < (use_order - 1); m++)
{
kptr++;
aptr = a;
aptr2 = &a[m];
anyptr = any;
for (i = 0; i < m + 1; i++)
*anyptr++ = (*aptr++) + (WebRtc_Word16)(((WebRtc_Word32)(*aptr2--)
* (WebRtc_Word32)*kptr) >> 15);
any[m + 1] = *kptr >> Qscale; // compute the next coefficient for next loop
aptr = a;
anyptr = any;
for (i = 0; i < (m + 2); i++)
{
*aptr = *anyptr;
*aptr++;
*anyptr++;
}
}
}

View File

@ -1,31 +0,0 @@
/*
* k_to_lar_w16.c
*
* This file contains the function WebRtcSpl_KToLarW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_KToLarW16(WebRtc_Word16 *kLar, int use_order)
{
// The LARs are computed from the reflection coefficients using
// a linear approximation of the logarithm.
WebRtc_Word16 tmp16;
int i;
for (i = 0; i < use_order; i++, kLar++)
{
tmp16 = WEBRTC_SPL_ABS_W16( *kLar );
if (tmp16 < 22118)
tmp16 >>= 1;
else if (tmp16 < 31130)
tmp16 -= 11059;
else
{
tmp16 -= 26112;
tmp16 <<= 2;
}
*kLar = *kLar < 0 ? -tmp16 : tmp16;
}
}

View File

@ -1,31 +0,0 @@
/*
* k_to_lar_w32.c
*
* This file contains the function WebRtcSpl_KToLarW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_KToLarW32(WebRtc_Word32 *kLar, int use_order)
{
// The LARs are computed from the reflection coefficients using
// a linear approximation of the logarithm.
WebRtc_Word32 tmp;
int i;
for (i = 0; i < use_order; i++, kLar++)
{
tmp = WEBRTC_SPL_ABS_W16(*kLar);
if (tmp < (WebRtc_Word32)1300000000)
tmp >>= 1;
else if (tmp < (WebRtc_Word32)2000000000)
tmp -= 650000000;
else
{
tmp -= 1662500000;
tmp <<= 2;
}
*kLar = *kLar < 0 ? -tmp : tmp;
}
}

View File

@ -1,29 +0,0 @@
/*
* lar_to_refl_coef_w16.c
*
* This file contains the function WebRtcSpl_LarToReflCoefW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_LarToReflCoefW16(WebRtc_Word16 *kLAR, int use_order)
{
int i;
WebRtc_Word16 temp;
for (i = 0; i < use_order; i++, kLAR++)
{
if ( *kLAR < 0)
{
temp = *kLAR == WEBRTC_SPL_WORD16_MIN ? WEBRTC_SPL_WORD16_MAX : -( *kLAR);
*kLAR = -((temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059
: WEBRTC_SPL_ADD_SAT_W16( temp >> 2, 26112 )));
} else
{
temp = *kLAR;
*kLAR = (temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059
: WEBRTC_SPL_ADD_SAT_W16( temp >> 2, 26112 ));
}
}
}

View File

@ -1,32 +0,0 @@
/*
* lar_to_refl_coef_w32.c
*
* This file contains the function WebRtcSpl_LarToReflCoefW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_LarToReflCoefW32(WebRtc_Word32 *kLAR, int use_order)
{
int i;
WebRtc_Word32 temp;
for (i = 0; i < use_order; i++, kLAR++)
{
if (*kLAR < 0)
{
temp = (*kLAR == WEBRTC_SPL_WORD32_MIN) ? WEBRTC_SPL_WORD32_MAX : -(*kLAR);
*kLAR = -((temp < (WebRtc_Word32)650000000) ? temp << 1 : ((temp
< (WebRtc_Word32)1350000000) ? temp + 650000000
: WEBRTC_SPL_ADD_SAT_W32( temp >> 2, 1662500000 )));
} else
{
temp = *kLAR;
*kLAR = (temp < (WebRtc_Word32)650000000) ? temp << 1 : ((temp
< (WebRtc_Word32)1350000000) ? temp + 650000000
: WEBRTC_SPL_ADD_SAT_W32( temp >> 2, 1662500000 ));
}
}
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_Lpc().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_Lpc(G_CONST WebRtc_Word16 *x, int x_length, int order,
WebRtc_Word16 *lpcvec) // out Q12
{
int cvlen, corrvlen;
int scaleDUMMY;
WebRtc_Word32 corrvector[WEBRTC_SPL_MAX_LPC_ORDER + 1];
WebRtc_Word16 reflCoefs[WEBRTC_SPL_MAX_LPC_ORDER];
cvlen = order + 1;
corrvlen = WebRtcSpl_AutoCorrelation(x, x_length, order, corrvector, &scaleDUMMY);
if (*corrvector == 0)
*corrvector = WEBRTC_SPL_WORD16_MAX;
WebRtcSpl_AutoCorrToReflCoef(corrvector, order, reflCoefs);
WebRtcSpl_ReflCoefToLpc(reflCoefs, order, lpcvec);
return cvlen;
}

View File

@ -1,33 +0,0 @@
/*
* max_abs_index_w16.c
*
* This file contains the function WebRtcSpl_MaxAbsIndexW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_MaxAbsIndexW16(G_CONST WebRtc_Word16* vector,
WebRtc_Word16 vector_length)
{
WebRtc_Word16 tempMax;
WebRtc_Word16 absTemp;
WebRtc_Word16 tempMaxIndex, i;
G_CONST WebRtc_Word16 *tmpvector = vector;
tempMaxIndex = 0;
tempMax = WEBRTC_SPL_ABS_W16(*tmpvector);
tmpvector++;
for (i = 1; i < vector_length; i++)
{
absTemp = WEBRTC_SPL_ABS_W16(*tmpvector);
tmpvector++;
if (absTemp > tempMax)
{
tempMax = absTemp;
tempMaxIndex = i;
}
}
return tempMaxIndex;
}

View File

@ -1,75 +0,0 @@
/*
* max_abs_value_w16.c
*
* This file contains the function WebRtcSpl_MaxAbsValueW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_MaxAbsValueW16(G_CONST WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtc_Word32 tempMax = 0;
WebRtc_Word32 absVal;
WebRtc_Word16 totMax;
int i;
G_CONST WebRtc_Word16 *tmpvector = vector;
#ifdef _ARM_OPT_
#pragma message("NOTE: _ARM_OPT_ optimizations are used")
WebRtc_Word16 len4 = (length >> 2) << 2;
#endif
#ifndef _ARM_OPT_
for (i = 0; i < length; i++)
{
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
}
#else
for (i = 0; i < len4; i = i + 4)
{
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
}
for (i = len4; i < len; i++)
{
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
}
#endif
totMax = (WebRtc_Word16)WEBRTC_SPL_MIN(tempMax, WEBRTC_SPL_WORD16_MAX);
return totMax;
}

View File

@ -1,31 +0,0 @@
/*
* max_abs_value_w32.c
*
* This file contains the function WebRtcSpl_MaxAbsValueW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_MaxAbsValueW32(G_CONST WebRtc_Word32 *vector, // (i) Input vector
WebRtc_Word16 length) // (i) Number of elements
{
WebRtc_UWord32 tempMax = 0;
WebRtc_UWord32 absVal;
WebRtc_Word32 retval;
int i;
G_CONST WebRtc_Word32 *tmpvector = vector;
for (i = 0; i < length; i++)
{
absVal = WEBRTC_SPL_ABS_W32((*tmpvector));
if (absVal > tempMax)
{
tempMax = absVal;
}
tmpvector++;
}
retval = (WebRtc_Word32)(WEBRTC_SPL_MIN(tempMax, WEBRTC_SPL_WORD32_MAX));
return retval;
}

View File

@ -1,28 +0,0 @@
/*
* max_index_w16.c
*
* This file contains the function WebRtcSpl_MaxIndexW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_MaxIndexW16(G_CONST WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtc_Word16 tempMax;
WebRtc_Word16 tempMaxIndex, i;
G_CONST WebRtc_Word16 *tmpvector = vector;
tempMaxIndex = 0;
tempMax = *tmpvector++;
for (i = 1; i < length; i++)
{
if ( *tmpvector++ > tempMax)
{
tempMax = vector[i];
tempMaxIndex = i;
}
}
return tempMaxIndex;
}

View File

@ -1,29 +0,0 @@
/*
* max_index_w32.c
*
* This file contains the function WebRtcSpl_MaxIndexW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_MaxIndexW32(G_CONST WebRtc_Word32* vector, // (i) Input vector
WebRtc_Word16 length) // (i) Number of elements
{
WebRtc_Word32 tempMax;
WebRtc_Word16 tempMaxIndex, i;
G_CONST WebRtc_Word32 *tmpvector = vector;
tempMaxIndex = 0;
tempMax = *tmpvector++;
for (i = 1; i < length; i++)
{
if (*tmpvector++ > tempMax)
{
tempMax = vector[i];
tempMaxIndex = i;
}
}
return tempMaxIndex;
}

View File

@ -1,30 +0,0 @@
/*
* max_value_w16.c
*
* This file contains the function WebRtcSpl_MaxValueW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifndef XSCALE_OPT
WebRtc_Word16 WebRtcSpl_MaxValueW16(G_CONST WebRtc_Word16* vector, WebRtc_Word16 length)
{
WebRtc_Word16 tempMax;
WebRtc_Word16 i;
G_CONST WebRtc_Word16 *tmpvector = vector;
tempMax = *tmpvector++;
for (i = 1; i < length; i++)
{
if (*tmpvector++ > tempMax)
tempMax = vector[i];
}
return tempMax;
}
#else
#pragma message(">> max_value_w16.c is excluded from this build")
#endif

View File

@ -1,31 +0,0 @@
/*
* max_value_w32.c
*
* This file contains the function WebRtcSpl_MaxValueW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifndef XSCALE_OPT
WebRtc_Word32 WebRtcSpl_MaxValueW32(G_CONST WebRtc_Word32* vector, // (i) Input vector
WebRtc_Word16 length) // (i) Number of elements
{
WebRtc_Word32 tempMax;
WebRtc_Word16 i;
G_CONST WebRtc_Word32 *tmpvector = vector;
tempMax = *tmpvector++;
for (i = 1; i < length; i++)
{
if (*tmpvector++ > tempMax)
tempMax = vector[i];
}
return tempMax;
}
#else
#pragma message(">> max_value_w32.c is excluded from this build")
#endif

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_MemCpyReversedOrder().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_MemCpyReversedOrder(WebRtc_Word16* dest, WebRtc_Word16* source, int length)
{
int j;
WebRtc_Word16* destPtr = dest;
WebRtc_Word16* sourcePtr = source;
for (j = 0; j < length; j++)
{
*destPtr-- = *sourcePtr++;
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_MemSetW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_MemSetW16(WebRtc_Word16 *ptr, WebRtc_Word16 set_value, int length)
{
int j;
WebRtc_Word16 *arrptr = ptr;
for (j = length; j > 0; j--)
{
*arrptr++ = set_value;
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file contains the function WebRtcSpl_MemSetW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_MemSetW32(WebRtc_Word32 *ptr, WebRtc_Word32 set_value, int length)
{
int j;
WebRtc_Word32 *arrptr = ptr;
for (j = length; j > 0; j--)
{
*arrptr++ = set_value;
}
}

View File

@ -1,35 +0,0 @@
/*
* min_index_w16.c
*
* This file contains the function WebRtcSpl_MinIndexW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifndef XSCALE_OPT
WebRtc_Word16 WebRtcSpl_MinIndexW16(G_CONST WebRtc_Word16* vector, WebRtc_Word16 vector_length)
{
WebRtc_Word16 tempMin;
WebRtc_Word16 tempMinIndex, i;
G_CONST WebRtc_Word16 *tmpvector = vector;
// Find index of smallest value
tempMinIndex = 0;
tempMin = *tmpvector++;
for (i = 1; i < vector_length; i++)
{
if (*tmpvector++ < tempMin)
{
tempMin = vector[i];
tempMinIndex = i;
}
}
return tempMinIndex;
}
#else
#pragma message(">> min_index_w16.c is excluded from this build")
#endif

View File

@ -1,36 +0,0 @@
/*
* min_index_w16.c
*
* This file contains the function WebRtcSpl_MinIndexW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifndef XSCALE_OPT
WebRtc_Word16 WebRtcSpl_MinIndexW32(G_CONST WebRtc_Word32* vector, // (i) Input vector
WebRtc_Word16 vector_length) // (i) Number of elements
{
WebRtc_Word32 tempMin;
WebRtc_Word16 tempMinIndex, i;
G_CONST WebRtc_Word32 *tmpvector = vector;
// Find index of smallest value
tempMinIndex = 0;
tempMin = *tmpvector++;
for (i = 1; i < vector_length; i++)
{
if (*tmpvector++ < tempMin)
{
tempMin = vector[i];
tempMinIndex = i;
}
}
return tempMinIndex;
}
#else
#pragma message(">> max_index_w16.c is excluded from this build")
#endif

View File

@ -1,20 +0,0 @@
/*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_MinValueW16(G_CONST WebRtc_Word16 *vector, WebRtc_Word16 vector_length)
{
WebRtc_Word16 tempMin;
WebRtc_Word16 i;
G_CONST WebRtc_Word16 *tmpvector = vector;
/* Find the minimum value */
tempMin = *tmpvector++;
for (i = 1; i < vector_length; i++)
{
if ( *tmpvector++ < tempMin)
tempMin = (vector[i]);
}
return tempMin;
}

View File

@ -1,22 +0,0 @@
/*
*/
#include "signal_processing_library.h"
/* (o) Minimum value of input vector */
WebRtc_Word32 WebRtcSpl_MinValueW32(G_CONST WebRtc_Word32 *vector, /* (i) Input vector */
WebRtc_Word16 vector_length) /* (i) Number of elements */
{
WebRtc_Word32 tempMin;
WebRtc_Word16 i;
G_CONST WebRtc_Word32 *tmpvector = vector;
/* Find the minimum value */
tempMin = *tmpvector++;
for (i = 1; i < vector_length; i++)
{
if ( *tmpvector++ < tempMin)
tempMin = (vector[i]);
}
return tempMin;
}

View File

@ -1,20 +0,0 @@
/*
* ones_array_w16.c
*
* This file contains the function WebRtcSpl_OnesArrayW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_OnesArrayW16(WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtc_Word16 i;
WebRtc_Word16 *tmpvec = vector;
for (i = 0; i < length; i++)
{
*tmpvec++ = 1;
}
return length;
}

View File

@ -1,20 +0,0 @@
/*
* ones_array_w32.c
*
* This file contains the function WebRtcSpl_OnesArrayW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_OnesArrayW32(WebRtc_Word32 *vector, WebRtc_Word16 length)
{
WebRtc_Word16 i;
WebRtc_Word32 *tmpvec = vector;
for (i = 0; i < length; i++)
{
*tmpvec++ = 1;
}
return length;
}

View File

@ -1,14 +0,0 @@
/*
* rand_n.c
*
* This file contains the function WebRtcSpl_RandN().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_RandN(WebRtc_UWord32 *seed)
{
return (WebRtcSpl_kRandNTable[WebRtcSpl_IncreaseSeed(seed) >> 23]);
}

View File

@ -1,53 +0,0 @@
/*
* rand_n_array.c
*
* This file contains the function WebRtcSpl_RandNArray().
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_RandNArray(WebRtc_Word16* vector,
WebRtc_Word16 vector_length,
WebRtc_UWord32* seed)
{
WebRtc_Word16 startpos;
WebRtc_Word16 endpos;
WebRtc_Word16* vecptr;
startpos = (WebRtc_Word16)((*seed) & 0x1FF); // Value between 0 and 511
*seed = *seed + vector_length;
endpos = (WebRtc_Word16)((*seed) & 0x1FF); // Value between 0 and 511
if (vector_length < 512)
{
if (endpos > startpos)
{
WEBRTC_SPL_MEMCPY_W16(vector, &WebRtcSpl_kRandNTable[startpos], vector_length);
} else
{
WEBRTC_SPL_MEMCPY_W16(vector, &WebRtcSpl_kRandNTable[startpos], (512 - startpos));
WEBRTC_SPL_MEMCPY_W16(&vector[512-startpos], WebRtcSpl_kRandNTable,
(vector_length - (512 - startpos)));
}
} else
{
WebRtc_Word16 lensave = vector_length;
WEBRTC_SPL_MEMCPY_W16(vector, &WebRtcSpl_kRandNTable[startpos], (512-startpos));
vecptr = &vector[512 - startpos];
vector_length = vector_length - (512 - startpos);
while (vector_length > 512)
{
WEBRTC_SPL_MEMCPY_W16(vecptr, WebRtcSpl_kRandNTable, 512);
vecptr += 512;
vector_length -= 512;
}
WEBRTC_SPL_MEMCPY_W16(vecptr, WebRtcSpl_kRandNTable, vector_length);
vector_length = lensave;
}
return vector_length;
}

View File

@ -1,14 +0,0 @@
/*
* rand_u.c
*
* This file contains the function WebRtcSpl_RandU().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_RandU(WebRtc_UWord32 *seed)
{
return ((WebRtc_Word16)(WebRtcSpl_IncreaseSeed(seed) >> 16));
}

View File

@ -1,24 +0,0 @@
/*
* rand_u_array.c
*
* This file contains the function WebRtcSpl_RandUArray().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
/*
* create an array of uniformly distributed variables
*/
WebRtc_Word16 WebRtcSpl_RandUArray(WebRtc_Word16* vector,
WebRtc_Word16 vector_length,
WebRtc_UWord32* seed)
{
int i;
for (i = 0; i < vector_length; i++)
{
vector[i] = WebRtcSpl_RandU(seed);
}
return vector_length;
}

View File

@ -1,29 +0,0 @@
/*
*/
#include <string.h>
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
WebRtc_Word16 WebRtcSpl_ReplaceInMidU8(unsigned char *in_vector, WebRtc_Word16 in_length,
WebRtc_Word16 pos, unsigned char *insert_vector,
WebRtc_Word16 insert_length)
{
#ifdef _DEBUG
if (in_length < insert_length + pos)
{
printf("chreplacemid : vector currently shorter than the length required to insert the samples\n");
exit(0);
}
#endif
/* A unsigned char is 1 bytes long */
WEBRTC_SPL_MEMCPY_W8(&in_vector[pos], insert_vector, insert_length);
return (in_length);
}

View File

@ -1,27 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_ReplaceInMidW16(WebRtc_Word16 *in_vector, WebRtc_Word16 in_length,
WebRtc_Word16 pos, WebRtc_Word16 *insert_vector,
WebRtc_Word16 insert_length)
{
#ifdef _DEBUG
if (in_length < insert_length + pos)
{
printf("w16replacemid : vector currently shorter than the length required to insert the samples\n");
exit(0);
}
#endif
/* A WebRtc_Word16 is 2 bytes long */
WEBRTC_SPL_MEMCPY_W16(&in_vector[pos], insert_vector, insert_length);
return (in_length);
}

View File

@ -1,28 +0,0 @@
/*
*/
#include <string.h>
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_ReplaceInMidW32(WebRtc_Word32 *in_vector, WebRtc_Word16 in_length,
WebRtc_Word16 pos, WebRtc_Word32 *insert_vector,
WebRtc_Word16 length)
{
#ifdef _DEBUG
if (in_length < length + pos)
{
printf("w32replacemid : vector currently shorter than the length required to insert the samples\n");
exit(0);
}
#endif
/* A WebRtc_Word32 is 4 bytes long */
WEBRTC_SPL_MEMCPY_W32(&in_vector[pos], insert_vector, length);
return (in_length);
}

View File

@ -1,269 +0,0 @@
/*
* resample_to_16khz.c
*
* TODO(bjornv):
*
*/
#include <string.h>
#include <stdlib.h>
#include "signal_processing_library.h"
/************************************************************
*
* WebRtcSpl_InitResamplerTo16(...)
*
* Initializes the mode of the resampler
* allowed modes:
* 8, 11, 12, 16, 22, 24, 32, 44, 48 (kHz)
*
* Returns 0 - OK
* -1 - Error (unsupported mode)
*
************************************************************/
WebRtc_Word16 WebRtcSpl_InitResamplerTo16(WebRtcSpl_StateTo16khz* state,
WebRtc_Word16 mode)
{
switch (mode)
{
case 8:
state->blockSizeIn = 1;
state->stepSizeIn = 1;
state->blockSizeOut = 2;
break;
case 11:
state->blockSizeIn = 18;
state->stepSizeIn = 11;
state->blockSizeOut = 8;
break;
case 12:
state->blockSizeIn = 9;
state->stepSizeIn = 3;
state->blockSizeOut = 2;
break;
case 16:
state->blockSizeIn = 1;
state->stepSizeIn = 1;
state->blockSizeOut = 1;
break;
case 22:
state->blockSizeIn = 18;
state->stepSizeIn = 11;
state->blockSizeOut = 8;
break;
case 24:
state->blockSizeIn = 9;
state->stepSizeIn = 3;
state->blockSizeOut = 2;
break;
case 32:
state->blockSizeIn = 2;
state->stepSizeIn = 2;
state->blockSizeOut = 1;
break;
case 44:
state->blockSizeIn = 18;
state->stepSizeIn = 11;
state->blockSizeOut = 8;
break;
case 48:
state->blockSizeIn = 9;
state->stepSizeIn = 3;
state->blockSizeOut = 2;
break;
default:
return -1;
}
state->mode = mode;
WebRtcSpl_ResetResamplerTo16(state);
return 0;
}
/************************************************************
*
* WebRtcSpl_ResetResamplerTo16(...)
*
* Resets the filter state of the resampler, but does not
* change the mode
*
************************************************************/
void WebRtcSpl_ResetResamplerTo16(WebRtcSpl_StateTo16khz* state)
{
memset(state->upsampleBy2FilterState, 0, 8 * sizeof(WebRtc_Word32));
memset(state->downsampleBy2FilterState, 0, 8 * sizeof(WebRtc_Word32));
memset(state->speechBlockIn, 0, 18 * sizeof(WebRtc_Word32));
memset(state->speechBlockIn, 0, 8 * sizeof(WebRtc_Word32));
state->blockPositionIn = 0;
}
/***********************************************************
*
* Update the speechBlockIn buffer with new data
* Internal function used by WebRtcSpl_ResamplerTo16()
*
***********************************************************/
WebRtc_Word16 WebRtcSpl_BlockUpdateIn(WebRtcSpl_StateTo16khz *state, WebRtc_Word16 *data,
WebRtc_Word16 len, WebRtc_Word16 *pos)
{
WebRtc_Word16 SamplesLeft = len - *pos;
int i;
if ((SamplesLeft + state->blockPositionIn) >= state->blockSizeIn)
{
for (i = 0; i < state->blockSizeIn - state->blockPositionIn; i++)
{
state->speechBlockIn[state->blockPositionIn + i] = (WebRtc_Word32)data[*pos];
(*pos)++;
}
state->blockPositionIn = state->blockSizeIn;
return 1;
} else
{
for (i = 0; i < SamplesLeft; i++)
{
state->speechBlockIn[state->blockPositionIn + i] = (WebRtc_Word32)data[*pos];
(*pos)++;
}
state->blockPositionIn += SamplesLeft;
return 0;
}
}
/***********************************************************
*
* Move data from speechBlockOut to data[] and update
* speechBlockIn buffer.
* Internal function used by WebRtcSpl_ResamplerTo16()
*
***********************************************************/
WebRtc_Word16 WebRtcSpl_BlockUpdateOut(WebRtcSpl_StateTo16khz *state, WebRtc_Word16 *data,
WebRtc_Word16 *pos)
{
int i;
for (i = 0; i < state->blockSizeOut; i++)
{
data[*pos]
= (WebRtc_Word16)WEBRTC_SPL_SAT(32767,((state->speechBlockOut[i])>>15), -32768);
(*pos)++;
}
/* Move data in input vector */
state->blockPositionIn -= state->stepSizeIn;
memmove(state->speechBlockIn, &(state->speechBlockIn[state->stepSizeIn]),
sizeof(WebRtc_Word32) * (state->blockPositionIn));
return 0;
}
/**********************************************************************************
*
* WebRtcSpl_ResamplerTo16(...)
*
* Resample input[] vector (with sample rate specified by init function) to 16 kHz
* and put result in output[] vector
*
* Limitation:
* For 32, 44 and 48 kHz input vector the number of input samples have to be even
* if the output[] vectors given by WebRtcSpl_ResamplerTo16() are concatenated.
*
* Returns 0 - OK
* -1 - Error (unsupported mode)
*
**********************************************************************************/
WebRtc_Word16 WebRtcSpl_ResamplerTo16(WebRtcSpl_StateTo16khz *state,
WebRtc_Word16 *input, WebRtc_Word16 inlen,
WebRtc_Word16 *output, WebRtc_Word16 *outlen)
{
WebRtc_Word16 NoOfSamples;
WebRtc_Word16 VecPosIn = 0;
WebRtc_Word16 VecPosOut = 0;
WebRtc_Word16 *tmpVec;
switch (state->mode)
{
case 8:
WebRtcSpl_UpsampleBy2(input, inlen, output, state->upsampleBy2FilterState);
*outlen = inlen * 2;
break;
case 11:
tmpVec = (WebRtc_Word16*)malloc(inlen * 2 * sizeof(WebRtc_Word16));
WebRtcSpl_UpsampleBy2(input, inlen, tmpVec, state->upsampleBy2FilterState);
NoOfSamples = inlen * 2;
while (WebRtcSpl_BlockUpdateIn(state, tmpVec, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample44khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
free(tmpVec);
break;
case 12:
tmpVec = (WebRtc_Word16*)malloc(inlen * 2 * sizeof(WebRtc_Word16));
WebRtcSpl_UpsampleBy2(input, inlen, tmpVec, state->upsampleBy2FilterState);
NoOfSamples = inlen * 2;
while (WebRtcSpl_BlockUpdateIn(state, tmpVec, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample48khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
free(tmpVec);
break;
case 16:
memcpy(output, input, inlen * sizeof(WebRtc_Word16));
*outlen = inlen;
break;
case 22:
NoOfSamples = inlen;
while (WebRtcSpl_BlockUpdateIn(state, input, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample44khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
break;
case 24:
NoOfSamples = inlen;
while (WebRtcSpl_BlockUpdateIn(state, input, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample48khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
break;
case 32:
WebRtcSpl_DownsampleBy2(input, inlen, output, state->downsampleBy2FilterState);
*outlen = inlen >> 1;
break;
case 44:
tmpVec = (WebRtc_Word16*)malloc((inlen >> 1) * sizeof(WebRtc_Word16));
WebRtcSpl_DownsampleBy2(input, inlen, tmpVec, state->downsampleBy2FilterState);
NoOfSamples = inlen >> 1;
while (WebRtcSpl_BlockUpdateIn(state, tmpVec, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample44khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
free(tmpVec);
break;
case 48:
tmpVec = (WebRtc_Word16*)malloc((inlen >> 1) * sizeof(WebRtc_Word16));
WebRtcSpl_DownsampleBy2(input, inlen, tmpVec, state->downsampleBy2FilterState);
NoOfSamples = inlen >> 1;
while (WebRtcSpl_BlockUpdateIn(state, tmpVec, NoOfSamples, &VecPosIn))
{
WebRtcSpl_Resample48khzTo32khz(state->speechBlockIn, state->speechBlockOut, 1);
WebRtcSpl_BlockUpdateOut(state, output, &VecPosOut);
}
*outlen = VecPosOut;
free(tmpVec);
break;
default:
return -1;
}
return 0;
}

View File

@ -1,25 +0,0 @@
/*
* reverse_order_mult_array_elements.c
*
* This file contains the function WebRtcSpl_ReverseOrderMultArrayElements().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ReverseOrderMultArrayElements(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in,
G_CONST WebRtc_Word16 *win,
WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *inptr = in;
G_CONST WebRtc_Word16 *winptr = win;
for (i = 0; i < vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(*inptr++,
*winptr--, right_shifts);
}
}

View File

@ -1,31 +0,0 @@
/*
* scale_and_add_vectors_r_shift16.c
*
* This file contains the function WebRtcSpl_ScaleAndAddVectorsRShift16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleAndAddVectorsRShift16(G_CONST WebRtc_Word16 *in1, WebRtc_Word16 gain1,
G_CONST WebRtc_Word16 *in2, WebRtc_Word16 gain2,
WebRtc_Word16 *out, int nrOfElements)
{
/* Performs vector operation: out = (gain1*in1+2^15)>>16 + (gain2*in2+2^15)>>16 */
int i;
G_CONST WebRtc_Word16 *in1ptr;
G_CONST WebRtc_Word16 *in2ptr;
WebRtc_Word16 *outptr;
in1ptr = in1;
in2ptr = in2;
outptr = out;
for (i = 0; i < nrOfElements; i++)
{
( *outptr++)
= (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((WEBRTC_SPL_MUL_16_16(gain1, *in1ptr++) + (WebRtc_Word32)32768), 16)
+ (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((WEBRTC_SPL_MUL_16_16(gain2, *in2ptr++) + (WebRtc_Word32)32768), 16);
}
}

View File

@ -1,30 +0,0 @@
/*
* scale_and_add_vectors.c
*
* This file contains the function WebRtcSpl_ScaleAndAddVectors().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleAndAddVectors(G_CONST WebRtc_Word16 *in1, WebRtc_Word16 gain1, int shift1,
G_CONST WebRtc_Word16 *in2, WebRtc_Word16 gain2, int shift2,
WebRtc_Word16 *out, int vector_length)
{
// Performs vector operation: out = (gain1*in1)>>shift1 + (gain2*in2)>>shift2
int i;
G_CONST WebRtc_Word16 *in1ptr;
G_CONST WebRtc_Word16 *in2ptr;
WebRtc_Word16 *outptr;
in1ptr = in1;
in2ptr = in2;
outptr = out;
for (i = 0; i < vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(gain1, *in1ptr++, shift1)
+ (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(gain2, *in2ptr++, shift2);
}
}

View File

@ -1,25 +0,0 @@
/*
* scale_and_add_vectors_with_round.c
*
* This file contains the function WebRtcSpl_ScaleAndAddVectorsWithRound().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleAndAddVectorsWithRound(WebRtc_Word16 *vec1, WebRtc_Word16 scale1,
WebRtc_Word16 *vec2, WebRtc_Word16 scale2,
WebRtc_Word16 rshifts, WebRtc_Word16 *out,
WebRtc_Word16 length)
{
int i;
WebRtc_Word16 roundVal;
roundVal = 1 << rshifts;
roundVal = roundVal >> 1;
for (i = 0; i < length; i++)
{
out[i] = (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16(vec1[i],scale1)
+ WEBRTC_SPL_MUL_16_16(vec2[i],scale2) + roundVal) >> rshifts);
}
}

View File

@ -1,27 +0,0 @@
/*
* scale_vector.c
*
* This file contains the function WebRtcSpl_ScaleVector().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleVector(G_CONST WebRtc_Word16 *in_vector, WebRtc_Word16 *out_vector,
WebRtc_Word16 gain, WebRtc_Word16 in_vector_length,
WebRtc_Word16 right_shifts)
{
// Performs vector operation: out_vector = (gain*in_vector)>>right_shifts
int i;
G_CONST WebRtc_Word16 *inptr;
WebRtc_Word16 *outptr;
inptr = in_vector;
outptr = out_vector;
for (i = 0; i < in_vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(*inptr++, gain, right_shifts);
}
}

View File

@ -1,29 +0,0 @@
/*
* scale_vector_with_sat.c
*
* This file contains the function WebRtcSpl_ScaleVectorWithSat().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleVectorWithSat(G_CONST WebRtc_Word16 *in_vector, WebRtc_Word16 *out_vector,
WebRtc_Word16 gain, WebRtc_Word16 in_vector_length,
WebRtc_Word16 right_shifts)
{
/* Performs vector operation: out_vector = (gain*in_vector)>>right_shifts */
int i;
WebRtc_Word32 tmpW32;
G_CONST WebRtc_Word16 *inptr;
WebRtc_Word16 *outptr;
inptr = in_vector;
outptr = out_vector;
for (i = 0; i < in_vector_length; i++)
{
tmpW32 = WEBRTC_SPL_MUL_16_16_RSFT(*inptr++, gain, right_shifts);
( *outptr++) = (WebRtc_Word16)WEBRTC_SPL_SAT(32767, tmpW32, -32768);
}
}

View File

@ -1,48 +0,0 @@
/*
* set_column.c
*
* This file contains the function WebRtcSpl_SetColumn().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
/*
* Insert a vector into a column in the matrix
*/
void WebRtcSpl_SetColumn(G_CONST WebRtc_Word32 *in_column, WebRtc_Word16 in_column_length,
WebRtc_Word32 *matrix, WebRtc_Word16 number_of_rows,
WebRtc_Word16 number_of_cols, WebRtc_Word16 column_chosen)
{
WebRtc_Word16 i;
G_CONST WebRtc_Word32 *inarrptr = in_column;
WebRtc_Word32 *matptr = &matrix[column_chosen];
#ifdef _DEBUG
if (in_column_length != number_of_rows)
{
printf(" SetColumn : the vector to be inserted does not have the same length as a column in the matrix\n");
exit(0);
}
if ((column_chosen < 0) || (column_chosen >= number_of_cols))
{
printf(" SetColumn : selected column is negative or larger than the dimension of the matrix\n");
exit(0);
}
#endif
/* Unused input variable */
number_of_rows = number_of_rows;
for (i = 0; i < in_column_length; i++)
{
(*matptr) = (*inarrptr++);
matptr += number_of_cols;
}
}

View File

@ -1,46 +0,0 @@
/*
* set_row.c
*
* This file contains the function WebRtcSpl_SetRow().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#ifdef _DEBUG
#include <stdio.h>
#include <stdlib.h>
#endif
/*
* Insert a vector into a row in the matrix
*/
void WebRtcSpl_SetRow(G_CONST WebRtc_Word32 *in_row, WebRtc_Word16 in_column_length,
WebRtc_Word32 *matrix, WebRtc_Word16 number_of_rows,
WebRtc_Word16 number_of_cols, WebRtc_Word16 row_chosen)
{
WebRtc_Word16 i;
G_CONST WebRtc_Word32 *inarrptr = in_row;
WebRtc_Word32 *matptr = &matrix[row_chosen * number_of_cols];
#ifdef _DEBUG
if (in_column_length != number_of_cols)
{
printf(" SetRow : the vector to be inserted does not have the same length as a row in the matrix\n");
exit(0);
}
if ((row_chosen < 0) || (row_chosen >= number_of_rows))
{
printf(" SetRow : selected row is negative or larger than the dimension of the matrix\n");
exit(0);
}
#endif
/* Unused input variable */
number_of_rows = number_of_rows;
for (i = 0; i < in_column_length; i++)
{
(*matptr++) = (*inarrptr++);
}
}

View File

@ -1,25 +0,0 @@
/*
* update_energy_from_array.c
*
* This file contains the function WebRtcSpl_UpdateEnergyFromArray().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_UpdateEnergyFromArray(WebRtc_Word32 *E, WebRtc_Word16 *vector,
WebRtc_Word16 vector_length, WebRtc_Word16 alpha,
WebRtc_Word16 round_factor)
{
int loop;
WebRtc_Word32 tmp32a;
for (loop = 0; loop < vector_length; loop++)
{
tmp32a = WEBRTC_SPL_MUL_16_16(vector[loop], vector[loop]);
tmp32a = (WebRtc_Word32)(tmp32a - *E + round_factor); // rounding factor
tmp32a = tmp32a >> alpha;
*E += tmp32a;
}
}

View File

@ -1,34 +0,0 @@
/*
* update_energy_from_value.c
*
* This file contains the function WebRtcSpl_UpdateEnergyFromValue().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_UpdateEnergyFromValue(WebRtc_Word32 *energy, WebRtc_Word16 weight1,
WebRtc_Word32 new_data, WebRtc_Word16 weight2)
{
int sh1, sh2;
WebRtc_Word32 tmp32a, tmp32b;
WebRtc_Word16 tmp16a, tmp16b;
tmp32a = *energy; /* Let tmp32a */
tmp32b = new_data; /* Let tmp32b */
/* Make tmp32a to a WebRtc_Word16 in Q(sh1-16) domain */
sh1 = WebRtcSpl_NormW32(tmp32a);
tmp16a = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(tmp32a, sh1 - 16);
/* Make tmp32b to a WebRtc_Word16 in Q(sh2-16) domain */
sh2 = WebRtcSpl_NormW32(tmp32b);
tmp16b = (WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(tmp32b, sh2 - 16);
/* Determine weight1*tmp16a + weight2*tmp16b */
tmp32a = WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(tmp16a, weight1, sh1 - 1);
tmp32b = WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(tmp16b, weight2, sh2 - 1);
*energy = tmp32a + tmp32b;
}

View File

@ -1,21 +0,0 @@
/*
* update_filter.c
*
* This file contains the function WebRtcSpl_UpdateFilter().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_UpdateFilter(WebRtc_Word16 gain, int vector_length, WebRtc_Word16* phi,
WebRtc_Word16* H)
{
int i;
for (i = 0; i < vector_length; i++)
{
*H += (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(gain, *phi++, 16);
H++;
}
}

View File

@ -1,15 +0,0 @@
/*
* zeros_array_w16.c
*
* This file contains the function WebRtcSpl_ZerosArrayW16().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_ZerosArrayW16(WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtcSpl_MemSetW16(vector, 0, length);
return length;
}

View File

@ -1,15 +0,0 @@
/*
* zeros_array_w32.c
*
* This file contains the function WebRtcSpl_ZerosArrayW32().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word16 WebRtcSpl_ZerosArrayW32(WebRtc_Word32 *vector, WebRtc_Word16 length)
{
WebRtcSpl_MemSetW32(vector, 0, length);
return length;
}