Commit b62d99ab authored by vaclav's avatar vaclav
Browse files

- "const" to function input parameters

- define local function as static
parent 6e313005
Loading
Loading
Loading
Loading
+40 −44
Original line number Diff line number Diff line
@@ -8663,17 +8663,13 @@ void ApplyFdCng(
    const int16_t concealWholeFrame, /* i  : binary flag indicating frame loss       */
    const int16_t is_music );

void perform_noise_estimation_dec(
    const float *timeDomainInput,
    float *power_spectrum,
    HANDLE_FD_CNG_DEC hFdCngDec,   /* i/o: FD_CNG structure                                 */
    const int16_t element_mode,    /* i  : element mode type                                */
    const int16_t bwidth,          /* i  : audio bandwidth                                  */
    const int16_t L_frame,         /* i  : frame length at internal Fs                      */
    const int16_t last_L_frame,    /* i  : frame length of the last frame at internal Fs    */
    const int32_t last_core_brate, /* i  : previous frame core bitrate                      */
    const int16_t VAD              /* i  : VAD flag in the decoder                          */
void generate_comfort_noise_dec(
    float **bufferReal,     /* o  : Real part of input bands      */
    float **bufferImag,     /* o  : Imaginary part of input bands */
    Decoder_State *st,      /* i/o: decoder state structure       */
    const int16_t nchan_out /* i  : number of output channels     */
);

/*! r: CNG energy */
float cng_energy(
    const int16_t element_mode, /* i  : element mode                            */
@@ -8777,40 +8773,40 @@ void ReadFromBitstream(
    int16_t **pStream,
    int16_t *pnSize );

void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue );
void *SetTnsFilterOrder( void *p, int16_t index, int16_t value );
void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue );
void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value );
void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue );
void *SetTnsEnabled( void *p, int16_t index, int16_t value );
void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue );
void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value );
void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue );
void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value );

void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue );
void *SetTnsOnWhite( void *p, int16_t index, int16_t value );

int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index );
int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index );
int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );

int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index );
int16_t EncodeWBTCX20TnsFilterCoeff( int16_t, int16_t index );
int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue );

int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBits( int16_t value, int16_t index );
int16_t EncodeTnsFilterOrder( int16_t value, int16_t index );
int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue );
void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value );
void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue );
void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value );
void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsEnabled( void *p, const int16_t index, const int16_t value );
void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value );
void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value );

void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue );
void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value );

int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index );
int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index );
int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );

int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index );
int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t, const int16_t index );
int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue );

int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue );
int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index );
int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index );
int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue );

void ResetTnsData(
    STnsData *pTnsData );
+30 −30
Original line number Diff line number Diff line
@@ -287,67 +287,67 @@ static int16_t DecodeUsingTable( Decoder_State *st, int16_t *pValue, const Codin

/* TNS filter coefficients */

void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue )
void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = ( (int16_t const *) p )[index] + INDEX_SHIFT;
    return NULL;
}

void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value )
void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value )
{
    ( (int16_t *) p )[index] = value - INDEX_SHIFT;
    return NULL;
}

int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index )
int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return GetBitsFromTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes );
}

int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index )
int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return EncodeUsingTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes );
}

int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes );
}

int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index )
int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return GetBitsFromTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes );
}

int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index )
int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return EncodeUsingTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes );
}

int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes );
}

int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index )
int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return GetBitsFromTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes );
}

int16_t EncodeWBTCX20TnsFilterCoeff( int16_t value, int16_t index )
int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return EncodeUsingTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes );
}

int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) );
    return DecodeUsingTable( st, pValue, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes );
@@ -356,67 +356,67 @@ int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *

/* TNS filter order */

void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue )
void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = ( (STnsFilter const *) p )[index].order;
    return ( (STnsFilter const *) p )[index].coefIndex;
}

void *SetTnsFilterOrder( void *p, int16_t index, int16_t value )
void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value )
{
    ( (STnsFilter *) p )[index].order = value;
    return ( (STnsFilter *) p )[index].coefIndex;
}

