Commit 723943ca authored by Fabian Bauer's avatar Fabian Bauer
Browse files

checkout *m from lib_com from main

parent 6a035e4a
Loading
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -23,12 +23,6 @@
#include <stdlib.h>
#include <stdio.h>

#ifndef ISSUE_1836_FILEACTIVE_math_op_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
/*___________________________________________________________________________
 |                                                                           |
 |   Function Name : Isqrt                                                   |
@@ -234,30 +228,20 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
{
    Word16 i, sft, tmp;
    Word32 L_sum;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif


    L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */

    IF( expi == 0 )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        L_sum = L_mac_sat( 1, x[0], x[0] ); //??sat
        FOR( i = 1; i < lg; i++ )
        {
            L_sum = L_mac_sat( L_sum, x[i], x[i] ); //??sat
        }
#else
        L_sum = L_mac_o( 1, x[0], x[0], &Overflow );
        FOR( i = 1; i < lg; i++ )
        {
            L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow );
        }
#endif
    }
    IF( expi < 0 )
    {
@@ -267,24 +251,11 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
        FOR( i = 1; i < lg; i++ )
        {
            tmp = mult_r( x[i], sft );
#ifdef ISSUE_1836_replace_overflow_libcom
            L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat
#else
            L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
#endif
        }
    }
    IF( expi > 0 )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        tmp = shl_sat( x[0], expi );      //??sat
        L_sum = L_mac_sat( 1, tmp, tmp ); //??sat
        FOR( i = 1; i < lg; i++ )
        {
            tmp = shl_sat( x[i], expi );          //??sat
            L_sum = L_mac_sat( L_sum, tmp, tmp ); //??sat
        }
#else
        tmp = shl_o( x[0], expi, &Overflow );
        L_sum = L_mac_o( 1, tmp, tmp, &Overflow );
        FOR( i = 1; i < lg; i++ )
@@ -292,7 +263,6 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
            tmp = shl_o( x[i], expi, &Overflow );
            L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
        }
#endif
    }

    /* Normalize acc in Q31 */
+31 −165
Original line number Diff line number Diff line
@@ -15,12 +15,6 @@
#include "wmc_auto.h"


#ifndef ISSUE_1836_FILEACTIVE_modif_fs_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif

/*-----------------------------------------------------------------*
 * Local functions
 *-----------------------------------------------------------------*/
@@ -81,11 +75,9 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
    Word16 flag_low_order = 0;
    move16();
    Word16 filt_len_tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    const Resampling_cfg *cfg_ptr_fx;

@@ -285,11 +277,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
                test();
                IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
                {
#ifdef ISSUE_1836_replace_overflow_libcom
                    num_den = shl_sat( num_den, 1 ); //??sat
#else
                    num_den = shl_o( num_den, 1, &Overflow );
#endif
                    *Q_new_inp = add( *Q_new_inp, 1 );
                    move16();
                }
@@ -370,11 +358,9 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
    Word16 flag_low_order = 0;
    move16();
    Word16 filt_len_tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    const Resampling_cfg *cfg_ptr_fx;

@@ -571,11 +557,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
                if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
                {
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifdef ISSUE_1836_replace_overflow_libcom
                    num_den = shl_sat( num_den, 1 ); //??sat
#else
                    num_den = shl_o( num_den, 1, &Overflow );
#endif
#else
                    num_den = shl( num_den, 1 );
#endif
@@ -947,11 +929,9 @@ void Decimate_allpass_steep_fx(
    Word32 Lacc, Lacc1;
    Word16 temp1, temp2;
    Word16 sum = 0;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    move16();

@@ -962,34 +942,20 @@ void Decimate_allpass_steep_fx(
    {

        Lacc = L_deposit_h( mem[0] );                                     /* Q(16+x)   */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x)   */ //??sat
        Lacc1 = L_deposit_h( in_fx[2 * k] );                                     /* Q16+Qx    */
        temp1 = extract_h( Lacc );                                               /* Qx        */
        Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx    */      //??sat
#else
        Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x)   */
        Lacc1 = L_deposit_h( in_fx[2 * k] );                              /* Q16+Qx    */
        temp1 = extract_h( Lacc );                                        /* Qx        */
        Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow );      /* Q16+Qx    */
#endif
        mem[0] = extract_h( Lacc1 );                                      /* Qx        */
        temp[0] = temp1;
        move16();
        move16();

        Lacc1 = L_deposit_h( mem[1] );                                   /* Q16+Qx    */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx    */ //??sat

        temp2 = extract_h( Lacc1 );                                       /* Qx        */
        Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx    */ //??sat
#else
        Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx    */

        temp2 = extract_h( Lacc1 );                                /* Qx        */
        Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx    */
#endif
        mem[1] = extract_h( Lacc );                                /* Qx        */
        temp[1] = temp2;
        move16();
@@ -997,66 +963,37 @@ void Decimate_allpass_steep_fx(


        Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] );                                                /* Q(16+x)              */
#ifdef ISSUE_1836_replace_overflow_libcom
        out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format            */ //??sat
        move16();
        mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx  */ //??sat
        move16();
#else
        out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format            */
        move16();
        mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx    */
        move16();
#endif
    }

    /* lower allpass filter chain  */

    Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] );                                   /*  Q(16+x)     */
#ifdef ISSUE_1836_replace_overflow_libcom
    Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /*  Q(16+x)     */ //??sat
    Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] );                                        /*  Q(16+x)     */
    temp1 = extract_h( Lacc );                                                                    /*  Qx          */
    Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /*  Q(16+x)     */                        //??sat
#else
    Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x)   */
    Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] );                              /*  Q(16+x)     */
    temp1 = extract_h( Lacc );                                                          /*  Qx          */
    Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow );                        /*  Q(16+x)     */
