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

initial version see MR 1122 comment

parent 0fcb812a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -756,7 +756,9 @@ int main(
        if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
#ifndef FIX_OLD_BINARY_FORMAT
            goto cleanup;
#endif
        }

        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
+9 −1
Original line number Diff line number Diff line
@@ -151,9 +151,15 @@
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_879_USAN_ERROR_IN_MASA_DECODING             /* FhG: Issue 879 : avoid arithmetic with NULL pointer in the DirAC decoder to fix USAN error */

#define FIX_740_MASA_PREREND_VALIDITY_CHECK             /* Nokia: issue 740: fix incorrect validity check in lib_rend to allow use of MASA prerenderer */

//#define FIX_INV_DIFFUSE_WEIGHT                          /* Orange : Fix error in energy compensation in late binaural reverb*/
//#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_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
// #define FIX_20_MS_FRAME_LEN_TABLES_CONVERTER            /* Orange : generate_tables_convereter tools can generate rom for 5 and 20 ms frame length */
// #define FIX_HOA_BRIR_EXT_RENDERER                       /* Orange : allow to create and load hoa brir binary files for renderer */

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


@@ -166,6 +172,8 @@
#define NONBE_FIX_836_PARAMUPMIX_HEADROT                      /* Dlb: issue #836: Resolve "ParamUpmix MC to SBA conversion done on the already binaurlized output" */
#define NONBE_FIX_874_OMASA_BRSW_2TD                          /* Nokia: issue 874: Fixes the crashes with the long test vectors that prompted switching to TD*/

//#define NONBE_FIX_BINARY_BINAURAL_READING                      /* Add support reading binaural binary file */

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

/* ################## End DEVELOPMENT switches ######################### */
+56 −1
Original line number Diff line number Diff line
@@ -1248,7 +1248,11 @@ ivas_error ivas_rend_openCrend(
)
{
    int16_t i, subframe_length;
#ifdef FIX_CRASH_LONG_BRIR
    int32_t max_total_ir_len, j;
#else
    int16_t max_total_ir_len;
#endif
    HRTFS_HANDLE hHrtf;
    CREND_HANDLE hCrend;
    ivas_error error;
@@ -1298,13 +1302,26 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->freq_buffer_re[i][j] = 0.f;
                }
#else
                set_zero( hCrend->freq_buffer_re[i], max_total_ir_len );

#endif
                if ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->freq_buffer_im[i][j] = 0.f;
                }
#else
                set_zero( hCrend->freq_buffer_im[i], max_total_ir_len );
#endif
            }

            for ( i = 0; i < BINAURAL_CHANNELS; i++ )
@@ -1313,7 +1330,14 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < subframe_length; j++ )
                {
                    hCrend->prev_out_buffer[i][j] = 0.f;
                }
#else
                set_zero( hCrend->prev_out_buffer[i], subframe_length );
#endif
            }

            max_total_ir_len = hHrtf->num_iterations_diffuse[0] * subframe_length;
@@ -1324,13 +1348,33 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_re_diffuse != NULL )
                {
                    for ( j = 0; j < max_total_ir_len; j++ )
                    {
                        hCrend->freq_buffer_re_diffuse[j] = 0.f;
                    }
                }
#else
                set_zero( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
#endif

                if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_im_diffuse != NULL )
                {
                    for ( j = 0; j < max_total_ir_len; j++ )
                    {
                        hCrend->freq_buffer_im_diffuse[j] = 0.f;
                    }
                }
#else
                set_zero( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
#endif
            }
            else
            {
@@ -1345,7 +1389,14 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->lfe_delay_line[j] = 0.f;
                }
#else
                set_zero( hCrend->lfe_delay_line, max_total_ir_len );
#endif
            }
            else
            {
@@ -1588,7 +1639,11 @@ static ivas_error ivas_rend_crendConvolver(
    int16_t i, j, k, m;
    int16_t subframe_length, idx_in;
    int16_t lfe_idx_in;
#ifdef FIX_CRASH_LONG_BRIR
    int32_t offset, offset_in, offset_diffuse;
#else
    int16_t offset, offset_in, offset_diffuse;
#endif
    int16_t nchan_in, nchan_out;
    const float *pIn;
    float *pFreq_buf_re, *pFreq_buf_im;
+263 −264

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@

*******************************************************************************************************/


#ifndef _IVAS_ROM_TDBINAURALRENDERER_
#define _IVAS_ROM_TDBINAURALRENDERER_

#include <stdint.h>
#include "options.h"
#ifdef DEBUGGING
@@ -69,3 +73,4 @@ extern const uint32_t defaultHRIR_rom_ITD_azimBsShape[84];
extern const float defaultHRIR_rom_ITD_azimKSeq[19];
extern const uint32_t defaultHRIR_rom_ITD_elevBsShape[28];
extern const float defaultHRIR_rom_ITD_elevKSeq[16];
#endif
Loading