Commit 51d4b017 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge branch '2141_fix_assert_in_omasa_bitrate_switching' into 'main'

[non-BE]Resolve "Assert in OMASA bitrate switching -10 dB LTV input, bw_detect_fx"

Closes #2141

See merge request !2439
parents d3b5c67f e6cb9b3d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@
#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 */
#define FIX_2092_ASSERT_IN_OMASA_RENDER                      /* FhG, Nokia: Fix LTV crash due to overflow in OMASA EXT output */
#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 */
/* ################### End FIXES switches ########################### */

/* #################### Start BASOP porting switches ############################ */
+29 −6
Original line number Diff line number Diff line
@@ -117,14 +117,25 @@ void bw_detect_fx(
            move32();                                            /* Q31 */
            cldfb_bin_Exp[0] = add( cldfb_bin_Exp[0], CLDFBscalingFactor_EXP );
            move16();

#ifdef FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING
            if ( cldfb_bin[0] == 0 )
            {
                cldfb_bin[0] = L_deposit_l( 1 );
                move32();
            }
#else
            if ( cldfb_bin[i] == 0 )
            {
                cldfb_bin[i] = L_deposit_l( 1 );
                move32();
            }
#endif
            L_tmp = BASOP_Util_Log2( cldfb_bin[0] ); /*(log2(660423549*2^(-31))/64)*2^31*/
#ifdef FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING
            L_tmp = L_add_sat( L_tmp, L_shl_sat( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#else
            L_tmp = L_add_sat( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ) );     /* Q25 */
#endif
            cldfb_bin[0] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ );
            move32(); /* 1/log2(10) */ /* Q25 */

@@ -154,7 +165,11 @@ void bw_detect_fx(
                        move32();
                    }
                    L_tmp = BASOP_Util_Log2( cldfb_bin[i] ); /*(log2(660423549*2^(-31))/64)*2^31*/
#ifdef FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING
                    L_tmp = L_add( L_tmp, L_shl_sat( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#else
                    L_tmp = L_add( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#endif
                    cldfb_bin[i] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ );
                    move32(); /* 1/log2(10) */ /* Q25 */
                }
@@ -193,7 +208,11 @@ void bw_detect_fx(
                        move32();
                    }
                    L_tmp = BASOP_Util_Log2( cldfb_bin[i] ); /*(log2(660423549*2^(-31))/64)*2^31*/
#ifdef FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING
                    L_tmp = L_add( L_tmp, L_shl_sat( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#else
                    L_tmp = L_add( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#endif
                    cldfb_bin[i] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ );
                    move32(); /* 1/log2(10) */ /* Q25 */
                }
@@ -226,7 +245,11 @@ void bw_detect_fx(
                        move32();
                    }
                    L_tmp = BASOP_Util_Log2( cldfb_bin[i] ); /*(log2(660423549*2^(-31))/64)*2^31*/
#ifdef FIX_2141_ASSERT_IN_OMASA_BITRATE_SWITSCHING
                    L_tmp = L_add( L_tmp, L_shl_sat( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#else
                    L_tmp = L_add( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[i] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
#endif
                    cldfb_bin[i] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ );
                    move32(); /* 1/log2(10) */ /* Q25 */
                }