Commit 76a8b9b6 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into 3gpp_issue_1801_fix

# Conflicts:
#	lib_com/options.h
parents 77432c2e 9dfd5456
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@
#define ONE_IN_Q29                      536870912
#define ONE_IN_Q30                      1073741824
#define ONE_IN_Q31                      0x7fffffff
#define MINUS_ONE_IN_Q31                      -2147483648
#define MINUS_ONE_IN_Q31                0x80000000
#define TWO_IN_Q29                      1073741824
#define FOUR_IN_Q28                     1073741824

+98 −1
Original line number Diff line number Diff line
@@ -4017,7 +4017,12 @@ void ivas_compute_spar_params_fx(
Word32 diff_norm_order1_table[4] = { 0, 805306368, 402653184, 268435456 };                                              // q28
Word32 diff_norm_order2_table[6] = { 0, 1342177280, 671088640, 447392416, 335544320, 268435456 };                       // q28
Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762048, 375809632, 313174688, 268435456 }; // q28
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
#define EPSILON_FX_SHIFT 6
#define EPSILON_FX_THR   ( 1 << EPSILON_FX_SHIFT )
#else
#define EPSILON_FX_THR 70
#endif
#define ONE_BY_THREE_Q31 715827882
#define ONE_BY_FIVE_Q31  429496729
#define ONE_BY_SEVEN_Q31 306783378
@@ -4257,10 +4262,20 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                {
                    Word32 norm_fx;
                    Word16 norm_q;

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    Word16 num_ch_order, norm_t;
                    Word32 tmp_norm_out;
#else
                    Word16 num_ch_order, hoa2_ch_order;
#endif

                    num_ch_order = ivas_sba_get_nchan_fx( order, 0 );
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 );
#else
                    assert( order == 1 );
#endif

                    FOR( ch = 0; ch < num_ch_order; ch++ )
                    {
@@ -4275,16 +4290,26 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                    }

                    /*normalize 1st order*/
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) );
                    norm_t = sub( norm_t, 1 );
                    scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t );
#endif
                    norm_fx = 0;
                    move32();
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_q = 0;
                    move16();
#endif
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
                    }

                    norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) );
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
#else
                    IF( norm_fx )
                    {
                        norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
@@ -4294,6 +4319,7 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                        norm_fx = EPSILON_FX;
                        move32();
                    }
#endif
                    IF( norm_q <= 0 )
                    {
                        norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31
@@ -4301,6 +4327,27 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                        move16();
                    }
                    norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    IF( LT_32( norm_fx, EPSILON_FX_THR ) )
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/
                            response_avg_fx[ch] = L_shl( response_avg_fx[ch], Q30 - EPSILON_FX_SHIFT ); // q30
                            move32();
                        }
                    }
                    ELSE
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            tmp_norm_out = divide3232( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ) ); // q15
                            response_avg_fx[ch] = L_shl( tmp_norm_out, 15 );                                                  // q30
                            move32();
                        }
                    }
#else
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        IF( LT_32( norm_fx, EPSILON_FX_THR ) )
@@ -4326,6 +4373,9 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                            move32();
                        }
                    }
#endif

#ifndef NONBE_FIX_1748_SPAR_DIV_OPT

                    /*normalize 2nd order*/
                    norm_fx = 0;
@@ -4426,6 +4476,7 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                            move32();
                        }
                    }
#endif
                }
            }

