Commit 437133dc authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Core coder functions conversion and integration: acelp core, stereo tcx core

[x] acelp core sub-functions integration
[x] stereo dft res cod sub-functions
[x] stereo_tcx_core_enc sub-functions and cleanup
[x] TNSAnalysisStereo && enc_ste_pre_mdct integration
[x] sns_compute_scf_fx, ShapeSpectrum_ivas_fx, Quantize SNS in ivas_mdct_core_whitening_enc integration
[x] fd cng encode stack
[x] front_vad_fx() integration
parent 5ecf0b22
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -209,6 +209,15 @@ enum{
#define L_FRAME8k                       160             /* Frame size in samples at 8kHz */
#define L_FRAME4k                       80              /* Frame size in samples at 4kHz */

#define ONE_BY_L_FRAME48k_Q31           2236962
#define ONE_BY_L_FRAME32k_Q31           3355443
#define ONE_BY_L_FRAME25_6k_Q31         4194304
#define ONE_BY_L_FRAME16k_Q31           6710886
#define ONE_BY_L_FRAME_Q31              8388608
#define ONE_BY_240_Q31                  8947849
#define ONE_BY_L_FRAME8k_Q31            13421772
#define ONE_BY_L_FRAME4k_Q31            26843546

#define L_SPEC48k                       800             /* HQ spectrum length at 48kHz */
#define L_SPEC32k                       640             /* HQ spectrum length at 32kHz */
#define L_SPEC16k                       320             /* HQ spectrum length at 16kHz */
@@ -737,6 +746,7 @@ enum
#define PIT_L_INTERPOL6_2                   17
#define PIT_FIR_SIZE6_2                     ( PIT_UP_SAMP6 * PIT_L_INTERPOL6_2 + 1 )
#define E_MIN                               0.0035f                /* minimum allowable energy */
#define E_MIN_Q11_FX                            7                      /* minimum allowable energy in Q11*/
#define STEP_DELTA                          0.0625f                /* quantization step for tilt compensation of gaussian cb. excitation */
#define GAMMA_EV                            0.92f                  /* weighting factor for core synthesis error weighting */
#define FORMANT_SHARPENING_NOISE_THRESHOLD  21.0f                  /* lp_noise level above which formant sharpening is deactivated */
@@ -2752,6 +2762,7 @@ enum
#define Fs_2_16k                              20480     /* lsf max value (Use in reorder_fx.c) */

#define LG10                                  24660       /*  10*log10(2)  in Q13                 */
#define TEN_MULT_LOG10_2_IN_Q29               1616142464             /* (10 * log10(2)) =  3.0103 (in Q29) */
#define LG10_s3_0                             16440       /* 10*log10(2)/1.55 = 1.00343331 in Q14              */
#define LOG2_10                               27213      /* log base 2 of 10 in Q12 */
#define LOG2_10_Q29                           1783446566      /* log base 2 of 10 in Q12 */
+32 −3
Original line number Diff line number Diff line
@@ -703,6 +703,7 @@ void stereo_tcx_init_enc(
    Encoder_State *st                                           /* i/o: encoder state structure                 */
);

#ifndef IVAS_FLOAT_FIXED
void stereo_tcx_core_enc(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const float new_samples_12k8[],                             /* i  : buffer of input signal @12.8 kHz        */
@@ -715,7 +716,6 @@ void stereo_tcx_core_enc(
    const int16_t vad_hover_flag                                /* i  : VAD hangover flag                       */
);

#ifndef IVAS_FLOAT_FIXED
void stereo_tcx_core_dec(
    Decoder_State *st,                                          /* i/o: decoder state structure                 */
    const FRAME_MODE frameMode,                                 /* i  : Decoder frame mode                      */
@@ -3102,7 +3102,17 @@ void TNSAnalysisStereo(
    int16_t param_core[][NB_DIV * NPRM_DIV],                    /* o  : quantized noise filling level           */
    const int16_t mct_on                                        /* i  : flag mct block (1) or stereo (0)        */
);

#ifdef IVAS_FLOAT_FIXED
void TNSAnalysisStereo_fx(
    Encoder_State **sts,                        /* i  : encoder state handle                    */
    Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* o  : MDST spectrum                       Qx*/
    const Word16 bWhitenedDomain,               /* i  : whitened domain flag                    Q0*/
    Word16 tnsSize[CPE_CHANNELS][NB_DIV],       /* i  : number of tns parameters put into prm   Q0*/
    Word16 tnsBits[CPE_CHANNELS][NB_DIV],       /* i  : number of tns bits in the frame         Q0*/
    Word16 param_core[][NB_DIV * NPRM_DIV],     /* o  : TNS parameters                          Q0*/
    const Word16 mct_on                         /* i  : flag mct block (1) or stereo (0)        Q0*/
);
#endif
void InternalTCXDecoder(
    Encoder_State *st,                                          /* i/o: state handle                            */
    const int16_t frame_cnt,                                    /* i  : frame counter in the super_frame        */
@@ -3681,7 +3691,26 @@ ivas_error front_vad(
    float *PS_out,                                              /* o  : energy spectrum                         */
    float *Bin_E_out                                            /* o  : log-energy spectrum of the current frame*/
);

#ifdef IVAS_FLOAT_FIXED
ivas_error front_vad_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure, nullable         */
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const ENCODER_CONFIG_HANDLE hEncoderConfig,                 /* i  : configuration structure                 */
    FRONT_VAD_ENC_HANDLE *hFrontVads,                           /* i/o: front-VAD handles                       */
    const int16_t MCT_flag,                                     /* i  : hMCT handle allocated (1) or not (0)    */
    const int16_t input_frame,                                  /* i  : frame length                            */
    int16_t vad_flag_dtx[],                                     /* o  : HE-SAD flag with additional DTX HO      */
    float fr_bands[][2 * NB_BANDS],                             /* i  : energy in frequency bands               */
    float Etot_LR[],                                            /* o  : total energy Left & Right channel       */
    float lf_E[][2 * VOIC_BINS],                                /* i  : per bin spectrum energy in lf, LR channels  */
    int16_t localVAD_HE_SAD[],                                  /* o  : HE-SAD flag without hangover, LR channels   */
    int16_t vad_hover_flag[],                                   /* o  : VAD hangover flag                           */
    float band_energies_LR[2 * NB_BANDS],                       /* o  : energy in critical bands without minimum noise floor E_MIN */
    float *PS_out,                                              /* o  : energy spectrum                         */
    float *Bin_E_out,                                            /* o  : log-energy spectrum of the current frame*/
    Word16 Qinp
);
#endif
ivas_error front_vad_spar(
    SPAR_ENC_HANDLE hSpar,                                      /* i/o: SPAR encoder structure                  */
    const float *omni_in,                                       /* i  : omnidirectional input signal            */
+49 −5
Original line number Diff line number Diff line
@@ -296,10 +296,10 @@ Word16 res_bpf_adapt_fx(

// ivas_sns_com_fx.c
void sns_compute_scf_fx(
    Word32 spectrum[],
    Word32 spectrum[], /* i  : Spectrum (Q_in) */
    const PsychoacousticParameters *pPsychParams,
    const Word16 L_frame,
    Word32 *scf,
    Word32 *scf, /* o  : Scalefactors (Q16)*/
    Word16 q );

void sns_interpolate_scalefactors_fx(
@@ -1402,10 +1402,18 @@ void dtx_read_padding_bits_fx(
    DEC_CORE_HANDLE st,
    const Word16 num_bits );

void FdCngEncodeMDCTStereoSID_fx(
    CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure     */
);

void FdCngDecodeMDCTStereoSID_fx(
    CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure     */
);

void FdCngEncodeDiracMDCTStereoSID_fx(
    CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure             */
);

void FdCngDecodeDiracMDCTStereoSID_fx(
    CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure     */
);
@@ -2700,7 +2708,6 @@ void rc_uni_enc_encode_bits(
    const Word16 bits            /* i  : Number of bits                      */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_dft_enc_process_fx(
    CPE_ENC_HANDLE hCPE,           /* i/o: CPE encoder structure       */
    const Word16 vad_flag_dtx[],   /* i  : VAD dtx flags               */
@@ -2708,6 +2715,32 @@ void stereo_dft_enc_process_fx(
    const Word16 input_frame       /* i  : input frame length          */
);

void stereo_dft_cng_side_gain_fx(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo handle            */
    STEREO_CNG_ENC_HANDLE hStereoCng,      /* i/o: Stereo CNG data structure    */
    const Word32 core_brate,               /* i  : core bitrate                 */
    const Word32 last_core_brate,          /* i  : last core bitrate            */
    const Word16 bwidth                    /* i  : audio band-width             */
);

Word16 quantize_sns_fx(
    Word32 sns_in_fx[CPE_CHANNELS][NB_DIV][M],   /* sns_e */
    Word32 snsQ_out_fx[CPE_CHANNELS][NB_DIV][M], /* sns_e */
    Word16 *sns_e,
    Encoder_State **sts,
    Word16 *indices,           /* Q0 */
    Word16 *zero_side_flag,    /* Q0 */
    Word16 *sns_stereo_mode ); /* Q0 */

void stereo_cng_upd_counters_fx(
    STEREO_CNG_ENC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure     */
    const Word32 element_mode,        /* i  : element mode                  */
    const Word16 nbands,              /* i  : Number of bands in active     */
    const Word32 sidSideGain[],       /* i  : SID side gains                */
    const Word16 burst_ho_count,      /* i  : Hang-over count               */
    Word16 *coh_fade_counter          /* i  : Coherence fade counter        */
);

void spectral_balancer_fx16(
    Word16 *signal,        /* i/o  : signal  Qx                 */
    Word16 *mem,           /* i/o  : mem  Qx                    */
@@ -2763,8 +2796,6 @@ void acelp_fast_fx(
    const Word16 L_subfr                                     /* i  : subframe length                               */
);

#endif

void ivas_mdct_quant_coder_fx(
    CPE_ENC_HANDLE hCPE,                  /* i/o: Encoder CPE handle                   */
    Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i  : bits needed for TNS parameters       */
@@ -2819,4 +2850,17 @@ void InternalTCXDecoder_fx(
    Word16 synth[],                  /* o  : time domain signal                      */
    Word16 *gain_tcx_q               /* o  : quantized global gain (at low bitrates) */
);

void stereo_tcx_core_enc(
    Encoder_State *st,                /* i/o: encoder state structure                    */
    const float new_samples_12k8[],   /* i  : buffer of input signal @12.8 kHz           */
    const float new_samples_16k[],    /* i  : buffer of input signal @16 kHz             */
    const Word16 Aw_fx[],             /* i  : weighted A(z) unquant. for subframes, Q12  */
    float lsp_new[],                  /* i  : LSPs at the end of the frame, Q15          */
    float lsp_mid[],                  /* i  : LSPs in the middle of the frame, Q15       */
    Word16 pitch_buf_fx[NB_SUBFR16k], /* o  : pitch for each subframe, Q6                */
    const Word16 last_element_mode,   /* i  : last element mode, Q0                      */
    const Word16 vad_hover_flag       /* i  : VAD hangover flag, Q0                      */
);

#endif
+82 −61
Original line number Diff line number Diff line
@@ -50,22 +50,24 @@
 *-------------------------------------------------------------------*/

void sns_compute_scf_fx(
    Word32 spectrum[],
    Word32 spectrum[], /* i  : Spectrum (Q_in) */
    const PsychoacousticParameters *pPsychParams,
    const Word16 L_frame,
    Word32 *scf,
    Word32 *scf, /* o  : Scalefactors (Q16)*/
    Word16 q )
{
    Word16 i, n, k, exp;
    Word16 i, n, k;
    Word32 x[FDNS_NPTS], xs[FDNS_NPTS], mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS];
    Word64 x_64[FDNS_NPTS];
    Word64 sum;
    Word32 L_tmp;
    const Word16 *pow_tilt;
    const Word32 *pow_tilt;
    const UWord8 nBands = pPsychParams->nBands;
    move16();
    const UWord8 *bandLengths = pPsychParams->bandLengths;
    Word8 bw = 0;
    move16();
    Word16 q_shift;

    const Word16 w_0 = 2730; // (1.0f / 12.0f) in Q15
    move16();
@@ -82,6 +84,7 @@ void sns_compute_scf_fx(

    assert( nBands == FDNS_NPTS );

    set64_fx( x_64, 0, FDNS_NPTS );
    set32_fx( x, 0, FDNS_NPTS );

    IF( bandLengths == NULL )
@@ -93,19 +96,13 @@ void sns_compute_scf_fx(
        move16();
        FOR( i = 0; i < nBands; ++i )
        {
            x[i] = 0;
            move32();
            x_64[i] = 0;
            move64();
            FOR( n = 0; n < bw; ( ++n, ++k ) )
            {
                x[i] = L_add_sat( x[i], spectrum[k] );
                move32();
                x_64[i] = W_add( x_64[i], W_deposit32_l( spectrum[k] ) ); // Q_in
                move64();
            }
            exp = 15;
            move16();
            Word16 inv_bw = Invert16( bw, &exp );
            inv_bw = shl( inv_bw, exp );
            x[i] = Mpy_32_16_1( x[i], inv_bw );
            move32();
        }
    }
    ELSE
@@ -115,46 +112,73 @@ void sns_compute_scf_fx(
        move32();
        FOR( i = 0; i < nBands; ++i )
        {
            x[i] = 0;
            move32();
            x_64[i] = 0;
            move64();
            FOR( n = 0; n < bandLengths[i]; ( ++n, ++k ) )
            {
                x[i] = L_add_sat( x[i], spectrum[k] );
                move32();
                x_64[i] = W_add( x_64[i], W_deposit32_l( spectrum[k] ) ); // Q_in
                move64();
            }
        }
    }

    /* Move accumulated values to 32-bit */
    q_shift = W_norm( x_64[0] );
    FOR( i = 1; i < nBands; ++i )
    {
        q_shift = s_min( q_shift, W_norm( x_64[i] ) );
    }
    FOR( i = 0; i < nBands; ++i )
    {
        x[i] = W_extract_l( W_shl( x_64[i], sub( q_shift, 32 ) ) ); // Q_in + (q_shift - 32)
    }
            exp = 15;
            move16();

    IF( bandLengths == NULL )
    {
        Word16 inv_bw;
        bw = (Word8) shr( L_frame, 6 );
        move16();
        inv_bw = div_l( ONE_IN_Q16, bw ); // Q15
        FOR( i = 0; i < nBands; ++i )
        {
            x[i] = Mpy_32_16_1( x[i], inv_bw ); // Q_in + (q_shift - 32)
            move32();
        }
    }
    ELSE
    {
        FOR( i = 0; i < nBands; ++i )
        {
            Word16 inv_bw = div_l( ONE_IN_Q16, bandLengths[i] ); // Q15
            x[i] = Mpy_32_16_1( x[i], inv_bw );
            x[i] = Mpy_32_16_1( x[i], inv_bw );                  // Q_in + (q_shift - 32)
            move32();
        }
    }

    /* Smoothing */
    xs[0] = L_add( Mpy_32_16_1( x[0], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[1], 8192 /* 0.25 in Q15 */ ) );
    xs[0] = L_add( Mpy_32_16_1( x[0], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[1], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32)
    move32();

    FOR( i = 1; i < FDNS_NPTS - 1; i++ )
    {
        xs[i] = L_add( L_add( Mpy_32_16_1( x[i], 16384 /* 0.5 in Q15 */ ), Mpy_32_16_1( x[i - 1], 8192 /* 0.25 in Q15 */ ) ), Mpy_32_16_1( x[i + 1], 8192 /* 0.25 in Q15 */ ) );
        xs[i] = L_add( L_add( Mpy_32_16_1( x[i], 16384 /* 0.5 in Q15 */ ), Mpy_32_16_1( x[i - 1], 8192 /* 0.25 in Q15 */ ) ), Mpy_32_16_1( x[i + 1], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32)
        move32();
    }

    xs[FDNS_NPTS - 1] = L_add( Mpy_32_16_1( x[FDNS_NPTS - 1], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[FDNS_NPTS - 2], 8192 /* 0.25 in Q15 */ ) );
    xs[FDNS_NPTS - 1] = L_add( Mpy_32_16_1( x[FDNS_NPTS - 1], 24576 /* 0.75 in Q15 */ ), Mpy_32_16_1( x[FDNS_NPTS - 2], 8192 /* 0.25 in Q15 */ ) ); // Q_in + (q_shift - 32)
    move32();

    /* Pre-emphasis */
    SWITCH( L_frame )
    {
        case L_FRAME16k:
            pow_tilt = pow_tilt_16k; // Q7
            pow_tilt = pow_tilt_16k; // Q23
            BREAK;
        case L_FRAME25_6k:
            pow_tilt = pow_tilt_25_6k; // Q7
            pow_tilt = pow_tilt_25_6k; // Q23
            BREAK;
        case L_FRAME32k:
            pow_tilt = pow_tilt_32k; // Q7
            pow_tilt = pow_tilt_32k; // Q23
            BREAK;
        default:
            pow_tilt = NULL;
@@ -163,9 +187,7 @@ void sns_compute_scf_fx(

    FOR( i = 0; i < FDNS_NPTS; i++ )
    {
        xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] );
        move32();
        xs[i] = L_shl( xs[i], Q4 ); // xs => Q8
        xs[i] = Mpy_32_32( xs[i], pow_tilt[i] ); // Q_in + (q_shift - 32)
        move32();
    }

@@ -174,20 +196,18 @@ void sns_compute_scf_fx(
    move64();
    FOR( Word16 ind = 0; ind < FDNS_NPTS; ind++ )
    {
        sum = W_add( sum, (Word64) xs[ind] );
        sum = W_add( sum, (Word64) xs[ind] ); // Q_in + (q_shift - 32)
    }
    mean = (Word32) W_shr( sum, 6 );
    move32();

    nf = Mpy_32_16_1( mean, 3 ); // 3 => powf( 10.0f, -4.0f ) in Q15
    nf = L_max( nf, 0 );         // 0 => powf( 2.0f, -32.0f ) in Q15
    mean = W_extract_l( W_shr( sum, 6 ) ); // Q_in + (q_shift - 32)

    nf = Mpy_32_32( mean, 214748 /* powf( 10.0f, -4.0f ) in Q31 */ ); // Q_in + (q_shift - 32)
    nf = L_max( nf, 0 /* powf( 2.0f, -32.0f ) in Q31 */ );            // Q_in + (q_shift - 32)

    FOR( i = 0; i < FDNS_NPTS; i++ )
    {
        if ( LT_32( xs[i], nf ) )
        {
            xs[i] = nf;
            xs[i] = nf; // Q_in + (q_shift - 32)
            move32();
        }
    }
@@ -205,13 +225,13 @@ void sns_compute_scf_fx(

    /* Downsampling */
    L_tmp = L_deposit_l( 0 );
    L_tmp = Madd_32_16( L_tmp, xl[0], w_0 );
    L_tmp = Madd_32_16( L_tmp, xl[0], w_1 );
    L_tmp = Madd_32_16( L_tmp, xl[1], w_2 );
    L_tmp = Madd_32_16( L_tmp, xl[2], w_3 );
    L_tmp = Madd_32_16( L_tmp, xl[3], w_4 );
    L_tmp = Madd_32_16( L_tmp, xl[4], w_5 );
    xl4[0] = L_tmp;
    L_tmp = Madd_32_16( L_tmp, xl[0], w_0 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[0], w_1 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[1], w_2 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[2], w_3 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[3], w_4 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[4], w_5 ); // Q16
    xl4[0] = L_tmp;                          // Q16
    move32();

    FOR( n = 1; n < SNS_NPTS - 1; n++ )
@@ -219,37 +239,38 @@ void sns_compute_scf_fx(
        Word16 n4 = shl( n, 2 );

        L_tmp = L_deposit_l( 0 );
        L_tmp = Madd_32_16( L_tmp, xl[n4 - 1], w_0 );
        L_tmp = Madd_32_16( L_tmp, xl[n4], w_1 );
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 1], w_2 );
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 2], w_3 );
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 3], w_4 );
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 4], w_5 );
        xl4[n] = L_tmp;
        L_tmp = Madd_32_16( L_tmp, xl[n4 - 1], w_0 ); // Q16
        L_tmp = Madd_32_16( L_tmp, xl[n4], w_1 );     // Q16
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 1], w_2 ); // Q16
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 2], w_3 ); // Q16
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 3], w_4 ); // Q16
        L_tmp = Madd_32_16( L_tmp, xl[n4 + 4], w_5 ); // Q16
        xl4[n] = L_tmp;                               // Q16
        move32();
    }

    L_tmp = L_deposit_l( 0 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 5], w_0 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 4], w_1 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 3], w_2 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 2], w_3 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_4 );
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_5 );
    xl4[SNS_NPTS - 1] = L_tmp;
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 5], w_0 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 4], w_1 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 3], w_2 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 2], w_3 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_4 ); // Q16
    L_tmp = Madd_32_16( L_tmp, xl[FDNS_NPTS - 1], w_5 ); // Q16
    xl4[SNS_NPTS - 1] = L_tmp;                           // Q16
    move32();

    /* Remove mean and scaling */
    sum = 0;
    move64();
    FOR( Word16 ind = 0; ind < SNS_NPTS; ind++ )
    {
        sum = W_add( sum, (Word64) xl4[ind] );
        sum = W_add( sum, (Word64) xl4[ind] ); // Q16
    }
    mean = (Word32) W_shr( sum, 4 );
    mean = W_extract_l( W_shr( sum, 4 ) ); // Q16

    FOR( i = 0; i < SNS_NPTS; i++ )
    {
        scf[i] = Mpy_32_16_1( L_sub( xl4[i], mean ), 27853 /* 0.85 in in Q15 */ );
        scf[i] = Mpy_32_16_1( L_sub( xl4[i], mean ), 27853 /* 0.85 in in Q15 */ ); // Q16
        move32();
    }

