Commit 5d35065b authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 20251027-consolidated-cleanup-main
parents 0c453dec 17bfb0fa
Loading
Loading
Loading
Loading
Loading
+65 −2
Original line number Diff line number Diff line
@@ -2563,7 +2563,71 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */
     headroom is introduced into acc
*/

#ifdef OPT_2146_BASOP_UTIL_ADD_MANT32EXP
Word32 BASOP_Util_Add_Mant32Exp /* o  : normalized result mantissa */
    ( Word32 a_m,               /* i  : Mantissa of 1st operand a  */
      Word16 a_e,               /* i  : Exponent of 1st operand a  */
      Word32 b_m,               /* i  : Mantissa of 2nd operand b  */
      Word16 b_e,               /* i  : Exponent of 2nd operand b  */
      Word16 *ptr_e )           /* o  : exponent of result         */
{
    Word16 shift;
    /* Compare exponents: the difference is limited to +/- 31
       The Word32 mantissa of the operand with lower exponent is shifted right by the exponent difference.
       Then, the unshifted mantissa of the operand with the higher exponent is added. The addition result
       is normalized and the result represents the mantissa to return. The returned exponent takes into
       account all shift operations.
    */

    if ( !a_m )
    {
        a_e = b_e;
        move16();
    }

    if ( !b_m )
    {
        b_e = a_e;
        move16();
    }

    shift = sub( a_e, b_e );

    if ( shift > 0 )
        shift = s_min( shift, 31 );
    if ( shift < 0 )
        shift = s_max( shift, -31 );

    /* shift > 0 exponent of a is greater than exponent of b */
    if ( shift > 0 )
        b_m = L_shr( b_m, shift );
    /* shift < 0 exponent of b is greater than exponent of a */
    if ( shift < 0 )
        a_m = L_shl( a_m, shift );

    a_m = L_add( L_shr( a_m, 1 ), L_shr( b_m, 1 ) );

    if ( shift >= 0 )
        a_e = add( a_e, 1 );
    if ( shift < 0 )
        a_e = add( b_e, 1 );

    shift = norm_l( a_m );
    if ( shift )
        a_m = L_shl( a_m, shift );
    if ( !a_m )
    {
        a_e = 0;
        move16();
    }
    if ( a_m )
        a_e = sub( a_e, shift );

    *ptr_e = a_e;

    return ( a_m );
}
#else
Word32 BASOP_Util_Add_Mant32Exp /* o  : normalized result mantissa */
    ( Word32 a_m,               /* i  : Mantissa of 1st operand a  */
      Word16 a_e,               /* i  : Exponent of 1st operand a  */
@@ -2580,7 +2644,6 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */
       is normalized and the result represents the mantissa to return. The returned exponent takes into
       account all shift operations.
    */

    if ( !a_m )
    {
        a_e = b_e;
@@ -2622,7 +2685,7 @@ Word32 BASOP_Util_Add_Mant32Exp /* o : normalized result mantissa */

    return ( L_tmp );
}

#endif

static const Word16 shift_lc[] = { 9, 10 };

+4 −1
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@
#endif

/* ################### Start FIXES switches ########################### */

#define FIX_1990_SANITIZER_IN_REVERB_LOAD                    /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK            /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#define TEMP_FIX_2088_MSAN_INIT_ERROR                        /* Eri: Temporary fix for Issue 2088 - MSAN error. Will come with later port of JBM+Split rendering update */
@@ -80,6 +79,9 @@
#define FIX_2084_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in IVAS_ENC_FeedObjectMetadata() */
#define FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING          /* FhG: Replace L_shl with L_shl_sat to prevent overflow when calculating scale factors for very small numbers in the logarithmic domain */
#define FIX_APA_EXECS_SCALING                                /* VA: fix scaling of JBM APA buffer */
#define FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT            /* Nokia: Issue 2164: Prevent overflow when calculating equalization coefficient for editing before clamping to safe range */
#define FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC                   /* FhG: fix for issue 2165 - using saturating addition in tonal MDCT PLC function */
#define OPT_2146_BASOP_UTIL_ADD_MANT32EXP                    /* Dlb: optimized version of BASOP_Util_Add_Mant32Exp() */

/* ################### End FIXES switches ########################### */

@@ -110,6 +112,7 @@
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */


// object-editing feature porting
#define TMP_FIX_SPLIT_REND                              // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
#define TMP_FIX_OMASA_SR_BE                             // temporary fix to keep OMASA split-rendering BE
+4 −0
Original line number Diff line number Diff line
@@ -454,7 +454,11 @@ static void getEnvelope(

    FOR( i = 0; i < n2; i++ )
    {
#ifdef FIX_BASOP_ASSERT_IN_TONAL_MDCT_PLC
        sum = L_add_sat( sum, powerSpec[i] ); /*powerSpec_exp*/
#else
        sum = L_add( sum, powerSpec[i] ); /*powerSpec_exp*/
#endif
    }
    /* No need for PTR_INIT for powerSpec[i+n2] as we continue from the previous loop */
    FOR( i = 0; i < n1; i++ )
+5 −1
Original line number Diff line number Diff line
@@ -6362,7 +6362,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
                temp = BASOP_Util_Divide3232_Scale_newton( hMasaIsmData->preprocEneTarget_fx[band_idx], L_max( 1, hMasaIsmData->preprocEneRealized_fx[band_idx] ), &temp_q );
                temp_q = sub( Q31, sub( sub( Q31, temp_q ), sub( hMasaIsmData->preprocEneTarget_e[band_idx], hMasaIsmData->preprocEneRealized_e[band_idx] ) ) );
                temp = Sqrt32( temp, &temp_q ); // Q: 31-temp_q
#ifdef FIX_2164_ASSERT_IN_OMASA_PREPROC_FOR_EDIT
                temp = L_shl_sat( temp, sub( temp_q, 3 ) ); // Q28
#else
                temp = L_shl( temp, sub( temp_q, 3 ) ); // Q28
#endif
                temp_q = Q28;
                move16();
            }