Commit f1c46223 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '1744-use-of-divide3232-with-restricted-call-parameters-l_num-l_denom' into 'main'

Resolve "Use of divide3232 with restricted call parameters: L_num <= L_denom"

Closes #1744

See merge request !1778
parents 8373302b ee0097e7
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@

#define FIX_1740_MISING_POP_WMOPS               /* VA: fix issue 1740: missing pop_wmops() */

#define FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC       /* FhG: NON-BE!!! Simplify azimuth & elevation calculations, remove parameter mismatch for divide3232, fix copy/paste error for elevation */
#define FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG /* FhG: NON-BE!!! Simplify threshold - comparison, change (wrong) Equal-comparion to (correct) Greater-Than-comparison */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */

#define FIX_1762_COMPILER_ISSUE                 /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
+21 −5
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@
/*------------------------------------------------------------------------------------------*
 * Local constants
 *------------------------------------------------------------------------------------------*/
#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
#define DEG180_BY_PI_Q24 ( (Word32) 0x394BB835 ) /* 180.0/PI in Q24) */
#endif

#define IVAS_DEFAULT_DTX_CNG_RAMP ( 8 )

@@ -2959,8 +2962,13 @@ void ivas_spar_to_dirac_fx(
                radius_fx = Sqrt32( temp, &q_temp );

                Word16 check_azi_fx = BASOP_util_atan2( dvy_fx[band], dvx_fx[band], 0 ); /*Q13*/
                Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 );                      /*Q29*/

#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
                Word32 azi_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_azi_fx );
#else
                Word16 check_azi_fx_res;
                Word32 check_azi_fx_32 = L_shl( check_azi_fx, 16 ); /*Q29*/

                IF( check_azi_fx_32 < 0 )
                {
                    check_azi_fx_res = negate( divide3232( L_negate( check_azi_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/
@@ -2970,6 +2978,8 @@ void ivas_spar_to_dirac_fx(
                    check_azi_fx_res = divide3232( check_azi_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/
                }
                Word32 azi_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_azi_fx_res ); /*Q22*/
#endif

                azi_intermediate = L_add( azi_intermediate, ONE_IN_Q21 ); /*Q22*/

                Word16 azi_res;
@@ -2983,9 +2993,14 @@ void ivas_spar_to_dirac_fx(
                }

                Word16 check_ele_fx = BASOP_util_atan2( dvz_fx[band], radius_fx, sub( add( 9, q_dvnorm ), q_temp ) ); /*Q13*/
                Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 );                                                   /*Q29*/
#ifdef FIX_ISSUE_1744_IVAS_SPAR_TO_DIRAC
                Word32 ele_intermediate = Mpy_32_16_1( DEG180_BY_PI_Q24, check_ele_fx );
#else

                Word16 check_ele_fx_res;
                IF( check_azi_fx_32 < 0 )
                Word32 check_ele_fx_32 = L_shl( check_ele_fx, 16 ); /*Q29*/

                IF( check_ele_fx_32 < 0 )
                {
                    check_ele_fx_res = negate( divide3232( L_negate( check_ele_fx_32 ), 1686629760 /*3.145f in Q29*/ ) ); /*Q15*/
                }
@@ -2994,6 +3009,7 @@ void ivas_spar_to_dirac_fx(
                    check_ele_fx_res = divide3232( check_ele_fx_32, 1686629760 /*3.145f in Q29*/ ); /*Q15*/
                }
                Word32 ele_intermediate = Mpy_32_16_1( DEGREE_180_Q_22, check_ele_fx_res ); /*Q22*/
#endif
                ele_intermediate = L_add( ele_intermediate, ONE_IN_Q21 ); /*Q22*/

                Word16 ele_res;
+13 −1
Original line number Diff line number Diff line
@@ -660,7 +660,18 @@ static Word16 ivas_dirac_get_mono_flag_fx(
                    move32();
                    move16();
                }

#ifdef FIX_ISSUE_1744_IVAS_DIRAC_GET_MONO_FLAG
                IF( BASOP_Util_Cmp_Mant32Exp( W_band_power, W_band_power_e, Mpy_32_32( other_ch_band_power, threshold ), other_ch_band_power_e + threshold_e ) == 1 )
                {
                    any_mono_band = 1;
                    move16();
                }
                ELSE
                {
                    any_mc_band = 1;
                    move16();
                }
#else
                IF( BASOP_Util_Cmp_Mant32Exp( divide3232( W_band_power, other_ch_band_power ), 31, threshold, threshold_e ) == 0 )
                {
                    any_mono_band = 1;
@@ -671,6 +682,7 @@ static Word16 ivas_dirac_get_mono_flag_fx(
                    any_mc_band = 1;
                    move16();
                }
#endif
            }
        }
    }