Commit 335f0b34 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 2131-basop-PortMr2116-from-float-clarify-ivas_max_output_channels
parents 2bcae6ec 51d4b017
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3487,7 +3487,11 @@ static void do_object_editing_fx(
                if ( readInfo->obj_gain_relative[obj_idx] )
                {
                    /* gain: apply relative edit + saturation */
#ifdef FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES
                    editableParameters->ism_metadata[obj_idx].gain_fx = L_max( L_min( L_shl_sat( Mpy_32_32( editableParameters->ism_metadata[obj_idx].gain_fx, (Word32) readInfo->obj_gain[obj_idx] * 536870912 ), 2 ), OBJ_EDIT_GAIN_MAX_FX ), OBJ_EDIT_GAIN_MIN_FX ); /* Q29*Q29 -> Q27 shift back to Q29 */
#else
                    editableParameters->ism_metadata[obj_idx].gain_fx = L_max( L_min( editableParameters->ism_metadata[obj_idx].gain_fx * (Word32) readInfo->obj_gain[obj_idx] * 536870912, OBJ_EDIT_GAIN_MAX_FX ), OBJ_EDIT_GAIN_MIN_FX ); /* Q29 */
#endif
                }
                else
                {
+2 −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 ############################ */
@@ -123,6 +124,7 @@
#define NONBE_1217_OBJ_EDIT_FOA                         /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */
#define NONBE_FIX_1255_OBJ_EDIT_JBM                     /* VA: issue 1255: restore object editing in JBM */
#define FIX_1372_OSBA_OBJECT_EDITING                    /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */
#define FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES        /* Nokia: Issue 2140, fixes three different sanitizer issues persisting in object editing code. */

/* #################### End BASOP porting switches ############################ */

+6 −0
Original line number Diff line number Diff line
@@ -2318,7 +2318,9 @@ void ivas_dirac_dec_render_sf_fx(
    Word32 Cldfb_RealBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_ImagBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
#endif
#ifndef FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES
    Word16 cldfb_buf_q;
#endif
    Word16 offset = 0, buff_len = 0;
    move16();
    move16();
@@ -2831,7 +2833,11 @@ void ivas_dirac_dec_render_sf_fx(
        IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
        {
#ifdef FIX_1319_STACK_SBA_DECODER
#ifdef FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES
            ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( st_ivas, Cldfb_RealBuffer_Binaural_fx[0], Cldfb_ImagBuffer_Binaural_fx[0], &q_cldfb, hSpatParamRendCom->num_freq_bands, subframe_idx );
#else
            ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( st_ivas, Cldfb_RealBuffer_Binaural_fx[0], Cldfb_ImagBuffer_Binaural_fx[0], &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx );
#endif
#else
            ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( st_ivas, Cldfb_RealBuffer_Temp_fx, Cldfb_ImagBuffer_Temp_fx, &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx );
#endif
+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 */
                }
+11 −0
Original line number Diff line number Diff line
@@ -5855,6 +5855,16 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            move16();
            move16();

#ifdef FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES
            totalTargetEneCh[0] = subframeEneCh[0]; // subQch[0]
            move32();
            totalTargetEneCh[1] = subframeEneCh[1]; // subQch[1]
            move32();
            masaEneThisCh[0] = subframeEneCh[0]; // subQch[0]
            move32();
            masaEneThisCh[1] = subframeEneCh[1]; // subQch[1]
            move32();
#else
            /* Zero check */
            IF( GT_32( subframeEne, 0 ) )
            {
@@ -5867,6 +5877,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
                masaEneThisCh[1] = subframeEneCh[1]; // subQch[1]
                move32();
            }
#endif

            /* Gain editing */
            /* For each object, estimate new target energy per channel based on the applied gain */