Commit 374d8c89 authored by vaclav's avatar vaclav
Browse files

harmonize tbe_celp_exc(), under CLEANUP_ACELP_ENC

parent 602321e1
Loading
Loading
Loading
Loading
+8478 −8473
Original line number Diff line number Diff line
@@ -2910,6 +2910,7 @@ Word16 tbe_celp_exc_offset(
    const Word16 L_frame     /* i  : frame lenght */
);
#ifndef CLEANUP_ACELP_ENC
void tbe_celp_exc(
    const Word16 L_frame_fx, /* i  : Frame lenght */
    const Word16 i_subfr_fx, /* i  : sub frame */
@@ -2918,8 +2919,12 @@ void tbe_celp_exc(
    Word16 *error_fx,        /* i/o: Error */
    Word16 *bwe_exc_fx       /* i/o: bandwitdh extension signal */
);
#endif
#ifdef CLEANUP_ACELP_ENC
void tbe_celp_exc(
#else
void tbe_celp_exc_ivas(
#endif
    const Word16 element_mode, /* i  : element mode            */
    const Word16 idchan,       /* i  : channel ID              */
    const Word16 L_frame_fx,   /* i  : Frame lenght */
+42 −7
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ Word16 tbe_celp_exc_offset(
 *
 * Compute tbe bwe celp excitation
 *-------------------------------------------------------------------*/
#ifndef CLEANUP_ACELP_ENC
void tbe_celp_exc(
    const Word16 L_frame_fx, /* i  : Frame lenght                       */
    const Word16 i_subfr_fx, /* i  : sub frame                          */
@@ -238,7 +239,13 @@ void tbe_celp_exc(
 *
 * Compute tbe bwe celp excitation
 *-------------------------------------------------------------------*/
#endif

#ifdef CLEANUP_ACELP_ENC
void tbe_celp_exc(
#else
void tbe_celp_exc_ivas(
#endif
    const Word16 element_mode, /* i  : element mode            */
    const Word16 idchan,       /* i  : channel ID              */
    const Word16 L_frame_fx,   /* i  : Frame lenght */
@@ -321,6 +328,8 @@ void tbe_celp_exc_ivas(
        *error_fx = add( *error_fx, tmp_fx );          /*error_fx in Q5*/
        move16();
    }

    return;
}

/*===========================================================================*/
@@ -349,6 +358,16 @@ void tbe_celp_exc_ivas(
/* RETURN ARGUMENTS : */
/* _ None */
/*---------------------------------------------------------------------------*/

#ifdef CLEANUP_ACELP_ENC
static const Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580,
                                                 -26319, -17530, -6393, 6393, 17530, 26319,
                                                 31580, 32609, 29268, 22005, 11793 }; /* Q15 */
static const Word16 local_cos_table17[17] = { 32767, 30571, 24279, 14732, 3212, -8739,
                                              -19519, -27683, -32137, -32137, -27683,
                                              -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */
#endif

void flip_and_downmix_generic_fx(
    Word16 input[],                      /* i : input spectrum Qx*/
    Word16 output[],                     /* o : output spectrum Qx*/
@@ -371,6 +390,7 @@ void flip_and_downmix_generic_fx(
    /*Word16 s_tmp[L_FRAME32k];*/
    /*Word16 factor;*/
    Word16 period;
#ifndef CLEANUP_ACELP_ENC
    Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580,
                                        -26319, -17530, -6393, 6393, 17530, 26319,
                                        31580, 32609, 29268, 22005, 11793 }; /* Q15 */
@@ -378,14 +398,16 @@ void flip_and_downmix_generic_fx(
                                     -19519, -27683, -32137, -32137, -27683,
                                     -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */
    Word16 *local_negsin_table, *local_cos_table;
#endif
    Word32 L_tmp;

    /* 1850 Hz downmix */
    period = 17;
    move16();
#ifndef CLEANUP_ACELP_ENC
    local_negsin_table = local_negsin_table17;
    local_cos_table = local_cos_table17;

#endif

    FOR( i = 0; i < length; i = i + 2 )
    {
@@ -467,8 +489,13 @@ void flip_and_downmix_generic_fx(
    {
        WHILE( ( j < period ) && ( i < length ) )
        {
#ifdef CLEANUP_ACELP_ENC
            L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table17[j] );           /*//Qx+16 */
            L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table17[j] ); /*Qx+16 */
#else
            L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table[j] );           /*//Qx+16 */
            L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table[j] ); /*Qx+16 */
#endif
            output[i] = round_fx( L_tmp ); /*Qx */
            move16();
            i++;
@@ -511,6 +538,7 @@ void flip_and_downmix_generic_fx32(
    /*Word16 s_tmp[L_FRAME32k];*/
    /*Word16 factor;*/
    Word16 period;
#ifndef CLEANUP_ACELP_ENC
    Word16 local_negsin_table17[17] = { 0, -11793, -22005, -29268, -32609, -31580,
                                        -26319, -17530, -6393, 6393, 17530, 26319,
                                        31580, 32609, 29268, 22005, 11793 }; /* Q15 */
@@ -518,14 +546,16 @@ void flip_and_downmix_generic_fx32(
                                     -19519, -27683, -32137, -32137, -27683,
                                     -19519, -8739, 3212, 14732, 24279, 30571 }; /* Q15 */
    Word16 *local_negsin_table, *local_cos_table;
#endif
    Word32 L_tmp;

    /* 1850 Hz downmix */
    period = 17;
    move16();
#ifndef CLEANUP_ACELP_ENC
    local_negsin_table = local_negsin_table17;
    local_cos_table = local_cos_table17;

#endif

    FOR( i = 0; i < length; i = i + 2 )
    {
@@ -597,8 +627,13 @@ void flip_and_downmix_generic_fx32(
        WHILE( ( j < period ) && ( i < length ) )
        {
            test();
#ifdef CLEANUP_ACELP_ENC
            L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table17[j] );           /*//Qx+16 */
            L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table17[j] ); /*Qx+16 */
#else
            L_tmp = Mult_32_16( tmp_R[i + 4], local_cos_table[j] );           /*//Qx+16 */
            L_tmp = Madd_32_16( L_tmp, tmp_I[i + 4], local_negsin_table[j] ); /*Qx+16 */
#endif
            output[i] = L_tmp; /*Qx */
            move32();
            i++;
+4 −0
Original line number Diff line number Diff line
@@ -353,7 +353,11 @@ void decoder_acelp_fx(

            IF( st->igf != 0 )
            {
#ifdef CLEANUP_ACELP_ENC
                tbe_celp_exc(  EVS_MONO, 0, st->L_frame, L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc,0 );
#else
                tbe_celp_exc( st->L_frame, i_subfr, T0, T0_frac, &error, bwe_exc );
#endif
            }

            pitch_buffer[idx] = shl( add( shl( T0, 2 ), T0_frac ), 4 ); // Q6
+5 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ ivas_error decod_gen_voic_fx(
        /*--------------------------------------------------------------*
         * Find the adaptive codebook vector
         *--------------------------------------------------------------*/

        IF( st_fx->element_mode != EVS_MONO )
        {
            pred_lt4_ivas_fx( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
@@ -173,7 +174,11 @@ ivas_error decod_gen_voic_fx(
            pred_lt4( &exc_fx[i_subfr_fx], &exc_fx[i_subfr_fx], T0_fx, T0_frac_fx, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
        }

#ifdef CLEANUP_ACELP_ENC
        tbe_celp_exc( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag );
#else
        tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag );
#endif

        /*--------------------------------------------------------------*
         * LP filtering of the adaptive excitation
+4 −0
Original line number Diff line number Diff line
@@ -267,7 +267,11 @@ void decod_gen_2sbfr_fx(
        test();
        IF( !( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) && !( st->tdm_LRTD_flag ) ) )
        {
#ifdef CLEANUP_ACELP_ENC
            tbe_celp_exc( st->element_mode, st->idchan, L_frame, 2 * L_SUBFR, i_subfr, T0, T0_frac, &error, bwe_exc, 0 );
#else
            tbe_celp_exc( L_frame, i_subfr, T0, T0_frac, &error, bwe_exc );
#endif
        }

        /*--------------------------------------------------------------*
Loading