| SKP_Silk_SDK_API.h | | SKP_Silk_SDK_API.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| #define SILK_MAX_FRAMES_PER_PACKET 3 | | #define SILK_MAX_FRAMES_PER_PACKET 3 | |
| | | | |
| /* Struct for TOC (Table of Contents) */ | | /* Struct for TOC (Table of Contents) */ | |
| typedef struct { | | typedef struct { | |
|
| SKP_int framesInPacket; /* Number o | | SKP_int VADFlag; /* Voice activity f | |
| f 20 ms frames in packet */ | | or packet */ | |
| SKP_int fs_kHz; /* Sampling | | SKP_int VADFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Voice activity f | |
| frequency in packet */ | | or each frame in packet */ | |
| SKP_int inbandLBRR; /* Does pac | | SKP_int inbandFECFlag; /* Flag indicating | |
| ket contain LBRR information */ | | if packet contains in-band FEC */ | |
| SKP_int corrupt; /* Packet i | | | |
| s corrupt */ | | | |
| SKP_int signalTypeFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Signal t | | | |
| ype for each frame in packet */ | | | |
| } SKP_Silk_TOC_struct; | | } SKP_Silk_TOC_struct; | |
| | | | |
| /****************************************/ | | /****************************************/ | |
| /* Encoder functions */ | | /* Encoder functions */ | |
| /****************************************/ | | /****************************************/ | |
| | | | |
| /***********************************************/ | | /***********************************************/ | |
| /* Get size in bytes of the Silk encoder state */ | | /* Get size in bytes of the Silk encoder state */ | |
| /***********************************************/ | | /***********************************************/ | |
| SKP_int SKP_Silk_SDK_Get_Encoder_Size( /* O: Returns err
or code */ | | SKP_int SKP_Silk_SDK_Get_Encoder_Size( /* O: Returns err
or code */ | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 114 | |
| SKP_int SKP_Silk_SDK_InitDecoder( /* O: Returns err
or code */ | | SKP_int SKP_Silk_SDK_InitDecoder( /* O: Returns err
or code */ | |
| void *decState /* I/O: State
*/ | | void *decState /* I/O: State
*/ | |
| ); | | ); | |
| | | | |
| /******************/ | | /******************/ | |
| /* Decode a frame */ | | /* Decode a frame */ | |
| /******************/ | | /******************/ | |
| SKP_int SKP_Silk_SDK_Decode( /* O: Returns err
or code */ | | SKP_int SKP_Silk_SDK_Decode( /* O: Returns err
or code */ | |
| void* decState, /* I/O: State
*/ | | void* decState, /* I/O: State
*/ | |
| SKP_SILK_SDK_DecControlStruct* decControl, /* I/O: Control Str
ucture */ | | SKP_SILK_SDK_DecControlStruct* decControl, /* I/O: Control Str
ucture */ | |
|
| SKP_int lostFlag, /* I: 0: no loss, | | SKP_int lostFlag, /* I: 0: no loss, | |
| 1 loss */ | | 1 loss, 2 decode fec */ | |
| | | SKP_int newPacketFlag, /* I: Indicates f | |
| | | irst decoder call for this packet */ | |
| ec_dec *psRangeDec, /* I/O Compressor
data structure */ | | ec_dec *psRangeDec, /* I/O Compressor
data structure */ | |
| const SKP_int nBytesIn, /* I: Number of i
nput bytes */ | | const SKP_int nBytesIn, /* I: Number of i
nput bytes */ | |
| SKP_int16 *samplesOut, /* O: Decoded out
put speech vector */ | | SKP_int16 *samplesOut, /* O: Decoded out
put speech vector */ | |
| SKP_int32 *nSamplesOut /* O: Number of s
amples decoded */ | | SKP_int32 *nSamplesOut /* O: Number of s
amples decoded */ | |
| ); | | ); | |
| | | | |
| /***************************************************************/ | | /***************************************************************/ | |
| /* Find Low Bit Rate Redundancy (LBRR) information in a packet */ | | /* Find Low Bit Rate Redundancy (LBRR) information in a packet */ | |
| /***************************************************************/ | | /***************************************************************/ | |
| void SKP_Silk_SDK_search_for_LBRR( | | void SKP_Silk_SDK_search_for_LBRR( | |
| const SKP_uint8 *inData, /* I: Encoded inp
ut vector */ | | const SKP_uint8 *inData, /* I: Encoded inp
ut vector */ | |
| const SKP_int16 nBytesIn, /* I: Number of i
nput bytes */ | | const SKP_int16 nBytesIn, /* I: Number of i
nput bytes */ | |
| SKP_int lost_offset, /* I: Offset from
lost packet */ | | SKP_int lost_offset, /* I: Offset from
lost packet */ | |
| SKP_uint8 *LBRRData, /* O: LBRR payloa
d */ | | SKP_uint8 *LBRRData, /* O: LBRR payloa
d */ | |
| SKP_int32 *nLBRRBytes /* O: Number of L
BRR Bytes */ | | SKP_int32 *nLBRRBytes /* O: Number of L
BRR Bytes */ | |
| ); | | ); | |
| | | | |
| /**************************************/ | | /**************************************/ | |
| /* Get table of contents for a packet */ | | /* Get table of contents for a packet */ | |
| /**************************************/ | | /**************************************/ | |
|
| void SKP_Silk_SDK_get_TOC( | | SKP_int SKP_Silk_SDK_get_TOC( | |
| ec_dec *psRangeDec, /* I/O Compressor | | const SKP_uint8 *payload, /* I Payload | |
| data structure */ | | data */ | |
| const SKP_int16 nBytesIn, /* I: Number of i | | const SKP_int nBytesIn, /* I: Number | |
| nput bytes */ | | of input bytes */ | |
| SKP_Silk_TOC_struct *Silk_TOC /* O: Table of co | | const SKP_int nFramesPerPayload, /* I: Number | |
| ntents */ | | of SILK frames per payload */ | |
| | | SKP_Silk_TOC_struct *Silk_TOC /* O: Type of | |
| | | content */ | |
| ); | | ); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 20 lines changed or deleted | | 20 lines changed or added | |
|
| SKP_Silk_SigProc_FIX.h | | SKP_Silk_SigProc_FIX.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| #define _SKP_SILK_SIGPROC_FIX_H_ | | #define _SKP_SILK_SIGPROC_FIX_H_ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| //#define SKP_MACRO_COUNT /* Used to enable WMOPS counting */ | | //#define SKP_MACRO_COUNT /* Used to enable WMOPS counting */ | |
| | | | |
| #define SKP_Silk_MAX_ORDER_LPC 16 /* max orde
r of the LPC analysis in schur() and k2a() */ | | #define SKP_Silk_MAX_ORDER_LPC 16 /* max orde
r of the LPC analysis in schur() and k2a() */ | |
|
| #define SKP_Silk_MAX_CORRELATION_LENGTH 640 /* max inpu
t length to the correlation */ | | #define SKP_Silk_MAX_CORRELATION_LENGTH 640 /* max inpu
t length to the correlation */ | |
| #include "SKP_Silk_typedef.h" | | #include "SKP_Silk_typedef.h" | |
| #include <string.h> | | #include <string.h> | |
| #include <stdlib.h> /* for abs()
*/ | | #include <stdlib.h> /* for abs()
*/ | |
| #include "SKP_Silk_resampler_structs.h" | | #include "SKP_Silk_resampler_structs.h" | |
| | | | |
| # include "SKP_Silk_macros.h" | | # include "SKP_Silk_macros.h" | |
| | | | |
| /********************************************************************/ | | /********************************************************************/ | |
| /* SIGNAL PROCESSING FUNCTIONS */ | | /* SIGNAL PROCESSING FUNCTIONS */ | |
| /********************************************************************/ | | /********************************************************************/ | |
| | | | |
| /*! | | /*! | |
| * Initialize/reset the resampler state for a given pair of input/output sa
mpling rates | | * Initialize/reset the resampler state for a given pair of input/output sa
mpling rates | |
| */ | | */ | |
| SKP_int SKP_Silk_resampler_init( | | SKP_int SKP_Silk_resampler_init( | |
|
| SKP_Silk_resampler_state_struct *S, /* I/O: Resample
r state */ | | SKP_Silk_resampler_state_struct *S, /* I/O: Resa
mpler state */ | |
| SKP_int32 Fs_H
z_in, /* I: Input sampling rate (Hz) */ | | SKP_int32 Fs_H
z_in, /* I: Input sampling rate (Hz) */ | |
| SKP_int32 Fs_H
z_out /* I: Output sampling rate (Hz) */ | | SKP_int32 Fs_H
z_out /* I: Output sampling rate (Hz) */ | |
| ); | | ); | |
| | | | |
| /*! | | /*! | |
| * Clear the states of all resampling filters, without resetting sampling r
ate ratio | | * Clear the states of all resampling filters, without resetting sampling r
ate ratio | |
| */ | | */ | |
| SKP_int SKP_Silk_resampler_clear( | | SKP_int SKP_Silk_resampler_clear( | |
|
| SKP_Silk_resampler_state_struct *S /* I/O: Resample
r state */ | | SKP_Silk_resampler_state_struct *S /* I/O: Resa
mpler state */ | |
| ); | | ); | |
| | | | |
| /*! | | /*! | |
| * Resampler: convert from one sampling rate to another | | * Resampler: convert from one sampling rate to another | |
| */ | | */ | |
| SKP_int SKP_Silk_resampler( | | SKP_int SKP_Silk_resampler( | |
|
| SKP_Silk_resampler_state_struct *S, /* I/O: Resample
r state */ | | SKP_Silk_resampler_state_struct *S, /* I/O: Resa
mpler state */ | |
| SKP_int16 out[
], /* O: Output signal */ | | SKP_int16 out[
], /* O: Output signal */ | |
| const SKP_int16 in[],
/* I: Input signal */ | | const SKP_int16 in[],
/* I: Input signal */ | |
| SKP_int32 inLe
n /* I: Number of input samples */ | | SKP_int32 inLe
n /* I: Number of input samples */ | |
| ); | | ); | |
| | | | |
| /*! | | /*! | |
| Upsample 2x, low quality | | Upsample 2x, low quality | |
| */ | | */ | |
| void SKP_Silk_resampler_up2( | | void SKP_Silk_resampler_up2( | |
| SKP_int32 *S, /* I/O: State vector [
2 ] */ | | SKP_int32 *S, /* I/O: State vector [
2 ] */ | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 174 | |
| */ | | */ | |
| void SKP_Silk_MA_Prediction( | | void SKP_Silk_MA_Prediction( | |
| const SKP_int16 *in, /* I: Input signal
*/ | | const SKP_int16 *in, /* I: Input signal
*/ | |
| const SKP_int16 *B, /* I: MA prediction coefficients,
Q12 [order] */ | | const SKP_int16 *B, /* I: MA prediction coefficients,
Q12 [order] */ | |
| SKP_int32 *S, /* I/O: State vector [order]
*/ | | SKP_int32 *S, /* I/O: State vector [order]
*/ | |
| SKP_int16 *out, /* O: Output signal
*/ | | SKP_int16 *out, /* O: Output signal
*/ | |
| const SKP_int32 len, /* I: Signal length
*/ | | const SKP_int32 len, /* I: Signal length
*/ | |
| const SKP_int32 order /* I: Filter order
*/ | | const SKP_int32 order /* I: Filter order
*/ | |
| ); | | ); | |
| | | | |
|
| void SKP_Silk_MA_Prediction_Q13( | | | |
| const SKP_int16 *in, /* I: input signal | | | |
| */ | | | |
| const SKP_int16 *B, /* I: MA prediction coefficients, | | | |
| Q13 [order] */ | | | |
| SKP_int32 *S, /* I/O: state vector [order] | | | |
| */ | | | |
| SKP_int16 *out, /* O: output signal | | | |
| */ | | | |
| SKP_int32 len, /* I: signal length | | | |
| */ | | | |
| SKP_int32 order /* I: filter order | | | |
| */ | | | |
| ); | | | |
| | | | |
| /*! | | /*! | |
| * 16th order AR filter for LPC synthesis, coefficients are in Q12 | | * 16th order AR filter for LPC synthesis, coefficients are in Q12 | |
| */ | | */ | |
| void SKP_Silk_LPC_synthesis_order16( | | void SKP_Silk_LPC_synthesis_order16( | |
| const SKP_int16 *in, /* I: excitation signal
*/ | | const SKP_int16 *in, /* I: excitation signal
*/ | |
| const SKP_int16 *A_Q12, /* I: AR coefficients [16], betwee
n -8_Q0 and 8_Q0 */ | | const SKP_int16 *A_Q12, /* I: AR coefficients [16], betwee
n -8_Q0 and 8_Q0 */ | |
| const SKP_int32 Gain_Q26, /* I: gain
*/ | | const SKP_int32 Gain_Q26, /* I: gain
*/ | |
| SKP_int32 *S, /* I/O: state vector [16]
*/ | | SKP_int32 *S, /* I/O: state vector [16]
*/ | |
| SKP_int16 *out, /* O: output signal
*/ | | SKP_int16 *out, /* O: output signal
*/ | |
| const SKP_int32 len /* I: signal length, must be multi
ple of 16 */ | | const SKP_int32 len /* I: signal length, must be multi
ple of 16 */ | |
| ); | | ); | |
| | | | |
| /* variable order MA prediction error filter. */ | | /* variable order MA prediction error filter. */ | |
| /* Inverse filter of SKP_Silk_LPC_synthesis_filter */ | | /* Inverse filter of SKP_Silk_LPC_synthesis_filter */ | |
| void SKP_Silk_LPC_analysis_filter( | | void SKP_Silk_LPC_analysis_filter( | |
|
| | | SKP_int16 *out, /* O: Output signal
*/ | |
| const SKP_int16 *in, /* I: Input signal
*/ | | const SKP_int16 *in, /* I: Input signal
*/ | |
| const SKP_int16 *B, /* I: MA prediction coefficients,
Q12 [order] */ | | const SKP_int16 *B, /* I: MA prediction coefficients,
Q12 [order] */ | |
|
| SKP_int16 *S, /* I/O: State vector [order] | | | |
| */ | | | |
| SKP_int16 *out, /* O: Output signal | | | |
| */ | | | |
| const SKP_int32 len, /* I: Signal length
*/ | | const SKP_int32 len, /* I: Signal length
*/ | |
| const SKP_int32 Order /* I: Filter order
*/ | | const SKP_int32 Order /* I: Filter order
*/ | |
| ); | | ); | |
| | | | |
| /* even order AR filter */ | | /* even order AR filter */ | |
| void SKP_Silk_LPC_synthesis_filter( | | void SKP_Silk_LPC_synthesis_filter( | |
| const SKP_int16 *in, /* I: excitation signal
*/ | | const SKP_int16 *in, /* I: excitation signal
*/ | |
| const SKP_int16 *A_Q12, /* I: AR coefficients [Order], bet
ween -8_Q0 and 8_Q0 */ | | const SKP_int16 *A_Q12, /* I: AR coefficients [Order], bet
ween -8_Q0 and 8_Q0 */ | |
| const SKP_int32 Gain_Q26, /* I: gain
*/ | | const SKP_int32 Gain_Q26, /* I: gain
*/ | |
| SKP_int32 *S, /* I/O: state vector [Order]
*/ | | SKP_int32 *S, /* I/O: state vector [Order]
*/ | |
| | | | |
| skipping to change at line 344 | | skipping to change at line 334 | |
| const SKP_int inputDataSize, /* I Length of input
*/ | | const SKP_int inputDataSize, /* I Length of input
*/ | |
| const SKP_int correlationCount /* I Number of correlation taps t
o compute */ | | const SKP_int correlationCount /* I Number of correlation taps t
o compute */ | |
| ); | | ); | |
| | | | |
| /* Pitch estimator */ | | /* Pitch estimator */ | |
| #define SKP_Silk_PE_MIN_COMPLEX 0 | | #define SKP_Silk_PE_MIN_COMPLEX 0 | |
| #define SKP_Silk_PE_MID_COMPLEX 1 | | #define SKP_Silk_PE_MID_COMPLEX 1 | |
| #define SKP_Silk_PE_MAX_COMPLEX 2 | | #define SKP_Silk_PE_MAX_COMPLEX 2 | |
| | | | |
| void SKP_Silk_decode_pitch( | | void SKP_Silk_decode_pitch( | |
|
| SKP_int lagIndex, /* I | | SKP_int16 lagIndex, /* I | |
| */ | | */ | |
| SKP_int contourIndex, /* O | | SKP_int8 contourIndex, /* O | |
| */ | | */ | |
| SKP_int pitch_lags[], /* O 4 pitch values
*/ | | SKP_int pitch_lags[], /* O 4 pitch values
*/ | |
| const SKP_int Fs_kHz, /* I sampling frequenc
y (kHz) */ | | const SKP_int Fs_kHz, /* I sampling frequenc
y (kHz) */ | |
| const SKP_int nb_subfr /* I number of sub fra
mes */ | | const SKP_int nb_subfr /* I number of sub fra
mes */ | |
| ); | | ); | |
| | | | |
|
| SKP_int SKP_Silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced, | | SKP_int SKP_Silk_pitch_analysis_core( /* O Voicing estimate: 0 voiced | |
| 1 unvoiced */ | | , 1 unvoiced */ | |
| const SKP_int16 *signal, /* I Signal of length PE_FRAME_ | | const SKP_int16 *signal, /* I Signal of length PE_FRAME_ | |
| LENGTH_MS*Fs_kHz */ | | LENGTH_MS*Fs_kHz */ | |
| SKP_int *pitch_out, /* O 4 pitch lag values | | SKP_int *pitch_out, /* O 4 pitch lag values | |
| */ | | */ | |
| SKP_int *lagIndex, /* O Lag Index | | SKP_int16 *lagIndex, /* O Lag Index | |
| */ | | */ | |
| SKP_int *contourIndex, /* O Pitch contour Index | | SKP_int8 *contourIndex, /* O Pitch contour Index | |
| */ | | */ | |
| SKP_int *LTPCorr_Q15, /* I/O Normalized correlation; in | | SKP_int *LTPCorr_Q15, /* I/O Normalized correlation; in | |
| put: value from previous frame */ | | put: value from previous frame */ | |
| SKP_int prevLag, /* I Last lag of previous frame | | SKP_int prevLag, /* I Last lag of previous frame | |
| ; set to zero is unvoiced */ | | ; set to zero is unvoiced */ | |
| const SKP_int32 search_thres1_Q16, /* I First stage threshold for | | const SKP_int32 search_thres1_Q16, /* I First stage threshold for | |
| lag candidates 0 - 1 */ | | lag candidates 0 - 1 */ | |
| const SKP_int search_thres2_Q15, /* I Final threshold for lag ca | | const SKP_int search_thres2_Q15, /* I Final threshold for lag ca | |
| ndidates 0 - 1 */ | | ndidates 0 - 1 */ | |
| const SKP_int Fs_kHz, /* I Sample frequency (kHz) | | const SKP_int Fs_kHz, /* I Sample frequency (kHz) | |
| */ | | */ | |
| const SKP_int complexity, /* I Complexity setting, 0-2, w | | const SKP_int complexity, /* I Complexity setting, 0-2, w | |
| here 2 is highest */ | | here 2 is highest */ | |
| const SKP_int nb_subfr /* I number of 5 ms subframes | | const SKP_int nb_subfr /* I number of 5 ms subframes | |
| */ | | */ | |
| ); | | ); | |
| | | | |
| /* parameter defining the size and accuracy of the piecewise linear */ | | /* parameter defining the size and accuracy of the piecewise linear */ | |
| /* cosine approximatin table. */ | | /* cosine approximatin table. */ | |
| | | | |
| #define LSF_COS_TAB_SZ_FIX 128 | | #define LSF_COS_TAB_SZ_FIX 128 | |
| /* rom table with cosine values */ | | /* rom table with cosine values */ | |
| extern const SKP_int SKP_Silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ]; | | extern const SKP_int SKP_Silk_LSFCosTab_FIX_Q12[ LSF_COS_TAB_SZ_FIX + 1 ]; | |
| | | | |
| void SKP_Silk_LPC_fit( | | void SKP_Silk_LPC_fit( | |
|
| SKP_int16 *a_QQ, /* O stabilized LPC vector, Q(2 | | SKP_int16 *a_QQ, /* O stabilized LPC vector, Q(2 | |
| 4-rshift) [L] */ | | 4-rshift) [L] */ | |
| SKP_int32 *a_Q24, /* I LPC vector [L] | | SKP_int32 *a_Q24, /* I LPC vector [L] | |
| */ | | */ | |
| const SKP_int QQ, /* I Q domain of output LPC vec | | const SKP_int QQ, /* I Q domain of output LPC vec | |
| tor */ | | tor */ | |
| const SKP_int L /* I Number of LPC parameters i | | const SKP_int L /* I Number of LPC parameters i | |
| n the input vector */ | | n the input vector */ | |
| ); | | ); | |
| | | | |
|
| /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filt | | /* Compute Normalized Line Spectral Frequencies (NLSFs) from whitening filt | |
| er coefficients */ | | er coefficients */ | |
| /* If not all roots are found, the a_Q16 coefficients are bandwidth expande | | /* If not all roots are found, the a_Q16 coefficients are bandwidth expande | |
| d until convergence. */ | | d until convergence. */ | |
| void SKP_Silk_A2NLSF( | | void SKP_Silk_A2NLSF( | |
| SKP_int *NLSF, /* O Normalized Line Spectral F
requencies, Q15 (0 - (2^15-1)), [d] */ | | SKP_int *NLSF, /* O Normalized Line Spectral F
requencies, Q15 (0 - (2^15-1)), [d] */ | |
| SKP_int32 *a_Q16, /* I/O Monic whitening filter coe
fficients in Q16 [d] */ | | SKP_int32 *a_Q16, /* I/O Monic whitening filter coe
fficients in Q16 [d] */ | |
| const SKP_int d /* I Filter order (must be even
) */ | | const SKP_int d /* I Filter order (must be even
) */ | |
| ); | | ); | |
| | | | |
| /* compute whitening filter coefficients from normalized line spectral freq
uencies */ | | /* compute whitening filter coefficients from normalized line spectral freq
uencies */ | |
| void SKP_Silk_NLSF2A( | | void SKP_Silk_NLSF2A( | |
| SKP_int16 *a, /* o monic whitening filter coe
fficients in Q12, [d] */ | | SKP_int16 *a, /* o monic whitening filter coe
fficients in Q12, [d] */ | |
| const SKP_int *NLSF, /* i normalized line spectral f
requencies in Q15, [d] */ | | const SKP_int *NLSF, /* i normalized line spectral f
requencies in Q15, [d] */ | |
| | | | |
| skipping to change at line 547 | | skipping to change at line 537 | |
| /* Allocate SKP_int16 alligned to 4-byte memory address */ | | /* Allocate SKP_int16 alligned to 4-byte memory address */ | |
| #if EMBEDDED_ARM | | #if EMBEDDED_ARM | |
| #define SKP_DWORD_ALIGN __attribute__((aligned(4))) | | #define SKP_DWORD_ALIGN __attribute__((aligned(4))) | |
| #else | | #else | |
| #define SKP_DWORD_ALIGN | | #define SKP_DWORD_ALIGN | |
| #endif | | #endif | |
| | | | |
| /* Useful Macros that can be adjusted to other platforms */ | | /* Useful Macros that can be adjusted to other platforms */ | |
| #define SKP_memcpy(a, b, c) memcpy((a), (b), (c)) /* Dest
, Src, ByteCount */ | | #define SKP_memcpy(a, b, c) memcpy((a), (b), (c)) /* Dest
, Src, ByteCount */ | |
| #define SKP_memset(a, b, c) memset((a), (b), (c)) /* Dest
, value, ByteCount */ | | #define SKP_memset(a, b, c) memset((a), (b), (c)) /* Dest
, value, ByteCount */ | |
|
| #define SKP_memmove(a, b, c) memmove((a), (b), (c)) /* Des
t, Src, ByteCount */ | | #define SKP_memmove(a, b, c) memmove((a), (b), (c)) /* Dest
, Src, ByteCount */ | |
| /* fixed point macros */ | | /* fixed point macros */ | |
| | | | |
| // (a32 * b32) output have to be 32bit int | | // (a32 * b32) output have to be 32bit int | |
| #define SKP_MUL(a32, b32) ((a32) * (b32)) | | #define SKP_MUL(a32, b32) ((a32) * (b32)) | |
| | | | |
| // (a32 * b32) output have to be 32bit uint | | // (a32 * b32) output have to be 32bit uint | |
| #define SKP_MUL_uint(a32, b32) SKP_MUL(a32, b32) | | #define SKP_MUL_uint(a32, b32) SKP_MUL(a32, b32) | |
| | | | |
| // a32 + (b32 * c32) output have to be 32bit int | | // a32 + (b32 * c32) output have to be 32bit int | |
| #define SKP_MLA(a32, b32, c32) SKP_ADD32((a32),((b32) * (c32))) | | #define SKP_MLA(a32, b32, c32) SKP_ADD32((a32),((b32) * (c32))) | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 719 | |
| #define SKP_abs_int32(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)
) | | #define SKP_abs_int32(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)
) | |
| #define SKP_abs_int64(a) (((a) > 0) ? (a) : -(a)) | | #define SKP_abs_int64(a) (((a) > 0) ? (a) : -(a)) | |
| | | | |
| #define SKP_sign(a) ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0
)) | | #define SKP_sign(a) ((a) > 0 ? 1 : ( (a) < 0 ? -1 : 0
)) | |
| | | | |
| #define SKP_sqrt(a) (sqrt(a)) | | #define SKP_sqrt(a) (sqrt(a)) | |
| | | | |
| /* PSEUDO-RANDOM GENERATOR
*/ | | /* PSEUDO-RANDOM GENERATOR
*/ | |
| /* Make sure to store the result as the seed for the next call (also in bet
ween */ | | /* Make sure to store the result as the seed for the next call (also in bet
ween */ | |
| /* frames), otherwise result won't be random at all. When only using some o
f the */ | | /* frames), otherwise result won't be random at all. When only using some o
f the */ | |
|
| /* bits, take the most significant bits by right-shifting. Do not just mask | | /* bits, take the most significant bits by right-shifting. | |
| off */ | | */ | |
| /* the lowest bits. | | | |
| */ | | | |
| #define SKP_RAND(seed) (SKP_MLA_ovflw(907633515, (seed),
196314165)) | | #define SKP_RAND(seed) (SKP_MLA_ovflw(907633515, (seed),
196314165)) | |
| | | | |
| // Add some multiplication functions that can be easily mapped to ARM. | | // Add some multiplication functions that can be easily mapped to ARM. | |
| | | | |
| // SKP_SMMUL: Signed top word multiply. | | // SKP_SMMUL: Signed top word multiply. | |
| // ARMv6 2 instruction cycles. | | // ARMv6 2 instruction cycles. | |
| // ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB reg
isters.(except xM) | | // ARMv3M+ 3 instruction cycles. use SMULL and ignore LSB reg
isters.(except xM) | |
| //#define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT(SKP_SMLAL(SK
P_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)), 16) | | //#define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT(SKP_SMLAL(SK
P_SMULWB((a32), (b32)), (a32), SKP_RSHIFT_ROUND((b32), 16)), 16) | |
| // the following seems faster on x86 | | // the following seems faster on x86 | |
| #define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT64(SKP_SMULL(
(a32), (b32)), 32) | | #define SKP_SMMUL(a32, b32) (SKP_int32)SKP_RSHIFT64(SKP_SMULL(
(a32), (b32)), 32) | |
| | | | |
End of changes. 14 change blocks. |
| 69 lines changed or deleted | | 49 lines changed or added | |
|
| SKP_Silk_SigProc_FLP.h | | SKP_Silk_SigProc_FLP.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
| ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| ***********************************************************************/ | | ***********************************************************************/ | |
| | | | |
| #ifndef _SKP_SILK_SIGPROC_FLP_H_ | | #ifndef _SKP_SILK_SIGPROC_FLP_H_ | |
| #define _SKP_SILK_SIGPROC_FLP_H_ | | #define _SKP_SILK_SIGPROC_FLP_H_ | |
| | | | |
| #include "SKP_Silk_SigProc_FIX.h" | | #include "SKP_Silk_SigProc_FIX.h" | |
|
| | | #include "float_cast.h" | |
| #include <math.h> | | #include <math.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| /********************************************************************/ | | /********************************************************************/ | |
| /* SIGNAL PROCESSING FUNCTIONS */ | | /* SIGNAL PROCESSING FUNCTIONS */ | |
| /********************************************************************/ | | /********************************************************************/ | |
| | | | |
|
| /* first-order allpass filter */ | | | |
| void SKP_Silk_allpass_int_FLP( | | | |
| const SKP_float *in, /* I: input signal [len] | | | |
| */ | | | |
| SKP_float *S, /* I/O: state [1] | | | |
| */ | | | |
| SKP_float A, /* I: coefficient (0 <= A < 1) | | | |
| */ | | | |
| SKP_float *out, /* O: output signal [len] | | | |
| */ | | | |
| const SKP_int32 len /* I: number of samples | | | |
| */ | | | |
| ); | | | |
| | | | |
| /* downsample by a factor 2, coarser */ | | | |
| void SKP_Silk_decimate2_coarse_FLP( | | | |
| const SKP_float *in, /* I: signal [2*len] | | | |
| */ | | | |
| SKP_float *S, /* I/O: state vector [2] * | | | |
| / | | | |
| SKP_float *out, /* O: decimated signal [len] * | | | |
| / | | | |
| SKP_float *scratch, /* I: scratch memory [3*len] * | | | |
| / | | | |
| const SKP_int32 len /* I: number of OUTPUT samples * | | | |
| / | | | |
| ); | | | |
| | | | |
| /* downsample by a factor 2, coarsest */ | | | |
| void SKP_Silk_decimate2_coarsest_FLP( | | | |
| const SKP_float *in, /* I: signal [2*len] | | | |
| */ | | | |
| SKP_float *S, /* I/O: state vector [2] * | | | |
| / | | | |
| SKP_float *out, /* O: decimated signal [len] * | | | |
| / | | | |
| SKP_float *scratch, /* I: scratch memory [3*len] * | | | |
| / | | | |
| const SKP_int32 len /* I: number of OUTPUT samples * | | | |
| / | | | |
| ); | | | |
| | | | |
| /* Chirp (bw expand) LP AR filter */ | | /* Chirp (bw expand) LP AR filter */ | |
| void SKP_Silk_bwexpander_FLP( | | void SKP_Silk_bwexpander_FLP( | |
| SKP_float *ar, /* io AR filter to be expanded (wi
thout leading 1) */ | | SKP_float *ar, /* io AR filter to be expanded (wi
thout leading 1) */ | |
| const SKP_int d, /* i length of ar
*/ | | const SKP_int d, /* i length of ar
*/ | |
| const SKP_float chirp /* i chirp factor (typically in r
ange (0..1) ) */ | | const SKP_float chirp /* i chirp factor (typically in r
ange (0..1) ) */ | |
| ); | | ); | |
| | | | |
| /* compute inverse of LPC prediction gain, and
*/ | | /* compute inverse of LPC prediction gain, and
*/ | |
| /* test if LPC coefficients are stable (all poles within unit circle) */ | | /* test if LPC coefficients are stable (all poles within unit circle) */ | |
| /* this code is based on SKP_Silk_FLP_a2k()
*/ | | /* this code is based on SKP_Silk_FLP_a2k()
*/ | |
| | | | |
| skipping to change at line 119 | | skipping to change at line 93 | |
| SKP_int inputDataSize, /* i length of input
*/ | | SKP_int inputDataSize, /* i length of input
*/ | |
| SKP_int correlationCount /* i number of correlation taps
to compute */ | | SKP_int correlationCount /* i number of correlation taps
to compute */ | |
| ); | | ); | |
| | | | |
| /* Pitch estimator */ | | /* Pitch estimator */ | |
| #define SigProc_PE_MIN_COMPLEX 0 | | #define SigProc_PE_MIN_COMPLEX 0 | |
| #define SigProc_PE_MID_COMPLEX 1 | | #define SigProc_PE_MID_COMPLEX 1 | |
| #define SigProc_PE_MAX_COMPLEX 2 | | #define SigProc_PE_MAX_COMPLEX 2 | |
| | | | |
| SKP_int SKP_Silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced,
1 unvoiced */ | | SKP_int SKP_Silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced,
1 unvoiced */ | |
|
| const SKP_float *signal, /* I signal of length PE_FRAME_LENG
TH_MS*Fs_kHz */ | | const SKP_float *signal, /* I signal of length PE_FRAME_LENG
TH_MS*Fs_kHz */ | |
| SKP_int *pitch_out, /* O 4 pitch lag values
*/ | | SKP_int *pitch_out, /* O 4 pitch lag values
*/ | |
|
| SKP_int *lagIndex, /* O lag Index | | SKP_int16 *lagIndex, /* O lag Index | |
| */ | | */ | |
| SKP_int *contourIndex, /* O pitch contour Index | | SKP_int8 *contourIndex, /* O pitch contour Index | |
| */ | | */ | |
| SKP_float *LTPCorr, /* I/O normalized correlation; inpu
t: value from previous frame */ | | SKP_float *LTPCorr, /* I/O normalized correlation; inpu
t: value from previous frame */ | |
| SKP_int prevLag, /* I last lag of previous frame; se
t to zero is unvoiced */ | | SKP_int prevLag, /* I last lag of previous frame; se
t to zero is unvoiced */ | |
| const SKP_float search_thres1, /* I first stage threshold for lag
candidates 0 - 1 */ | | const SKP_float search_thres1, /* I first stage threshold for lag
candidates 0 - 1 */ | |
| const SKP_float search_thres2, /* I final threshold for lag candid
ates 0 - 1 */ | | const SKP_float search_thres2, /* I final threshold for lag candid
ates 0 - 1 */ | |
| const SKP_int Fs_kHz, /* I sample frequency (kHz)
*/ | | const SKP_int Fs_kHz, /* I sample frequency (kHz)
*/ | |
| const SKP_int complexity, /* I Complexity setting, 0-2, where
2 is highest */ | | const SKP_int complexity, /* I Complexity setting, 0-2, where
2 is highest */ | |
| const SKP_int nb_subfr /* I number of 5 ms subframes
*/ | | const SKP_int nb_subfr /* I number of 5 ms subframes
*/ | |
| ); | | ); | |
| | | | |
| #define PI (3.1415926536f) | | #define PI (3.1415926536f) | |
| | | | |
| skipping to change at line 211 | | skipping to change at line 185 | |
| #define SKP_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a)
> (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ | | #define SKP_LIMIT_float( a, limit1, limit2) ((limit1) > (limit2) ? ((a)
> (limit1) ? (limit1) : ((a) < (limit2) ? (limit2) : (a))) \ | |
|
: ((a) > (limit2) ? (limit
2) : ((a) < (limit1) ? (limit1) : (a)))) | |
: ((a) > (limit2) ? (limit
2) : ((a) < (limit1) ? (limit1) : (a)))) | |
| | | | |
| /* sigmoid function */ | | /* sigmoid function */ | |
| SKP_INLINE SKP_float SKP_sigmoid(SKP_float x) | | SKP_INLINE SKP_float SKP_sigmoid(SKP_float x) | |
| { | | { | |
| return (SKP_float)(1.0 / (1.0 + exp(-x))); | | return (SKP_float)(1.0 / (1.0 + exp(-x))); | |
| } | | } | |
| | | | |
| /* floating-point to integer conversion (rounding) */ | | /* floating-point to integer conversion (rounding) */ | |
|
| | | #if 1 | |
| | | /* use implementation in float_cast.h */ | |
| | | #define SKP_float2int(x) float2int(x) | |
| | | #else | |
| | | SKP_INLINE SKP_int32 SKP_float2int(SKP_float x) | |
| | | { | |
| | | double y = x; | |
| | | return (SKP_int32)( ( y > 0 ) ? y + 0.5 : y - 0.5 ); | |
| | | } | |
| | | #endif | |
| | | | |
| | | /* floating-point to integer conversion (rounding) */ | |
| SKP_INLINE void SKP_float2short_array( | | SKP_INLINE void SKP_float2short_array( | |
| SKP_int16 *out, | | SKP_int16 *out, | |
| const SKP_float *in, | | const SKP_float *in, | |
| SKP_int32 length | | SKP_int32 length | |
| ) | | ) | |
| { | | { | |
| SKP_int32 k; | | SKP_int32 k; | |
| for (k = length-1; k >= 0; k--) { | | for (k = length-1; k >= 0; k--) { | |
|
| double x = in[k]; | | out[k] = (SKP_int16)SKP_SAT16( float2int( in[k] ) ); | |
| out[k] = (SKP_int16)SKP_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 ); | | | |
| } | | } | |
| } | | } | |
| | | | |
|
| /* floating-point to integer conversion (rounding) */ | | | |
| SKP_INLINE SKP_int32 SKP_float2int(double x) | | | |
| { | | | |
| return (SKP_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 ); | | | |
| } | | | |
| | | | |
| /* integer to floating-point conversion */ | | /* integer to floating-point conversion */ | |
| SKP_INLINE void SKP_short2float_array( | | SKP_INLINE void SKP_short2float_array( | |
| SKP_float *out, | | SKP_float *out, | |
| const SKP_int16 *in, | | const SKP_int16 *in, | |
| SKP_int32 length | | SKP_int32 length | |
| ) | | ) | |
| { | | { | |
| SKP_int32 k; | | SKP_int32 k; | |
| for (k = length-1; k >= 0; k--) { | | for (k = length-1; k >= 0; k--) { | |
| out[k] = (SKP_float)in[k]; | | out[k] = (SKP_float)in[k]; | |
| | | | |
End of changes. 8 change blocks. |
| 56 lines changed or deleted | | 20 lines changed or added | |
|
| SKP_Silk_define.h | | SKP_Silk_define.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 51 | |
| #endif | | #endif | |
| | | | |
| #define MAX_FRAMES_PER_PACKET 3 | | #define MAX_FRAMES_PER_PACKET 3 | |
| | | | |
| #ifndef FIXED_POINT | | #ifndef FIXED_POINT | |
| # define FIXED_POINT 0 | | # define FIXED_POINT 0 | |
| #endif | | #endif | |
| | | | |
| /* Limits on bitrate */ | | /* Limits on bitrate */ | |
| #define MIN_TARGET_RATE_BPS 5000 | | #define MIN_TARGET_RATE_BPS 5000 | |
|
| #define MAX_TARGET_RATE_BPS SKP_uint16_MAX | | #define MAX_TARGET_RATE_BPS 80000 | |
| | | | |
| /* Compensation in bitrate calculations for 10 ms modes */ | | /* Compensation in bitrate calculations for 10 ms modes */ | |
| #define REDUCE_BITRATE_10_MS_BPS 2200 | | #define REDUCE_BITRATE_10_MS_BPS 2200 | |
| | | | |
| /* Transition bitrates between modes */ | | /* Transition bitrates between modes */ | |
| #define WB2MB_BITRATE_BPS 12000 | | #define WB2MB_BITRATE_BPS 12000 | |
| #define MB2WB_BITRATE_BPS 16000 | | #define MB2WB_BITRATE_BPS 16000 | |
| #define MB2NB_BITRATE_BPS 9000 | | #define MB2NB_BITRATE_BPS 9000 | |
| #define NB2MB_BITRATE_BPS 12000 | | #define NB2MB_BITRATE_BPS 12000 | |
| | | | |
| /* Integration/hysteresis threshold for lowering internal sample frequency
*/ | | /* Integration/hysteresis threshold for lowering internal sample frequency
*/ | |
| /* 30000000 -> 6 sec if bitrate is 5000 bps below limit; 3 sec if bitrate i
s 10000 bps below limit */ | | /* 30000000 -> 6 sec if bitrate is 5000 bps below limit; 3 sec if bitrate i
s 10000 bps below limit */ | |
| #define ACCUM_BITS_DIFF_THRESHOLD 30000000 | | #define ACCUM_BITS_DIFF_THRESHOLD 30000000 | |
| #define TARGET_RATE_TAB_SZ 8 | | #define TARGET_RATE_TAB_SZ 8 | |
| | | | |
| /* DTX settings */ | | /* DTX settings */ | |
| #define NO_SPEECH_FRAMES_BEFORE_DTX 5 /* eq 100 ms */ | | #define NO_SPEECH_FRAMES_BEFORE_DTX 5 /* eq 100 ms */ | |
| #define MAX_CONSECUTIVE_DTX 20 /* eq 400 ms */ | | #define MAX_CONSECUTIVE_DTX 20 /* eq 400 ms */ | |
| | | | |
|
| #define USE_LBRR 0 | | /* LBRR thresholds */ | |
| | | #define LBRR_NB_MIN_RATE_BPS 9000 | |
| /* Amount of concecutive no FEC packets before telling JB */ | | #define LBRR_MB_MIN_RATE_BPS 12000 | |
| #define NO_LBRR_THRES 10 | | #define LBRR_WB_MIN_RATE_BPS 15000 | |
| | | | |
| /* Maximum delay between real packet and LBRR packet */ | | | |
| #define MAX_LBRR_DELAY 2 | | | |
| #define LBRR_IDX_MASK 1 | | | |
| | | | |
| #define INBAND_FEC_MIN_RATE_BPS 18000 /* Dont use inband F | | | |
| EC below this total target rate */ | | | |
| #define LBRR_LOSS_THRES 2 /* Start adding LBRR at | | | |
| this loss rate (needs tuning) */ | | | |
| | | | |
| /* Frame termination indicator defines */ | | | |
| #define SKP_SILK_NO_LBRR 0 | | | |
| #define SKP_SILK_LBRR 1 | | | |
| | | | |
| /* Activate bandwidth transition filtering for mode switching */ | | /* Activate bandwidth transition filtering for mode switching */ | |
| #define SWITCH_TRANSITION_FILTERING 1 | | #define SWITCH_TRANSITION_FILTERING 1 | |
| | | | |
| /* Decoder Parameters */ | | /* Decoder Parameters */ | |
| #define DEC_HP_ORDER 2 | | #define DEC_HP_ORDER 2 | |
| | | | |
| /* Maximum sampling frequency, should be 16 for embedded */ | | /* Maximum sampling frequency, should be 16 for embedded */ | |
| #define MAX_FS_KHZ 16 | | #define MAX_FS_KHZ 16 | |
| #define MAX_API_FS_KHZ 48 | | #define MAX_API_FS_KHZ 48 | |
| | | | |
| /* Signal types used by silk */ | | /* Signal types used by silk */ | |
| #define TYPE_NO_VOICE_ACTIVITY 0 | | #define TYPE_NO_VOICE_ACTIVITY 0 | |
| #define TYPE_UNVOICED 1 | | #define TYPE_UNVOICED 1 | |
| #define TYPE_VOICED 2 | | #define TYPE_VOICED 2 | |
| | | | |
|
| /* VAD Types used by silk */ | | | |
| #define NO_VOICE_ACTIVITY 0 | | | |
| #define VOICE_ACTIVITY 1 | | | |
| | | | |
| /* Number of subframes */ | | /* Number of subframes */ | |
| #define MAX_NB_SUBFR 4 | | #define MAX_NB_SUBFR 4 | |
| | | | |
| /* Number of samples per frame */ | | /* Number of samples per frame */ | |
| #define LTP_MEM_LENGTH_MS 20 | | #define LTP_MEM_LENGTH_MS 20 | |
| #define SUB_FRAME_LENGTH_MS 5 | | #define SUB_FRAME_LENGTH_MS 5 | |
| #define MAX_SUB_FRAME_LENGTH ( SUB_FRAME_LENGTH_MS * MAX
_FS_KHZ ) | | #define MAX_SUB_FRAME_LENGTH ( SUB_FRAME_LENGTH_MS * MAX
_FS_KHZ ) | |
| #define MAX_FRAME_LENGTH_MS ( SUB_FRAME_LENGTH_MS * MAX
_NB_SUBFR ) | | #define MAX_FRAME_LENGTH_MS ( SUB_FRAME_LENGTH_MS * MAX
_NB_SUBFR ) | |
| #define MAX_FRAME_LENGTH ( MAX_FRAME_LENGTH_MS * MAX
_FS_KHZ ) | | #define MAX_FRAME_LENGTH ( MAX_FRAME_LENGTH_MS * MAX
_FS_KHZ ) | |
| | | | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 120 | |
| #define FIND_PITCH_LPC_WIN_MS_2_SF ( 10 + (LA_PITCH_MS << 1) ) | | #define FIND_PITCH_LPC_WIN_MS_2_SF ( 10 + (LA_PITCH_MS << 1) ) | |
| #define FIND_PITCH_LPC_WIN_MAX ( FIND_PITCH_LPC_WIN_MS * M
AX_FS_KHZ ) | | #define FIND_PITCH_LPC_WIN_MAX ( FIND_PITCH_LPC_WIN_MS * M
AX_FS_KHZ ) | |
| | | | |
| /* Milliseconds of lookahead for noise shape analysis */ | | /* Milliseconds of lookahead for noise shape analysis */ | |
| #define LA_SHAPE_MS 5 | | #define LA_SHAPE_MS 5 | |
| #define LA_SHAPE_MAX ( LA_SHAPE_MS * MAX_FS_KHZ
) | | #define LA_SHAPE_MAX ( LA_SHAPE_MS * MAX_FS_KHZ
) | |
| | | | |
| /* Maximum length of LPC window used in noise shape analysis */ | | /* Maximum length of LPC window used in noise shape analysis */ | |
| #define SHAPE_LPC_WIN_MAX ( 15 * MAX_FS_KHZ ) | | #define SHAPE_LPC_WIN_MAX ( 15 * MAX_FS_KHZ ) | |
| | | | |
|
| /* Max number of bytes in payload output buffer (may contain multiple frame | | | |
| s) */ | | | |
| #define MAX_ARITHM_BYTES 1024 | | | |
| | | | |
| /* dB level of lowest gain quantization level */ | | /* dB level of lowest gain quantization level */ | |
| #define MIN_QGAIN_DB 2 | | #define MIN_QGAIN_DB 2 | |
| /* dB level of highest gain quantization level */ | | /* dB level of highest gain quantization level */ | |
| #define MAX_QGAIN_DB 88 | | #define MAX_QGAIN_DB 88 | |
| /* Number of gain quantization levels */ | | /* Number of gain quantization levels */ | |
| #define N_LEVELS_QGAIN 64 | | #define N_LEVELS_QGAIN 64 | |
| /* Max increase in gain quantization index */ | | /* Max increase in gain quantization index */ | |
| #define MAX_DELTA_GAIN_QUANT 36 | | #define MAX_DELTA_GAIN_QUANT 36 | |
| /* Max decrease in gain quantization index */ | | /* Max decrease in gain quantization index */ | |
| #define MIN_DELTA_GAIN_QUANT -4 | | #define MIN_DELTA_GAIN_QUANT -4 | |
| | | | |
End of changes. 5 change blocks. |
| 27 lines changed or deleted | | 6 lines changed or added | |
|
| SKP_Silk_main.h | | SKP_Silk_main.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| #include "entdec.h" | | #include "entdec.h" | |
| | | | |
| /* Uncomment the next line to store intermadiate data to files */ | | /* Uncomment the next line to store intermadiate data to files */ | |
| //#define SAVE_ALL_INTERNAL_DATA 1 | | //#define SAVE_ALL_INTERNAL_DATA 1 | |
| /* Uncomment the next line to force a fixed internal sampling rate (indepen
dent of what bitrate is used */ | | /* Uncomment the next line to force a fixed internal sampling rate (indepen
dent of what bitrate is used */ | |
| //#define FORCE_INTERNAL_FS_KHZ 16 | | //#define FORCE_INTERNAL_FS_KHZ 16 | |
| | | | |
| /* Encodes signs of excitation */ | | /* Encodes signs of excitation */ | |
| void SKP_Silk_encode_signs( | | void SKP_Silk_encode_signs( | |
| ec_enc *psRangeEnc, /* I/O
Compressor data structure */ | | ec_enc *psRangeEnc, /* I/O
Compressor data structure */ | |
|
| const SKP_int8 q[], /* I
pulse signal */ | | const SKP_int8 pulses[], /* I
pulse signal */ | |
| SKP_int length, /* I
length of input */ | | SKP_int length, /* I
length of input */ | |
| const SKP_int signalType, /* I
Signal type */ | | const SKP_int signalType, /* I
Signal type */ | |
| const SKP_int quantOffsetType, /* I
Quantization offset type */ | | const SKP_int quantOffsetType, /* I
Quantization offset type */ | |
| const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I
Sum of absolute pulses per block */ | | const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I
Sum of absolute pulses per block */ | |
| ); | | ); | |
| | | | |
| /* Decodes signs of excitation */ | | /* Decodes signs of excitation */ | |
| void SKP_Silk_decode_signs( | | void SKP_Silk_decode_signs( | |
| ec_dec *psRangeDec, /* I/O
Compressor data structure */ | | ec_dec *psRangeDec, /* I/O
Compressor data structure */ | |
|
| SKP_int q[], /* I/O
pulse signal */ | | SKP_int pulses[], /* I/O
pulse signal */ | |
| SKP_int length, /* I
length of input */ | | SKP_int length, /* I
length of input */ | |
| const SKP_int signalType, /* I
Signal type */ | | const SKP_int signalType, /* I
Signal type */ | |
| const SKP_int quantOffsetType, /* I
Quantization offset type */ | | const SKP_int quantOffsetType, /* I
Quantization offset type */ | |
| const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I
Sum of absolute pulses per block */ | | const SKP_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I
Sum of absolute pulses per block */ | |
| ); | | ); | |
| | | | |
| /* Control internal sampling rate */ | | /* Control internal sampling rate */ | |
| SKP_int SKP_Silk_control_audio_bandwidth( | | SKP_int SKP_Silk_control_audio_bandwidth( | |
| SKP_Silk_encoder_state *psEncC, /* I/O Pointer to Silk
encoder state */ | | SKP_Silk_encoder_state *psEncC, /* I/O Pointer to Silk
encoder state */ | |
| SKP_int32 TargetRate_bps /* I Target max bitr
ate (bps) */ | | SKP_int32 TargetRate_bps /* I Target max bitr
ate (bps) */ | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| | | | |
| /***************/ | | /***************/ | |
| /* Shell coder */ | | /* Shell coder */ | |
| /***************/ | | /***************/ | |
| | | | |
| /* Encode quantization indices of excitation */ | | /* Encode quantization indices of excitation */ | |
| void SKP_Silk_encode_pulses( | | void SKP_Silk_encode_pulses( | |
| ec_enc *psRangeEnc, /* I/O compressor data
structure */ | | ec_enc *psRangeEnc, /* I/O compressor data
structure */ | |
| const SKP_int signalType, /* I Signal type
*/ | | const SKP_int signalType, /* I Signal type
*/ | |
| const SKP_int quantOffsetType, /* I quantOffsetType
*/ | | const SKP_int quantOffsetType, /* I quantOffsetType
*/ | |
|
| SKP_int8 q[], /* I quantization in
dices */ | | SKP_int8 pulses[], /* I quantization in
dices */ | |
| const SKP_int frame_length /* I Frame length
*/ | | const SKP_int frame_length /* I Frame length
*/ | |
| ); | | ); | |
| | | | |
| /* Shell encoder, operates on one shell code frame of 16 pulses */ | | /* Shell encoder, operates on one shell code frame of 16 pulses */ | |
| void SKP_Silk_shell_encoder( | | void SKP_Silk_shell_encoder( | |
| ec_enc *psRangeEnc, /* I/O compressor data
structure */ | | ec_enc *psRangeEnc, /* I/O compressor data
structure */ | |
| const SKP_int *pulses0 /* I data: nonnegati
ve pulse amplitudes */ | | const SKP_int *pulses0 /* I data: nonnegati
ve pulse amplitudes */ | |
| ); | | ); | |
| | | | |
| /* Shell decoder, operates on one shell code frame of 16 pulses */ | | /* Shell decoder, operates on one shell code frame of 16 pulses */ | |
| void SKP_Silk_shell_decoder( | | void SKP_Silk_shell_decoder( | |
| SKP_int *pulses0, /* O data: nonnegati
ve pulse amplitudes */ | | SKP_int *pulses0, /* O data: nonnegati
ve pulse amplitudes */ | |
| ec_dec *psRangeDec, /* I/O Compressor data
structure */ | | ec_dec *psRangeDec, /* I/O Compressor data
structure */ | |
| const SKP_int pulses4 /* I number of pulse
s per pulse-subframe */ | | const SKP_int pulses4 /* I number of pulse
s per pulse-subframe */ | |
| ); | | ); | |
| | | | |
| /* Gain scalar quantization with hysteresis, uniform on log scale */ | | /* Gain scalar quantization with hysteresis, uniform on log scale */ | |
| void SKP_Silk_gains_quant( | | void SKP_Silk_gains_quant( | |
|
| SKP_int ind[ MAX_NB_SUBFR ], /* O gai
n indices */ | | SKP_int8 ind[ MAX_NB_SUBFR ], /* O gai
n indices */ | |
| SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gai
ns (quantized out) */ | | SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gai
ns (quantized out) */ | |
|
| SKP_int *prev_ind, /* I/O las
t index in previous frame */ | | SKP_int8 *prev_ind, /* I/O las
t index in previous frame */ | |
| const SKP_int conditional, /* I fir
st gain is delta coded if 1 */ | | const SKP_int conditional, /* I fir
st gain is delta coded if 1 */ | |
| const SKP_int nb_subfr /* I num
ber of subframes */ | | const SKP_int nb_subfr /* I num
ber of subframes */ | |
| ); | | ); | |
| | | | |
| /* Gains scalar dequantization, uniform on log scale */ | | /* Gains scalar dequantization, uniform on log scale */ | |
| void SKP_Silk_gains_dequant( | | void SKP_Silk_gains_dequant( | |
| SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* O qua
ntized gains */ | | SKP_int32 gain_Q16[ MAX_NB_SUBFR ], /* O qua
ntized gains */ | |
|
| const SKP_int ind[ MAX_NB_SUBFR ], /* I gai | | const SKP_int8 ind[ MAX_NB_SUBFR ], /* I gai | |
| n indices */ | | n indices */ | |
| SKP_int *prev_ind, /* I/O las | | SKP_int8 *prev_ind, /* I/O las | |
| t index in previous frame */ | | t index in previous frame */ | |
| const SKP_int conditional, /* I fir
st gain is delta coded if 1 */ | | const SKP_int conditional, /* I fir
st gain is delta coded if 1 */ | |
| const SKP_int nb_subfr /* I num
ber of subframes */ | | const SKP_int nb_subfr /* I num
ber of subframes */ | |
| ); | | ); | |
| | | | |
| /* Convert NLSF parameters to stable AR prediction filter coefficients */ | | /* Convert NLSF parameters to stable AR prediction filter coefficients */ | |
| void SKP_Silk_NLSF2A_stable( | | void SKP_Silk_NLSF2A_stable( | |
| SKP_int16 pAR_Q12[ MAX_LPC_ORDER ], /* O Stabili
zed AR coefs [LPC_order] */ | | SKP_int16 pAR_Q12[ MAX_LPC_ORDER ], /* O Stabili
zed AR coefs [LPC_order] */ | |
| const SKP_int pNLSF[ MAX_LPC_ORDER ], /* I NLSF ve
ctor [LPC_order] */ | | const SKP_int pNLSF[ MAX_LPC_ORDER ], /* I NLSF ve
ctor [LPC_order] */ | |
| const SKP_int LPC_order /* I LPC/LSF
order */ | | const SKP_int LPC_order /* I LPC/LSF
order */ | |
| ); | | ); | |
| | | | |
| skipping to change at line 139 | | skipping to change at line 139 | |
| SKP_int xi[ MAX_LPC_ORDER ], /* O interpolate
d vector */ | | SKP_int xi[ MAX_LPC_ORDER ], /* O interpolate
d vector */ | |
| const SKP_int x0[ MAX_LPC_ORDER ], /* I first vecto
r */ | | const SKP_int x0[ MAX_LPC_ORDER ], /* I first vecto
r */ | |
| const SKP_int x1[ MAX_LPC_ORDER ], /* I second vect
or */ | | const SKP_int x1[ MAX_LPC_ORDER ], /* I second vect
or */ | |
| const SKP_int ifact_Q2, /* I interp. fac
tor, weight on 2nd vector */ | | const SKP_int ifact_Q2, /* I interp. fac
tor, weight on 2nd vector */ | |
| const SKP_int d /* I number of p
arameters */ | | const SKP_int d /* I number of p
arameters */ | |
| ); | | ); | |
| | | | |
| /* LTP tap quantizer */ | | /* LTP tap quantizer */ | |
| void SKP_Silk_quant_LTP_gains( | | void SKP_Silk_quant_LTP_gains( | |
| SKP_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /*
I/O (un)quantized LTP gains */ | | SKP_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /*
I/O (un)quantized LTP gains */ | |
|
| SKP_int cbk_index[ MAX_NB_SUBFR ], /* | | SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* | |
| O Codebook Index */ | | O Codebook Index */ | |
| SKP_int *periodicity_index, /* | | SKP_int8 *periodicity_index, /* | |
| O Periodicity Index */ | | O Periodicity Index */ | |
| const SKP_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /*
I Error Weights in Q18 */ | | const SKP_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /*
I Error Weights in Q18 */ | |
| SKP_int mu_Q9, /*
I Mu value (R/D tradeoff) */ | | SKP_int mu_Q9, /*
I Mu value (R/D tradeoff) */ | |
| SKP_int lowComplexity, /*
I Flag for low complexity */ | | SKP_int lowComplexity, /*
I Flag for low complexity */ | |
| const SKP_int nb_subfr /*
I number of subframes */ | | const SKP_int nb_subfr /*
I number of subframes */ | |
| ); | | ); | |
| | | | |
| /* Entropy constrained matrix-weighted VQ, for a single input data vector *
/ | | /* Entropy constrained matrix-weighted VQ, for a single input data vector *
/ | |
| void SKP_Silk_VQ_WMat_EC( | | void SKP_Silk_VQ_WMat_EC( | |
|
| SKP_int *ind, /* O index of be
st codebook vector */ | | SKP_int8 *ind, /* O index of be
st codebook vector */ | |
| SKP_int32 *rate_dist_Q14, /* O best weight
ed quantization error + mu * rate*/ | | SKP_int32 *rate_dist_Q14, /* O best weight
ed quantization error + mu * rate*/ | |
| const SKP_int16 *in_Q14, /* I input vecto
r to be quantized */ | | const SKP_int16 *in_Q14, /* I input vecto
r to be quantized */ | |
| const SKP_int32 *W_Q18, /* I weighting m
atrix */ | | const SKP_int32 *W_Q18, /* I weighting m
atrix */ | |
| const SKP_int8 *cb_Q7, /* I codebook
*/ | | const SKP_int8 *cb_Q7, /* I codebook
*/ | |
| const SKP_uint8 *cl_Q5, /* I code length
for each codebook vector */ | | const SKP_uint8 *cl_Q5, /* I code length
for each codebook vector */ | |
| const SKP_int mu_Q9, /* I tradeoff be
tween weighted error and rate */ | | const SKP_int mu_Q9, /* I tradeoff be
tween weighted error and rate */ | |
| SKP_int L /* I number of v
ectors in codebook */ | | SKP_int L /* I number of v
ectors in codebook */ | |
| ); | | ); | |
| | | | |
| /***********************************/ | | /***********************************/ | |
| /* Noise shaping quantization (NSQ)*/ | | /* Noise shaping quantization (NSQ)*/ | |
| /***********************************/ | | /***********************************/ | |
| void SKP_Silk_NSQ( | | void SKP_Silk_NSQ( | |
|
| SKP_Silk_encoder_state *psEncC, | | const SKP_Silk_encoder_state *psEncC, | |
| /* I/O Encoder State */ | | /* I/O Encoder State */ | |
| SKP_Silk_encoder_control *psEncCtrlC, | | | |
| /* I Encoder Control */ | | | |
| SKP_Silk_nsq_state *NSQ,
/* I/O NSQ state */ | | SKP_Silk_nsq_state *NSQ,
/* I/O NSQ state */ | |
|
| | | SideInfoIndices *psIndices,
/* I/O Quantization Indices */ | |
| const SKP_int16 x[],
/* I prefiltered input signal */ | | const SKP_int16 x[],
/* I prefiltered input signal */ | |
|
| SKP_int8 q[], | | SKP_int8 pulses[], | |
| /* O quantized qulse signal */ | | /* O quantized qulse signal */ | |
| const SKP_int LSFInterpFactor_Q2, | | | |
| /* I LSF interpolation factor in Q2 */ | | | |
| const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
/* I Short term prediction coefficients */ | | const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
/* I Short term prediction coefficients */ | |
|
| const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ] | | const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ] | |
| , /* I Long term prediction coefficients */ | | , /* I Long term prediction coefficients */ | |
| const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_O | | const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_O | |
| RDER ], /* I */ | | RDER ], /* I */ | |
| const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], | | const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], | | const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], | |
| /* I Spectral tilt */ | | /* I Spectral tilt */ | |
| const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], | | const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], | | const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| | | const SKP_int pitchL[ MAX_NB_SUBFR ], | |
| | | /* I */ | |
| const SKP_int Lambda_Q10,
/* I */ | | const SKP_int Lambda_Q10,
/* I */ | |
| const SKP_int LTP_scale_Q14
/* I LTP state scaling */ | | const SKP_int LTP_scale_Q14
/* I LTP state scaling */ | |
| ); | | ); | |
| | | | |
| /* Noise shaping using delayed decision */ | | /* Noise shaping using delayed decision */ | |
| void SKP_Silk_NSQ_del_dec( | | void SKP_Silk_NSQ_del_dec( | |
|
| SKP_Silk_encoder_state *psEncC, | | const SKP_Silk_encoder_state *psEncC, | |
| /* I/O Encoder State */ | | /* I/O Encoder State */ | |
| SKP_Silk_encoder_control *psEncCtrlC, | | | |
| /* I Encoder Control */ | | | |
| SKP_Silk_nsq_state *NSQ,
/* I/O NSQ state */ | | SKP_Silk_nsq_state *NSQ,
/* I/O NSQ state */ | |
|
| | | SideInfoIndices *psIndices,
/* I/O Quantization Indices */ | |
| const SKP_int16 x[],
/* I Prefiltered input signal */ | | const SKP_int16 x[],
/* I Prefiltered input signal */ | |
|
| SKP_int8 q[], | | SKP_int8 pulses[], | |
| /* O Quantized pulse signal */ | | /* O Quantized pulse signal */ | |
| const SKP_int LSFInterpFactor_Q2, | | | |
| /* I LSF interpolation factor in Q2 */ | | | |
| const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
/* I Prediction coefs */ | | const SKP_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
/* I Prediction coefs */ | |
|
| const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ] | | const SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ] | |
| , /* I LT prediction coefs */ | | , /* I LT prediction coefs */ | |
| const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_O | | const SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_O | |
| RDER ], /* I */ | | RDER ], /* I */ | |
| const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], | | const SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], | | const SKP_int Tilt_Q14[ MAX_NB_SUBFR ], | |
| /* I Spectral tilt */ | | /* I Spectral tilt */ | |
| const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], | | const SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], | | const SKP_int32 Gains_Q16[ MAX_NB_SUBFR ], | |
| /* I */ | | /* I */ | |
| | | const SKP_int pitchL[ MAX_NB_SUBFR ], | |
| | | /* I */ | |
| const SKP_int Lambda_Q10,
/* I */ | | const SKP_int Lambda_Q10,
/* I */ | |
| const SKP_int LTP_scale_Q14
/* I LTP state scaling */ | | const SKP_int LTP_scale_Q14
/* I LTP state scaling */ | |
| ); | | ); | |
| | | | |
| /************/ | | /************/ | |
| /* Silk VAD */ | | /* Silk VAD */ | |
| /************/ | | /************/ | |
| /* Initialize the Silk VAD */ | | /* Initialize the Silk VAD */ | |
| SKP_int SKP_Silk_VAD_Init( /* O Return value, 0
if success */ | | SKP_int SKP_Silk_VAD_Init( /* O Return value, 0
if success */ | |
| SKP_Silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk
VAD state */ | | SKP_Silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk
VAD state */ | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 231 | |
| const SKP_int framelength, /* I Inp
ut frame length */ | | const SKP_int framelength, /* I Inp
ut frame length */ | |
| const SKP_int fs_kHz /* I Inp
ut frame sample frequency */ | | const SKP_int fs_kHz /* I Inp
ut frame sample frequency */ | |
| ); | | ); | |
| | | | |
| #if SWITCH_TRANSITION_FILTERING | | #if SWITCH_TRANSITION_FILTERING | |
| /* Low-pass filter with variable cutoff frequency based on */ | | /* Low-pass filter with variable cutoff frequency based on */ | |
| /* piece-wise linear interpolation between elliptic filters */ | | /* piece-wise linear interpolation between elliptic filters */ | |
| /* Start by setting transition_frame_no = 1; */ | | /* Start by setting transition_frame_no = 1; */ | |
| void SKP_Silk_LP_variable_cutoff( | | void SKP_Silk_LP_variable_cutoff( | |
| SKP_Silk_LP_state *psLP, /* I/O LP filter state
*/ | | SKP_Silk_LP_state *psLP, /* I/O LP filter state
*/ | |
|
| SKP_int16 *out, /* O Low-pass filter | | SKP_int16 *signal, /* I/O Low-pass filter | |
| ed output signal */ | | ed output signal */ | |
| const SKP_int16 *in, /* I Input signal | | | |
| */ | | | |
| const SKP_int frame_length /* I Frame length
*/ | | const SKP_int frame_length /* I Frame length
*/ | |
| ); | | ); | |
| #endif | | #endif | |
| | | | |
|
| | | /* Encode LBRR side info and excitation */ | |
| | | void SKP_Silk_LBRR_embed( | |
| | | SKP_Silk_encoder_state *psEncC, /* I/O Encoder state | |
| | | */ | |
| | | ec_enc *psRangeEnc /* I/O Compressor data | |
| | | structure */ | |
| | | ); | |
| | | | |
| /****************************************************/ | | /****************************************************/ | |
| /* Decoder Functions */ | | /* Decoder Functions */ | |
| /****************************************************/ | | /****************************************************/ | |
| SKP_int SKP_Silk_create_decoder( | | SKP_int SKP_Silk_create_decoder( | |
| SKP_Silk_decoder_state **ppsDec /* I/O Decoder state p
ointer pointer */ | | SKP_Silk_decoder_state **ppsDec /* I/O Decoder state p
ointer pointer */ | |
| ); | | ); | |
| | | | |
| SKP_int SKP_Silk_free_decoder( | | SKP_int SKP_Silk_free_decoder( | |
| SKP_Silk_decoder_state *psDec /* I/O Decoder state p
ointer */ | | SKP_Silk_decoder_state *psDec /* I/O Decoder state p
ointer */ | |
| ); | | ); | |
| | | | |
| skipping to change at line 267 | | skipping to change at line 272 | |
| | | | |
| /****************/ | | /****************/ | |
| /* Decode frame */ | | /* Decode frame */ | |
| /****************/ | | /****************/ | |
| SKP_int SKP_Silk_decode_frame( | | SKP_int SKP_Silk_decode_frame( | |
| SKP_Silk_decoder_state *psDec, /* I/O Pointer to Silk
decoder state */ | | SKP_Silk_decoder_state *psDec, /* I/O Pointer to Silk
decoder state */ | |
| ec_dec *psRangeDec, /* I/O Compressor data
structure */ | | ec_dec *psRangeDec, /* I/O Compressor data
structure */ | |
| SKP_int16 pOut[], /* O Pointer to outp
ut speech frame */ | | SKP_int16 pOut[], /* O Pointer to outp
ut speech frame */ | |
| SKP_int32 *pN, /* O Pointer to size
of output frame */ | | SKP_int32 *pN, /* O Pointer to size
of output frame */ | |
| const SKP_int nBytes, /* I Payload length
*/ | | const SKP_int nBytes, /* I Payload length
*/ | |
|
| SKP_int action, /* I Action from Jit | | SKP_int lostFlag /* I 0: no loss, 1 l | |
| ter Buffer */ | | oss, 2 decode fec */ | |
| SKP_int *decBytes /* O Used bytes to d | | ); | |
| ecode this frame */ | | | |
| | | /* Decode LBRR side info and excitation */ | |
| | | void SKP_Silk_LBRR_extract( | |
| | | SKP_Silk_decoder_state *psDec, /* I/O State | |
| | | */ | |
| | | ec_dec *psRangeDec /* I/O Compressor data | |
| | | structure */ | |
| ); | | ); | |
| | | | |
| /* Decode indices from payload v4 Bitstream */ | | /* Decode indices from payload v4 Bitstream */ | |
| void SKP_Silk_decode_indices( | | void SKP_Silk_decode_indices( | |
| SKP_Silk_decoder_state *psDec, /* I/O State
*/ | | SKP_Silk_decoder_state *psDec, /* I/O State
*/ | |
|
| ec_dec *psRangeDec /* I/O Compressor data | | ec_dec *psRangeDec, /* I/O Compressor data | |
| structure */ | | structure */ | |
| | | SKP_int FrameIndex, /* I Frame number | |
| | | */ | |
| | | SKP_int decode_LBRR /* I Flag indicating | |
| | | LBRR data is being decoded */ | |
| ); | | ); | |
| | | | |
| /* Decode parameters from payload v4 Bitstream */ | | /* Decode parameters from payload v4 Bitstream */ | |
| void SKP_Silk_decode_parameters( | | void SKP_Silk_decode_parameters( | |
| SKP_Silk_decoder_state *psDec, /* I/O
State */ | | SKP_Silk_decoder_state *psDec, /* I/O
State */ | |
|
| SKP_Silk_decoder_control *psDecCtrl, /* I/O | | SKP_Silk_decoder_control *psDecCtrl /* I/O | |
| Decoder control */ | | Decoder control */ | |
| ec_dec *psRangeDec, /* I/O | | | |
| Compressor data structure */ | | | |
| SKP_int q[ MAX_FRAME_LENGTH ] /* O | | | |
| Excitation signal */ | | | |
| ); | | ); | |
| | | | |
| /* Core decoder. Performs inverse NSQ operation LTP + LPC */ | | /* Core decoder. Performs inverse NSQ operation LTP + LPC */ | |
| void SKP_Silk_decode_core( | | void SKP_Silk_decode_core( | |
| SKP_Silk_decoder_state *psDec, /* I/O
Decoder state */ | | SKP_Silk_decoder_state *psDec, /* I/O
Decoder state */ | |
| SKP_Silk_decoder_control *psDecCtrl, /* I
Decoder control */ | | SKP_Silk_decoder_control *psDecCtrl, /* I
Decoder control */ | |
| SKP_int16 xq[], /* O
Decoded speech */ | | SKP_int16 xq[], /* O
Decoded speech */ | |
|
| const SKP_int q[ MAX_FRAME_LENGTH ] /* I
Pulse signal */ | | const SKP_int pulses[ MAX_FRAME_LENGTH ] /* I
Pulse signal */ | |
| ); | | ); | |
| | | | |
| /* NLSF vector decoder */ | | /* NLSF vector decoder */ | |
| void SKP_Silk_NLSF_MSVQ_decode( | | void SKP_Silk_NLSF_MSVQ_decode( | |
| SKP_int *pNLSF_Q15, /* O Pointer to deco
ded output [LPC_ORDER x 1] */ | | SKP_int *pNLSF_Q15, /* O Pointer to deco
ded output [LPC_ORDER x 1] */ | |
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Pointer to NLSF
codebook struct */ | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Pointer to NLSF
codebook struct */ | |
|
| const SKP_int *NLSFIndices, /* I Pointer to NLSF
indices [nStages x 1] */ | | const SKP_int8 *NLSFIndices, /* I Pointer to NLSF
indices [nStages x 1] */ | |
| const SKP_int LPC_order /* I LPC order
*/ | | const SKP_int LPC_order /* I LPC order
*/ | |
| ); | | ); | |
| | | | |
|
| /**********************/ | | | |
| /* Arithmetic coding */ | | | |
| /*********************/ | | | |
| | | | |
| /* Decode quantization indices of excitation (Shell coding) */ | | /* Decode quantization indices of excitation (Shell coding) */ | |
| void SKP_Silk_decode_pulses( | | void SKP_Silk_decode_pulses( | |
|
| ec_dec *psRangeDec, /* I/O Compressor data | | ec_dec *psRangeDec, /* I/O Compressor | |
| structure */ | | data structure */ | |
| SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control | | SKP_int pulses[], /* O Excitation | |
| */ | | signal */ | |
| SKP_int q[], /* O Excitation sign | | const SKP_int signalType, /* I Sigtype | |
| al */ | | */ | |
| const SKP_int frame_length /* I Frame length (p | | const SKP_int quantOffsetType, /* I quantOffset | |
| reliminary) */ | | Type */ | |
| | | const SKP_int frame_length /* I Frame lengt | |
| | | h */ | |
| ); | | ); | |
| | | | |
| /******************/ | | /******************/ | |
| /* CNG */ | | /* CNG */ | |
| /******************/ | | /******************/ | |
| | | | |
| /* Reset CNG */ | | /* Reset CNG */ | |
| void SKP_Silk_CNG_Reset( | | void SKP_Silk_CNG_Reset( | |
| SKP_Silk_decoder_state *psDec /* I/O Decoder state
*/ | | SKP_Silk_decoder_state *psDec /* I/O Decoder state
*/ | |
| ); | | ); | |
| | | | |
| skipping to change at line 333 | | skipping to change at line 340 | |
| void SKP_Silk_CNG( | | void SKP_Silk_CNG( | |
| SKP_Silk_decoder_state *psDec, /* I/O Decoder state
*/ | | SKP_Silk_decoder_state *psDec, /* I/O Decoder state
*/ | |
| SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control
*/ | | SKP_Silk_decoder_control *psDecCtrl, /* I/O Decoder control
*/ | |
| SKP_int16 signal[], /* I/O Signal
*/ | | SKP_int16 signal[], /* I/O Signal
*/ | |
| SKP_int length /* I Length of resid
ual */ | | SKP_int length /* I Length of resid
ual */ | |
| ); | | ); | |
| | | | |
| /* Encoding of various parameters */ | | /* Encoding of various parameters */ | |
| void SKP_Silk_encode_indices( | | void SKP_Silk_encode_indices( | |
| SKP_Silk_encoder_state *psEncC, /* I/O Encoder state
*/ | | SKP_Silk_encoder_state *psEncC, /* I/O Encoder state
*/ | |
|
| SKP_Silk_encoder_control *psEncCtrlC, /* I/O Encoder control | | ec_enc *psRangeEnc, /* I/O Compressor data | |
| */ | | structure */ | |
| ec_enc *psRangeEnc /* I/O Compressor data | | SKP_int FrameIndex, /* I Frame number | |
| structure */ | | */ | |
| ); | | SKP_int encode_LBRR /* I Flag indicating | |
| | | LBRR data is being encoded */ | |
| /* Extract lowest layer encoding */ | | | |
| void SKP_Silk_get_low_layer_internal( | | | |
| const SKP_uint8 *indata, /* I: Encoded input v | | | |
| ector */ | | | |
| const SKP_int16 nBytesIn, /* I: Number of input | | | |
| Bytes */ | | | |
| SKP_uint8 *Layer0data, /* O: Layer0 payload | | | |
| */ | | | |
| SKP_int32 *nLayer0Bytes /* O: Number of FEC B | | | |
| ytes */ | | | |
| ); | | | |
| | | | |
| /* Predict number of bytes used to encode q */ | | | |
| SKP_int SKP_Silk_pulses_to_bytes( /* O Return value, predicted number of b | | | |
| ytes used to encode q */ | | | |
| SKP_Silk_encoder_state *psEncC, /* I/O Encoder State*/ | | | |
| SKP_int8 q[] /* I Pulse signal * | | | |
| / | | | |
| ); | | ); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 27 change blocks. |
| 109 lines changed or deleted | | 99 lines changed or added | |
|
| SKP_Silk_main_FIX.h | | SKP_Silk_main_FIX.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| void SKP_Silk_HP_variable_cutoff_FIX( | | void SKP_Silk_HP_variable_cutoff_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O Encoder state
*/ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O Encoder state
*/ | |
| SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control
*/ | | SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O Encoder control
*/ | |
| SKP_int16 *out, /* O high-pass filte
red output signal */ | | SKP_int16 *out, /* O high-pass filte
red output signal */ | |
| const SKP_int16 *in /* I input signal
*/ | | const SKP_int16 *in /* I input signal
*/ | |
| ); | | ); | |
| | | | |
| /* Encoder main function */ | | /* Encoder main function */ | |
| SKP_int SKP_Silk_encode_frame_FIX( | | SKP_int SKP_Silk_encode_frame_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to
Silk FIX encoder state */ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to
Silk FIX encoder state */ | |
|
| SKP_int32 *pnBytesOut, /* I/O Pointer to | | SKP_int32 *pnBytesOut, /* O Pointer to | |
| number of payload bytes; */ | | number of payload bytes; */ | |
| /* input: max | | ec_enc *psRangeEnc /* I/O compressor | |
| length; output: used */ | | data structure */ | |
| ec_enc *psRangeEnc, /* I/O compressor | | | |
| data structure */ | | | |
| const SKP_int16 *pIn /* I Pointer to | | | |
| input speech frame */ | | | |
| ); | | ); | |
| | | | |
| /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode
with lower bitrate */ | | /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode
with lower bitrate */ | |
| void SKP_Silk_LBRR_encode_FIX( | | void SKP_Silk_LBRR_encode_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk
FIX encoder state */ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk
FIX encoder state */ | |
| SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk
FIX encoder control struct */ | | SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O Pointer to Silk
FIX encoder control struct */ | |
|
| SKP_uint8 *pCode, /* O Pointer to payl | | const SKP_int16 xfw[] /* I Input signal | |
| oad */ | | */ | |
| SKP_int32 *pnBytesOut, /* I/O Pointer to numb | | | |
| er of payload bytes */ | | | |
| SKP_int16 xfw[] /* I Input signal | | | |
| */ | | | |
| ); | | ); | |
| | | | |
| /* Initializes the Silk encoder state */ | | /* Initializes the Silk encoder state */ | |
| SKP_int SKP_Silk_init_encoder_FIX( | | SKP_int SKP_Silk_init_encoder_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk
FIX encoder state */ | | SKP_Silk_encoder_state_FIX *psEnc /* I/O Pointer to Silk
FIX encoder state */ | |
| ); | | ); | |
| | | | |
| /* Control the Silk encoder */ | | /* Control the Silk encoder */ | |
| SKP_int SKP_Silk_control_encoder_FIX( | | SKP_int SKP_Silk_control_encoder_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to
Silk encoder state */ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O Pointer to
Silk encoder state */ | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 144 | |
| void SKP_Silk_find_pred_coefs_FIX( | | void SKP_Silk_find_pred_coefs_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O encoder state
*/ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O encoder state
*/ | |
| SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control
*/ | | SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control
*/ | |
| const SKP_int16 res_pitch[], /* I Residual from p
itch analysis */ | | const SKP_int16 res_pitch[], /* I Residual from p
itch analysis */ | |
| const SKP_int16 x[] /* I Speech signal
*/ | | const SKP_int16 x[] /* I Speech signal
*/ | |
| ); | | ); | |
| | | | |
| /* LPC analysis */ | | /* LPC analysis */ | |
| void SKP_Silk_find_LPC_FIX( | | void SKP_Silk_find_LPC_FIX( | |
| SKP_int NLSF_Q15[], /* O NLSFs
*/ | | SKP_int NLSF_Q15[], /* O NLSFs
*/ | |
|
| SKP_int *interpIndex, /* O NLSF interpolat
ion index, only used for NLSF interpolation */ | | SKP_int8 *interpIndex, /* O NLSF interpolat
ion index, only used for NLSF interpolation */ | |
| const SKP_int prev_NLSFq_Q15[], /* I previous NLSFs,
only used for NLSF interpolation */ | | const SKP_int prev_NLSFq_Q15[], /* I previous NLSFs,
only used for NLSF interpolation */ | |
| const SKP_int useInterpolatedNLSFs, /* I Flag
*/ | | const SKP_int useInterpolatedNLSFs, /* I Flag
*/ | |
| const SKP_int LPC_order, /* I LPC order
*/ | | const SKP_int LPC_order, /* I LPC order
*/ | |
| const SKP_int16 x[], /* I Input signal
*/ | | const SKP_int16 x[], /* I Input signal
*/ | |
| const SKP_int subfr_length, /* I Input signal su
bframe length including preceeding samples */ | | const SKP_int subfr_length, /* I Input signal su
bframe length including preceeding samples */ | |
| const SKP_int nb_subfr /* I: Number of subfr
ames */ | | const SKP_int nb_subfr /* I: Number of subfr
ames */ | |
| ); | | ); | |
| | | | |
| /* LTP analysis */ | | /* LTP analysis */ | |
| void SKP_Silk_find_LTP_FIX( | | void SKP_Silk_find_LTP_FIX( | |
| | | | |
| skipping to change at line 207 | | skipping to change at line 203 | |
| /******************/ | | /******************/ | |
| /* Limit, stabilize, convert and quantize NLSFs. */ | | /* Limit, stabilize, convert and quantize NLSFs. */ | |
| void SKP_Silk_process_NLSFs_FIX( | | void SKP_Silk_process_NLSFs_FIX( | |
| SKP_Silk_encoder_state_FIX *psEnc, /* I/O encoder state
*/ | | SKP_Silk_encoder_state_FIX *psEnc, /* I/O encoder state
*/ | |
| SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control
*/ | | SKP_Silk_encoder_control_FIX *psEncCtrl, /* I/O encoder control
*/ | |
| SKP_int *pNLSF_Q15 /* I/O Normalized LSFs (qu
ant out) (0 - (2^15-1)) */ | | SKP_int *pNLSF_Q15 /* I/O Normalized LSFs (qu
ant out) (0 - (2^15-1)) */ | |
| ); | | ); | |
| | | | |
| /* NLSF vector encoder */ | | /* NLSF vector encoder */ | |
| void SKP_Silk_NLSF_MSVQ_encode_FIX( | | void SKP_Silk_NLSF_MSVQ_encode_FIX( | |
|
| SKP_int *NLSFIndices, /* O Codeboo
k path vector [ CB_STAGES ] */ | | SKP_int8 *NLSFIndices, /* O Codeboo
k path vector [ CB_STAGES ] */ | |
| SKP_int *pNLSF_Q15, /* I/O Quantiz
ed NLSF vector [ LPC_ORDER ] */ | | SKP_int *pNLSF_Q15, /* I/O Quantiz
ed NLSF vector [ LPC_ORDER ] */ | |
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Codeboo
k object */ | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Codeboo
k object */ | |
| const SKP_int *pNLSF_q_Q15_prev, /* I Prev. q
uantized NLSF vector [LPC_ORDER] */ | | const SKP_int *pNLSF_q_Q15_prev, /* I Prev. q
uantized NLSF vector [LPC_ORDER] */ | |
| const SKP_int *pW_Q6, /* I NLSF we
ight vector [ LPC_ORDER ] */ | | const SKP_int *pW_Q6, /* I NLSF we
ight vector [ LPC_ORDER ] */ | |
| const SKP_int NLSF_mu_Q15, /* I Rate we
ight for the RD optimization */ | | const SKP_int NLSF_mu_Q15, /* I Rate we
ight for the RD optimization */ | |
| const SKP_int NLSF_mu_fluc_red_Q16, /* I Fluctua
tion reduction error weight */ | | const SKP_int NLSF_mu_fluc_red_Q16, /* I Fluctua
tion reduction error weight */ | |
| const SKP_int NLSF_MSVQ_Survivors, /* I Max sur
vivors from each stage */ | | const SKP_int NLSF_MSVQ_Survivors, /* I Max sur
vivors from each stage */ | |
| const SKP_int LPC_order, /* I LPC ord
er */ | | const SKP_int LPC_order, /* I LPC ord
er */ | |
| const SKP_int deactivate_fluc_red /* I Deactiv
ate fluctuation reduction */ | | const SKP_int deactivate_fluc_red /* I Deactiv
ate fluctuation reduction */ | |
| ); | | ); | |
| | | | |
| /* Rate-Distortion calculations for multiple input data vectors */ | | /* Rate-Distortion calculations for multiple input data vectors */ | |
| void SKP_Silk_NLSF_VQ_rate_distortion_FIX( | | void SKP_Silk_NLSF_VQ_rate_distortion_FIX( | |
| SKP_int32 *pRD_Q20, /* O Rate-distor
tion values [psNLSF_CBS->nVectors*N] */ | | SKP_int32 *pRD_Q20, /* O Rate-distor
tion values [psNLSF_CBS->nVectors*N] */ | |
| const SKP_Silk_NLSF_CBS *psNLSF_CBS, /* I NLSF codebo
ok stage struct */ | | const SKP_Silk_NLSF_CBS *psNLSF_CBS, /* I NLSF codebo
ok stage struct */ | |
|
| const SKP_int *in_Q15, /* I Input vecto
rs to be quantized */ | | const SKP_int16 *in_Q15, /* I Input vecto
rs to be quantized */ | |
| const SKP_int *w_Q6, /* I Weight vect
or */ | | const SKP_int *w_Q6, /* I Weight vect
or */ | |
| const SKP_int32 *rate_acc_Q5, /* I Accumulated
rates from previous stage */ | | const SKP_int32 *rate_acc_Q5, /* I Accumulated
rates from previous stage */ | |
| const SKP_int mu_Q15, /* I Weight betw
een weighted error and rate */ | | const SKP_int mu_Q15, /* I Weight betw
een weighted error and rate */ | |
| const SKP_int N, /* I Number of i
nput vectors to be quantized */ | | const SKP_int N, /* I Number of i
nput vectors to be quantized */ | |
| const SKP_int LPC_order /* I LPC order
*/ | | const SKP_int LPC_order /* I LPC order
*/ | |
| ); | | ); | |
| | | | |
| /* Compute weighted quantization errors for an LPC_order element input vect
or, over one codebook stage */ | | /* Compute weighted quantization errors for an LPC_order element input vect
or, over one codebook stage */ | |
| void SKP_Silk_NLSF_VQ_sum_error_FIX( | | void SKP_Silk_NLSF_VQ_sum_error_FIX( | |
| SKP_int32 *err_Q20, /* O Weighted qu
antization errors [N*K] */ | | SKP_int32 *err_Q20, /* O Weighted qu
antization errors [N*K] */ | |
|
| const SKP_int *in_Q15, /* I Input vecto
rs to be quantized [N*LPC_order] */ | | const SKP_int16 *in_Q15, /* I Input vecto
rs to be quantized [N*LPC_order] */ | |
| const SKP_int *w_Q6, /* I Weighting v
ectors [N*LPC_order] */ | | const SKP_int *w_Q6, /* I Weighting v
ectors [N*LPC_order] */ | |
| const SKP_int8 *pCB_Q9, /* I Codebook ve
ctors [K*LPC_order] */ | | const SKP_int8 *pCB_Q9, /* I Codebook ve
ctors [K*LPC_order] */ | |
| const SKP_int N, /* I Number of i
nput vectors */ | | const SKP_int N, /* I Number of i
nput vectors */ | |
| const SKP_int K, /* I Number of c
odebook vectors */ | | const SKP_int K, /* I Number of c
odebook vectors */ | |
| const SKP_int LPC_order /* I Number of L
PCs */ | | const SKP_int LPC_order /* I Number of L
PCs */ | |
| ); | | ); | |
| | | | |
| /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ | | /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ | |
| SKP_int32 SKP_Silk_residual_energy16_covar_FIX( | | SKP_int32 SKP_Silk_residual_energy16_covar_FIX( | |
| const SKP_int16 *c, /* I Prediction
vector */ | | const SKP_int16 *c, /* I Prediction
vector */ | |
| | | | |
End of changes. 7 change blocks. |
| 19 lines changed or deleted | | 11 lines changed or added | |
|
| SKP_Silk_main_FLP.h | | SKP_Silk_main_FLP.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| void SKP_Silk_HP_variable_cutoff_FLP( | | void SKP_Silk_HP_variable_cutoff_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | |
| SKP_int16 *out, /* O High-pass f
iltered output signal */ | | SKP_int16 *out, /* O High-pass f
iltered output signal */ | |
| const SKP_int16 *in /* I Input signa
l */ | | const SKP_int16 *in /* I Input signa
l */ | |
| ); | | ); | |
| | | | |
| /* Encoder main function */ | | /* Encoder main function */ | |
| SKP_int SKP_Silk_encode_frame_FLP( | | SKP_int SKP_Silk_encode_frame_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | |
|
| SKP_int32 *pnBytesOut, /* I/O Number of p | | SKP_int32 *pnBytesOut, /* O Number of p | |
| ayload bytes; */ | | ayload bytes; */ | |
| /* input: max | | ec_enc *psRangeEnc /* I/O compressor | |
| length; output: used */ | | data structure */ | |
| ec_enc *psRangeEnc, /* I/O compressor | | | |
| data structure */ | | | |
| const SKP_int16 *pIn /* I Input speec | | | |
| h frame */ | | | |
| ); | | ); | |
| | | | |
| /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode
with lower bitrate */ | | /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode
with lower bitrate */ | |
| void SKP_Silk_LBRR_encode_FLP( | | void SKP_Silk_LBRR_encode_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | |
|
| SKP_uint8 *pCode, /* O Payload | | | |
| */ | | | |
| SKP_int32 *pnBytesOut, /* I/O Payload byt | | | |
| es; in: max; out: used */ | | | |
| const SKP_float xfw[] /* I Input signa
l */ | | const SKP_float xfw[] /* I Input signa
l */ | |
| ); | | ); | |
| | | | |
| /* Initializes the Silk encoder state */ | | /* Initializes the Silk encoder state */ | |
| SKP_int SKP_Silk_init_encoder_FLP( | | SKP_int SKP_Silk_init_encoder_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc /* I/O Encoder sta
te FLP */ | |
| ); | | ); | |
| | | | |
| /* Control the Silk encoder */ | | /* Control the Silk encoder */ | |
| SKP_int SKP_Silk_control_encoder_FLP( | | SKP_int SKP_Silk_control_encoder_FLP( | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 145 | |
| void SKP_Silk_find_pred_coefs_FLP( | | void SKP_Silk_find_pred_coefs_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | |
| const SKP_float res_pitch[], /* I Residual fr
om pitch analysis */ | | const SKP_float res_pitch[], /* I Residual fr
om pitch analysis */ | |
| const SKP_float x[] /* I Speech sign
al */ | | const SKP_float x[] /* I Speech sign
al */ | |
| ); | | ); | |
| | | | |
| /* LPC analysis */ | | /* LPC analysis */ | |
| void SKP_Silk_find_LPC_FLP( | | void SKP_Silk_find_LPC_FLP( | |
| SKP_float NLSF[], /* O NLSFs
*/ | | SKP_float NLSF[], /* O NLSFs
*/ | |
|
| SKP_int *interpIndex, /* O NLSF interp
. index for NLSF interp. */ | | SKP_int8 *interpIndex, /* O NLSF interp
. index for NLSF interp. */ | |
| const SKP_float prev_NLSFq[], /* I Previous NL
SFs, for NLSF interpolation */ | | const SKP_float prev_NLSFq[], /* I Previous NL
SFs, for NLSF interpolation */ | |
| const SKP_int useInterpNLSFs, /* I Flag
*/ | | const SKP_int useInterpNLSFs, /* I Flag
*/ | |
| const SKP_int LPC_order, /* I LPC order
*/ | | const SKP_int LPC_order, /* I LPC order
*/ | |
| const SKP_float x[], /* I Input signa
l */ | | const SKP_float x[], /* I Input signa
l */ | |
| const SKP_int subfr_length, /* I Subframe le
ngth incl preceeding samples */ | | const SKP_int subfr_length, /* I Subframe le
ngth incl preceeding samples */ | |
| const SKP_int nb_subfr /* I: Number of s
ubframes */ | | const SKP_int nb_subfr /* I: Number of s
ubframes */ | |
| ); | | ); | |
| | | | |
| /* LTP analysis */ | | /* LTP analysis */ | |
| void SKP_Silk_find_LTP_FLP( | | void SKP_Silk_find_LTP_FLP( | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 202 | |
| SKP_float r_LPC[], /* O LPC residua
l signal */ | | SKP_float r_LPC[], /* O LPC residua
l signal */ | |
| const SKP_float PredCoef[], /* I LPC coeffic
ients */ | | const SKP_float PredCoef[], /* I LPC coeffic
ients */ | |
| const SKP_float s[], /* I Input signa
l */ | | const SKP_float s[], /* I Input signa
l */ | |
| const SKP_int length, /* I Length of i
nput signal */ | | const SKP_int length, /* I Length of i
nput signal */ | |
| const SKP_int Order /* I LPC order
*/ | | const SKP_int Order /* I LPC order
*/ | |
| ); | | ); | |
| | | | |
| /* LTP tap quantizer */ | | /* LTP tap quantizer */ | |
| void SKP_Silk_quant_LTP_gains_FLP( | | void SKP_Silk_quant_LTP_gains_FLP( | |
| SKP_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un
-)quantized LTP gains */ | | SKP_float B[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (Un
-)quantized LTP gains */ | |
|
| SKP_int cbk_index[ MAX_NB_SUBFR ], /* O Cod | | SKP_int8 cbk_index[ MAX_NB_SUBFR ], /* O Cod | |
| ebook index */ | | ebook index */ | |
| SKP_int *periodicity_index, /* O Per | | SKP_int8 *periodicity_index, /* O Per | |
| iodicity index */ | | iodicity index */ | |
| const SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Err
or weights */ | | const SKP_float W[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ], /* I Err
or weights */ | |
|
| const SKP_int mu_Q10, /* I Mu
value (R/D tradeoff) */ | | const SKP_int mu_Q10, /* I Mu
value (R/D tradeoff) */ | |
| const SKP_int lowComplexity, /* I Fla
g for low complexity */ | | const SKP_int lowComplexity, /* I Fla
g for low complexity */ | |
| const SKP_int nb_subfr /* I num
ber of subframes */ | | const SKP_int nb_subfr /* I num
ber of subframes */ | |
| ); | | ); | |
| | | | |
| /******************/ | | /******************/ | |
| /* NLSF Quantizer */ | | /* NLSF Quantizer */ | |
| /******************/ | | /******************/ | |
| /* Limit, stabilize, and quantize NLSFs */ | | /* Limit, stabilize, and quantize NLSFs */ | |
| void SKP_Silk_process_NLSFs_FLP( | | void SKP_Silk_process_NLSFs_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder sta
te FLP */ | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | |
| SKP_float *pNLSF /* I/O NLSFs (quan
tized output) */ | | SKP_float *pNLSF /* I/O NLSFs (quan
tized output) */ | |
| ); | | ); | |
| | | | |
| /* NLSF vector encoder */ | | /* NLSF vector encoder */ | |
| void SKP_Silk_NLSF_MSVQ_encode_FLP( | | void SKP_Silk_NLSF_MSVQ_encode_FLP( | |
|
| SKP_int *NLSFIndices, /* O Codebook pa
th vector [ CB_STAGES ] */ | | SKP_int8 *NLSFIndices, /* O Codebook pa
th vector [ CB_STAGES ] */ | |
| SKP_float *pNLSF, /* I/O Quantized N
LSF vector [ LPC_ORDER ] */ | | SKP_float *pNLSF, /* I/O Quantized N
LSF vector [ LPC_ORDER ] */ | |
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook ob
ject */ | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook ob
ject */ | |
| const SKP_float *pNLSF_q_prev, /* I Prev. quant
ized NLSF vector [LPC_ORDER] */ | | const SKP_float *pNLSF_q_prev, /* I Prev. quant
ized NLSF vector [LPC_ORDER] */ | |
| const SKP_float *pW, /* I NLSF weight
vector [ LPC_ORDER ] */ | | const SKP_float *pW, /* I NLSF weight
vector [ LPC_ORDER ] */ | |
| const SKP_float NLSF_mu, /* I Rate weight
for the RD optimization */ | | const SKP_float NLSF_mu, /* I Rate weight
for the RD optimization */ | |
| const SKP_float NLSF_mu_fluc_red, /* I Fluctuation
reduction error weight */ | | const SKP_float NLSF_mu_fluc_red, /* I Fluctuation
reduction error weight */ | |
| const SKP_int NLSF_MSVQ_Survivors,/* I Max survivo
rs from each stage */ | | const SKP_int NLSF_MSVQ_Survivors,/* I Max survivo
rs from each stage */ | |
| const SKP_int LPC_order, /* I LPC order
*/ | | const SKP_int LPC_order, /* I LPC order
*/ | |
| const SKP_int deactivate_fluc_red /* I Deactivate
fluctuation reduction */ | | const SKP_int deactivate_fluc_red /* I Deactivate
fluctuation reduction */ | |
| ); | | ); | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 261 | |
| const SKP_int8 *pCB_NLSF_Q8, /* I Codebook ve
ctors [ K * LPC_order ] */ | | const SKP_int8 *pCB_NLSF_Q8, /* I Codebook ve
ctors [ K * LPC_order ] */ | |
| const SKP_int N, /* I Number of i
nput vectors */ | | const SKP_int N, /* I Number of i
nput vectors */ | |
| const SKP_int K, /* I Number of c
odebook vectors */ | | const SKP_int K, /* I Number of c
odebook vectors */ | |
| const SKP_int LPC_order /* I LPC order
*/ | | const SKP_int LPC_order /* I LPC order
*/ | |
| ); | | ); | |
| | | | |
| /* NLSF vector decoder */ | | /* NLSF vector decoder */ | |
| void SKP_Silk_NLSF_MSVQ_decode_FLP( | | void SKP_Silk_NLSF_MSVQ_decode_FLP( | |
| SKP_float *pNLSF, /* O Decoded out
put vector [ LPC_ORDER ] */ | | SKP_float *pNLSF, /* O Decoded out
put vector [ LPC_ORDER ] */ | |
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I NLSF codebo
ok struct */ | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB, /* I NLSF codebo
ok struct */ | |
|
| const SKP_int *NLSFIndices, /* I NLSF indice
s [ nStages ] */ | | const SKP_int8 *NLSFIndices, /* I NLSF indice
s [ nStages ] */ | |
| const SKP_int LPC_order /* I LPC order u
sed */ | | const SKP_int LPC_order /* I LPC order u
sed */ | |
| ); | | ); | |
| | | | |
| /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ | | /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */ | |
| SKP_float SKP_Silk_residual_energy_covar_FLP( /* O Weighted re
sidual energy */ | | SKP_float SKP_Silk_residual_energy_covar_FLP( /* O Weighted re
sidual energy */ | |
| const SKP_float *c, /* I Filter coef
ficients */ | | const SKP_float *c, /* I Filter coef
ficients */ | |
| SKP_float *wXX, /* I/O Weighted co
rrelation matrix, reg. out */ | | SKP_float *wXX, /* I/O Weighted co
rrelation matrix, reg. out */ | |
| const SKP_float *wXx, /* I Weighted co
rrelation vector */ | | const SKP_float *wXx, /* I Weighted co
rrelation vector */ | |
| const SKP_float wxx, /* I Weighted co
rrelation value */ | | const SKP_float wxx, /* I Weighted co
rrelation value */ | |
| const SKP_int D /* I Dimension
*/ | | const SKP_int D /* I Dimension
*/ | |
| | | | |
| skipping to change at line 390 | | skipping to change at line 386 | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder con
trol FLP */ | |
| const SKP_int16 *pIn /* I Input signa
l */ | | const SKP_int16 *pIn /* I Input signa
l */ | |
| ); | | ); | |
| | | | |
| /****************************************/ | | /****************************************/ | |
| /* Floating-point Silk NSQ wrapper */ | | /* Floating-point Silk NSQ wrapper */ | |
| /****************************************/ | | /****************************************/ | |
| void SKP_Silk_NSQ_wrapper_FLP( | | void SKP_Silk_NSQ_wrapper_FLP( | |
| SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder state F
LP */ | | SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder state F
LP */ | |
| SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control
FLP */ | | SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control
FLP */ | |
|
| const SKP_float x[], /* I Prefiltered inp | | SideInfoIndices *psIndices, /* I/O Quantization in | |
| ut signal */ | | dices */ | |
| SKP_int8 q[], /* O Quantized pulse | | SKP_Silk_nsq_state *psNSQ, /* I/O Noise Shaping Q | |
| signal */ | | uantzation state */ | |
| const SKP_int useLBRR /* I LBRR flag | | SKP_int8 pulses[], /* O Quantized pulse | |
| */ | | signal */ | |
| | | const SKP_float x[] /* I Prefiltered inp | |
| | | ut signal */ | |
| ); | | ); | |
| | | | |
| /* using log2() helps the fixed-point conversion */ | | /* using log2() helps the fixed-point conversion */ | |
| SKP_INLINE SKP_float SKP_Silk_log2( double x ) { return ( SKP_float )( 3.32
192809488736 * log10( x ) ); } | | SKP_INLINE SKP_float SKP_Silk_log2( double x ) { return ( SKP_float )( 3.32
192809488736 * log10( x ) ); } | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 27 lines changed or deleted | | 21 lines changed or added | |
|
| SKP_Silk_structs.h | | SKP_Silk_structs.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| /************************************/ | | /************************************/ | |
| /* Noise shaping quantization state */ | | /* Noise shaping quantization state */ | |
| /************************************/ | | /************************************/ | |
| typedef struct { | | typedef struct { | |
| SKP_int16 xq[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for quantiz
ed output signal */ | | SKP_int16 xq[ 2 * MAX_FRAME_LENGTH ]; /* Buffer for quantiz
ed output signal */ | |
| SKP_int32 sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ]; | | SKP_int32 sLTP_shp_Q10[ 2 * MAX_FRAME_LENGTH ]; | |
|
| SKP_int32 sLPC_Q14[ MAX_FRAME_LENGTH / MAX_NB_SUBFR + NSQ_LPC_BUF_LEN
GTH ]; | | SKP_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH ]; | |
| SKP_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; | | SKP_int32 sAR2_Q14[ MAX_SHAPE_LPC_ORDER ]; | |
| SKP_int32 sLF_AR_shp_Q12; | | SKP_int32 sLF_AR_shp_Q12; | |
| SKP_int lagPrev; | | SKP_int lagPrev; | |
| SKP_int sLTP_buf_idx; | | SKP_int sLTP_buf_idx; | |
| SKP_int sLTP_shp_buf_idx; | | SKP_int sLTP_shp_buf_idx; | |
| SKP_int32 rand_seed; | | SKP_int32 rand_seed; | |
| SKP_int32 prev_inv_gain_Q16; | | SKP_int32 prev_inv_gain_Q16; | |
| SKP_int rewhite_flag; | | SKP_int rewhite_flag; | |
|
| } SKP_Silk_nsq_state; /* FIX*/ | | } SKP_Silk_nsq_state; | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* VAD state */ | | /* VAD state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
| SKP_int32 AnaState[ 2 ]; /* Analysis filterbank stat
e: 0-8 kHz */ | | SKP_int32 AnaState[ 2 ]; /* Analysis filterbank stat
e: 0-8 kHz */ | |
| SKP_int32 AnaState1[ 2 ]; /* Analysis filterbank stat
e: 0-4 kHz */ | | SKP_int32 AnaState1[ 2 ]; /* Analysis filterbank stat
e: 0-4 kHz */ | |
| SKP_int32 AnaState2[ 2 ]; /* Analysis filterbank stat
e: 0-2 kHz */ | | SKP_int32 AnaState2[ 2 ]; /* Analysis filterbank stat
e: 0-2 kHz */ | |
| SKP_int32 XnrgSubfr[ VAD_N_BANDS ]; /* Subframe energies
*/ | | SKP_int32 XnrgSubfr[ VAD_N_BANDS ]; /* Subframe energies
*/ | |
| SKP_int32 NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in
each band */ | | SKP_int32 NrgRatioSmth_Q8[ VAD_N_BANDS ]; /* Smoothed energy level in
each band */ | |
| SKP_int16 HPstate; /* State of differentiator
in the lowest band */ | | SKP_int16 HPstate; /* State of differentiator
in the lowest band */ | |
| SKP_int32 NL[ VAD_N_BANDS ]; /* Noise energy level in ea
ch band */ | | SKP_int32 NL[ VAD_N_BANDS ]; /* Noise energy level in ea
ch band */ | |
| SKP_int32 inv_NL[ VAD_N_BANDS ]; /* Inverse noise energy lev
el in each band */ | | SKP_int32 inv_NL[ VAD_N_BANDS ]; /* Inverse noise energy lev
el in each band */ | |
| SKP_int32 NoiseLevelBias[ VAD_N_BANDS ]; /* Noise level estimator bi
as/offset */ | | SKP_int32 NoiseLevelBias[ VAD_N_BANDS ]; /* Noise level estimator bi
as/offset */ | |
| SKP_int32 counter; /* Frame counter used in th
e initial phase */ | | SKP_int32 counter; /* Frame counter used in th
e initial phase */ | |
| } SKP_Silk_VAD_state; | | } SKP_Silk_VAD_state; | |
| | | | |
|
| /*******************************/ | | | |
| /* Range encoder/decoder state */ | | | |
| /*******************************/ | | | |
| #if 0 | | | |
| typedef struct { | | | |
| SKP_int32 bufferLength; | | | |
| SKP_int32 bufferIx; | | | |
| SKP_uint32 base_Q32; | | | |
| SKP_uint32 range_Q16; | | | |
| SKP_int32 error; | | | |
| SKP_uint8 buffer[ MAX_ARITHM_BYTES ]; /* Buffer containing payloa | | | |
| d */ | | | |
| /* The CELT entropy decoder */ | | | |
| ec_dec range_dec_celt_state; | | | |
| } SKP_Silk_range_coder_state; | | | |
| #endif | | | |
| | | | |
| #if SWITCH_TRANSITION_FILTERING | | #if SWITCH_TRANSITION_FILTERING | |
| /* Variable cut-off low-pass filter state */ | | /* Variable cut-off low-pass filter state */ | |
| typedef struct { | | typedef struct { | |
| SKP_int32 In_LP_State[ 2 ]; /* Low pass fil
ter state */ | | SKP_int32 In_LP_State[ 2 ]; /* Low pass fil
ter state */ | |
| SKP_int32 transition_frame_no; /* Counter whic
h is mapped to a cut-off frequency */ | | SKP_int32 transition_frame_no; /* Counter whic
h is mapped to a cut-off frequency */ | |
| SKP_int mode; /* Operating mo
de, 0: switch down, 1: switch up */ | | SKP_int mode; /* Operating mo
de, 0: switch down, 1: switch up */ | |
| } SKP_Silk_LP_state; | | } SKP_Silk_LP_state; | |
| #endif | | #endif | |
| | | | |
| /* Structure for one stage of MSVQ */ | | /* Structure for one stage of MSVQ */ | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 99 | |
| } SKP_Silk_NLSF_CBS; | | } SKP_Silk_NLSF_CBS; | |
| | | | |
| /* Structure containing NLSF MSVQ codebook */ | | /* Structure containing NLSF MSVQ codebook */ | |
| typedef struct { | | typedef struct { | |
| const SKP_int32 nStages; | | const SKP_int32 nStages; | |
| | | | |
| /* Fields for (de)quantizing */ | | /* Fields for (de)quantizing */ | |
| const SKP_Silk_NLSF_CBS *CBStages; | | const SKP_Silk_NLSF_CBS *CBStages; | |
| const SKP_int *NDeltaMin_Q15; | | const SKP_int *NDeltaMin_Q15; | |
| | | | |
|
| /* Fields for arithmetic (de)coding */ | | /* Fields for range (de)coding */ | |
| const SKP_uint8 *CDF; | | | |
| const SKP_uint8 * const *StartPtr; | | const SKP_uint8 * const *StartPtr; | |
| } SKP_Silk_NLSF_CB_struct; | | } SKP_Silk_NLSF_CB_struct; | |
| | | | |
|
| | | typedef struct { | |
| | | SKP_int8 GainsIndices[ MAX_NB_SUBFR ]; | |
| | | SKP_int8 LTPIndex[ MAX_NB_SUBFR ]; | |
| | | SKP_int8 NLSFIndices[ NLSF_MSVQ_MAX_CB_STAGES ]; | |
| | | SKP_int16 lagIndex; | |
| | | SKP_int8 contourIndex; | |
| | | SKP_int8 signalType; | |
| | | SKP_int8 quantOffsetType; | |
| | | SKP_int8 NLSFInterpCoef_Q2; | |
| | | SKP_int8 PERIndex; | |
| | | SKP_int8 LTP_scaleIndex; | |
| | | SKP_int8 Seed; | |
| | | } SideInfoIndices; | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Encoder state */ | | /* Encoder state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
| #if HIGH_PASS_INPUT | | #if HIGH_PASS_INPUT | |
| SKP_int32 In_HP_State[ 2 ]; /* High
pass filter state */ | | SKP_int32 In_HP_State[ 2 ]; /* High
pass filter state */ | |
| #endif | | #endif | |
| #if SWITCH_TRANSITION_FILTERING | | #if SWITCH_TRANSITION_FILTERING | |
|
| SKP_Silk_LP_state sLP; /* Low
pass filter state */ | | SKP_Silk_LP_state sLP; /* Low
pass filter state */ | |
| #endif | | #endif | |
| SKP_Silk_VAD_state sVAD; /* Voic
e activity detector state */ | | SKP_Silk_VAD_state sVAD; /* Voic
e activity detector state */ | |
|
| | | SKP_Silk_nsq_state sNSQ; /* Nois | |
| SKP_int LBRRprevLastGainIndex; | | e Shape Quantizer State */ | |
| SKP_int prevSignalType; | | SKP_int8 LBRRprevLastGainIndex; | |
| SKP_int typeOffsetPrev; /* Prev | | SKP_int8 prevSignalType; | |
| ious signal type and quantization offset */ | | | |
| SKP_int prevLag; | | SKP_int prevLag; | |
|
| SKP_int prev_lagIndex; | | | |
| SKP_int32 API_fs_Hz; /* API
sampling frequency (Hz) */ | | SKP_int32 API_fs_Hz; /* API
sampling frequency (Hz) */ | |
| SKP_int32 prev_API_fs_Hz; /* Prev
ious API sampling frequency (Hz) */ | | SKP_int32 prev_API_fs_Hz; /* Prev
ious API sampling frequency (Hz) */ | |
| SKP_int maxInternal_fs_kHz; /* Maxi
mum internal sampling frequency (kHz) */ | | SKP_int maxInternal_fs_kHz; /* Maxi
mum internal sampling frequency (kHz) */ | |
| SKP_int minInternal_fs_kHz; /* Mini
mum internal sampling frequency (kHz) */ | | SKP_int minInternal_fs_kHz; /* Mini
mum internal sampling frequency (kHz) */ | |
| SKP_int fs_kHz; /* Inte
rnal sampling frequency (kHz) */ | | SKP_int fs_kHz; /* Inte
rnal sampling frequency (kHz) */ | |
|
| SKP_int fs_kHz_changed; /* Did
we switch yet? */ | | | |
| SKP_int nb_subfr; /* Numb
er of 5 ms subframes in a frame */ | | SKP_int nb_subfr; /* Numb
er of 5 ms subframes in a frame */ | |
| SKP_int frame_length; /* Fram
e length (samples) */ | | SKP_int frame_length; /* Fram
e length (samples) */ | |
| SKP_int subfr_length; /* Subf
rame length (samples) */ | | SKP_int subfr_length; /* Subf
rame length (samples) */ | |
| SKP_int ltp_mem_length; /* Leng
th of LTP memory */ | | SKP_int ltp_mem_length; /* Leng
th of LTP memory */ | |
| SKP_int la_pitch; /* Look
-ahead for pitch analysis (samples) */ | | SKP_int la_pitch; /* Look
-ahead for pitch analysis (samples) */ | |
| SKP_int la_shape; /* Look
-ahead for noise shape analysis (samples) */ | | SKP_int la_shape; /* Look
-ahead for noise shape analysis (samples) */ | |
| SKP_int shapeWinLength; /* Wind
ow length for noise shape analysis (samples) */ | | SKP_int shapeWinLength; /* Wind
ow length for noise shape analysis (samples) */ | |
| SKP_int32 TargetRate_bps; /* Targ
et bitrate (bps) */ | | SKP_int32 TargetRate_bps; /* Targ
et bitrate (bps) */ | |
| SKP_int PacketSize_ms; /* Numb
er of milliseconds to put in each packet */ | | SKP_int PacketSize_ms; /* Numb
er of milliseconds to put in each packet */ | |
| SKP_int PacketLoss_perc; /* Pack
et loss rate measured by farend */ | | SKP_int PacketLoss_perc; /* Pack
et loss rate measured by farend */ | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 163 | |
| SKP_int pitchEstimationComplexity; /* Comp
lexity level for pitch estimator */ | | SKP_int pitchEstimationComplexity; /* Comp
lexity level for pitch estimator */ | |
| SKP_int pitchEstimationLPCOrder; /* Whit
ening filter order for pitch estimator */ | | SKP_int pitchEstimationLPCOrder; /* Whit
ening filter order for pitch estimator */ | |
| SKP_int32 pitchEstimationThreshold_Q16; /* Thre
shold for pitch estimator */ | | SKP_int32 pitchEstimationThreshold_Q16; /* Thre
shold for pitch estimator */ | |
| SKP_int LTPQuantLowComplexity; /* Flag
for low complexity LTP quantization */ | | SKP_int LTPQuantLowComplexity; /* Flag
for low complexity LTP quantization */ | |
| SKP_int mu_LTP_Q9; /* Rate
-distortion tradeoff in LTP quantization */ | | SKP_int mu_LTP_Q9; /* Rate
-distortion tradeoff in LTP quantization */ | |
| SKP_int NLSF_MSVQ_Survivors; /* Numb
er of survivors in NLSF MSVQ */ | | SKP_int NLSF_MSVQ_Survivors; /* Numb
er of survivors in NLSF MSVQ */ | |
| SKP_int first_frame_after_reset; /* Flag
for deactivating NLSF interp. and fluc. reduction after resets */ | | SKP_int first_frame_after_reset; /* Flag
for deactivating NLSF interp. and fluc. reduction after resets */ | |
| SKP_int controlled_since_last_payload; /* Flag
for ensuring codec_control only runs once per packet */ | | SKP_int controlled_since_last_payload; /* Flag
for ensuring codec_control only runs once per packet */ | |
| SKP_int warping_Q16; /* W
arping parameter for warped noise shaping */ | | SKP_int warping_Q16; /* W
arping parameter for warped noise shaping */ | |
| SKP_int useCBR; /* Flag
to enable constant bitrate */ | | SKP_int useCBR; /* Flag
to enable constant bitrate */ | |
|
| | | SKP_int prev_nBits; /* Use
to track bits used by each frame in packet */ | |
| const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Poin
ter to iCDF table for low bits of pitch lag index */ | | const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Poin
ter to iCDF table for low bits of pitch lag index */ | |
| const SKP_uint8 *pitch_contour_iCDF; /* Poin
ter to iCDF table for pitch contour index */ | | const SKP_uint8 *pitch_contour_iCDF; /* Poin
ter to iCDF table for pitch contour index */ | |
|
| | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB[ 2 ]; /* Poin | |
| | | ters to voiced/unvoiced NLSF codebooks */ | |
| | | | |
| | | SKP_int8 VAD_flags[ MAX_FRAMES_PER_PACKET ]; | |
| | | SKP_int8 LBRR_flag; | |
| | | SKP_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; | |
| | | | |
| | | SideInfoIndices indices; | |
| | | SKP_int8 pulses[ MAX_FRAME_LENGTH ]; | |
| | | | |
| /* Input/output buffering */ | | /* Input/output buffering */ | |
|
| SKP_int16 inputBuf[ MAX_FRAME_LENGTH ]; /* buff
er containin input signal */ | | SKP_int16 inputBuf[ MAX_FRAME_LENGTH ]; /* buff
er containing input signal */ | |
| SKP_int inputBufIx; | | SKP_int inputBufIx; | |
|
| SKP_int nFramesInPayloadBuf; /* numb | | SKP_int nFramesPerPacket; | |
| er of frames sitting in outputBuf */ | | SKP_int nFramesAnalyzed; /* Numb | |
| SKP_int nBytesInPayloadBuf; /* numb | | er of frames analyzed in current packet */ | |
| er of bytes sitting in outputBuf */ | | | |
| | | | |
| /* Parameters For LTP scaling Control */ | | /* Parameters For LTP scaling Control */ | |
| SKP_int frames_since_onset; | | SKP_int frames_since_onset; | |
| | | | |
|
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB[ 2 ]; /* Poin | | /* Specifically for entropy coding */ | |
| ters to voiced/unvoiced NLSF codebooks */ | | SKP_int ec_prevSignalType; | |
| | | SKP_int16 ec_prevLagIndex; | |
| /* Inband Low Bitrate Redundancy (LBRR) data */ | | | |
| SKP_int useInBandFEC; /* Save | | | |
| s the API setting for query */ | | | |
| SKP_int LBRR_enabled; | | | |
| SKP_int LBRR_GainIncreases; /* Numb | | | |
| er of shifts to Gains to get LBRR rate Voiced frames */ | | | |
| | | | |
| /* Bitrate control */ | | /* Bitrate control */ | |
| SKP_int32 bitrateDiff; /* Accu
mulated diff. between the target bitrate and the switch bitrates */ | | SKP_int32 bitrateDiff; /* Accu
mulated diff. between the target bitrate and the switch bitrates */ | |
| SKP_int32 bitrate_threshold_up; /* Thre
shold for switching to a higher internal sample frequency */ | | SKP_int32 bitrate_threshold_up; /* Thre
shold for switching to a higher internal sample frequency */ | |
| SKP_int32 bitrate_threshold_down; /* Thre
shold for switching to a lower internal sample frequency */ | | SKP_int32 bitrate_threshold_down; /* Thre
shold for switching to a lower internal sample frequency */ | |
| | | | |
|
| SKP_Silk_resampler_state_struct resampler_state; | | SKP_Silk_resampler_state_struct resampler_state; | |
| | | | |
| /* DTX */ | | /* DTX */ | |
|
| SKP_int noSpeechCounter; /* Coun
ts concecutive nonactive frames, used by DTX */ | | | |
| SKP_int useDTX; /* Flag
to enable DTX */ | | SKP_int useDTX; /* Flag
to enable DTX */ | |
| SKP_int inDTX; /* Flag
to signal DTX period */ | | SKP_int inDTX; /* Flag
to signal DTX period */ | |
|
| SKP_int LBRR_nBytes; | | SKP_int noSpeechCounter; /* Coun
ts concecutive nonactive frames, used by DTX */ | |
| | | | |
|
| /* Buffers */ | | /* Inband Low Bitrate Redundancy (LBRR) data */ | |
| SKP_int8 q[ MAX_FRAME_LENGTH * MAX_FRAMES_PER | | SKP_int useInBandFEC; /* Save | |
| _PACKET ]; /* pulse signal buffer */ | | s the API setting for query */ | |
| SKP_int8 q_LBRR[ MAX_FRAME_LENGTH * MAX_FRAMES_P | | SKP_int LBRR_enabled; /* Depe | |
| ER_PACKET ]; /* pulse signal buffer */ | | nds on useInBandFRC, bitrate and packet loss rate */ | |
| SKP_int quantOffsetType[ MAX_FRAMES_PER_PACKET | | SKP_int LBRR_GainIncreases; /* Numb | |
| ]; | | er of shifts to Gains to get LBRR rate Voiced frames */ | |
| SKP_int signalType[ MAX_FRAMES_PER_PACKET ]; | | SideInfoIndices indices_LBRR[ MAX_FRAMES_PER_PACKET ]; | |
| | | SKP_int8 pulses_LBRR[ MAX_FRAMES_PER_PACKET ] | |
| | | [ MAX_FRAME_LENGTH ]; | |
| } SKP_Silk_encoder_state; | | } SKP_Silk_encoder_state; | |
| | | | |
|
| /************************/ | | | |
| /* Encoder control */ | | | |
| /************************/ | | | |
| typedef struct { | | | |
| /* Quantization indices */ | | | |
| SKP_int lagIndex; | | | |
| SKP_int contourIndex; | | | |
| SKP_int PERIndex; | | | |
| SKP_int LTPIndex[ MAX_NB_SUBFR ]; | | | |
| SKP_int NLSFIndices[ NLSF_MSVQ_MAX_CB_STAGES ]; /* NLSF path of qu | | | |
| antized LSF vector */ | | | |
| SKP_int NLSFInterpCoef_Q2; | | | |
| SKP_int GainsIndices[ MAX_NB_SUBFR ]; | | | |
| SKP_int32 Seed; | | | |
| SKP_int LTP_scaleIndex; | | | |
| SKP_int RateLevelIndex; | | | |
| SKP_int quantOffsetType; | | | |
| SKP_int signalType; | | | |
| | | | |
| /* Prediction and coding parameters */ | | | |
| SKP_int pitchL[ MAX_NB_SUBFR ]; | | | |
| | | | |
| SKP_int LBRR_usage; /* Low bitrate redundancy u | | | |
| sage */ | | | |
| } SKP_Silk_encoder_control; | | | |
| | | | |
| /* Struct for Packet Loss Concealment */ | | /* Struct for Packet Loss Concealment */ | |
| typedef struct { | | typedef struct { | |
| SKP_int32 pitchL_Q8; /* Pitch lag to use for voi
ced concealment */ | | SKP_int32 pitchL_Q8; /* Pitch lag to use for voi
ced concealment */ | |
| SKP_int16 LTPCoef_Q14[ LTP_ORDER ]; /* LTP coeficients to use f
or voiced concealment */ | | SKP_int16 LTPCoef_Q14[ LTP_ORDER ]; /* LTP coeficients to use f
or voiced concealment */ | |
| SKP_int16 prevLPC_Q12[ MAX_LPC_ORDER ]; | | SKP_int16 prevLPC_Q12[ MAX_LPC_ORDER ]; | |
| SKP_int last_frame_lost; /* Was previous frame lost
*/ | | SKP_int last_frame_lost; /* Was previous frame lost
*/ | |
| SKP_int32 rand_seed; /* Seed for unvoiced signal
generation */ | | SKP_int32 rand_seed; /* Seed for unvoiced signal
generation */ | |
| SKP_int16 randScale_Q14; /* Scaling of unvoiced rand
om signal */ | | SKP_int16 randScale_Q14; /* Scaling of unvoiced rand
om signal */ | |
| SKP_int32 conc_energy; | | SKP_int32 conc_energy; | |
| SKP_int conc_energy_shift; | | SKP_int conc_energy_shift; | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 237 | |
| SKP_int32 CNG_synth_state[ MAX_LPC_ORDER ]; | | SKP_int32 CNG_synth_state[ MAX_LPC_ORDER ]; | |
| SKP_int32 CNG_smth_Gain_Q16; | | SKP_int32 CNG_smth_Gain_Q16; | |
| SKP_int32 rand_seed; | | SKP_int32 rand_seed; | |
| SKP_int fs_kHz; | | SKP_int fs_kHz; | |
| } SKP_Silk_CNG_struct; | | } SKP_Silk_CNG_struct; | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Decoder state */ | | /* Decoder state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
|
| //SKP_Silk_range_coder_state sRC; /* Range
coder state */ | | | |
| SKP_int32 prev_inv_gain_Q16; | | SKP_int32 prev_inv_gain_Q16; | |
| SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; | | SKP_int32 sLTP_Q16[ 2 * MAX_FRAME_LENGTH ]; | |
|
| SKP_int32 sLPC_Q14[ MAX_FRAME_LENGTH / MAX_NB_SUBFR + MAX_LPC_ORD
ER ]; | | SKP_int32 sLPC_Q14[ MAX_SUB_FRAME_LENGTH + MAX_LPC_ORDER ]; | |
| SKP_int32 exc_Q10[ MAX_FRAME_LENGTH ]; | | SKP_int32 exc_Q10[ MAX_FRAME_LENGTH ]; | |
| SKP_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer f
or output signal */ | | SKP_int16 outBuf[ 2 * MAX_FRAME_LENGTH ]; /* Buffer f
or output signal */ | |
| SKP_int lagPrev; /* Previous
Lag */ | | SKP_int lagPrev; /* Previous
Lag */ | |
|
| SKP_int LastGainIndex; /* Previous | | SKP_int8 LastGainIndex; /* Previous | |
| gain index */ | | gain index */ | |
| SKP_int LastGainIndex_EnhLayer; /* Previous | | | |
| gain index */ | | | |
| SKP_int typeOffsetPrev; /* Previous | | | |
| signal type and quantization offset */ | | | |
| SKP_int32 HPState[ DEC_HP_ORDER ]; /* HP filte
r state */ | | SKP_int32 HPState[ DEC_HP_ORDER ]; /* HP filte
r state */ | |
| const SKP_int32 *HP_A; /* HP filte
r AR coefficients */ | | const SKP_int32 *HP_A; /* HP filte
r AR coefficients */ | |
| const SKP_int32 *HP_B; /* HP filte
r MA coefficients */ | | const SKP_int32 *HP_B; /* HP filte
r MA coefficients */ | |
| SKP_int fs_kHz; /* Sampling
frequency in kHz */ | | SKP_int fs_kHz; /* Sampling
frequency in kHz */ | |
| SKP_int32 prev_API_sampleRate; /* Previous
API sample frequency (Hz) */ | | SKP_int32 prev_API_sampleRate; /* Previous
API sample frequency (Hz) */ | |
| SKP_int nb_subfr; /* Number o
f 5 ms subframes in a frame */ | | SKP_int nb_subfr; /* Number o
f 5 ms subframes in a frame */ | |
| SKP_int frame_length; /* Frame le
ngth (samples) */ | | SKP_int frame_length; /* Frame le
ngth (samples) */ | |
| SKP_int subfr_length; /* Subframe
length (samples) */ | | SKP_int subfr_length; /* Subframe
length (samples) */ | |
| SKP_int ltp_mem_length; /* Length o
f LTP memory */ | | SKP_int ltp_mem_length; /* Length o
f LTP memory */ | |
| SKP_int LPC_order; /* LPC orde
r */ | | SKP_int LPC_order; /* LPC orde
r */ | |
| SKP_int prevNLSF_Q15[ MAX_LPC_ORDER ]; /* Used to
interpolate LSFs */ | | SKP_int prevNLSF_Q15[ MAX_LPC_ORDER ]; /* Used to
interpolate LSFs */ | |
| SKP_int first_frame_after_reset; /* Flag for
deactivating NLSF interp. and fluc. reduction after resets */ | | SKP_int first_frame_after_reset; /* Flag for
deactivating NLSF interp. and fluc. reduction after resets */ | |
| const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Pointer
to iCDF table for low bits of pitch lag index */ | | const SKP_uint8 *pitch_lag_low_bits_iCDF; /* Pointer
to iCDF table for low bits of pitch lag index */ | |
| const SKP_uint8 *pitch_contour_iCDF; /* Pointer
to iCDF table for pitch contour index */ | | const SKP_uint8 *pitch_contour_iCDF; /* Pointer
to iCDF table for pitch contour index */ | |
| | | | |
| /* For buffering payload in case of more frames per packet */ | | /* For buffering payload in case of more frames per packet */ | |
|
| SKP_int nBytesLeft; | | | |
| SKP_int nFramesDecoded; | | SKP_int nFramesDecoded; | |
|
| SKP_int nFramesInPacket; | | SKP_int nFramesPerPacket; | |
| SKP_int moreInternalDecoderFrames; | | | |
| SKP_int FrameTermination; | | /* Specifically for entropy coding */ | |
| | | SKP_int ec_prevSignalType; | |
| | | SKP_int16 ec_prevLagIndex; | |
| | | | |
|
| SKP_Silk_resampler_state_struct resampler_state; | | SKP_int VAD_flags[ MAX_FRAMES_PER_PACKET ]; | |
| | | SKP_int LBRR_flag; | |
| | | SKP_int LBRR_flags[ MAX_FRAMES_PER_PACKET ]; | |
| | | | |
| | | SKP_Silk_resampler_state_struct resampler_state; | |
| | | | |
| const SKP_Silk_NLSF_CB_struct *psNLSF_CB[ 2 ]; /* Pointers to voic
ed/unvoiced NLSF codebooks */ | | const SKP_Silk_NLSF_CB_struct *psNLSF_CB[ 2 ]; /* Pointers to voic
ed/unvoiced NLSF codebooks */ | |
| | | | |
|
| SKP_int signalType[ MAX_FRAMES_PER_PACKET ]; | | /* Quantization indices */ | |
| SKP_int quantOffsetType[ MAX_FRAMES_PER_PACKET ]; | | SideInfoIndices indices; | |
| SKP_int GainsIndices[ MAX_FRAMES_PER_PACKET ][ MAX_NB_ | | | |
| SUBFR ]; | | | |
| SKP_int GainsIndices_EnhLayer[ MAX_FRAMES_PER_PACKET ][ MAX_NB_ | | | |
| SUBFR ]; | | | |
| SKP_int NLSFIndices[ MAX_FRAMES_PER_PACKET ][ NLSF_MS | | | |
| VQ_MAX_CB_STAGES ]; | | | |
| SKP_int NLSFInterpCoef_Q2[ MAX_FRAMES_PER_PACKET ]; | | | |
| SKP_int lagIndex[ MAX_FRAMES_PER_PACKET ]; | | | |
| SKP_int contourIndex[ MAX_FRAMES_PER_PACKET ]; | | | |
| SKP_int PERIndex[ MAX_FRAMES_PER_PACKET ]; | | | |
| SKP_int LTPIndex[ MAX_FRAMES_PER_PACKET ][ MAX_NB_ | | | |
| SUBFR ]; | | | |
| SKP_int LTP_scaleIndex[ MAX_FRAMES_PER_PACKET ]; | | | |
| SKP_int Seed[ MAX_FRAMES_PER_PACKET ]; | | | |
| | | | |
| /* Parameters used to investigate if inband FEC is used */ | | | |
| SKP_int vadFlag; | | | |
| SKP_int no_FEC_counter; /* Counts n | | | |
| umber of frames wo inband FEC */ | | | |
| SKP_int inband_FEC_offset; /* 0: no FE | | | |
| C, 1: FEC with 1 packet offset, 2: FEC w 2 packets offset */ | | | |
| | | | |
| /* CNG state */ | | /* CNG state */ | |
| SKP_Silk_CNG_struct sCNG; | | SKP_Silk_CNG_struct sCNG; | |
| | | | |
| /* Stuff used for PLC */ | | /* Stuff used for PLC */ | |
| SKP_int lossCnt; | | SKP_int lossCnt; | |
| SKP_int prevSignalType; | | SKP_int prevSignalType; | |
| | | | |
| SKP_Silk_PLC_struct sPLC; | | SKP_Silk_PLC_struct sPLC; | |
| | | | |
| } SKP_Silk_decoder_state; | | } SKP_Silk_decoder_state; | |
| | | | |
| /************************/ | | /************************/ | |
| /* Decoder control */ | | /* Decoder control */ | |
| /************************/ | | /************************/ | |
| typedef struct { | | typedef struct { | |
| /* prediction and coding parameters */ | | /* prediction and coding parameters */ | |
| SKP_int pitchL[ MAX_NB_SUBFR ]; | | SKP_int pitchL[ MAX_NB_SUBFR ]; | |
| SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; | | SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; | |
|
| SKP_int32 Seed; | | | |
| /* holds interpolated and final coefficients, 4-byte aligned */ | | /* holds interpolated and final coefficients, 4-byte aligned */ | |
| SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; | | SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; | |
| SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; | | SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; | |
| SKP_int LTP_scale_Q14; | | SKP_int LTP_scale_Q14; | |
|
| | | | |
| /* quantization indices */ | | | |
| SKP_int PERIndex; | | | |
| SKP_int RateLevelIndex; | | | |
| SKP_int quantOffsetType; | | | |
| SKP_int signalType; | | | |
| SKP_int NLSFInterpCoef_Q2; | | | |
| } SKP_Silk_decoder_control; | | } SKP_Silk_decoder_control; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 29 change blocks. |
| 125 lines changed or deleted | | 67 lines changed or added | |
|
| SKP_Silk_structs_FIX.h | | SKP_Silk_structs_FIX.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Noise shaping analysis state */ | | /* Noise shaping analysis state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
|
| SKP_int LastGainIndex; | | SKP_int8 LastGainIndex; | |
| SKP_int32 HarmBoost_smth_Q16; | | SKP_int32 HarmBoost_smth_Q16; | |
| SKP_int32 HarmShapeGain_smth_Q16; | | SKP_int32 HarmShapeGain_smth_Q16; | |
| SKP_int32 Tilt_smth_Q16; | | SKP_int32 Tilt_smth_Q16; | |
| } SKP_Silk_shape_state_FIX; | | } SKP_Silk_shape_state_FIX; | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Prefilter state */ | | /* Prefilter state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
| SKP_int16 sLTP_shp[ LTP_BUF_LENGTH ]; | | SKP_int16 sLTP_shp[ LTP_BUF_LENGTH ]; | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 87 | |
| typedef struct { | | typedef struct { | |
| SKP_Silk_encoder_state sCmn; /* Comm
on struct, shared with floating-point code */ | | SKP_Silk_encoder_state sCmn; /* Comm
on struct, shared with floating-point code */ | |
| | | | |
| #if HIGH_PASS_INPUT | | #if HIGH_PASS_INPUT | |
| SKP_int32 variable_HP_smth1_Q15; /* Stat
e of first smoother */ | | SKP_int32 variable_HP_smth1_Q15; /* Stat
e of first smoother */ | |
| SKP_int32 variable_HP_smth2_Q15; /* Stat
e of second smoother */ | | SKP_int32 variable_HP_smth2_Q15; /* Stat
e of second smoother */ | |
| #endif | | #endif | |
| SKP_Silk_shape_state_FIX sShape; /* Shap
e state */ | | SKP_Silk_shape_state_FIX sShape; /* Shap
e state */ | |
| SKP_Silk_prefilter_state_FIX sPrefilt; /* Pref
ilter State */ | | SKP_Silk_prefilter_state_FIX sPrefilt; /* Pref
ilter State */ | |
| SKP_Silk_predict_state_FIX sPred; /* Pred
iction state */ | | SKP_Silk_predict_state_FIX sPred; /* Pred
iction state */ | |
|
| SKP_Silk_nsq_state sNSQ; /* Nois | | | |
| e Shape Quantizer State */ | | | |
| SKP_Silk_nsq_state sNSQ_LBRR; /* Nois | | | |
| e Shape Quantizer State ( for low bitrate redundancy ) */ | | | |
| | | | |
| /* Buffer for find pitch and noise shape analysis */ | | /* Buffer for find pitch and noise shape analysis */ | |
| SKP_DWORD_ALIGN SKP_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ]; | | SKP_DWORD_ALIGN SKP_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ]; | |
| SKP_int LTPCorr_Q15; /* Norm
alized correlation from pitch lag estimator */ | | SKP_int LTPCorr_Q15; /* Norm
alized correlation from pitch lag estimator */ | |
| SKP_int32 SNR_dB_Q7; /* Qual
ity setting */ | | SKP_int32 SNR_dB_Q7; /* Qual
ity setting */ | |
| SKP_int BufferedInChannel_ms; /* Simu
lated number of ms buffer because of exceeded TargetRate_bps */ | | SKP_int BufferedInChannel_ms; /* Simu
lated number of ms buffer because of exceeded TargetRate_bps */ | |
| SKP_int speech_activity_Q8; /* Spee
ch activity in Q8 */ | | SKP_int speech_activity_Q8; /* Spee
ch activity in Q8 */ | |
| | | | |
| /* Parameters For LTP scaling Control */ | | /* Parameters For LTP scaling Control */ | |
| SKP_int prevLTPredCodGain_Q7; | | SKP_int prevLTPredCodGain_Q7; | |
| SKP_int HPLTPredCodGain_Q7; | | SKP_int HPLTPredCodGain_Q7; | |
| | | | |
|
| SKP_int32 inBandFEC_SNR_comp_Q8; /* Comp
ensation to SNR_dB when using inband FEC Voiced */ | | SKP_int32 inBandFEC_SNR_comp_Q7; /* Comp
ensation to SNR_dB when using inband FEC Voiced */ | |
| | | | |
| } SKP_Silk_encoder_state_FIX; | | } SKP_Silk_encoder_state_FIX; | |
| | | | |
| /************************/ | | /************************/ | |
| /* Encoder control FIX */ | | /* Encoder control FIX */ | |
| /************************/ | | /************************/ | |
| typedef struct { | | typedef struct { | |
|
| SKP_Silk_encoder_control sCmn; /* Comm | | | |
| on struct, shared with floating-point code */ | | | |
| | | | |
| /* Prediction and coding parameters */ | | /* Prediction and coding parameters */ | |
| SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; | | SKP_int32 Gains_Q16[ MAX_NB_SUBFR ]; | |
| SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; | | SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ]; | |
| SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; | | SKP_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ]; | |
| SKP_int LTP_scale_Q14; | | SKP_int LTP_scale_Q14; | |
|
| | | SKP_int pitchL[ MAX_NB_SUBFR ]; | |
| | | | |
| /* Noise shaping parameters */ | | /* Noise shaping parameters */ | |
| /* Testing */ | | /* Testing */ | |
| SKP_DWORD_ALIGN SKP_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]
; | | SKP_DWORD_ALIGN SKP_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]
; | |
| SKP_DWORD_ALIGN SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]
; | | SKP_DWORD_ALIGN SKP_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ]
; | |
| SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two in
t16 coefficients per int32 value */ | | SKP_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two in
t16 coefficients per int32 value */ | |
| SKP_int GainsPre_Q14[ MAX_NB_SUBFR ]; | | SKP_int GainsPre_Q14[ MAX_NB_SUBFR ]; | |
| SKP_int HarmBoost_Q14[ MAX_NB_SUBFR ]; | | SKP_int HarmBoost_Q14[ MAX_NB_SUBFR ]; | |
| SKP_int Tilt_Q14[ MAX_NB_SUBFR ]; | | SKP_int Tilt_Q14[ MAX_NB_SUBFR ]; | |
| SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; | | SKP_int HarmShapeGain_Q14[ MAX_NB_SUBFR ]; | |
| | | | |
End of changes. 6 change blocks. |
| 10 lines changed or deleted | | 4 lines changed or added | |
|
| SKP_Silk_structs_FLP.h | | SKP_Silk_structs_FLP.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif | | #endif | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Noise shaping analysis state */ | | /* Noise shaping analysis state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
|
| SKP_int LastGainIndex; | | SKP_int8 LastGainIndex; | |
| SKP_float HarmBoost_smth; | | SKP_float HarmBoost_smth; | |
| SKP_float HarmShapeGain_smth; | | SKP_float HarmShapeGain_smth; | |
| SKP_float Tilt_smth; | | SKP_float Tilt_smth; | |
| } SKP_Silk_shape_state_FLP; | | } SKP_Silk_shape_state_FLP; | |
| | | | |
| /********************************/ | | /********************************/ | |
| /* Prefilter state */ | | /* Prefilter state */ | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
| SKP_float sLTP_shp[ LTP_BUF_LENGTH ]; | | SKP_float sLTP_shp[ LTP_BUF_LENGTH ]; | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| /********************************/ | | /********************************/ | |
| typedef struct { | | typedef struct { | |
| SKP_Silk_encoder_state sCmn; /* Comm
on struct, shared with fixed-point code */ | | SKP_Silk_encoder_state sCmn; /* Comm
on struct, shared with fixed-point code */ | |
| | | | |
| SKP_float variable_HP_smth1; /* Stat
e of first smoother */ | | SKP_float variable_HP_smth1; /* Stat
e of first smoother */ | |
| SKP_float variable_HP_smth2; /* Stat
e of second smoother */ | | SKP_float variable_HP_smth2; /* Stat
e of second smoother */ | |
| | | | |
| SKP_Silk_shape_state_FLP sShape; /* Nois
e shaping state */ | | SKP_Silk_shape_state_FLP sShape; /* Nois
e shaping state */ | |
| SKP_Silk_prefilter_state_FLP sPrefilt; /* Pref
ilter State */ | | SKP_Silk_prefilter_state_FLP sPrefilt; /* Pref
ilter State */ | |
| SKP_Silk_predict_state_FLP sPred; /* Pred
iction State */ | | SKP_Silk_predict_state_FLP sPred; /* Pred
iction State */ | |
|
| SKP_Silk_nsq_state sNSQ; /* Nois | | | |
| e Shape Quantizer State */ | | | |
| SKP_Silk_nsq_state sNSQ_LBRR; /* Nois | | | |
| e Shape Quantizer State ( for low bitrate redundancy )*/ | | | |
| | | | |
| /* Buffer for find pitch and noise shape analysis */ | | /* Buffer for find pitch and noise shape analysis */ | |
| SKP_float x_buf[ 2 * MAX_FRAME_LENGTH + LA_SH
APE_MAX ];/* Buffer for find pitch and noise shape analysis */ | | SKP_float x_buf[ 2 * MAX_FRAME_LENGTH + LA_SH
APE_MAX ];/* Buffer for find pitch and noise shape analysis */ | |
| SKP_float LTPCorr; /* Norm
alized correlation from pitch lag estimator */ | | SKP_float LTPCorr; /* Norm
alized correlation from pitch lag estimator */ | |
| SKP_float SNR_dB; /* Qual
ity setting */ | | SKP_float SNR_dB; /* Qual
ity setting */ | |
| SKP_float BufferedInChannel_ms; /* Simu
lated number of ms buffer in channel because of exceeded TargetRate_bps */ | | SKP_float BufferedInChannel_ms; /* Simu
lated number of ms buffer in channel because of exceeded TargetRate_bps */ | |
| SKP_float speech_activity; /* Spee
ch activity */ | | SKP_float speech_activity; /* Spee
ch activity */ | |
| | | | |
| /* Parameters for LTP scaling control */ | | /* Parameters for LTP scaling control */ | |
| SKP_float prevLTPredCodGain; | | SKP_float prevLTPredCodGain; | |
| SKP_float HPLTPredCodGain; | | SKP_float HPLTPredCodGain; | |
| | | | |
| SKP_float inBandFEC_SNR_comp; /* Comp
ensation to SNR_DB when using inband FEC Voiced */ | | SKP_float inBandFEC_SNR_comp; /* Comp
ensation to SNR_DB when using inband FEC Voiced */ | |
| } SKP_Silk_encoder_state_FLP; | | } SKP_Silk_encoder_state_FLP; | |
| | | | |
| /************************/ | | /************************/ | |
| /* Encoder control FLP */ | | /* Encoder control FLP */ | |
| /************************/ | | /************************/ | |
| typedef struct { | | typedef struct { | |
|
| SKP_Silk_encoder_control sCmn; /* Comm | | | |
| on struct, shared with fixed-point code */ | | | |
| | | | |
| /* Prediction and coding parameters */ | | /* Prediction and coding parameters */ | |
| SKP_float Gains[MAX_NB_SUBFR]; | | SKP_float Gains[MAX_NB_SUBFR]; | |
| SKP_float PredCoef[ 2 ][ MAX_L
PC_ORDER ]; /* holds interpolated and final coefficients */ | | SKP_float PredCoef[ 2 ][ MAX_L
PC_ORDER ]; /* holds interpolated and final coefficients */ | |
| SKP_float LTPCoef[LTP_ORDER *
MAX_NB_SUBFR]; | | SKP_float LTPCoef[LTP_ORDER *
MAX_NB_SUBFR]; | |
| SKP_float LTP_scale; | | SKP_float LTP_scale; | |
|
| | | SKP_int pitchL[ MAX_NB_SUBFR ]; | |
| | | | |
| /* Noise shaping parameters */ | | /* Noise shaping parameters */ | |
| SKP_float AR1[ MAX_NB_SUBFR *
MAX_SHAPE_LPC_ORDER ]; | | SKP_float AR1[ MAX_NB_SUBFR *
MAX_SHAPE_LPC_ORDER ]; | |
| SKP_float AR2[ MAX_NB_SUBFR *
MAX_SHAPE_LPC_ORDER ]; | | SKP_float AR2[ MAX_NB_SUBFR *
MAX_SHAPE_LPC_ORDER ]; | |
| SKP_float LF_MA_shp[ MAX_N
B_SUBFR ]; | | SKP_float LF_MA_shp[ MAX_N
B_SUBFR ]; | |
| SKP_float LF_AR_shp[ MAX_N
B_SUBFR ]; | | SKP_float LF_AR_shp[ MAX_N
B_SUBFR ]; | |
| SKP_float GainsPre[ MAX_N
B_SUBFR ]; | | SKP_float GainsPre[ MAX_N
B_SUBFR ]; | |
| SKP_float HarmBoost[ MAX_N
B_SUBFR ]; | | SKP_float HarmBoost[ MAX_N
B_SUBFR ]; | |
| SKP_float Tilt[ MAX_N
B_SUBFR ]; | | SKP_float Tilt[ MAX_N
B_SUBFR ]; | |
| SKP_float HarmShapeGain[ MAX_N
B_SUBFR ]; | | SKP_float HarmShapeGain[ MAX_N
B_SUBFR ]; | |
| | | | |
End of changes. 5 change blocks. |
| 9 lines changed or deleted | | 3 lines changed or added | |
|
| SKP_Silk_tables.h | | SKP_Silk_tables.h | |
| /*********************************************************************** | | /*********************************************************************** | |
|
| Copyright (c) 2006-2010, Skype Limited. All rights reserved. | | Copyright (c) 2006-2011, Skype Limited. All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without | |
| modification, (subject to the limitations in the disclaimer below) | | modification, (subject to the limitations in the disclaimer below) | |
| are permitted provided that the following conditions are met: | | are permitted provided that the following conditions are met: | |
| - Redistributions of source code must retain the above copyright notice, | | - Redistributions of source code must retain the above copyright notice, | |
| this list of conditions and the following disclaimer. | | this list of conditions and the following disclaimer. | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| - Neither the name of Skype Limited, nor the names of specific | | - Neither the name of Skype Limited, nor the names of specific | |
| contributors, may be used to endorse or promote products derived from | | contributors, may be used to endorse or promote products derived from | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| extern const SKP_uint8 SKP_Silk_LTP_per_index_iCDF[ 3 ];
/* 3 */ | | extern const SKP_uint8 SKP_Silk_LTP_per_index_iCDF[ 3 ];
/* 3 */ | |
| extern const SKP_uint8 * const SKP_Silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ];
/* 3 */ | | extern const SKP_uint8 * const SKP_Silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ];
/* 3 */ | |
| extern const SKP_uint8 * const SKP_Silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS
]; /* 3 */ | | extern const SKP_uint8 * const SKP_Silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS
]; /* 3 */ | |
| extern const SKP_int16 SKP_Silk_LTP_gain_middle_avg_RD_Q14; | | extern const SKP_int16 SKP_Silk_LTP_gain_middle_avg_RD_Q14; | |
| extern const SKP_int8 * const SKP_Silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ];
/* 168 */ | | extern const SKP_int8 * const SKP_Silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ];
/* 168 */ | |
| extern const SKP_int8 SKP_Silk_LTP_vq_sizes[ NB_LTP_CBKS ];
/* 3 */ | | extern const SKP_int8 SKP_Silk_LTP_vq_sizes[ NB_LTP_CBKS ];
/* 3 */ | |
| | | | |
| extern const SKP_uint8 SKP_Silk_LTPscale_iCDF[ 3 ];
/* 4 */ | | extern const SKP_uint8 SKP_Silk_LTPscale_iCDF[ 3 ];
/* 4 */ | |
| extern const SKP_int16 SKP_Silk_LTPScales_table_Q14[ 3 ]; | | extern const SKP_int16 SKP_Silk_LTPScales_table_Q14[ 3 ]; | |
| | | | |
|
| const SKP_uint8 SKP_Silk_type_offset_iCDF[6]; | | extern const SKP_uint8 SKP_Silk_type_offset_VAD_iCDF[4]; | |
| /* 6 */ | | /* 4 */ | |
| const SKP_uint8 SKP_Silk_type_offset_joint_iCDF[6][6]; | | extern const SKP_uint8 SKP_Silk_type_offset_no_VAD_iCDF[2]; | |
| /* 36 */ | | /* 2 */ | |
| | | | |
| | | extern const SKP_uint8 * const SKP_Silk_LBRR_flags_iCDF_ptr[2]; | |
| | | /* 10 */ | |
| | | | |
| extern const SKP_uint8 SKP_Silk_NLSF_interpolation_factor_iCDF[ 5 ];
/* 5 */ | | extern const SKP_uint8 SKP_Silk_NLSF_interpolation_factor_iCDF[ 5 ];
/* 5 */ | |
| | | | |
| /* NLSF codebooks */ | | /* NLSF codebooks */ | |
| extern const SKP_Silk_NLSF_CB_struct SKP_Silk_NLSF_CB0_16, SKP_Silk_NLSF_CB
1_16; | | extern const SKP_Silk_NLSF_CB_struct SKP_Silk_NLSF_CB0_16, SKP_Silk_NLSF_CB
1_16; | |
| extern const SKP_Silk_NLSF_CB_struct SKP_Silk_NLSF_CB0_10, SKP_Silk_NLSF_CB
1_10; | | extern const SKP_Silk_NLSF_CB_struct SKP_Silk_NLSF_CB0_10, SKP_Silk_NLSF_CB
1_10; | |
| | | | |
| /* Piece-wise linear mapping from bitrate in kbps to coding quality in dB S
NR */ | | /* Piece-wise linear mapping from bitrate in kbps to coding quality in dB S
NR */ | |
|
| extern const SKP_uint16 TargetRate_table_NB[ TARGET_RATE_TAB_SZ ]; | | extern const SKP_int32 TargetRate_table_NB[ TARGET_RATE_TAB_SZ ]; | |
| extern const SKP_uint16 TargetRate_table_MB[ TARGET_RATE_TAB_SZ ]; | | extern const SKP_int32 TargetRate_table_MB[ TARGET_RATE_TAB_SZ ]; | |
| extern const SKP_uint16 TargetRate_table_WB[ TARGET_RATE_TAB_SZ ]; | | extern const SKP_int32 TargetRate_table_WB[ TARGET_RATE_TAB_SZ ]; | |
| extern const SKP_uint16 SNR_table_Q1[ TARGET_RATE_TAB_SZ ]; | | extern const SKP_int16 SNR_table_Q1[ TARGET_RATE_TAB_SZ ]; | |
| | | | |
| /* Decoder high-pass filter coefficients */ | | /* Decoder high-pass filter coefficients */ | |
| extern const SKP_int32 SKP_Silk_Dec_A_HP_16[ DEC_HP_ORDER ];
/* 2 */ | | extern const SKP_int32 SKP_Silk_Dec_A_HP_16[ DEC_HP_ORDER ];
/* 2 */ | |
| extern const SKP_int32 SKP_Silk_Dec_B_HP_16[ DEC_HP_ORDER + 1 ];
/* 3 */ | | extern const SKP_int32 SKP_Silk_Dec_B_HP_16[ DEC_HP_ORDER + 1 ];
/* 3 */ | |
| extern const SKP_int32 SKP_Silk_Dec_A_HP_12[ DEC_HP_ORDER ];
/* 2 */ | | extern const SKP_int32 SKP_Silk_Dec_A_HP_12[ DEC_HP_ORDER ];
/* 2 */ | |
| extern const SKP_int32 SKP_Silk_Dec_B_HP_12[ DEC_HP_ORDER + 1 ];
/* 3 */ | | extern const SKP_int32 SKP_Silk_Dec_B_HP_12[ DEC_HP_ORDER + 1 ];
/* 3 */ | |
| extern const SKP_int32 SKP_Silk_Dec_A_HP_8[ DEC_HP_ORDER ];
/* 2 */ | | extern const SKP_int32 SKP_Silk_Dec_A_HP_8[ DEC_HP_ORDER ];
/* 2 */ | |
| extern const SKP_int32 SKP_Silk_Dec_B_HP_8[ DEC_HP_ORDER + 1 ];
/* 3 */ | | extern const SKP_int32 SKP_Silk_Dec_B_HP_8[ DEC_HP_ORDER + 1 ];
/* 3 */ | |
| | | | |
|
| /* Table for frame termination indication */ | | | |
| extern const SKP_uint8 SKP_Silk_LBRR_Present_iCDF[ 2 ]; | | | |
| | | | |
| /* Table for random seed */ | | | |
| extern const SKP_uint8 SKP_Silk_Seed_iCDF[ 4 ]; | | | |
| | | | |
| /* Quantization offsets */ | | /* Quantization offsets */ | |
| extern const SKP_int16 SKP_Silk_Quantization_Offsets_Q10[ 2 ][ 2 ]; | | extern const SKP_int16 SKP_Silk_Quantization_Offsets_Q10[ 2 ][ 2 ]; | |
| | | | |
| #if SWITCH_TRANSITION_FILTERING | | #if SWITCH_TRANSITION_FILTERING | |
| /* Interpolation points for filter coefficients used in the bandwidth trans
ition smoother */ | | /* Interpolation points for filter coefficients used in the bandwidth trans
ition smoother */ | |
| extern const SKP_int32 SKP_Silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][
TRANSITION_NB ]; | | extern const SKP_int32 SKP_Silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][
TRANSITION_NB ]; | |
| extern const SKP_int32 SKP_Silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][
TRANSITION_NA ]; | | extern const SKP_int32 SKP_Silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][
TRANSITION_NA ]; | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| | | | |
End of changes. 4 change blocks. |
| 15 lines changed or deleted | | 12 lines changed or added | |
|
| celt.h | | celt.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| modification, are permitted provided that the following conditions | | modification, are permitted provided that the following conditions | |
| are met: | | are met: | |
| | | | |
| - Redistributions of source code must retain the above copyright | | - Redistributions of source code must retain the above copyright | |
| notice, this list of conditions and the following disclaimer. | | notice, this list of conditions and the following disclaimer. | |
| | | | |
| - Redistributions in binary form must reproduce the above copyright | | - Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | | notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. | | documentation and/or other materials provided with the distribution. | |
| | | | |
|
| - Neither the name of the Xiph.org Foundation nor the names of its | | | |
| contributors may be used to endorse or promote products derived from | | | |
| this software without specific prior written permission. | | | |
| | | | |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O
R | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O
R | |
| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| | | | |
| skipping to change at line 223 | | skipping to change at line 219 | |
| @param compressed The compressed data is written here. This may not alias
pcm or | | @param compressed The compressed data is written here. This may not alias
pcm or | |
| * optional_synthesis. | | * optional_synthesis. | |
| @param nbCompressedBytes Maximum number of bytes to use for compressing th
e frame | | @param nbCompressedBytes Maximum number of bytes to use for compressing th
e frame | |
| * (can change from one frame to another) | | * (can change from one frame to another) | |
| @return Number of bytes written to "compressed". Will be the same as | | @return Number of bytes written to "compressed". Will be the same as | |
| * "nbCompressedBytes" unless the stream is VBR and will never be lar
ger. | | * "nbCompressedBytes" unless the stream is VBR and will never be lar
ger. | |
| * If negative, an error has occurred (see error codes). It is IMPORT
ANT that | | * If negative, an error has occurred (see error codes). It is IMPORT
ANT that | |
| * the length returned be somehow transmitted to the decoder. Otherwi
se, no | | * the length returned be somehow transmitted to the decoder. Otherwi
se, no | |
| * decoding is possible. | | * decoding is possible. | |
| */ | | */ | |
|
| EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, int frame_s
ize, unsigned char *compressed, int nbCompressedBytes); | | EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, int frame_s
ize, unsigned char *compressed, int maxCompressedBytes); | |
| | | | |
| /** Encodes a frame of audio. | | /** Encodes a frame of audio. | |
| @param st Encoder state | | @param st Encoder state | |
| @param pcm PCM audio in signed 16-bit format (native endian). There must b
e | | @param pcm PCM audio in signed 16-bit format (native endian). There must b
e | |
| * exactly frame_size samples per channel. | | * exactly frame_size samples per channel. | |
| @param compressed The compressed data is written here. This may not alias
pcm or | | @param compressed The compressed data is written here. This may not alias
pcm or | |
| * optional_synthesis. | | * optional_synthesis. | |
| @param nbCompressedBytes Maximum number of bytes to use for compressing th
e frame | | @param nbCompressedBytes Maximum number of bytes to use for compressing th
e frame | |
| * (can change from one frame to another) | | * (can change from one frame to another) | |
| @return Number of bytes written to "compressed". Will be the same as | | @return Number of bytes written to "compressed". Will be the same as | |
| * "nbCompressedBytes" unless the stream is VBR and will never be lar
ger. | | * "nbCompressedBytes" unless the stream is VBR and will never be lar
ger. | |
| * If negative, an error has occurred (see error codes). It is IMPORT
ANT that | | * If negative, an error has occurred (see error codes). It is IMPORT
ANT that | |
| * the length returned be somehow transmitted to the decoder. Otherwi
se, no | | * the length returned be somehow transmitted to the decoder. Otherwi
se, no | |
| * decoding is possible. | | * decoding is possible. | |
| */ | | */ | |
|
| EXPORT int celt_encode(CELTEncoder *st, const celt_int16 *pcm, int frame_si
ze, unsigned char *compressed, int nbCompressedBytes); | | EXPORT int celt_encode(CELTEncoder *st, const celt_int16 *pcm, int frame_si
ze, unsigned char *compressed, int maxCompressedBytes); | |
| | | | |
| /** Query and set encoder parameters | | /** Query and set encoder parameters | |
| @param st Encoder state | | @param st Encoder state | |
| @param request Parameter to change or query | | @param request Parameter to change or query | |
| @param value Pointer to a 32-bit int value | | @param value Pointer to a 32-bit int value | |
| @return Error code | | @return Error code | |
| */ | | */ | |
| EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...); | | EXPORT int celt_encoder_ctl(CELTEncoder * st, int request, ...); | |
| | | | |
| /* Decoder stuff */ | | /* Decoder stuff */ | |
| | | | |
End of changes. 3 change blocks. |
| 6 lines changed or deleted | | 2 lines changed or added | |
|