#endif
    mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 );
    temp[0] = temp1;
    move16();

    Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] );       /*   Q(16+x) */
#ifdef ISSUE_1836_replace_overflow_libcom
    Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /*  Q(16+x) */ //??sat
    temp2 = extract_h( Lacc1 );                                        /*  Qx      */
    temp[1] = temp2;
    move16();
    Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /*  Q(16+x) */ //??sat
#else
    Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /*  Q(16+x) */
    temp2 = extract_h( Lacc1 );                                  /*  Qx      */
    temp[1] = temp2;
    move16();
    Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /*  Q(16+x) */
#endif
    mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc );        /*  Qx      */
    move16();

    Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] );                          /* Q(16+x)  */
#ifdef ISSUE_1836_replace_overflow_libcom
    Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */ //??sat
    temp[2] = extract_h( Lacc );                                                                                          /* temp[2] in Qx  */
    move16();
    Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /*   Q(16+x) */ //??sat
#else
    Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
    temp[2] = extract_h( Lacc );                                                       /* temp[2] in Qx  */
    move16();
    Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /*   Q(16+x) */
#endif
    mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 );                               /*   Qx      */
    move16();
    sum = mult_r( out_fx[0], 16384 );                                             /* Qx */
@@ -1069,17 +1006,10 @@ void Decimate_allpass_steep_fx(


        Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] );                     /* Q(16+x)           */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0]   */ //??sat
        Lacc1 = L_deposit_h( in_fx[2 * k - 1] );                                             /* Q(16+x)           */
        temp1 = extract_h( Lacc );                                                           /* Qx                */
        Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x)           */          //??sat
#else
        Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0]   */
        Lacc1 = L_deposit_h( in_fx[2 * k - 1] );                              /* Q(16+x)           */
        temp1 = extract_h( Lacc );                                            /* Qx                */
        Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow );          /* Q(16+x)           */
#endif

        mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */
        move16();
@@ -1088,20 +1018,6 @@ void Decimate_allpass_steep_fx(


        Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] );       /* Q(16+x)  */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x)  */ //??sat
        temp2 = extract_h( Lacc1 );                                        /* Qx       */
        temp[1] = temp2;
        move16();
        Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x)  */ //??sat
        mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc );              /* Qx       */


        Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] );                     /* Q(16+x) */
        Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] );   //??sat  /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
        temp[2] = extract_h( Lacc );                                                  /*temp[2] in Qx  */
        Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); //??sat  /* Q(16+x) */
#else
        Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x)  */
        temp2 = extract_h( Lacc1 );                                  /* Qx       */
        temp[1] = temp2;
@@ -1114,7 +1030,6 @@ void Decimate_allpass_steep_fx(
        Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow );   /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
        temp[2] = extract_h( Lacc );                                                           /*temp[2] in Qx  */
        Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */
#endif
        mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 );                               /* Qx  */


@@ -1231,11 +1146,9 @@ void Interpolate_allpass_steep_fx(
    Word16 k;
    Word32 Lacc = 0, Lacc1 = 0;
    Word16 temp1, temp2;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15  OP in Q0 ************/
    /*upper allpass filter chain     */
@@ -1244,30 +1157,7 @@ void Interpolate_allpass_steep_fx(
    {

        Lacc = L_deposit_h( mem[0] );                                 /* Q(16+x) */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat
        Lacc1 = L_deposit_h( in_fx[k] );                                           /* Q(16+x) */
        temp1 = round_fx_sat( Lacc ); /* Qx */                                     //??sat
        Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x)  */         //??sat

        mem[0] = round_fx_sat( Lacc1 ); //??sat
        move16();
        Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */                                  //??sat
        Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */ //??sat
        Lacc = L_deposit_h( temp1 );

        temp2 = round_fx_sat( Lacc1 ); /* Qx */                         //??sat
        Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat
        mem[1] = round_fx_sat( Lacc ); /* Qx */                         //??sat
        move16();

        Lacc1 = L_deposit_h( temp2 );
        Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x)   */                                                  //??sat
        out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat
        move16();
        mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx  */ //??sat //??sat
        move16();
#else
        Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */
        Lacc1 = L_deposit_h( in_fx[k] );                              /* Q(16+x) */
        temp1 = round_fx_o( Lacc, &Overflow );                        /* Qx */
        Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow );  /* Q(16+x)  */
@@ -1289,7 +1179,6 @@ void Interpolate_allpass_steep_fx(
        move16();
        mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx  */
        move16();
#endif
    }

    /*  lower allpass filter chain    */
@@ -1297,28 +1186,6 @@ void Interpolate_allpass_steep_fx(
    FOR( k = 0; k < N; k++ )
    {
        Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] );             /* Q(16+x) */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */ //??sat
        Lacc1 = L_deposit_h( in_fx[k] );                                           /* Q(16+x) */
        temp1 = round_fx_sat( Lacc ); /* Qx */                                     //??sat
        Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x)  */         //??sat

        mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 );                       //??sat
        Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] );                    /* Q(16+x) */
        Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */ //??sat

        temp2 = round_fx_sat( Lacc1 ); /* Qx */ //??sat
        Lacc = L_deposit_h( temp1 );
        Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */ //??sat
        mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */ //??sat

        Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
        Lacc1 = L_deposit_h( temp2 );
        out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */ //??sat //??sat
        move16();
        mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */ //??sat //??sat
        move16();
#else
        Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */
        Lacc1 = L_deposit_h( in_fx[k] );                              /* Q(16+x) */
        temp1 = round_fx_o( Lacc, &Overflow );                        /* Qx */
@@ -1339,7 +1206,6 @@ void Interpolate_allpass_steep_fx(
        move16();
        mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */
        move16();
#endif
    }

    return;