LCOV - code coverage report
Current view: top level - lib_dec - transition_dec_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main @ da9cc8ead0679b4682d329fdff98cf1616159273 Lines: 404 416 97.1 %
Date: 2025-10-13 22:24:20 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : #include <stdint.h>
       5             : #include "options.h" /* Compilation switches                   */
       6             : #include "cnst.h"    /* Common constants                       */
       7             : #include "rom_com.h" /* Static table prototypes                */
       8             : #include "prot_fx.h" /* Function prototypes                    */
       9             : #include "stl.h"
      10             : 
      11             : /*----------------------------------------------------------------------*
      12             :  * Local function prototypes
      13             :  *----------------------------------------------------------------------*/
      14             : static void tc_dec_fx( Decoder_State *st_fx, const Word16 L_frame, Word16 exc[], Word16 *T0, Word16 *T0_frac, const Word16 i_subfr, const Word16 tc_subfr, Word16 *position, Word16 bwe_exc[], Word16 *Q_exc );
      15             : /*======================================================================*/
      16             : /* FUNCTION : transition_dec_fx()                                                                           */
      17             : /*----------------------------------------------------------------------*/
      18             : /* PURPOSE : Principal function for TC decoding                                 */
      19             : /*                                                                                                                                              */
      20             : /*----------------------------------------------------------------------*/
      21             : /* GLOBAL INPUT ARGUMENTS :                                                                                             */
      22             : /* _ (Word16) L_frame           : length of the frame           Q0                      */
      23             : /* _ (Word16[]) pitch_buf_fx    : floating pitch values for each subframe Q6*/
      24             : /* _ (Word16[]) voice_factors_fx: frame error rate                              Q15             */
      25             : /*-----------------------------------------------------------------------*/
      26             : /* OUTPUT ARGUMENTS :                                                                                                    */
      27             : /* _ (Word16[]) exc_fx                  : adapt. excitation exc (Q0)                     */
      28             : /* _ (Word16[]) exc2_fx                 : adapt. excitation/total exc (Q0)               */
      29             : /*-----------------------------------------------------------------------*/
      30             : 
      31             : 
      32             : /*-----------------------------------------------------------------------*/
      33             : /* RETURN ARGUMENTS :                                                                                                    */
      34             : /* _ None                                                                                                                                */
      35             : /*=======================================================================*/
      36             : 
      37       58633 : void transition_dec_fx(
      38             :     Decoder_State *st_fx,    /* i/o: decoder state structure */
      39             :     const Word16 Opt_AMR_WB, /* i  : flag indicating AMR-WB IO mode         Q0 */
      40             :     const Word16 L_frame,    /* i  : length of the frame                    Q0 */
      41             :     const Word16 i_subfr,    /* i  : subframe index                         Q0 */
      42             :     const Word16 tc_subfr,   /* i  : TC subframe index                      Q0 */
      43             :     Word16 *Jopt_flag,       /* i  : joint optimization flag                 Q0*/
      44             :     Word16 *exc,             /* o  : excitation signal                    Q0   */
      45             :     Word16 *T0,              /* o  : close loop integer pitch             Q0   */
      46             :     Word16 *T0_frac,         /* o  : close loop fractional part of the pitch Q0*/
      47             :     Word16 *T0_min,          /* i/o: delta search min for sf 2 & 4          Q0 */
      48             :     Word16 *T0_max,          /* i/o: delta search max for sf 2 & 4          Q0 */
      49             :     Word16 **pt_pitch,       /* o  : floating pitch values             Q6      */
      50             :     Word16 *position,        /* i/o: first glottal impulse position in frame Q0*/
      51             :     Word16 *bwe_exc,         /* o  : excitation for SWB TBE              Q_exc    */
      52             :     Word16 *Q_exc            /*i/o : scaling of excitation                   */
      53             : )
      54             : {
      55             :     Word16 pit_flag, pit_start, pit_limit, index, nBits;
      56             :     Word16 i, offset, temp, tmp;
      57             :     Word16 limit_flag;
      58             :     Word16 i_subfridx;
      59             :     (void) ( Opt_AMR_WB );
      60             : 
      61       58633 :     i_subfridx = i_subfr / L_SUBFR; /*i_subfr / L_SUBFR*/
      62             :     /* Set limit_flag to 0 for restrained limits, and 1 for extended limits */
      63       58633 :     limit_flag = 0;
      64       58633 :     move16();
      65             :     /*---------------------------------------------------------------------*
      66             :      * zero adaptive contribution (glottal shape codebook search not
      67             :      *                             in first subframe(s) )
      68             :      *---------------------------------------------------------------------*/
      69       58633 :     test();
      70       58633 :     IF( GT_16( tc_subfr, add( i_subfr, TC_0_192 ) ) )
      71             :     {
      72       17167 :         set16_fx( &exc[i_subfr], 0, L_SUBFR );
      73             : 
      74       17167 :         IF( EQ_16( L_frame, L_FRAME ) )
      75             :         {
      76        6564 :             set16_fx( &bwe_exc[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) ); /* set past excitation buffer to 0 */
      77             :         }
      78             :         ELSE
      79             :         {
      80       10603 :             set16_fx( &bwe_exc[i_subfr * 2], 0, (Word16) ( L_SUBFR * 2 ) ); /* set past excitation buffer to 0 */
      81             :         }
      82             : 
      83       17167 :         *T0 = L_SUBFR;
      84       17167 :         move16();
      85       17167 :         *T0_frac = 0;
      86       17167 :         move16();
      87       17167 :         **pt_pitch = L_SUBFR_Q6;
      88       17167 :         move16();
      89             :     }
      90             : 
      91             :     /*---------------------------------------------------------------------*
      92             :      * glottal shape codebook search
      93             :      *---------------------------------------------------------------------*/
      94             : 
      95       41466 :     ELSE IF( ( ( GE_16( tc_subfr, i_subfr ) ) && ( LE_16( sub( tc_subfr, i_subfr ), TC_0_192 ) ) ) )
      96             :     {
      97       13057 :         set16_fx( exc - L_EXC_MEM, 0, L_EXC_MEM ); /* set past excitation buffer to 0 */
      98             : 
      99       13057 :         IF( EQ_16( L_frame, L_FRAME ) )
     100             :         {
     101        6652 :             set16_fx( bwe_exc - PIT_MAX * HIBND_ACB_L_FAC, 0, PIT_MAX * HIBND_ACB_L_FAC ); /* set past excitation buffer to 0 */
     102             :         }
     103             :         ELSE
     104             :         {
     105        6405 :             set16_fx( bwe_exc - PIT16k_MAX * 2, 0, PIT16k_MAX * 2 ); /* set past excitation buffer to 0 */
     106             :         }
     107             : 
     108             :         /* glottal shape codebook contribution construction */
     109       13057 :         tc_dec_fx( st_fx, L_frame, exc, T0, T0_frac, i_subfr, tc_subfr, position, bwe_exc, Q_exc );
     110       13057 :         **pt_pitch = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); // Q6
     111       13057 :         move16();                                              /* save subframe pitch values Q6 */
     112             : 
     113       13057 :         *Jopt_flag = 1;
     114       13057 :         move16();
     115             :     }
     116             : 
     117             :     /*---------------------------------------------------------------------*
     118             :      * Regular ACELP Decoding using GENERIC type decoder
     119             :      * (all subframes following subframe with glottal shape codebook seach)
     120             :      * - search the position of the 2nd glottal impulse in case that the first
     121             :      *   one is in the 1st subframe (different adaptive contribution
     122             :      *   construction and the pitch period coding is used)
     123             :      *---------------------------------------------------------------------*/
     124             : 
     125       28409 :     ELSE IF( LT_16( tc_subfr, i_subfr ) )
     126             :     {
     127       28409 :         IF( EQ_16( L_frame, L_FRAME ) )
     128             :         {
     129       13392 :             *Jopt_flag = 1;
     130       13392 :             move16();
     131       13392 :             test();
     132       13392 :             IF( ( GE_16( sub( i_subfr, tc_subfr ), L_SUBFR ) ) && ( LE_16( sub( i_subfr, tc_subfr ), L_SUBFR + TC_0_192 ) ) )
     133             :             {
     134        1462 :                 pit_flag = 0;
     135        1462 :                 move16();
     136             :             }
     137             :             ELSE
     138             :             {
     139       11930 :                 pit_flag = L_SUBFR;
     140       11930 :                 move16();
     141             :             }
     142       13392 :             IF( EQ_16( tc_subfr, TC_0_0 ) )
     143             :             {
     144        4725 :                 IF( EQ_16( i_subfr, L_SUBFR ) )
     145             :                 {
     146        1575 :                     limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max );
     147             :                 }
     148        4725 :                 pit_flag = 1;
     149        4725 :                 move16();
     150             :             }
     151             : 
     152             :             /*-----------------------------------------------------------------*
     153             :              * get number of bits for pitch decoding
     154             :              *-----------------------------------------------------------------*/
     155       13392 :             nBits = st_fx->acelp_cfg.pitch_bits[i_subfridx];
     156       13392 :             move16();
     157             : 
     158             :             /*------------------------------------------------------------*
     159             :              * first glottal impulse is in the 1st subframe
     160             :              *------------------------------------------------------------*/
     161       13392 :             test();
     162       13392 :             test();
     163       13392 :             test();
     164       13392 :             test();
     165       13392 :             test();
     166       13392 :             test();
     167       13392 :             IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( GE_16( tc_subfr, TC_0_128 ) ) )
     168             :             {
     169             :                 /*--------------------------------------------------------*
     170             :                  * second glottal impulse is in the 3rd or 4th subframe
     171             :                  * - build exc[] in 2nd subframe
     172             :                  *--------------------------------------------------------*/
     173             : 
     174         827 :                 *T0 = 2 * L_SUBFR;
     175         827 :                 move16();
     176         827 :                 *T0_frac = 0;
     177         827 :                 move16();
     178         827 :                 *Jopt_flag = 0;
     179         827 :                 move16();
     180             : 
     181             :                 /* set adaptive part of exciation for curent subframe to 0 */
     182         827 :                 set16_fx( &exc[i_subfr], 0, (Word16) ( L_SUBFR + 1 ) );
     183         827 :                 set16_fx( &bwe_exc[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) );
     184             :             }
     185       12565 :             ELSE IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( EQ_16( tc_subfr, TC_0_64 ) ) )
     186             :             {
     187             :                 /*--------------------------------------------------------*
     188             :                  * second glottal impulse is in the 2nd subframe,
     189             :                  * - build exc[] in 2nd subframe
     190             :                  *--------------------------------------------------------*/
     191        1237 :                 pit_start = PIT_MIN;
     192        1237 :                 move16();
     193        1237 :                 if ( GT_16( PIT_MIN, ( *position ) ) )
     194             :                 {
     195         937 :                     pit_start = sub( L_SUBFR, *position );
     196             :                 }
     197             : 
     198        1237 :                 pit_start = s_max( pit_start, PIT_MIN );
     199        1237 :                 pit_limit = add( shl( pit_start, 1 ), *position );
     200             : 
     201             :                 /* 7 bit pitch DECODER */
     202        1237 :                 index = (Word16) get_next_indice_fx( st_fx, nBits );
     203             : 
     204        1237 :                 *T0 = add( pit_start, shr( ( index ), 1 ) );
     205        1237 :                 move16();
     206        1237 :                 *T0_frac = shl( sub( ( index ), shl( sub( *T0, pit_start ), 1 ) ), 1 );
     207        1237 :                 move16();
     208             : 
     209        1237 :                 limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max */
     210             : 
     211             :                 /* Find the adaptive codebook vector - ACELP long-term prediction   */
     212        1237 :                 IF( st_fx->element_mode != EVS_MONO )
     213             :                 {
     214        1228 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     215             :                 }
     216             :                 ELSE
     217             :                 {
     218           9 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     219             :                 }
     220        1237 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     221             : 
     222        1237 :                 move16();
     223        1237 :                 move16(); /* penality for 2 ptrs initialization */
     224             : 
     225      199157 :                 FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
     226             :                 {
     227      197920 :                     bwe_exc[add( i, i_subfr * HIBND_ACB_L_FAC )] = bwe_exc[sub( add( i, i_subfr * HIBND_ACB_L_FAC ), offset )];
     228      197920 :                     move16();
     229             :                 }
     230             :             }
     231       11328 :             ELSE IF( ( EQ_16( i_subfr, 2 * L_SUBFR ) ) && ( EQ_16( tc_subfr, TC_0_128 ) ) )
     232             :             {
     233             :                 /*--------------------------------------------------------*
     234             :                  * second glottal impulse is in the 3rd subframe
     235             :                  * - build exc[] in 3rd subframe
     236             :                  *--------------------------------------------------------*/
     237             : 
     238             :                 /* 7bit pitch DECODER */
     239         630 :                 pit_start = sub( 2 * L_SUBFR, ( *position ) );
     240         630 :                 index = (Word16) get_next_indice_fx( st_fx, nBits );
     241             : 
     242         630 :                 *T0 = add( pit_start, shr( ( index ), 1 ) );
     243         630 :                 move16();
     244         630 :                 *T0_frac = shl( sub( ( index ), shl( sub( *T0, pit_start ), 1 ) ), 1 );
     245         630 :                 move16();
     246         630 :                 limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max */
     247             : 
     248             :                 /* Find the adaptive codebook vector. ACELP long-term prediction */
     249         630 :                 IF( st_fx->element_mode != EVS_MONO )
     250             :                 {
     251         625 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     252             :                 }
     253             :                 ELSE
     254             :                 {
     255           5 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     256             :                 }
     257         630 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     258         630 :                 move16();
     259         630 :                 move16(); /* penality for 2 ptrs initialization */
     260             : 
     261      101430 :                 FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
     262             :                 {
     263      100800 :                     bwe_exc[add( i, i_subfr * HIBND_ACB_L_FAC )] = bwe_exc[sub( add( i, i_subfr * HIBND_ACB_L_FAC ), offset )];
     264      100800 :                     move16();
     265             :                 }
     266             :             }
     267       10698 :             ELSE IF( ( EQ_16( i_subfr, 2 * L_SUBFR ) ) && ( EQ_16( tc_subfr, TC_0_192 ) ) )
     268             :             {
     269             :                 /*--------------------------------------------------------*
     270             :                  * second glottal impulse is in the 4th subframe
     271             :                  * - build exc[] in 3rd subframe
     272             :                  *--------------------------------------------------------*/
     273             : 
     274         197 :                 *T0 = 4 * L_SUBFR;
     275         197 :                 move16();
     276         197 :                 *T0_frac = 0;
     277         197 :                 move16();
     278         197 :                 *Jopt_flag = 0;
     279         197 :                 move16();
     280             : 
     281             :                 /* set adaptive part of exciation for curent subframe to 0 */
     282         197 :                 set16_fx( &exc[i_subfr], 0, (Word16) ( L_SUBFR + 1 ) );
     283         197 :                 set16_fx( &bwe_exc[i_subfr * HIBND_ACB_L_FAC], 0, (Word16) ( L_SUBFR * HIBND_ACB_L_FAC ) );
     284             :             }
     285       10501 :             ELSE IF( ( EQ_16( i_subfr, 3 * L_SUBFR ) ) && ( EQ_16( tc_subfr, TC_0_192 ) ) )
     286             :             {
     287             :                 /*--------------------------------------------------------*
     288             :                  * second glottal impulse is in the 4th subframe
     289             :                  * - build exc[] in 4th subframe
     290             :                  *--------------------------------------------------------*/
     291         197 :                 pit_start = sub( 3 * L_SUBFR, ( *position ) );
     292         197 :                 pit_limit = sub( 2 * L_FRAME - PIT_MAX, add( shl( ( *position ), 1 ), 2 ) );
     293             : 
     294             : 
     295         197 :                 index = (Word16) get_next_indice_fx( st_fx, nBits );
     296             : 
     297         197 :                 IF( LT_16( index, shl( sub( pit_limit, pit_start ), 1 ) ) )
     298             :                 {
     299         155 :                     *T0 = add( pit_start, shr( index, 1 ) );
     300         155 :                     move16();
     301         155 :                     *T0_frac = shl( sub( index, shl( sub( ( *T0 ), pit_start ), 1 ) ), 1 );
     302         155 :                     move16();
     303             :                 }
     304             :                 ELSE
     305             :                 {
     306          42 :                     *T0 = add( index, sub( pit_limit, shl( sub( pit_limit, pit_start ), 1 ) ) );
     307          42 :                     move16();
     308             : 
     309          42 :                     *T0_frac = 0;
     310          42 :                     move16();
     311             :                 }
     312             : 
     313             :                 /* biterror detection mechanism */
     314         197 :                 IF( GT_16( add( shl( *T0, 2 ), *T0_frac ), add( ( PIT_MAX << 2 ), 2 ) ) )
     315             :                 {
     316           0 :                     *T0 = L_SUBFR;
     317           0 :                     move16();
     318           0 :                     *T0_frac = 0;
     319           0 :                     move16();
     320           0 :                     st_fx->BER_detect = 1;
     321           0 :                     move16();
     322             :                 }
     323             : 
     324             :                 /* Find the adaptive codebook vector. ACELP long-term prediction   */
     325         197 :                 IF( st_fx->element_mode != EVS_MONO )
     326             :                 {
     327         194 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     328             :                 }
     329             :                 ELSE
     330             :                 {
     331           3 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     332             :                 }
     333         197 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     334         197 :                 move16();
     335         197 :                 move16(); /* penality for 2 ptrs initialization */
     336       31717 :                 FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
     337             :                 {
     338       31520 :                     bwe_exc[add( i, i_subfr * HIBND_ACB_L_FAC )] = bwe_exc[sub( add( i, i_subfr * HIBND_ACB_L_FAC ), offset )];
     339       31520 :                     move16();
     340             :                 }
     341             :             }
     342       10304 :             ELSE IF( ( EQ_16( i_subfr, 3 * L_SUBFR ) ) && ( EQ_16( tc_subfr, TC_0_128 ) ) )
     343             :             {
     344             :                 /*--------------------------------------------------------*
     345             :                  * second glottal impulse in the 3rd subframe
     346             :                  * build exc[] in 4th subframe
     347             :                  *--------------------------------------------------------*/
     348             : 
     349             : 
     350         630 :                 index = (Word16) get_next_indice_fx( st_fx, nBits );
     351         630 :                 delta_pit_dec_fx( 2, index, T0, T0_frac, *T0_min );
     352             : 
     353             :                 /* Find the adaptive codebook vector. ACELP long-term prediction   */
     354         630 :                 IF( st_fx->element_mode != EVS_MONO )
     355             :                 {
     356         625 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     357             :                 }
     358             :                 ELSE
     359             :                 {
     360           5 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     361             :                 }
     362         630 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     363         630 :                 move16();
     364         630 :                 move16(); /* penality for 2 ptrs initialization */
     365      101430 :                 FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
     366             :                 {
     367      100800 :                     bwe_exc[add( i, i_subfr * HIBND_ACB_L_FAC )] = bwe_exc[sub( add( i, i_subfr * HIBND_ACB_L_FAC ), offset )];
     368      100800 :                     move16();
     369             :                 }
     370             :             }
     371             :             /*------------------------------------------------------------*
     372             :              * first glottal impulse is NOT in the 1st subframe,
     373             :              * or two impulses are in the 1st subframe
     374             :              *------------------------------------------------------------*/
     375             :             ELSE
     376             :             {
     377        9674 :                 index = (Word16) get_next_indice_fx( st_fx, nBits );
     378             : 
     379        9674 :                 pit_Q_dec_fx( 0, index, nBits, 8, pit_flag, limit_flag, T0, T0_frac, T0_min, T0_max, &st_fx->BER_detect );
     380             : 
     381             :                 /* Find the adaptive codebook vector */
     382        9674 :                 IF( st_fx->element_mode != EVS_MONO )
     383             :                 {
     384        9552 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     385             :                 }
     386             :                 ELSE
     387             :                 {
     388         122 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     389             :                 }
     390        9674 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     391        9674 :                 move16();
     392        9674 :                 move16(); /* penality for 2 ptrs initialization */
     393     1557514 :                 FOR( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
     394             :                 {
     395     1547840 :                     bwe_exc[add( i, i_subfr * HIBND_ACB_L_FAC )] = bwe_exc[sub( add( i, i_subfr * HIBND_ACB_L_FAC ), offset )];
     396     1547840 :                     move16();
     397             :                 }
     398             :             }
     399             : 
     400             :             /*-----------------------------------------------------------------*
     401             :              * LP filtering of the adaptive excitation (if non-zero)
     402             :              *-----------------------------------------------------------------*/
     403       13392 :             IF( *Jopt_flag )
     404             :             {
     405       12368 :                 lp_filt_exc_dec_fx( st_fx, MODE1, i_subfr, L_SUBFR, L_frame, st_fx->acelp_cfg.ltf_mode, exc );
     406             :             }
     407             : 
     408             :             /*---------------------------------------------------------------------*
     409             :              * fill the pitch buffer - needed for post-processing and FEC_clas_estim()
     410             :              *---------------------------------------------------------------------*/
     411             : 
     412       13392 :             **pt_pitch = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     413       13392 :             move16(); /* save subframe pitch values Q6 */
     414             : 
     415       13392 :             test();
     416       13392 :             test();
     417       13392 :             test();
     418       13392 :             test();
     419       13392 :             test();
     420       13392 :             IF( ( GE_16( tc_subfr, 2 * L_SUBFR ) ) && ( EQ_16( i_subfr, 3 * L_SUBFR ) ) )
     421             :             {
     422         449 :                 tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     423         449 :                 ( *pt_pitch ) -= 3;
     424         449 :                 move16();
     425         449 :                 **pt_pitch = tmp;
     426         449 :                 move16(); /*Q6*/
     427         449 :                 ( *pt_pitch )++;
     428         449 :                 **pt_pitch = tmp;
     429         449 :                 move16(); /*Q6*/
     430         449 :                 ( *pt_pitch )++;
     431         449 :                 move16();
     432         449 :                 **pt_pitch = tmp;
     433         449 :                 move16(); /*Q6*/
     434         449 :                 ( *pt_pitch )++;
     435         449 :                 move16();
     436             :             }
     437       12943 :             ELSE IF( ( EQ_16( tc_subfr, L_SUBFR ) ) && ( EQ_16( i_subfr, 2 * L_SUBFR ) ) )
     438             :             {
     439        1013 :                 tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     440        1013 :                 ( *pt_pitch ) -= 2;
     441        1013 :                 move16();
     442        1013 :                 **pt_pitch = tmp;
     443        1013 :                 move16(); /*Q6*/
     444        1013 :                 ( *pt_pitch )++;
     445        1013 :                 **pt_pitch = tmp;
     446        1013 :                 move16(); /*Q6*/
     447        1013 :                 ( *pt_pitch )++;
     448        1013 :                 move16();
     449             :             }
     450       11930 :             ELSE IF( ( EQ_16( tc_subfr, TC_0_64 ) ) && ( EQ_16( i_subfr, L_SUBFR ) ) )
     451             :             {
     452        1237 :                 tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     453        1237 :                 ( *pt_pitch ) -= 1;
     454        1237 :                 move16();
     455        1237 :                 **pt_pitch = tmp;
     456        1237 :                 move16(); /*Q6*/
     457        1237 :                 ( *pt_pitch )++;
     458             :             }
     459       10693 :             ELSE IF( ( EQ_16( tc_subfr, TC_0_128 ) ) && ( EQ_16( i_subfr, 2 * L_SUBFR ) ) )
     460             :             {
     461         630 :                 tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     462         630 :                 ( *pt_pitch ) -= 2;
     463         630 :                 move16();
     464         630 :                 **pt_pitch = tmp;
     465         630 :                 move16(); /*Q6*/
     466         630 :                 ( *pt_pitch )++;
     467         630 :                 **pt_pitch = tmp;
     468         630 :                 move16(); /*Q6*/
     469         630 :                 ( *pt_pitch )++;
     470         630 :                 move16();
     471             :             }
     472       10063 :             ELSE IF( ( EQ_16( tc_subfr, TC_0_192 ) ) && ( EQ_16( i_subfr, 3 * L_SUBFR ) ) )
     473             :             {
     474         197 :                 tmp = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     475         197 :                 ( *pt_pitch ) -= 3;
     476         197 :                 move16();
     477         197 :                 **pt_pitch = tmp;
     478         197 :                 move16(); /*Q6*/
     479         197 :                 ( *pt_pitch )++;
     480         197 :                 **pt_pitch = tmp;
     481         197 :                 move16(); /*Q6*/
     482         197 :                 ( *pt_pitch )++;
     483         197 :                 move16();
     484         197 :                 **pt_pitch = tmp;
     485         197 :                 move16(); /*Q6*/
     486         197 :                 ( *pt_pitch )++;
     487         197 :                 move16();
     488             :             }
     489             :         }
     490             :         ELSE /* L_frame == L_FRAME16k */
     491             :         {
     492       15017 :             if ( GE_16( i_subfr, 2 * L_SUBFR ) )
     493             :             {
     494       12347 :                 limit_flag = 1;
     495       12347 :                 move16();
     496             :             }
     497             : 
     498       15017 :             IF( EQ_16( sub( i_subfr, tc_subfr ), L_SUBFR ) )
     499             :             {
     500        4492 :                 limit_T0_fx( L_FRAME16k, 8, 0, limit_flag, *T0, *T0_frac, T0_min, T0_max );
     501             :             }
     502             : 
     503             :             /*-----------------------------------------------------------------*
     504             :              * get number of bits and index for pitch decoding
     505             :              *-----------------------------------------------------------------*/
     506       15017 :             nBits = st_fx->acelp_cfg.pitch_bits[i_subfridx];
     507       15017 :             move16();
     508             : 
     509       15017 :             index = (Word16) get_next_indice_fx( st_fx, nBits );
     510             : 
     511             :             /*-----------------------------------------------------------------*
     512             :              * Find adaptive part of excitation, encode pitch period
     513             :              *-----------------------------------------------------------------*/
     514             : 
     515       15017 :             IF( EQ_16( nBits, 10 ) )
     516             :             {
     517        3605 :                 pit16k_Q_dec_fx( index, nBits, limit_flag, T0, T0_frac, T0_min, T0_max, &st_fx->BER_detect );
     518             :             }
     519       11412 :             ELSE IF( EQ_16( nBits, 8 ) ) /* tc_subfr==0 && i_subfr==L_SUBFR */
     520             :             {
     521             :                 /*-----------------------------------------------------------------------------*
     522             :                  * The pitch range is encoded absolutely with 8 bits and is divided as follows:
     523             :                  *   PIT16k_MIN  to PIT16k_FR2_TC0_2SUBFR-1 resolution 1/4 (frac = 0,1,2 or 3)
     524             :                  *   PIT16k_FR2_TC0_2SUBFR to 2*L_SUBFR     resolution 1/2 (frac = 0 or 2)
     525             :                  *-----------------------------------------------------------------------------*/
     526             : 
     527        2670 :                 IF( LT_16( index, ( PIT16k_FR2_TC0_2SUBFR - PIT16k_MIN ) * 4 ) ) /*(PIT16k_FR2_TC0_2SUBFR-PIT16k_MIN)*4*/
     528             :                 {
     529        1543 :                     *T0 = add( PIT16k_MIN, shr( index, 2 ) );
     530        1543 :                     move16();
     531        1543 :                     temp = shl( sub( *T0, PIT16k_MIN ), 2 );
     532        1543 :                     move16();
     533        1543 :                     *T0_frac = sub( index, temp );
     534        1543 :                     move16();
     535             :                 }
     536             :                 ELSE
     537             :                 {
     538        1127 :                     index = sub( index, ( PIT16k_FR2_TC0_2SUBFR - PIT16k_MIN ) * 4 ); /* (PIT16k_FR2_TC0_2SUBFR-PIT16k_MIN)*4 */
     539        1127 :                     *T0 = add( PIT16k_FR2_TC0_2SUBFR, shr( index, 1 ) );
     540        1127 :                     move16();
     541        1127 :                     temp = shl( sub( *T0, PIT16k_FR2_TC0_2SUBFR ), 1 );
     542        1127 :                     move16();
     543        1127 :                     *T0_frac = shl( sub( index, temp ), 1 );
     544        1127 :                     move16();
     545             :                 }
     546             : 
     547             :                 /* biterror detection mechanism */
     548        2670 :                 IF( GT_16( add( shl( *T0, 2 ), *T0_frac ), ( ( 2 * L_SUBFR ) << 2 ) ) )
     549             :                 {
     550           0 :                     *T0 = L_SUBFR;
     551           0 :                     move16();
     552           0 :                     *T0_frac = 0;
     553           0 :                     move16();
     554           0 :                     st_fx->BER_detect = 1;
     555           0 :                     move16();
     556             :                 }
     557             :             }
     558        8742 :             ELSE IF( EQ_16( nBits, 6 ) )
     559             :             {
     560        8742 :                 delta_pit_dec_fx( 4, index, T0, T0_frac, *T0_min );
     561             :             }
     562       15017 :             IF( EQ_16( nBits, 6 ) )
     563             :             {
     564        8742 :                 limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, *T0, *T0_frac, T0_min, T0_max ); /* find T0_min and T0_max */
     565             :             }
     566             : 
     567             :             /*-----------------------------------------------------------------*
     568             :              * - find the adaptive codebook vector
     569             :              * - LP filtering of the adaptive excitation (if non-zero)
     570             :              *-----------------------------------------------------------------*/
     571       15017 :             test();
     572       15017 :             IF( ( EQ_16( i_subfr, L_SUBFR ) ) && ( EQ_16( *T0, 2 * L_SUBFR ) ) )
     573             :             {
     574             :                 /* no adaptive excitation in the second subframe */
     575         459 :                 set16_fx( &exc[i_subfr], 0, L_SUBFR + 1 );
     576         459 :                 get_next_indice_fx( st_fx, 1 ); /* this bit is actually not needed */
     577         459 :                 set16_fx( &bwe_exc[i_subfr * 2], 0, L_SUBFR * 2 );
     578             :             }
     579             :             ELSE
     580             :             {
     581             :                 /* Find the adaptive codebook vector - ACELP long-term prediction */
     582       14558 :                 IF( st_fx->element_mode != EVS_MONO )
     583             :                 {
     584       14377 :                     pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     585             :                 }
     586             :                 ELSE
     587             :                 {
     588         181 :                     pred_lt4( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
     589             :                 }
     590       14558 :                 offset = tbe_celp_exc_offset( *T0, *T0_frac, L_frame );
     591       14558 :                 move16();
     592       14558 :                 move16(); /* penalty for 2 ptrs initialization */
     593     1877982 :                 FOR( i = 0; i < L_SUBFR * 2; i++ )
     594             :                 {
     595             :                     /*  bwe_exc[i + i_subfr * 2] = bwe_exc[i + i_subfr * 2 - *T0 * 2 */
     596             :                     /*   - (int) ((float) *T0_frac * 0.5f + 4 + 0.5f) + 4];*/
     597     1863424 :                     bwe_exc[add( i, i_subfr * 2 )] = bwe_exc[sub( add( i, i_subfr * 2 ), offset )];
     598             :                 }
     599             : 
     600       14558 :                 lp_filt_exc_dec_fx( st_fx, MODE1, i_subfr, L_SUBFR, L_frame, st_fx->acelp_cfg.ltf_mode, exc );
     601       14558 :                 *Jopt_flag = 1;
     602       14558 :                 move16();
     603             :             }
     604             : 
     605       15017 :             **pt_pitch = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     606       15017 :             move16(); /* save subframe pitch values Q6 */
     607             : 
     608             :             /*---------------------------------------------------------------------*
     609             :              * fill the pitch buffer - needed for post-processing and FEC_clas_estim()
     610             :              *---------------------------------------------------------------------*/
     611       15017 :             test();
     612       15017 :             test();
     613       15017 :             IF( ( EQ_16( sub( i_subfr, tc_subfr ), L_SUBFR ) ) || ( tc_subfr == 0 && EQ_16( i_subfr, 2 * L_SUBFR ) ) )
     614             :             {
     615             :                 /*index = i_subfr/L_SUBFR;*/
     616        7162 :                 index = shr( i_subfr, 6 );
     617             : 
     618             :                 /*Ptr */
     619        7162 :                 ( *pt_pitch ) -= index;
     620        7162 :                 move16();
     621             : 
     622       19945 :                 FOR( i = 0; i < index; i++ )
     623             :                 {
     624       12783 :                     **pt_pitch = shl( add( shl( *T0, 2 ), *T0_frac ), 4 );
     625       12783 :                     move16(); /* save subframe pitch values Q6 */
     626             : 
     627       12783 :                     ( *pt_pitch )++;
     628             :                 }
     629             :             }
     630             :         }
     631             :     }
     632             : 
     633       58633 :     return;
     634             : }
     635             : 
     636             : 
     637             : /*======================================================================*/
     638             : /* FUNCTION : tc_dec_fx()                                                                                   */
     639             : /*----------------------------------------------------------------------*/
     640             : /* PURPOSE : Principal function for TC decoding                                 */
     641             : /*           *  Principal function for TC decoding.                                         */
     642             : /*           *  - constructs glottal codebook contribution                              */
     643             : /*          *  - uses pitch sharpening                                                              */
     644             : /*          *  - uses gain_trans                                                                                */
     645             : /*----------------------------------------------------------------------*/
     646             : /* GLOBAL INPUT ARGUMENTS :                                                                                             */
     647             : /* _ (Word16) L_frame           : length of the frame           Q0                      */
     648             : /*----------------------------------------------------------------------*/
     649             : /* OUTPUT ARGUMENTS :                                                                                               */
     650             : /* _ (Word16[]) exc_fx                  : adapt. excitation exc (Q0)                */
     651             : /* _ (Word16[]) exc2_fx                 : adapt. excitation/total exc (Q0)          */
     652             : /*----------------------------------------------------------------------*/
     653             : 
     654             : 
     655             : /*----------------------------------------------------------------------*/
     656             : /* RETURN ARGUMENTS :                                                                                                   */
     657             : /* _ None                                                                                                                               */
     658             : /*======================================================================*/
     659             : 
     660       13057 : static void tc_dec_fx(
     661             :     Decoder_State *st_fx,  /* i/o: decoder state structure */
     662             :     const Word16 L_frame,  /* i  : length of the frame                         Q0*/
     663             :     Word16 exc[],          /* o  : glottal codebook contribution               Q0*/
     664             :     Word16 *T0,            /* o  : close-loop pitch period                    Q0 */
     665             :     Word16 *T0_frac,       /* o  : close-loop pitch period - fractional part  Q0 */
     666             :     const Word16 i_subfr,  /* i  : subframe index                              Q0*/
     667             :     const Word16 tc_subfr, /* i  : TC subframe index                          Q0 */
     668             :     Word16 *position,      /* o  : first glottal impulse position in frame     Q0*/
     669             :     Word16 bwe_exc[],      /* o  : excitation for SWB TBE                    Q_exc  */
     670             :     Word16 *Q_exc          /*i/o : scaling of excitation                       */
     671             : )
     672             : {
     673             :     Word16 i, imp_shape, imp_pos, imp_sign, imp_gain, nBits;
     674             :     Word16 gain_trans, temp;
     675             :     const Word16 *pt_shape;
     676             :     Word16 j, sc;
     677             :     Word16 tempS;
     678             :     Word16 index;
     679             :     /*----------------------------------------------------------------*
     680             :      * find the number of bits
     681             :      *----------------------------------------------------------------*/
     682       13057 :     nBits = st_fx->acelp_cfg.pitch_bits[shr( i_subfr, 6 )];
     683       13057 :     move16();
     684             :     /*----------------------------------------------------------------*
     685             :      * decode parameter T0 (pitch period)
     686             :      *----------------------------------------------------------------*/
     687       13057 :     IF( EQ_16( L_frame, L_FRAME ) )
     688             :     {
     689        6652 :         test();
     690        6652 :         test();
     691        6652 :         test();
     692        6652 :         test();
     693        6652 :         test();
     694        6652 :         IF( ( ( i_subfr == 0 ) && ( ( tc_subfr == 0 ) || ( EQ_16( tc_subfr, TC_0_64 ) ) || ( EQ_16( tc_subfr, TC_0_128 ) ) || ( EQ_16( tc_subfr, TC_0_192 ) ) ) ) || ( EQ_16( tc_subfr, L_SUBFR ) ) )
     695             :         {
     696        3077 :             *T0 = L_SUBFR;
     697        3077 :             move16();
     698        3077 :             *T0_frac = 0;
     699        3077 :             move16();
     700             :         }
     701        3575 :         ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) )
     702             :         {
     703        1551 :             i = (Word16) get_next_indice_fx( st_fx, nBits );
     704             : 
     705        1551 :             IF( EQ_16( nBits, 9 ) )
     706             :             {
     707        1535 :                 abs_pit_dec_fx( 4, i, 0, T0, T0_frac );
     708             :             }
     709             :             ELSE
     710             :             {
     711          16 :                 abs_pit_dec_fx( 2, i, 0, T0, T0_frac );
     712             :             }
     713             :         }
     714             :         ELSE
     715             :         {
     716        2024 :             i = (Word16) get_next_indice_fx( st_fx, nBits );
     717        2024 :             move16();
     718             : 
     719        2024 :             IF( i == 0 )
     720             :             {
     721         305 :                 *T0 = L_SUBFR;
     722         305 :                 move16();
     723         305 :                 *T0_frac = 0;
     724         305 :                 move16();
     725             :             }
     726             :             ELSE
     727             :             {
     728        1719 :                 IF( EQ_16( tc_subfr, TC_0_0 ) )
     729             :                 {
     730        1575 :                     delta_pit_dec_fx( 2, i, T0, T0_frac, PIT_MIN - 1 );
     731             :                 }
     732             :                 ELSE
     733             :                 {
     734         144 :                     delta_pit_dec_fx( 0, i, T0, T0_frac, PIT_MIN - 1 );
     735             :                 }
     736             :             }
     737             :         }
     738             :     }
     739             :     ELSE /* L_frame == L_FRAME16k */
     740             :     {
     741        6405 :         i = (Word16) get_next_indice_fx( st_fx, nBits );
     742        6405 :         move16();
     743             : 
     744        6405 :         IF( EQ_16( nBits, 10 ) )
     745             :         {
     746        2800 :             IF( LT_16( i, ( PIT16k_FR2_EXTEND_10b - PIT16k_MIN_EXTEND ) * 4 ) )
     747             :             {
     748        2734 :                 *T0 = add( PIT16k_MIN_EXTEND, shr( i, 2 ) );
     749        2734 :                 move16();
     750        2734 :                 temp = shl( sub( *T0, PIT16k_MIN_EXTEND ), 2 );
     751        2734 :                 *T0_frac = sub( i, temp );
     752        2734 :                 move16();
     753             :             }
     754             :             ELSE
     755             :             {
     756          66 :                 index = sub( i, shl( sub( PIT16k_FR2_EXTEND_10b, PIT16k_MIN_EXTEND ), 2 ) );
     757          66 :                 *T0 = add( PIT16k_FR2_EXTEND_10b, shr( index, 1 ) );
     758          66 :                 *T0_frac = sub( index, shl( sub( *T0, PIT16k_FR2_EXTEND_10b ), 1 ) );
     759          66 :                 ( *T0_frac ) = shl( *T0_frac, 1 );
     760             :             }
     761             :         }
     762        3605 :         ELSE IF( EQ_16( nBits, 6 ) )
     763             :         {
     764        3605 :             *T0 = add( PIT16k_MIN, shr( i, 1 ) );
     765        3605 :             move16();
     766        3605 :             *T0_frac = sub( i, shl( sub( *T0, PIT16k_MIN ), 1 ) );
     767        3605 :             *T0_frac = shl( *T0_frac, 1 );
     768        3605 :             move16();
     769             :         }
     770             :     }
     771             : 
     772             :     /*----------------------------------------------------------------*
     773             :      * decode other TC parameters
     774             :      *----------------------------------------------------------------*/
     775             : 
     776       13057 :     imp_shape = (Word16) get_next_indice_fx( st_fx, 3 );
     777       13057 :     move16();
     778       13057 :     imp_pos = (Word16) get_next_indice_fx( st_fx, 6 );
     779       13057 :     move16();
     780       13057 :     imp_sign = (Word16) get_next_indice_fx( st_fx, 1 );
     781       13057 :     move16();
     782       13057 :     imp_gain = (Word16) get_next_indice_fx( st_fx, 3 );
     783       13057 :     move16();
     784             : 
     785             :     /*----------------------------------------------------------------*
     786             :      * - restore gain_trans
     787             :      * - build glottal codebook contribution
     788             :      *----------------------------------------------------------------*/
     789             : 
     790       13057 :     gain_trans = tbl_gain_trans_tc_fx[imp_gain];
     791       13057 :     move16();
     792       13057 :     test();
     793       13057 :     if ( imp_sign == 0 )
     794             :     {
     795        6334 :         gain_trans = negate( gain_trans );
     796        6334 :         move16();
     797             :     }
     798             : 
     799             :     /* local max for scaling need */
     800             :     /* maximum of impulse always takes 15 bits (except impulse #7 wich is using 14 bits) */
     801             : 
     802       13057 :     tempS = 4;
     803       13057 :     move16();
     804       13057 :     test();
     805       13057 :     if ( LE_16( imp_gain, 3 ) )
     806             :     {
     807        5885 :         tempS = 7;
     808        5885 :         move16();
     809             :     }
     810             : 
     811             :     /* build glottal codebook contribution */
     812       13057 :     sc = add( 13 - 15, tempS ); /* scaling of curent exc */
     813       13057 :     sc = sub( *Q_exc, sc );
     814             : 
     815       13057 :     pt_shape = &Glottal_cdbk_fx[add( sub( i_mult2( imp_shape, L_IMPULSE ), imp_pos ), L_IMPULSE2 )];
     816       13057 :     move16();
     817             : 
     818       13057 :     j = s_max( 0, sub( imp_pos, L_IMPULSE2 ) );
     819       13057 :     move16(); /* penalty for exc + i_subfr initialisation */
     820      250375 :     FOR( i = 0; i < j; i++ )
     821             :     {
     822      237318 :         exc[add( i, i_subfr )] = 0;
     823      237318 :         move16();
     824             :     }
     825       13057 :     j = s_min( L_SUBFR, add( imp_pos, L_IMPULSE2 ) );
     826      222246 :     FOR( ; i <= j; i++ )
     827             :     {
     828      209189 :         exc[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( pt_shape[i], gain_trans ), sc ) ); /* (Qx * Q14 ) */
     829      209189 :         move16();
     830             :     }
     831      402883 :     FOR( ; i < L_SUBFR; i++ )
     832             :     {
     833      389826 :         exc[i + i_subfr] = 0;
     834      389826 :         move16();
     835             :     }
     836             : 
     837             :     /*--------------------------------------------------------------*
     838             :      * adapt. search of the second impulse in the same subframe
     839             :      * (when appears)
     840             :      *--------------------------------------------------------------*/
     841             : 
     842       13057 :     pred_lt4_tc_fx( exc, *T0, *T0_frac, inter4_2_fx, imp_pos, i_subfr );
     843       13057 :     IF( st_fx->hBWE_TD != NULL ){
     844       13057 :         IF( EQ_16( L_frame, L_FRAME ) ){
     845        6652 :             interp_code_5over2_fx( &exc[i_subfr], &bwe_exc[i_subfr * HIBND_ACB_L_FAC], L_SUBFR );
     846             : }
     847             : ELSE
     848             : {
     849        6405 :     interp_code_4over2_fx( &exc[i_subfr], &bwe_exc[i_subfr * 2], L_SUBFR );
     850             : }
     851             : }
     852       13057 : *position = add( imp_pos, i_subfr );
     853       13057 : move16();
     854       13057 : return;
     855             : }
     856             : 
     857             : /*-------------------------------------------------------------------*
     858             :  * tc_classif_fx()
     859             :  *
     860             :  * TC subframe classification decoding
     861             :  *-------------------------------------------------------------------*/
     862             : 
     863       13057 : Word16 tc_classif_fx(                       /*o: Q0*/
     864             :                       Decoder_State *st_fx, /* i/o: decoder state structure */
     865             :                       const Word16 L_frame  /* i  : length of the frame      Q0         */
     866             : )
     867             : {
     868             :     Word16 tc_subfr, indice;
     869             :     (void) ( L_frame );
     870       13057 :     IF( EQ_16( st_fx->L_frame, L_FRAME ) )
     871             :     {
     872        6652 :         IF( get_next_indice_fx( st_fx, 1 ) )
     873             :         {
     874        1575 :             tc_subfr = TC_0_0;
     875        1575 :             move16();
     876             :         }
     877             :         ELSE
     878             :         {
     879        5077 :             IF( get_next_indice_fx( st_fx, 1 ) )
     880             :             {
     881        2064 :                 tc_subfr = 0;
     882        2064 :                 move16();
     883             : 
     884        2064 :                 IF( get_next_indice_fx( st_fx, 1 ) )
     885             :                 {
     886         197 :                     tc_subfr = TC_0_192;
     887         197 :                     move16();
     888             :                 }
     889             :                 ELSE
     890             :                 {
     891        1867 :                     tc_subfr = TC_0_128;
     892        1867 :                     move16();
     893        1867 :                     if ( get_next_indice_fx( st_fx, 1 ) )
     894             :                     {
     895        1237 :                         tc_subfr = TC_0_64;
     896        1237 :                         move16();
     897             :                     }
     898             :                 }
     899             :             }
     900             :             ELSE
     901             :             {
     902        3013 :                 IF( get_next_indice_fx( st_fx, 1 ) )
     903             :                 {
     904        1013 :                     tc_subfr = L_SUBFR;
     905        1013 :                     move16();
     906             :                 }
     907             :                 ELSE
     908             :                 {
     909        2000 :                     tc_subfr = 3 * L_SUBFR;
     910        2000 :                     move16();
     911        2000 :                     if ( get_next_indice_fx( st_fx, 1 ) )
     912             :                     {
     913         449 :                         tc_subfr = 2 * L_SUBFR;
     914         449 :                         move16();
     915             :                     }
     916             :                 }
     917             :             }
     918             :         }
     919             :     }
     920             :     ELSE /* L_frame == L_FRAME16k */
     921             :     {
     922        6405 :         indice = (Word16) get_next_indice_fx( st_fx, 2 );
     923             : 
     924        6405 :         IF( LT_16( indice, 3 ) )
     925             :         {
     926        4250 :             tc_subfr = shl( indice, 6 );
     927             :         }
     928             :         ELSE
     929             :         {
     930        2155 :             tc_subfr = 4 * L_SUBFR;
     931        2155 :             move16();
     932        2155 :             if ( get_next_indice_fx( st_fx, 1 ) == 0 )
     933             :             {
     934         242 :                 tc_subfr = 3 * L_SUBFR;
     935         242 :                 move16();
     936             :             }
     937             :         }
     938             :     }
     939             : 
     940       13057 :     return ( tc_subfr );
     941             : }

Generated by: LCOV version 1.14