+58 −0
Original line number Diff line number Diff line
@@ -187,6 +187,64 @@ void GetParameters(
    return;
}

void GetParameters_fx(
    ParamsBitMap const *paramsBitMap,
    const Word16 nArrayLength, // Q0
    void const *pParameter,    // Q0
    Word16 **pStream,          // Q0
    Word16 *pnSize,            // Q0
    Word16 *pnBits )           // Q0
{
    Word16 index;
    Word16 iParam, nParams;
    Word16 value;
    void const *pSubStruct;

    assert( ( paramsBitMap != NULL ) && ( nArrayLength > 0 ) && ( pParameter != NULL ) && ( pStream != NULL ) && ( pnSize != NULL ) && ( pnBits != NULL ) );

    nParams = paramsBitMap->nParams;
    move16();
    FOR( index = 0; index < nArrayLength; index++ )
    {
        FOR( iParam = 0; iParam < nParams; iParam++ )
        {
            ParamBitMap const *const param = &paramsBitMap->params[iParam];

#define WMC_TOOL_SKIP
            pSubStruct = param->GetParamValue( pParameter, index, &value );
#undef WMC_TOOL_SKIP
            /* If a function for encoding/decoding value is defined than it should take care of 0 */
            IF( param->fZeroAllowed || ( param->EncodeValue != NULL ) )
            {
                *( *pStream )++ = value;
                move16();
            }
            ELSE
            {
                *( *pStream )++ = sub( value, 1 );
                move16();
            }
            ++*pnSize;
#define WMC_TOOL_SKIP
            IF( ( param->nBits != 0 ) )
            {
                *pnBits = add( *pnBits, param->nBits );
            }
            ELSE
            {
                *pnBits = add( *pnBits, param->GetNumberOfBits( value, index ) );
            }
            move16();
#undef WMC_TOOL_SKIP
            IF( ( param->pSubParamBitMap != NULL ) && ( value > 0 ) )
            {
                GetParameters( param->pSubParamBitMap, value, ( pSubStruct != NULL ) ? pSubStruct : pParameter, pStream, pnSize, pnBits );
            }
        }
    }

    return;
}

void SetParameters(
    ParamsBitMap const *paramsBitMap,
Loading