Commit 8ad1c4a7 authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2505-ivas_dec-segfault' into 'main'

[rend-non-BE][non-BE] Resolve: "IVAS_dec segfault"

See merge request !2933
parents 028ad468 92f4759e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@
#define FIX_BASOP_2510_UNNECESSARY_ASSERT               /* Nokia: BASOP issue 2510: Fix by removing assert */
#define FIX_2515_TDREND_PORT_ERROR_SCALING              /* Nokia: BASOP issue 2515: Fix port error by changing to correct scaling */
#define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO          /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */
#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 ########################### */

+36 −0
Original line number Diff line number Diff line
@@ -1077,21 +1077,57 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                }
                ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) )
                {
#ifdef FIX_2505_IVAS_DEC_SEGFAULT
                    Word16 subframe_len, guard_bits, q_shift_min;

#endif
                    /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */
                    set16_fx( st_ivas->hIsmRendererData->interpolator_fx, 32767, n_samples_granularity ); // 32767=1.0f in Q15

                    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

                    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 );
        }
    }