@@ -4815,10 +4866,19 @@ void ivas_get_spar_md_from_dirac_fx(
                {
                    Word32 norm_fx;
                    Word16 norm_q;
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    Word16 num_ch_order, norm_t;
                    Word32 tmp_norm_out;
#else
                    Word16 num_ch_order, hoa2_ch_order;
#endif

                    num_ch_order = ivas_sba_get_nchan_fx( order, 0 );
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    hoa2_ch_order = ivas_sba_get_nchan_fx( SBA_HOA2_ORDER, 0 );
#else
                    assert( order == 1 );
#endif

                    FOR( ch = 0; ch < num_ch_order; ch++ )
                    {
@@ -4833,16 +4893,27 @@ void ivas_get_spar_md_from_dirac_fx(
                    }

                    /*normalize 1st order*/
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_t = L_norm_arr( &response_avg_fx[1], sub( foa_ch, 1 ) );
                    norm_t = sub( norm_t, 1 );
                    scale_sig32( &response_avg_fx[1], sub( foa_ch, 1 ), norm_t );
#endif
                    norm_fx = 0;
                    move32();
#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_q = 0;
                    move16();
#endif
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        norm_fx = L_add( norm_fx, Mpy_32_32( response_avg_fx[ch], response_avg_fx[ch] ) ); // q29
                    }

                    norm_q = sub( 31, ( sub( add( 30, 30 ), 31 ) ) );

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
#else
                    IF( norm_fx )
                    {
                        norm_fx = Sqrt32( norm_fx, &norm_q ); // q=31-norm_q
@@ -4852,6 +4923,8 @@ void ivas_get_spar_md_from_dirac_fx(
                        norm_fx = EPSILON_FX;
                        move32();
                    }
#endif

                    IF( norm_q <= 0 )
                    {
                        norm_fx = L_shr( norm_fx, ( negate( norm_q ) ) ); // q=31
@@ -4859,6 +4932,27 @@ void ivas_get_spar_md_from_dirac_fx(
                        move16();
                    }
                    norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    IF( LT_32( norm_fx, EPSILON_FX_THR ) )
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/
                            response_avg_fx[ch] = L_shl( response_avg_fx[ch], Q30 - EPSILON_FX_SHIFT ); // q30
                            move32();
                        }
                    }
                    ELSE
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            tmp_norm_out = divide3232( response_avg_fx[ch], L_max( norm_fx, L_abs( response_avg_fx[ch] ) ) ); // q15
                            response_avg_fx[ch] = L_shl( tmp_norm_out, 15 );                                                  // q30
                            move32();
                        }
                    }
#else
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        IF( LT_32( norm_fx, EPSILON_FX_THR ) )
@@ -4884,7 +4978,9 @@ void ivas_get_spar_md_from_dirac_fx(
                            move32();
                        }
                    }
#endif

#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    /*normalize 2nd order*/
                    norm_fx = 0;
                    move32();
@@ -4984,6 +5080,7 @@ void ivas_get_spar_md_from_dirac_fx(
                            move32();
                        }
                    }
#endif
                }
            }

+2 −2
Original line number Diff line number Diff line
@@ -1759,8 +1759,8 @@ void interpolate_3_over_1_allpass_fx32(
    {
        mem_temp = out[i]; // Qx
        move32();
        out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2424 ) ); // Qx
        // 0.572769 in Q15 -> 18768, 0.074005 in Q15 -> 2424
        out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2425 ) ); // Qx
        // 0.572769 in Q15 -> 18768, 0.074005 in Q15 -> 2425
        move32();
        mem[10] = mem[11]; // Qx
        move32();
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@
#define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
#define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD

#define FIX_1802

#define FIX_USAN_BASOP_UTIL_DIVIDE3232          /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */

#define FIX_1740_MISING_POP_WMOPS               /* VA: fix issue 1740: missing pop_wmops() */
@@ -119,5 +121,7 @@
#define FIX_ISSUE_1792                          /* FhG: fix noise bursts in binaural rendering */

#define FIX_ISSUE_1795_Q3_OVERFLOW              /* FhG: Q3 overflow in function WB_BWE_gain_pred_fx (EVS legacy code) BE, MR1855 */
#define NONBE_FIX_1748_SPAR_DIV_OPT                      /*Dlb: issue 1748: SPAR common div optimizations*/

#define FIX_ISSUE_1801_NOISE_FLOOR_REDUCTION    /* FhG: Fixed getScalefactor usage */
#endif
+1 −1
Original line number Diff line number Diff line
@@ -7077,7 +7077,7 @@ void prep_tbe_exc_fx(
        FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ )
        {
            L_tmp = L_mult( gain_code16, tmp_code_fx[i] );                                                  /* Q9 + Q_exc + 1*/
            L_tmp = L_shl( L_tmp, 5 );                                                                      /* Q9 + Q_exc + Q6*/
            L_tmp = L_shl_o( L_tmp, 5, &Overflow );                                                         /* Q9 + Q_exc + Q6*/
            L_tmp = L_mac_o( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC], &Overflow ); /*Q15+Q_exc */
            L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /*16+Q_exc */                                           /* saturation can occur here */
            bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow );                  /*Q_exc */
Loading