Commit 1ad638fd authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into 1793-fix-decoder-mc-to-mono-output-scaling

# Conflicts:
#	lib_com/options.h
parents 3735486f 51d4b017
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 */
#define FIX_1793_DEC_MC_TO_MONO_SCALING_ISSUE                /* FhG: Use dynamic Q factor for synth_fx and synthFB_fx to prevent overflow */
/* ################### End FIXES 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 */
                }