Commit beacbfc4 authored by thomas dettbarn's avatar thomas dettbarn
Browse files

replaced the division by 6 with a multiplication with 10923, followed by a shift 16.

parent 42fac338
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1325,7 +1325,7 @@ ivas_error config_acelp1_fx(
            test();
            IF( EQ_16( coder_type, UNVOICED ) && !( *uc_two_stage_flag ) )
            {
                i = idiv1616( bits, NB_SUBFR );
                i = shr( bits, NB_SUBFR_LOG2 );
                IF( s_and( i, 1 ) == 0 )
                {
                    i = sub( i, 1 ); /* must be odd */
+1 −0
Original line number Diff line number Diff line
@@ -714,6 +714,7 @@ enum
#define M                                   16                                                                                                               /* order of the LP filter @ 12.8kHz           */
#define L_FRAME                             256                                                                                                              /* frame size at 12.8kHz                      */
#define NB_SUBFR                            4                                                                                                                /* number of subframes per frame              */
#define NB_SUBFR_LOG2                       2                                                                                                                /* To be used for shift operation instead of division */
#define L_SUBFR                             ( L_FRAME / NB_SUBFR )                                                                                           /* subframe size                              */
#define L_SUBFR_LOG2                        6                                                                                                                /* To be used for shift operation instead of division */
#define L_SUBFR_Q6                            ((L_FRAME/NB_SUBFR)*64)       /* subframe size                              */
+2 −1
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ Word16 tcxGetNoiseFillingTilt(

    IF( mode != 0 )
    {
        firstLine = idiv1616U( L_frame, 6 );
        //firstLine = idiv1616U( L_frame, 6 );
        firstLine = extract_l( L_shr( imult3216( 10923, L_frame ), 16 ) ); /* equivalent to L_frame / 6 */
        *noiseTiltFactor = 18432 /*0.5625f Q15*/;
        move16();
    }
+6 −3
Original line number Diff line number Diff line
@@ -921,7 +921,8 @@ static void EstimateTCXNoiseLevel_ivas_fx(
        test();
        IF( GE_32( st->total_brate, ACELP_13k20 ) && st->rf_mode == 0 )
        {
            iStart = idiv1616U( L_frame, 6 );
            //iStart = idiv1616U( L_frame, 6 );
            iStart = extract_l( L_shr( imult3216( 10923, L_frame ), 16 ) ); /* equivalent to L_frame/6 */
        }

        noiseTransWidth = GetTransWidth_ivas_fx( st->tcxonly, (Word16) EQ_16( L_frame, shr( st->L_frame, 1 ) ), st->hTcxEnc->tcxltp_gain, ( st->hTcxCfg->ctx_hm && st->last_core != ACELP_CORE && hm_active ) );
@@ -1141,7 +1142,8 @@ void EstimateStereoTCXNoiseLevel_fx(
                test();
                IF( GE_32( total_brate, ACELP_13k20 ) && !st->rf_mode )
                {
                    iStart = idiv1616( L_frame[ch][n], 6 );
                    //iStart = idiv1616( L_frame[ch][n], 6 );
                    iStart = extract_l( L_shr( imult3216( 10923, L_frame[ch][n] ), 16 ) ); /* for x in [0...32767], this is the equivalent of x/6 */
                }
                ELSE
                {
@@ -2062,7 +2064,8 @@ void QuantizeSpectrum_fx(
                test();
                IF( GE_32( st->total_brate, ACELP_13k20 ) && st->rf_mode == 0 )
                {
                    i = idiv1616U( L_frame, 6 );
                    //i = idiv1616U( L_frame, 6 );
                    i = extract_l( L_shr( imult3216( 10923, L_frame ), 16 ) ); /* equivalent to L_frame/6 */
                }

                IF( tcxonly )