Commit 929667b3 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 2222-leftovers-from-float-fixed-conversions

parents ae192da6 3a3a2ce7
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -105,6 +105,9 @@
#define FIX_2148_OBJ_EDIT_ISSUE_WITH_OSBA                    /* Nokia: Add missing code to solve issue */
#define FIX_2200_ISAR_PLC_CRASH                              /* Dolby: Fix for ISAR PLC crash observed with newly added BASOP tests */
#define FIX_2210_ASSERT_IN_BW_DETEC_FX_FOR_OMASA             /* FhG: Resolve overflow by swapping the order of addition and multiplication */
#define FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC         /* FhG: Adjust Q_real to prevent overflow in st->cldfbSyn->cldfb_state_fx scaling */
#define FIX_2211_ASSERT_IN_REND_CREND_CONVOLER               /* FhG: Add headroom to p_output_fx to prevent overflow in ivas_rend_crendProcessSubframe_fx() */

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

/* #################### Start BASOP porting switches ############################ */
+14 −0
Original line number Diff line number Diff line
@@ -124,7 +124,11 @@ ivas_error acelp_core_dec_fx(
    ivas_error error;
    Word32 bpf_error_signal_fx[L_FRAME16k];
    Word16 bpf_error_signal_16fx[L_FRAME16k];
#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC
    Word16 Q_real, scf;
#else
    Word16 Q_real;
#endif
    Word32 max_real, max_imag, max_val;

    set32_fx( bpf_error_signal_fx, 0, L_FRAME16k );
@@ -2083,12 +2087,22 @@ ivas_error acelp_core_dec_fx(
                }
                max_val = L_max( max_real, max_imag );
                Q_real = sub( norm_l( max_val ), 3 ) /* Guard bits */;
#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC
                scf = L_norm_arr( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length );
                scf = s_min( scf, sub( Q_real, Q11 ) );
                Q_real = add( scf, Q11 );
#endif
                FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ )
                {
                    scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real
                    scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real
                }

#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC
                scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, scf ); // Q10 - > (Q_real-1)
#else
                scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1)
#endif
                st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 );
                move16();

+17 −1
Original line number Diff line number Diff line
@@ -2764,9 +2764,19 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    {
                        return error;
                    }
#ifdef FIX_2211_ASSERT_IN_REND_CREND_CONVOLER
                    Word16 subframe_len, gd_bits;
                    subframe_len = imult1616( st_ivas->hTcBuffer->subframe_nbslots[0], st_ivas->hTcBuffer->n_samples_granularity );
                    gd_bits = find_guarded_bits_fx( subframe_len );
                    *st_ivas->hCrendWrapper->p_io_qfactor = sub( 13, gd_bits );
                    FOR( Word16 i = 0; i < nchan_in; i++ )
                    {
                        scale_sig32( p_output_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, Q11 ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor
                    }
#else
                    *st_ivas->hCrendWrapper->p_io_qfactor = 11;
                    move16();

#endif
                    IF( NE_32( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
                                                                          hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ),
                               IVAS_ERR_OK ) )
@@ -2775,6 +2785,12 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    }

                    ivas_binaural_add_LFE_fx( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc_fx, p_output_fx );
#ifdef FIX_2211_ASSERT_IN_REND_CREND_CONVOLER
                    FOR( Word16 i = 0; i < nchan_in; i++ )
                    {
                        scale_sig32( p_output_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11
                    }
#endif
                }
                ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_OBJECTS_TD ) )
                {