Commit 9dd5d46f authored by emerit's avatar emerit
Browse files

fix masa renderer crash when loading hrir from file

parent 1ba9dd39
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -155,11 +155,12 @@
#define FIX_881_REMOVE_LFE_ADDITION_IN_ISM              /* VA: issue 881: remove LFE addition in ISM format */
#define FIX_887_ARRAY_SIZE_DFT_MDCT_STEREO              /* VA: Fix the definition of buffers/arrays in DFT and MDCT stereo to satisfy gcc v 11.4.0 */
#define FIX_891_PARAMUPMIX_CLEANUP                      /* Dlb: issue 891: remove unneeded code from ParamUpmix */
#define FIX_917_LCLD_WARNINGS                           /* Dlb: issue 917 and 918: fix LCLD codec warnings*/
#define FIX_920_IGF_INIT_ERROR                          /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */

#define FIX_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
#define FIX_638_ENERGIE_IAC_ROM_TABLES                  /* Orange : Missing left/right and coherence late reverb tables in binary format*/
#define FIX_OLD_BINARY_FORMAT
#define FIX_917_LCLD_WARNINGS                           /* Dlb: issue 917 and 918: fix LCLD codec warnings*/
#define FIX_920_IGF_INIT_ERROR                          /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */

/* #################### End BE switches ################################## */

+2 −18
Original line number Diff line number Diff line
@@ -721,6 +721,7 @@ void ivas_reverb_get_hrtf_set_properties(
        }
        else
        {
#endif
            const float tbl_index = ( norm_freq - inp_freq_offset ) / inp_freq_step;

            if ( tbl_index <= 0.0f ) /* In case of extrapolation (below 1st bin), choose nearest */
@@ -738,24 +739,7 @@ void ivas_reverb_get_hrtf_set_properties(
                    relative_pos = 1.0f;
                }
            }
        }
#else
        const float tbl_index = ( norm_freq - inp_freq_offset ) / inp_freq_step;

        if ( tbl_index <= 0.0f ) /* In case of extrapolation (below 1st bin), choose nearest */
        {
            base_idx = 0;
            relative_pos = 0.0f;
        }
        else
        {
            base_idx = (int16_t) floorf( tbl_index );
            relative_pos = tbl_index - base_idx;
            if ( base_idx > ( in_freq_count - 2 ) ) /* In case of extrapolation (above last bin), choose nearest */
            {
                base_idx = in_freq_count - 2;
                relative_pos = 1.0f;
            }
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
        }
#endif
        /* Computing 2 bins data for later interpolation */
+4 −0
Original line number Diff line number Diff line
@@ -1644,7 +1644,11 @@ typedef struct ivas_masa_external_rendering_struct
#endif

    REVERB_STRUCT_HANDLE hReverb;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin;
#else
    HRTFS_PARAMBIN_HANDLE hHrtfParambin;
#endif
    VBAP_HANDLE hVBAPdata;
    float *hoa_dec_mtx;

+13 −1
Original line number Diff line number Diff line
@@ -9272,7 +9272,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init(

    error = IVAS_ERR_OK;

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    hHrtfParambin = *( inputMasa->hMasaExtRend->hHrtfParambin );
#else
    hHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin;
#endif

    /* Set common variables and defaults */
    output_Fs = *( inputMasa->base.ctx.pOutSampleRate );
@@ -9439,7 +9443,7 @@ static ivas_error initMasaExtRenderer(
#endif
    hMasaExtRend->hReverb = NULL;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    hMasaExtRend->hHrtfParambin = hrtfs->hHrtfParambin;
    hMasaExtRend->hHrtfParambin = &hrtfs->hHrtfParambin;
#else
    hMasaExtRend->hHrtfParambin = NULL;
#endif
@@ -9533,7 +9537,11 @@ static ivas_error initMasaExtRenderer(
    {
        if ( hMasaExtRend->renderer_type != RENDERER_STEREO_PARAMETRIC )
        {
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -9627,7 +9635,11 @@ static void freeMasaExtRenderer(

    if ( hMasaExtRend->hHrtfParambin != NULL )
    {
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        ivas_HRTF_parambin_binary_close( hMasaExtRend->hHrtfParambin );
#else
        ivas_HRTF_parambin_binary_close( &hMasaExtRend->hHrtfParambin );
#endif
    }

    if ( hMasaExtRend->hVBAPdata != NULL )
+0 −2
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ set(SOURCE_FILES_C
    ${IVAS_TRUNK_COM_PATH}/tools.c
    ${IVAS_TRUNK_COM_PATH}/tns_base.c
    ${IVAS_TRUNK_UTIL_PATH}/cmdl_tools.c
    ${IVAS_TRUNK_REND_PATH}/ivas_reverb_filter_design.c
    ${IVAS_TRUNK_REND_PATH}/ivas_reverb_fft_filter.c
    ${IVAS_TRUNK_REND_PATH}/ivas_rom_rend.c
)

Loading