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

Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation

parent 21e1a6bd
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@
#define FIX_BASOP_2497_MCMASA_LFE_WRONG_SF_INDEX        /* Nokia: BASOP 2497: Fix wrong subframe index in McMASA LFE synth. */
#define FIX_BASOP_2496_OMASA_OBJ_EDIT_WRONG_ASSIGN      /* Nokia: BASOP 2496: Fix wrong assignment in OMASA object edit code */
#define FIX_2495_Q_ALIGN_OSBA_RENDERER                  /* FhG: Basop issue #2495: Corrected exponent scaling of outAudio.data_fx before buffer accumulation in renderSbaToBinaural(). */
#define FIX_2505_IVAS_DEC_SEGFAULT                      /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */

/* ##################### End NON-BE switches ########################### */

+33 −0
Original line number Diff line number Diff line
@@ -1083,15 +1083,48 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    ivas_ism_render_sf_fx( st_ivas, renderer_type_old, p_output_fx, n_samples_granularity );

                    st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor;
#ifdef FIX_2505_IVAS_DEC_SEGFAULT
                    Word16 subframe_len, guard_bits, q_shift_min;

                    IF( NE_32( ( error = getAudioConfigNumChannels( IVAS_AUDIO_CONFIG_7_1_4, &nchan_in ) ), IVAS_ERR_OK ) )
                    {
                        return error;
                    }

                    subframe_len = imult1616( st_ivas->hTcBuffer->subframe_nbslots[0], n_samples_granularity );
                    guard_bits = find_guarded_bits_fx( subframe_len );

                    q_shift_min = L_norm_arr( p_output_fx[0], subframe_len );
                    FOR( Word16 i = 1; i < nchan_in; i++ )
                    {
                        q_shift_min = s_min( q_shift_min, L_norm_arr( p_output_fx[i], subframe_len ) );
                    }
                    q_shift_min = sub( q_shift_min, guard_bits );

                    FOR( Word16 i = 0; i < nchan_in; i++ )
                    {
                        scale_sig32( p_output_fx[i], *nSamplesRendered, q_shift_min );
                    }
                    *st_ivas->hCrendWrapper->p_io_qfactor = add( Q11, q_shift_min );
#else
                    *st_ivas->hCrendWrapper->p_io_qfactor = 11;

                    move16();
#endif
                    IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL,
                                                                            NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ),
                               IVAS_ERR_OK ) )
                    {
                        return error;
                    }
#ifdef FIX_2505_IVAS_DEC_SEGFAULT
                    FOR( Word16 i = 0; i < nchan_in; i++ )
                    {
                        scale_sig32( p_output_fx[i], *nSamplesRendered, negate( q_shift_min ) ); // Q11
                    }
                    *st_ivas->hCrendWrapper->p_io_qfactor = Q11;
                    move16();
#endif
                }
            }
            ELSE
+4 −1
Original line number Diff line number Diff line
@@ -1923,8 +1923,11 @@ static ivas_error ivas_rend_crendConvolver_fx(
                    }
                }
            }

#ifdef FIX_2505_IVAS_DEC_SEGFAULT
            ivas_mdft_fx( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); // Input guard bits are added two functions up the call chain before ivas_rend_crendProcessSubframe_fx() is called
#else
            ivas_mdft_fx( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length );
#endif
            i = add( i, 1 );
        }
    }