int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index )
int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index )
{
    (void) index;
    return GetBitsFromTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes );
}

int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index )
int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index )
{
    (void) index;
    return EncodeUsingTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes );
}

int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    (void) index;
    return DecodeUsingTable( st, pValue, codesTnsOrderTCX20, nTnsOrderCodes );
}

int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index )
int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index )
{
    (void) index;
    return GetBitsFromTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes );
}

int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index )
int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index )
{
    (void) index;
    return EncodeUsingTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes );
}

int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    (void) index;
    return DecodeUsingTable( st, pValue, codesTnsOrderTCX10, nTnsOrderCodes );
}

int16_t GetTnsFilterOrderBits( int16_t value, int16_t index )
int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index )
{
    (void) index;
    return GetBitsFromTable( value - 1, codesTnsOrder, nTnsOrderCodes );
}

int16_t EncodeTnsFilterOrder( int16_t value, int16_t index )
int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index )
{
    (void) index;
    return EncodeUsingTable( value - 1, codesTnsOrder, nTnsOrderCodes );
}

int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue )
int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue )
{
    (void) index;
    return DecodeUsingTable( st, pValue, codesTnsOrder, nTnsOrderCodes );
@@ -424,13 +424,13 @@ int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue

/* Number of TNS filters */

void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue )
void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = (int16_t) abs( ( (STnsData const *) p )[index].nFilters );
    return ( (STnsData const *) p )[index].filter;
}

void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value )
void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value )
{
    ( (STnsData *) p )[index].nFilters = (int16_t) abs( value );
    return ( (STnsData *) p )[index].filter;
@@ -438,13 +438,13 @@ void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value )

/* TNS enabled/disabled flag */

void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue )
void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0;
    return NULL;
}

void *SetTnsEnabled( void *p, int16_t index, int16_t value )
void *SetTnsEnabled( void *p, const int16_t index, const int16_t value )
{
    (void) p, (void) index, (void) value;
    return NULL;
@@ -452,25 +452,25 @@ void *SetTnsEnabled( void *p, int16_t index, int16_t value )

/* TNS on whitened spectra  flag */

void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue )
void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = ( (STnsData const *) p )[index].tnsOnWhitenedSpectra > 0 ? 1 : 0;
    return NULL;
}

void *SetTnsOnWhite( void *p, int16_t index, int16_t value )
void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value )
{
    ( (STnsData *) p )[index].tnsOnWhitenedSpectra = value;
    return NULL;
}

void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue )
void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue )
{
    *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0;
    return ( (STnsData const *) p )[index].filter;
}

void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value )
void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value )
{
    ( (STnsData *) p )[index].nFilters = value;
    return ( (STnsData *) p )[index].filter;
+9 −1
Original line number Diff line number Diff line
@@ -58,6 +58,14 @@
#define CNA_ACT_DN_FACT            0.7 /* downward updating factor for CNA during active frames */
#define FIRST_CNA_NOISE_UPD_FRAMES 5   /* minimum number of CN initialization frames */


/*-------------------------------------------------------------------
 * Local fucntions declarations
 *-------------------------------------------------------------------*/

static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, const int16_t element_mode, const int16_t bwidth, const int16_t L_frame, const int16_t last_L_frame, const int32_t last_core_brate, const int16_t VAD );


/*-------------------------------------------------------------------
 * createFdCngDec()
 *
@@ -619,7 +627,7 @@ void ApplyFdCng(
 * Perform noise estimation at the decoder
 *-------------------------------------------------------------------*/

void perform_noise_estimation_dec(
static void perform_noise_estimation_dec(
    const float *timeDomainInput,
    float *power_spectrum,
    HANDLE_FD_CNG_DEC hFdCngDec,   /* i/o: FD_CNG structure containing all buffers and variables */
+2 −0
Original line number Diff line number Diff line
@@ -649,4 +649,6 @@ static void run_min_stats(
        /* restore VAD (see above) */
        st->VAD = save_VAD[ch];
    }

    return;
}