/********************************************************************/ /* SIGNAL PROCESSING FUNCTIONS */ /********************************************************************/
/*! *Initialize/resettheresamplerstateforagivenpairofinput/outputsamplingrates
*/
opus_int silk_resampler_init(
silk_resampler_state_struct *S, /* I/O Resampler state */
opus_int32 Fs_Hz_in, /* I Input sampling rate (Hz) */
opus_int32 Fs_Hz_out, /* I Output sampling rate (Hz) */
opus_int forEnc /* I If 1: encoder; if 0: decoder */
);
/*! *Resampler:convertfromonesamplingratetoanother
*/
opus_int silk_resampler(
silk_resampler_state_struct *S, /* I/O Resampler state */
opus_int16 out[], /* O Output signal */ const opus_int16 in[], /* I Input signal */
opus_int32 inLen /* I Number of input samples */
);
/*! *Downsample2x,mediocrequality
*/ void silk_resampler_down2(
opus_int32 *S, /* I/O State vector [ 2 ] */
opus_int16 *out, /* O Output signal [ len ] */ const opus_int16 *in, /* I Input signal [ floor(len/2) ] */
opus_int32 inLen /* I Number of input samples */
);
/*! *Downsamplebyafactor2/3,lowquality
*/ void silk_resampler_down2_3(
opus_int32 *S, /* I/O State vector [ 6 ] */
opus_int16 *out, /* O Output signal [ floor(2*inLen/3) ] */ const opus_int16 *in, /* I Input signal [ inLen ] */
opus_int32 inLen /* I Number of input samples */
);
/*! *secondorderARMAfilter; *slowerthanbiquad()butusesmoreprecisecoefficients *canhandle(slowly)varyingcoefficients
*/ void silk_biquad_alt_stride1( const opus_int16 *in, /* I input signal */ const opus_int32 *B_Q28, /* I MA coefficients [3] */ const opus_int32 *A_Q28, /* I AR coefficients [2] */
opus_int32 *S, /* I/O State vector [2] */
opus_int16 *out, /* O output signal */ const opus_int32 len /* I signal length (must be even) */
);
void silk_biquad_alt_stride2_c( const opus_int16 *in, /* I input signal */ const opus_int32 *B_Q28, /* I MA coefficients [3] */ const opus_int32 *A_Q28, /* I AR coefficients [2] */
opus_int32 *S, /* I/O State vector [4] */
opus_int16 *out, /* O output signal */ const opus_int32 len /* I signal length (must be even) */
);
/* Variable order MA prediction error filter. */ void silk_LPC_analysis_filter(
opus_int16 *out, /* O Output signal */ const opus_int16 *in, /* I Input signal */ const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */ const opus_int32 len, /* I Signal length */ const opus_int32 d, /* I Filter order */ int arch /* I Run-time architecture */
);
/* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander(
opus_int16 *ar, /* I/O AR filter to be expanded (without leading 1) */ const opus_int d, /* I Length of ar */
opus_int32 chirp_Q16 /* I Chirp factor (typically in the range 0 to 1) */
);
/* Chirp (bandwidth expand) LP AR filter */ void silk_bwexpander_32(
opus_int32 *ar, /* I/O AR filter to be expanded (without leading 1) */ const opus_int d, /* I Length of ar */
opus_int32 chirp_Q16 /* I Chirp factor in Q16 */
);
/* Compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */
opus_int32 silk_LPC_inverse_pred_gain_c( /* O Returns inverse prediction gain in energy domain, Q30 */ const opus_int16 *A_Q12, /* I Prediction coefficients, Q12 [order] */ const opus_int order /* I Prediction order */
);
/* Split signal in two decimated bands using first-order allpass filters */ void silk_ana_filt_bank_1( const opus_int16 *in, /* I Input signal [N] */
opus_int32 *S, /* I/O State vector [2] */
opus_int16 *outL, /* O Low band [N/2] */
opus_int16 *outH, /* O High band [N/2] */ const opus_int32 N /* I Number of input samples */
);
/* Approximation of 128 * log2() (exact inverse of approx 2^() below) */ /* Convert input to a log scale */
opus_int32 silk_lin2log( const opus_int32 inLin /* I input in linear scale */
);
/* Approximation of a sigmoid function */
opus_int silk_sigm_Q15(
opus_int in_Q5 /* I */
);
/* Approximation of 2^() (exact inverse of approx log2() above) */ /* Convert input to a linear scale */
opus_int32 silk_log2lin( const opus_int32 inLog_Q7 /* I input on log scale */
);
/* Compute number of bits to right shift the sum of squares of a vector */ /* of int16s to make it fit in an int32 */ void silk_sum_sqr_shift(
opus_int32 *energy, /* O Energy of x, after shifting to the right */
opus_int *shift, /* O Number of bits right shift applied to energy */ const opus_int16 *x, /* I Input vector */
opus_int len /* I Length of input vector */
);
/* Calculates the reflection coefficients from the correlation sequence */ /* Faster than schur64(), but much less accurate. */ /* uses SMLAWB(), requiring armv5E and higher. */
opus_int32 silk_schur( /* O Returns residual energy */
opus_int16 *rc_Q15, /* O reflection coefficients [order] Q15 */ const opus_int32 *c, /* I correlations [order+1] */ const opus_int32 order /* I prediction order */
);
/* Calculates the reflection coefficients from the correlation sequence */ /* Slower than schur(), but more accurate. */ /* Uses SMULL(), available on armv4 */
opus_int32 silk_schur64( /* O returns residual energy */
opus_int32 rc_Q16[], /* O Reflection coefficients [order] Q16 */ const opus_int32 c[], /* I Correlations [order+1] */
opus_int32 order /* I Prediction order */
);
/* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a(
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */ const opus_int16 *rc_Q15, /* I Reflection coefficients [order] Q15 */ const opus_int32 order /* I Prediction order */
);
/* Step up function, converts reflection coefficients to prediction coefficients */ void silk_k2a_Q16(
opus_int32 *A_Q24, /* O Prediction coefficients [order] Q24 */ const opus_int32 *rc_Q16, /* I Reflection coefficients [order] Q16 */ const opus_int32 order /* I Prediction order */
);
/* Apply sine window to signal vector. */ /* Window types: */ /* 1 -> sine window from 0 to pi/2 */ /* 2 -> sine window from pi/2 to pi */ /* every other sample of window is linearly interpolated, for speed */ void silk_apply_sine_window(
opus_int16 px_win[], /* O Pointer to windowed signal */ const opus_int16 px[], /* I Pointer to input signal */ const opus_int win_type, /* I Selects a window type */ const opus_int length /* I Window length, multiple of 4 */
);
/* Compute autocorrelation */ void silk_autocorr(
opus_int32 *results, /* O Result (length correlationCount) */
opus_int *scale, /* O Scaling of the correlation vector */ const opus_int16 *inputData, /* I Input data to correlate */ const opus_int inputDataSize, /* I Length of input */ const opus_int correlationCount, /* I Number of correlation taps to compute */ int arch /* I Run-time architecture */
);
void silk_decode_pitch(
opus_int16 lagIndex, /* I */
opus_int8 contourIndex, /* O */
opus_int pitch_lags[], /* O 4 pitch values */ const opus_int Fs_kHz, /* I sampling frequency (kHz) */ const opus_int nb_subfr /* I number of sub frames */
);
opus_int silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, 1 unvoiced */ const opus_int16 *frame, /* I Signal of length PE_FRAME_LENGTH_MS*Fs_kHz */
opus_int *pitch_out, /* O 4 pitch lag values */
opus_int16 *lagIndex, /* O Lag Index */
opus_int8 *contourIndex, /* O Pitch contour Index */
opus_int *LTPCorr_Q15, /* I/O Normalized correlation; input: value from previous frame */
opus_int prevLag, /* I Last lag of previous frame; set to zero is unvoiced */ const opus_int32 search_thres1_Q16, /* I First stage threshold for lag candidates 0 - 1 */ const opus_int search_thres2_Q13, /* I Final threshold for lag candidates 0 - 1 */ const opus_int Fs_kHz, /* I Sample frequency (kHz) */ const opus_int complexity, /* I Complexity setting, 0-2, where 2 is highest */ const opus_int nb_subfr, /* I number of 5 ms subframes */ int arch /* I Run-time architecture */
);
/* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filter coefficients */ /* If not all roots are found, the a_Q16 coefficients are bandwidth expanded until convergence. */ void silk_A2NLSF(
opus_int16 *NLSF, /* O Normalized Line Spectral Frequencies in Q15 (0..2^15-1) [d] */
opus_int32 *a_Q16, /* I/O Monic whitening filter coefficients in Q16 [d] */ const opus_int d /* I Filter order (must be even) */
);
/* compute whitening filter coefficients from normalized line spectral frequencies */ void silk_NLSF2A(
opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ const opus_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ const opus_int d, /* I filter order (should be even) */ int arch /* I Run-time architecture */
);
/* Convert int32 coefficients to int16 coefs and make sure there's no wrap-around */ void silk_LPC_fit(
opus_int16 *a_QOUT, /* O Output signal */
opus_int32 *a_QIN, /* I/O Input signal */ const opus_int QOUT, /* I Input Q domain */ const opus_int QIN, /* I Input Q domain */ const opus_int d /* I Filter order */
);
void silk_insertion_sort_increasing(
opus_int32 *a, /* I/O Unsorted / Sorted vector */
opus_int *idx, /* O Index vector for the sorted elements */ const opus_int L, /* I Vector length */ const opus_int K /* I Number of correctly sorted positions */
);
void silk_insertion_sort_decreasing_int16(
opus_int16 *a, /* I/O Unsorted / Sorted vector */
opus_int *idx, /* O Index vector for the sorted elements */ const opus_int L, /* I Vector length */ const opus_int K /* I Number of correctly sorted positions */
);
void silk_insertion_sort_increasing_all_values_int16(
opus_int16 *a, /* I/O Unsorted / Sorted vector */ const opus_int L /* I Vector length */
);
/* NLSF stabilizer, for a single input data vector */ void silk_NLSF_stabilize(
opus_int16 *NLSF_Q15, /* I/O Unstable/stabilized normalized LSF vector in Q15 [L] */ const opus_int16 *NDeltaMin_Q15, /* I Min distance vector, NDeltaMin_Q15[L] must be >= 1 [L+1] */ const opus_int L /* I Number of NLSF parameters in the input vector */
);
/* Laroia low complexity NLSF weights */ void silk_NLSF_VQ_weights_laroia(
opus_int16 *pNLSFW_Q_OUT, /* O Pointer to input vector weights [D] */ const opus_int16 *pNLSF_Q15, /* I Pointer to input vector [D] */ const opus_int D /* I Input vector dimension (even) */
);
/* Compute reflection coefficients from input signal */ void silk_burg_modified_c(
opus_int32 *res_nrg, /* O Residual energy */
opus_int *res_nrg_Q, /* O Residual energy Q value */
opus_int32 A_Q16[], /* O Prediction coefficients (length order) */ const opus_int16 x[], /* I Input signal, length: nb_subfr * ( D + subfr_length ) */ const opus_int32 minInvGain_Q30, /* I Inverse of max prediction gain */ const opus_int subfr_length, /* I Input signal subframe length (incl. D preceding samples) */ const opus_int nb_subfr, /* I Number of subframes stacked in x */ const opus_int D, /* I Order */ int arch /* I Run-time architecture */
);
/* Copy and multiply a vector by a constant */ void silk_scale_copy_vector16(
opus_int16 *data_out, const opus_int16 *data_in,
opus_int32 gain_Q16, /* I Gain in Q16 */ const opus_int dataSize /* I Length */
);
/* Some for the LTP related function requires Q26 to work.*/ void silk_scale_vector32_Q26_lshift_18(
opus_int32 *data1, /* I/O Q0/Q18 */
opus_int32 gain_Q26, /* I Q26 */
opus_int dataSize /* I length */
);
/********************************************************************/ /* INLINE ARM MATH */ /********************************************************************/
/* return sum( inVec1[i] * inVec2[i] ) */
opus_int32 silk_inner_prod_aligned( const opus_int16 *const inVec1, /* I input vector 1 */ const opus_int16 *const inVec2, /* I input vector 2 */ const opus_int len, /* I vector lengths */ int arch /* I Run-time architecture */
);
opus_int32 silk_inner_prod_aligned_scale( const opus_int16 *const inVec1, /* I input vector 1 */ const opus_int16 *const inVec2, /* I input vector 2 */ const opus_int scale, /* I number of bits to shift */ const opus_int len /* I vector lengths */
);
opus_int64 silk_inner_prod16_c( const opus_int16 *inVec1, /* I input vector 1 */ const opus_int16 *inVec2, /* I input vector 2 */ const opus_int len /* I vector lengths */
);
/* Adds two signed 32-bit values in a way that can overflow, while not relying on undefined behaviour
(just standard two's complement implementation-specific behaviour) */ #define silk_ADD32_ovflw(a, b) ((opus_int32)((opus_uint32)(a) + (opus_uint32)(b))) /* Subtractss two signed 32-bit values in a way that can overflow, while not relying on undefined behaviour
(just standard two's complement implementation-specific behaviour) */ #define silk_SUB32_ovflw(a, b) ((opus_int32)((opus_uint32)(a) - (opus_uint32)(b)))
/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */ #define silk_MLA_ovflw(a32, b32, c32) silk_ADD32_ovflw((a32), (opus_uint32)(b32) * (opus_uint32)(c32)) #define silk_SMLABB_ovflw(a32, b32, c32) (silk_ADD32_ovflw((a32) , ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))))
/* These macros enables checking for overflow in silk_API_Debug.h*/ #define silk_ADD16(a, b) ((a) + (b)) #define silk_ADD32(a, b) ((a) + (b)) #define silk_ADD64(a, b) ((a) + (b))
#define silk_SUB16(a, b) ((a) - (b)) #define silk_SUB32(a, b) ((a) - (b)) #define silk_SUB64(a, b) ((a) - (b))
/* Number of rightshift required to fit the multiplication */ #define silk_NSHIFT_MUL_32_32(a, b) ( -(31- (32-silk_CLZ32(silk_abs(a)) + (32-silk_CLZ32(silk_abs(b))))) ) #define silk_NSHIFT_MUL_16_16(a, b) ( -(15- (16-silk_CLZ16(silk_abs(a)) + (16-silk_CLZ16(silk_abs(b))))) )
#define silk_min(a, b) (((a) < (b)) ? (a) : (b)) #define silk_max(a, b) (((a) > (b)) ? (a) : (b))
/* PSEUDO-RANDOM GENERATOR */ /* Make sure to store the result as the seed for the next call (also in between */ /* frames), otherwise result won't be random at all. When only using some of the */ /* bits, take the most significant bits by right-shifting. */ #define RAND_MULTIPLIER 196314165 #define RAND_INCREMENT 907633515 #define silk_RAND(seed) (silk_MLA_ovflw((RAND_INCREMENT), (seed), (RAND_MULTIPLIER)))
/* Add some multiplication functions that can be easily mapped to ARM/MIPS32. */
/* silk_SMMUL: Signed top word multiply. ARMv62instructioncycles. ARMv3M+3instructioncycles.useSMULLandignoreLSBregisters.(exceptxM) MIPS322instructionsmul+mfhi
MIPS32r6 1 instruction muh */ /*#define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT(silk_SMLAL(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)), 16)*/ /* the following seems faster on x86 */ #define silk_SMMUL(a32, b32) (opus_int32)silk_RSHIFT64(silk_SMULL((a32), (b32)), 32)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.