diff --git a/apps/decoder.c b/apps/decoder.c index 37e3cc760810beb1334d37b3ad30b037d2f09eb1..01a373fe779272449bc453696e2f86f70573b52d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -174,6 +174,10 @@ int main( RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL; + IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; +#endif #ifdef WMOPS reset_wmops(); @@ -599,58 +603,171 @@ int main( if ( arg.hrtfReaderEnabled ) { +#ifndef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; - +#endif if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { +#ifdef FIX_OLD_BINARY_FORMAT + hrtfFileReader_close( &hrtfReader ); + strcat( arg.hrtfFileName, "new" ); + + if ( hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + + if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + else + { + destroy_td_hrtf( hHrtfTD ); + } + } +#else + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; +#endif + } + else + { + destroy_td_hrtf( hHrtfTD ); + } + } +#else if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); goto cleanup; } +#endif +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + } +#else + if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } +#endif +#endif +#ifndef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL; +#endif if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + else + { + destroy_SetOfHRTF( hSetOfHRTF ); + } + } +#else if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName ); goto cleanup; } +#endif +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL; +#else IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; +#endif if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + else + { + destroy_fastconv_hrtf( hHrtfFastConv ); + } + } +#else if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); goto cleanup; } +#endif +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL; +#else IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; +#endif if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } + else + { + destroy_parambin_hrtf( hHrtfParambin ); + } + } +#else if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); goto cleanup; } +#endif } /*------------------------------------------------------------------------------------------* @@ -713,12 +830,30 @@ cleanup: if ( arg.hrtfReaderEnabled ) { +#ifndef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; +#endif IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( hHrtfTD != NULL ) + { + destroy_td_hrtf( hHrtfTD ); + } +#else dealloc_HRTF_binary( hHrtfTD ); +#endif +#ifndef NONBE_FIX_BINARY_BINAURAL_READING IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL; +#endif IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( hSetOfHRTF != NULL ) + { + destroy_SetOfHRTF( hSetOfHRTF ); + } +#else destroy_SetOfHRTF( hSetOfHRTF ); +#endif } IVAS_DEC_Close( &hIvasDec ); diff --git a/apps/renderer.c b/apps/renderer.c index 2a14e28112fff7f6554da1f6fb5e718149acc74a..851583bbf99f409dec19e9c61eb255517eea2f3b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -762,6 +762,12 @@ int main( #endif Vector3PairFileReader *referenceVectorReader = NULL; hrtfFileReader *hrtfFileReader = NULL; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL; + IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL; + IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL; + IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL; +#endif IsmPositionProvider *positionProvider; LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS]; RenderConfigReader *renderConfigReader = NULL; @@ -906,6 +912,7 @@ int main( } } +#ifndef NONBE_FIX_BINARY_BINAURAL_READING if ( !isEmptyString( args.customHrtfFilePath ) ) { if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) @@ -914,6 +921,7 @@ int main( exit( -1 ); } } +#endif if ( !isEmptyString( args.renderConfigFilePath ) ) { @@ -1001,12 +1009,141 @@ int main( Word32 nonDiegeticPanGain_fx = ( args.nonDiegeticPanGain == 1.0f ) ? ONE_IN_Q31 : ( args.nonDiegeticPanGain == -1.0f ) ? L_negate( ONE_IN_Q31 ) : (Word32) ( args.nonDiegeticPanGain * ( 1LL << Q31 ) ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#else IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( !isEmptyString( args.customHrtfFilePath ) ) + { + if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); + exit( -1 ); + } + + if ( hrtfFileReader != NULL ) + { + if ( ( error = IVAS_REND_GetHrtfHandle( hIvasRend, &hHrtfTD ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_REND_GetHrtfHandle failed: %s\n\n", ivas_error_to_string( error ) ); + goto cleanup; + } + + if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { +#ifdef FIX_OLD_BINARY_FORMAT + hrtfFileReader_close( &hrtfFileReader ); + strcat( args.customHrtfFilePath, "new" ); + if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + else + { + destroy_td_hrtf( hHrtfTD ); + } + } +#else + fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; +#endif + } + else + { + destroy_td_hrtf( hHrtfTD ); + } + } + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + } +#endif + + if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hSetOfHRTF ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) ); + goto cleanup; + } + + if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + else + { + destroy_SetOfHRTF( hSetOfHRTF ); + } + } + + if ( ( error = IVAS_REND_GetHrtfFastConvHandle( hIvasRend, &hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_REND_GetHrtfFastConvHandle failed: %s\n\n", ivas_error_to_string( error ) ); + goto cleanup; + } + + if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfFileReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + else + { + destroy_fastconv_hrtf( hHrtfFastConv ); + } + } + + if ( ( error = IVAS_REND_GetHrtfParamBinHandle( hIvasRend, &hHrtfParambin ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", ivas_error_to_string( error ) ); + goto cleanup; + } + + if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hrtfFileReader ) ) != IVAS_ERR_OK ) + { + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); + goto cleanup; + } + else + { + destroy_parambin_hrtf( hHrtfParambin ); + } + } + } + + hrtfFileReader_close( &hrtfFileReader ); + } +#endif + fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); fprintf( stdout, "Output audio file: %s\n\n", args.outputFilePath ); @@ -1052,7 +1189,7 @@ int main( /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Renderer Config Init\n" ); + fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } @@ -2074,6 +2211,9 @@ int main( free( outFloatBuffer ); free( outInt32Buffer ); free( inInt32Buffer ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +cleanup: +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( bitsBufferData != NULL ) @@ -2107,7 +2247,19 @@ int main( RotationFileReader_close( &externalOrientationFileReader ); RotationFileReader_close( &referenceRotReader ); Vector3PairFileReader_close( &referenceVectorReader ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING hrtfFileReader_close( &hrtfFileReader ); +#endif +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( hSetOfHRTF != NULL && *hSetOfHRTF != NULL ) + { + destroy_SetOfHRTF( hSetOfHRTF ); + } + if ( hHrtfTD != NULL && *hHrtfTD != NULL ) + { + destroy_td_hrtf( hHrtfTD ); + } +#endif IVAS_REND_Close( &hIvasRend ); IsmPositionProvider_close( positionProvider ); RenderConfigReader_close( &renderConfigReader ); diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5ceac3b0324230215c994441b90b63f473b4cf0b..ee34014df7fbd584cd79d0c1d99062fd42491869 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1683,7 +1683,9 @@ typedef enum #define MAX_ANGULAR_STEP_INV ( 1.0f / MAX_ANGULAR_STEP ) #define MAX_INTERPOLATION_STEPS 12 +#ifndef NONBE_FIX_BINARY_BINAURAL_READING #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) +#endif #define DEG_360_IN_Q22 ( 360 << Q22 ) // Q22 #define DEG_180_IN_Q22 ( 180 << Q22 ) // Q22 @@ -1743,8 +1745,15 @@ typedef enum #define RV_FILTER_MAX_HISTORY ( 512 - 160 ) /* for longest history */ #define RV_LENGTH_NR_FC ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1 +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB +#define RV_LENGTH_NR_FC_16KHZ ( RV_FILTER_MAX_FFT_SIZE / 4 ) + 1 +#endif #define IVAS_REVERB_DEFAULT_N_BANDS 31 +#define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB +#define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) +#endif /*----------------------------------------------------------------------------------* * FB mixer constants diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 506c6ac00564f3eb7bdf78f05a1e54ec2995d588..4955c7e2c357866ce72d18af7c0a56f61f0f9521 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -78,6 +78,9 @@ typedef enum IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, IVAS_ERR_INVALID_HRTF, +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, +#endif IVAS_ERR_INVALID_INPUT_FORMAT, IVAS_ERR_INVALID_INDEX, IVAS_ERR_NOT_SUPPORTED_OPTION, @@ -257,6 +260,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Acoustic environment not supported"; case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA: + return "Renderer data missing in HRTF binary file"; +#endif case IVAS_ERR_INVALID_INPUT_FORMAT: return "Invalid input format"; case IVAS_ERR_INVALID_INDEX: diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index f4c5ffd78445df8f7aea67c6bed535843c6928eb..2c698d7ad7e20bef832b7966d95f1cd30d467e35 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,6 +105,16 @@ #define FIX_969_USAN_IGF_ARITH /* FhG: issue 969: fix USAN error in igf_sce_dec; same issue as #962 */ #define NONBE_FIX_973_HODIRAC_BAND_GROUPING /* FhG: issue 973: empty parameter band in DirAC */ +#define NONBE_FIX_BINARY_BINAURAL_READING /* Orange: Add support for reading binaural binary file */ +//#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT +#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#define NONBE_FIX_AVG_IAC_CLDFB_REVERB +#endif +#define FIX_OLD_BINARY_FORMAT /* Orange: trick to make tests succesful when changing hrtf binary format between ref and new branch*/ +#define FIX_OLD_BINARY_FILE /* Orange: current hrtf binary file in ref branch contains wrong values for fastconv value. This switch can be activated to compre running codec with and without hrtf file*/ +#endif /* #################### End BASOP porting switches ############################ */ #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ba49051897aea72fdf720be956a9bcace9489d77..69e24616422b93da4a2ffb0440f57461403b744d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3078,7 +3078,11 @@ void ivas_destroy_dec_fx( { ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( st_ivas->hHrtfTD != NULL ) +#else ELSE IF( st_ivas->hHrtfTD != NULL ) +#endif { BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD ); diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 999e15328b57e9f7ff485dacb6ac7610cc476840..f2281b779a26da2370c330fa28d74431d2eff1d6 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -358,25 +358,41 @@ ivas_error IVAS_DEC_FeedCustomLsData( ); /*! r: error code */ -ivas_error IVAS_DEC_GetHrtfHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ +ivas_error IVAS_DEC_GetHrtfHandle( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ +#else + IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ +#endif ); /*! r: error code */ ivas_error IVAS_DEC_GetHrtfCRendHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* o : Set of HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + #ifdef NONBE_FIX_BINARY_BINAURAL_READING +IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ +#else + IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* o : Set of HRTF handle */ +#endif ); ivas_error IVAS_DEC_GetHrtfFastConvHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* o : FASTCONV HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ +#else + IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* o : FASTCONV HRTF handle */ +#endif ); ivas_error IVAS_DEC_GetHrtfParamBinHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +#else + IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +#endif ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 95d599d6dfc5bb5fd821abe181ad7ed106086eee..e2bd37600e9241ecae1e78485606f33373ca24eb 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2511,8 +2511,12 @@ ivas_error IVAS_DEC_FeedCustomLsData( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetHrtfHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ +#else IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ +#endif ) { test(); @@ -2522,7 +2526,11 @@ ivas_error IVAS_DEC_GetHrtfHandle( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + *hHrtfTD = &hIvasDec->st_ivas->hHrtfTD; +#else *hHrtfTD = hIvasDec->st_ivas->hHrtfTD; +#endif return IVAS_ERR_OK; } @@ -2535,8 +2543,12 @@ ivas_error IVAS_DEC_GetHrtfHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetHrtfCRendHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ +#else IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* o : Set of HRTF handle */ +#endif ) { test(); @@ -2546,7 +2558,11 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( return IVAS_ERR_WRONG_PARAMS; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + *hSetOfHRTF = &hIvasDec->st_ivas->hSetOfHRTF; +#else *hSetOfHRTF = hIvasDec->st_ivas->hSetOfHRTF; +#endif return IVAS_ERR_OK; } @@ -2559,8 +2575,12 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetHrtfFastConvHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ +#else IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* o : FASTCONV HRTF handle */ +#endif ) { test(); @@ -2570,7 +2590,11 @@ ivas_error IVAS_DEC_GetHrtfFastConvHandle( return IVAS_ERR_WRONG_PARAMS; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + *hHrtfFastConv = &hIvasDec->st_ivas->hHrtfFastConv; +#else *hHrtfFastConv = hIvasDec->st_ivas->hHrtfFastConv; +#endif return IVAS_ERR_OK; } @@ -2583,8 +2607,12 @@ ivas_error IVAS_DEC_GetHrtfFastConvHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetHrtfParamBinHandle( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +#else IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +#endif ) { test(); @@ -2594,7 +2622,11 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_WRONG_PARAMS; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + *hHrtfParambin = &hIvasDec->st_ivas->hHrtfParambin; +#else *hHrtfParambin = hIvasDec->st_ivas->hHrtfParambin; +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index ef2c477a3c82d5e42fc9ec596f8d58660070a9e3..c6644b573f2253639571140219867c6cac7ef185 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -101,6 +101,10 @@ ivas_error ivas_hrtf_init( hHrtf->pOut_to_bin_diffuse_im_fx[j] = NULL; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hHrtf->init_from_rom = 1; +#endif + return IVAS_ERR_OK; } @@ -220,8 +224,36 @@ static ivas_error ivas_rend_initCrend_fx( return IVAS_ERR_INTERNAL_FATAL; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( ( hSetOfHRTF == NULL ) || + ( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) || + ( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL ) ) || + ( ( hSetOfHRTF->hHRTF_brir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) || + ( ( hSetOfHRTF->hHRTF_hrir_foa == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_FOA ) ) || + ( ( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA2 ) ) || + ( ( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA3 ) ) ) +#else IF( hSetOfHRTF == NULL ) +#endif { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hHrtf->init_from_rom = 1; +#endif IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ @@ -903,6 +935,10 @@ static ivas_error ivas_rend_initCrend_fx( } ELSE { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hHrtf->init_from_rom = 0; + move16(); +#endif IF( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ @@ -912,12 +948,24 @@ static ivas_error ivas_rend_initCrend_fx( IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( hSetOfHRTF->hHRTF_brir_combined == NULL ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " ); + } +#endif hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_brir_combined->latency_s_fx; // Q31 hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_brir_combined->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_brir_combined->index_frequency_max_diffuse; } ELSE { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( hSetOfHRTF->hHRTF_hrir_combined == NULL ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " ); + } +#endif hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_combined->latency_s_fx; // Q31 hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_combined->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_combined->index_frequency_max_diffuse; @@ -1017,6 +1065,12 @@ static ivas_error ivas_rend_initCrend_fx( { IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " ); + } +#endif hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx; // Q31 hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa3->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa3->index_frequency_max_diffuse; @@ -1057,6 +1111,12 @@ static ivas_error ivas_rend_initCrend_fx( } ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " ); + } +#endif hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx; // Q31 hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa2->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa2->index_frequency_max_diffuse; @@ -1097,6 +1157,12 @@ static ivas_error ivas_rend_initCrend_fx( } ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_FOA ) ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( hSetOfHRTF->hHRTF_hrir_foa == NULL ) + { + return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " ); + } +#endif hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_foa->latency_s_fx; // Q31 hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_foa->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_foa->index_frequency_max_diffuse; diff --git a/lib_rend/ivas_hrtf_fx.c b/lib_rend/ivas_hrtf_fx.c index 93f9fbd83ad15a678ebf73f29f0f0e2d4f617709..a9167f95b497699fd446eacf0a9f51542b8dd7c1 100644 --- a/lib_rend/ivas_hrtf_fx.c +++ b/lib_rend/ivas_hrtf_fx.c @@ -54,6 +54,10 @@ ivas_error ivas_HRTF_binary_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + set_c( (int8_t *) ( *hHrtfTD ), 0, (int32_t) sizeof( TDREND_HRFILT_FiltSet_t ) ); +#endif + return IVAS_ERR_OK; } @@ -184,6 +188,10 @@ ivas_error ivas_HRTF_parambin_binary_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + set_c( (int8_t *) ( *hHrtfParambin ), 0, (int32_t) sizeof( HRTFS_PARAMBIN ) ); +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 1b5bc0d1b5e5644d47cd293d00556fb30dbe3cc0..8b11d1f7ad2553c08406df26043325f26220d5c8 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -802,8 +802,11 @@ ivas_error ivas_td_binaural_open_ext_fx( { directivity_fx = hRendCfg->directivity_fx; } - +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); +#else return ivas_td_binaural_open_unwrap_fx( &pTDRend->hHrtfTD, outFs, *num_src, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); +#endif } /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_ext() diff --git a/lib_rend/ivas_objectRenderer_mix_fx.c b/lib_rend/ivas_objectRenderer_mix_fx.c index 0e61282d474afcbfe1fafe00f76aced101e92bb7..589baf50909ffa51477477b980d21bc423516a24 100644 --- a/lib_rend/ivas_objectRenderer_mix_fx.c +++ b/lib_rend/ivas_objectRenderer_mix_fx.c @@ -38,6 +38,9 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_rom_rend.h" +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#include "ivas_rom_binaural_crend_head.h" +#endif #include "ivas_prot_fx.h" /*-------------------------------------------------------------------* @@ -153,7 +156,12 @@ void TDREND_MIX_Dealloc_fx( hBinRendererTd->Listener_p = NULL; } /* Dealloc HR filter set */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + test(); + IF( ( *hBinRendererTd->pHrFiltSet_p != NULL ) && ( hBinRendererTd->HrFiltSet_p != NULL ) ) +#else IF( hBinRendererTd->HrFiltSet_p != NULL ) +#endif { IF( EQ_16( hBinRendererTd->HrFiltSet_p->FilterMethod, TDREND_HRFILT_Method_BSplineModel ) ) { @@ -182,8 +190,18 @@ void TDREND_MIX_Dealloc_fx( hBinRendererTd->HrFiltSet_p->RightFiltSet_p_fx = NULL; } } + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( EQ_16( hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, 1 ) ) + { + free( hBinRendererTd->HrFiltSet_p ); + hBinRendererTd->HrFiltSet_p = NULL; + *hBinRendererTd->pHrFiltSet_p = NULL; + } +#else free( hBinRendererTd->HrFiltSet_p ); hBinRendererTd->HrFiltSet_p = NULL; +#endif } return; @@ -247,6 +265,11 @@ ivas_error TDREND_MIX_Init_fx( { hBinRendererTd->HrFiltSet_p = *hHrtfTD; } + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hBinRendererTd->pHrFiltSet_p = hHrtfTD; +#endif + IF( NE_32( hBinRendererTd->HrFiltSet_p->SampleRate, output_Fs ) ) { return ( IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "The sampling rate for the HR filter set does not match the output sampling rate.\n" ) ); @@ -410,9 +433,26 @@ static ivas_error DefaultBSplineModel_fx( HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_32kHz_fx; // Q23 BREAK; case 16000: +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + for ( i = 0; i < 3; i++ ) + { + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( float ) ); + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } + } + floatToFixed_arr32( defaultHRIR_coherence_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], Q27, LR_IAC_LENGTH_NR_FC_16KHZ ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], Q23, LR_IAC_LENGTH_NR_FC_16KHZ ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], Q23, LR_IAC_LENGTH_NR_FC_16KHZ ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + HrFiltSet_p->lr_energy_and_iac_fx[0] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[0]; + HrFiltSet_p->lr_energy_and_iac_fx[1] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[1]; + HrFiltSet_p->lr_energy_and_iac_fx[2] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[2]; +#else HrFiltSet_p->lr_energy_and_iac_fx[0] = defaultHRIR_left_avg_power_16kHz_fx; // Q23 HrFiltSet_p->lr_energy_and_iac_fx[1] = defaultHRIR_right_avg_power_16kHz_fx; // Q23 HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_16kHz_fx; // Q23 +#endif BREAK; } diff --git a/lib_rend/ivas_rom_binaural_crend_head.h b/lib_rend/ivas_rom_binaural_crend_head.h index 2b4c3e919fcb39f74d9d8ae84b4a89ea1bf52ecf..456db9e262c37ec423b82aeec838e593f1862d53 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.h +++ b/lib_rend/ivas_rom_binaural_crend_head.h @@ -57,42 +57,42 @@ extern Word32 CRendBin_Combined_HRIR_latency_s_fx; /* Sample Rate = 48000 */ extern Word16 CRendBin_Combined_HRIR_max_num_iterations_48kHz; -extern UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; -extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[15]; +extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][240]; -extern Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ extern Word16 CRendBin_Combined_HRIR_max_num_iterations_32kHz; -extern UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; -extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[15]; +extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][160]; -extern Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ extern Word16 CRendBin_Combined_HRIR_max_num_iterations_16kHz; -extern UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; -extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[15]; +extern Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][80]; -extern Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]; @@ -106,42 +106,42 @@ extern Word32 CRendBin_FOA_HRIR_latency_s_fx; /* Sample Rate = 48000 */ extern Word16 CRendBin_FOA_HRIR_max_num_iterations_48kHz; -extern UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; -extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[4]; +extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[FOA_CHANNELS]; extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[4][BINAURAL_CHANNELS][240]; -extern Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[4][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ extern Word16 CRendBin_FOA_HRIR_max_num_iterations_32kHz; -extern UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; -extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[4]; +extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[FOA_CHANNELS]; extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[4][BINAURAL_CHANNELS][160]; -extern Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[4][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ extern Word16 CRendBin_FOA_HRIR_max_num_iterations_16kHz; -extern UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; -extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[4]; +extern Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[FOA_CHANNELS]; extern UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[4][BINAURAL_CHANNELS][80]; -extern Word32 CRendBin_FOA_HRIR_coeff_im_16kHz_fx[4][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_FOA_HRIR_coeff_im_16kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]; @@ -154,42 +154,42 @@ extern Word32 CRendBin_HOA2_HRIR_latency_s_fx; /* Sample Rate = 48000 */ extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_48kHz; -extern UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; -extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[9]; +extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[HOA2_CHANNELS]; extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[9][BINAURAL_CHANNELS][240]; -extern Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[9][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_32kHz; -extern UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; -extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[9]; +extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[HOA2_CHANNELS]; extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[9][BINAURAL_CHANNELS][160]; -extern Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[9][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ extern Word16 CRendBin_HOA2_HRIR_max_num_iterations_16kHz; -extern UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; -extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[9]; +extern Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[HOA2_CHANNELS]; extern UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[9][BINAURAL_CHANNELS][80]; -extern Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[9][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]; @@ -201,42 +201,42 @@ extern Word32 CRendBin_HOA3_HRIR_latency_s_fx; /* Sample Rate = 48000 */ extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_48kHz; -extern UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; -extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[16]; +extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[HOA3_CHANNELS]; extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[16][BINAURAL_CHANNELS][240]; -extern Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[16][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][240]; +extern Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][240]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 32000 */ extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_32kHz; -extern UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; -extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[16]; +extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[HOA3_CHANNELS]; extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[16][BINAURAL_CHANNELS][160]; -extern Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[16][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][160]; +extern Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][160]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]; /* Sample Rate = 16000 */ extern Word16 CRendBin_HOA3_HRIR_max_num_iterations_16kHz; -extern UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]; +extern UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]; extern UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; -extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[16]; +extern Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[HOA3_CHANNELS]; extern UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]; -extern Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[16][BINAURAL_CHANNELS][80]; -extern Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[16][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][80]; +extern Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][80]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]; extern Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]; @@ -249,42 +249,63 @@ extern Word32 CRendBin_Combined_BRIR_latency_s_fx; /* Sample Rate = 48000 */ extern Word16 CRendBin_Combined_BRIR_max_num_iterations_48kHz; -extern UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; -extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[15]; +extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]; -extern Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][2955]; -extern Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][2955]; +extern Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; +extern Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS][2885]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS][2885]; /* Sample Rate = 32000 */ extern Word16 CRendBin_Combined_BRIR_max_num_iterations_32kHz; -extern UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]; extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; -extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[15]; +extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]; -extern Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][2819]; -extern Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][2819]; +extern Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2819]; +extern Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2819]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS][2870]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS][2870]; /* Sample Rate = 16000 */ extern Word16 CRendBin_Combined_BRIR_max_num_iterations_16kHz; -extern UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]; +extern UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS]; -extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]; +extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][23]; extern UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; -extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[15]; +extern Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[HRTF_LS_CHANNELS]; extern UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]; -extern Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][1774]; -extern Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][1774]; +extern Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1774]; +extern Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1774]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS][2522]; extern Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS][2522]; + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +extern const Word32 defaultHRIR_coherence_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-27*/ +extern const Word32 defaultHRIR_left_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +extern const Word32 defaultHRIR_right_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ + +extern const Word32 defaultHRIR_coherence_32kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-27*/ +extern const Word32 defaultHRIR_left_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +extern const Word32 defaultHRIR_right_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ + +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB +extern float defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-27*/ +extern float defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-23*/ +extern float defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-23*/ +#else +extern const Word32 defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-27*/ +extern const Word32 defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +extern const Word32 defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +#endif +#endif + #endif /* _IVAS_ROM_BINAURAL_CREND_HEAD_ */ diff --git a/lib_rend/ivas_rom_binaural_crend_head_fx.c b/lib_rend/ivas_rom_binaural_crend_head_fx.c index be015058b11ea110a13953c52676ad6ac5cdc9b3..8b51d8f2a1a7868349e0c3f2c13551e469d92a34 100644 --- a/lib_rend/ivas_rom_binaural_crend_head_fx.c +++ b/lib_rend/ivas_rom_binaural_crend_head_fx.c @@ -57,33 +57,33 @@ const Word32 CRendBin_Combined_HRIR_latency_s_fx = 44741;/*Q-31*/ /* Sample Rate = 48000 */ const Word16 CRendBin_Combined_HRIR_max_num_iterations_48kHz = 1; -const UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz = 0; -const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; +const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[HRTF_LS_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ const Word16 CRendBin_Combined_HRIR_max_num_iterations_32kHz = 1; -const UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz = 0; -const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; +const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz_fx[HRTF_LS_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ const Word16 CRendBin_Combined_HRIR_max_num_iterations_16kHz = 1; -const UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_Combined_HRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; const UWord16 CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz = 0; -const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[15]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; +const Word16 CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[HRTF_LS_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; const UWord16 *CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -97,33 +97,33 @@ const Word32 CRendBin_FOA_HRIR_latency_s_fx = 44741; // Q31 /* Sample Rate = 48000 */ const Word16 CRendBin_FOA_HRIR_max_num_iterations_48kHz = 1; -const UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[4][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz = 0; -const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[4]={0, 0, 0, 0}; +const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[FOA_CHANNELS]={0, 0, 0, 0}; const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ const Word16 CRendBin_FOA_HRIR_max_num_iterations_32kHz = 1; -const UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[4][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz = 0; -const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[4]={0, 0, 0, 0}; +const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[FOA_CHANNELS]={0, 0, 0, 0}; const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ const Word16 CRendBin_FOA_HRIR_max_num_iterations_16kHz = 1; -const UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[4][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_FOA_HRIR_num_iterations_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[4][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[FOA_CHANNELS][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; const UWord16 CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz = 0; -const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[4]={0, 0, 0, 0}; +const Word16 CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[FOA_CHANNELS]={0, 0, 0, 0}; const UWord16 *CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -136,33 +136,33 @@ const Word32 CRendBin_HOA2_HRIR_latency_s_fx = 44741; // Q31 /* Sample Rate = 48000 */ const Word16 CRendBin_HOA2_HRIR_max_num_iterations_48kHz = 1; -const UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[9][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz = 0; -const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; +const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[HOA2_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ const Word16 CRendBin_HOA2_HRIR_max_num_iterations_32kHz = 1; -const UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[9][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz = 0; -const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; +const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[HOA2_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ const Word16 CRendBin_HOA2_HRIR_max_num_iterations_16kHz = 1; -const UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[9][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA2_HRIR_num_iterations_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[9][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[HOA2_CHANNELS][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; const UWord16 CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz = 0; -const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; +const Word16 CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[HOA2_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -174,34 +174,34 @@ const Word32 CRendBin_HOA3_HRIR_latency_s_fx = 44741;/*Q-31*/ /* Sample Rate = 48000 */ const Word16 CRendBin_HOA3_HRIR_max_num_iterations_48kHz = 1; -const UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[16][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]={{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}},{{240},{240}}}; const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz = 0; -const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[HOA3_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 32000 */ const Word16 CRendBin_HOA3_HRIR_max_num_iterations_32kHz = 1; -const UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[16][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]={{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}},{{160},{160}}}; const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz = 0; -const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[HOA3_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; /* Sample Rate = 16000 */ const Word16 CRendBin_HOA3_HRIR_max_num_iterations_16kHz = 1; -const UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[16][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; +const UWord16 CRendBin_HOA3_HRIR_num_iterations_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS]={{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1} }; const UWord16 CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {0, 0}; -const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[16][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; +const UWord16 CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[HOA3_CHANNELS][BINAURAL_CHANNELS][1]={{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}},{{80},{80}}}; const UWord16 CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz = 0; -const float CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[16]={0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f}; -const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[16]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const float CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[HOA3_CHANNELS]={0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f}; +const Word16 CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[HOA3_CHANNELS]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const UWord16 *CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NULL,NULL}; @@ -213,35 +213,35 @@ const Word32 CRendBin_Combined_BRIR_latency_s_fx = 313176;/*Q-31*/ /* Sample Rate = 48000 */ const Word16 CRendBin_Combined_BRIR_max_num_iterations_48kHz = 22; -const UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[BINAURAL_CHANNELS] = {40, 40}; -const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[15][BINAURAL_CHANNELS][22]={{{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240},{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240}},{{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240},{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240}},{{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240},{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240}},{{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240},{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240}},{{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240},{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240}},{{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240},{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240}},{{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240},{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240}},{{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240},{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240}},{{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240},{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240}},{{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240},{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240}},{{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240},{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240}},{{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240},{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240}},{{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240},{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240}},{{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240},{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240}},{{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240},{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240}}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]={{{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240},{116, 118, 117, 121, 112, 119, 121, 131, 134, 131, 137, 127, 134, 135, 134, 135, 129, 139, 135, 130, 128, 240}},{{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240},{122, 106, 121, 114, 121, 123, 119, 126, 123, 126, 127, 130, 128, 136, 132, 131, 129, 141, 137, 131, 129, 240}},{{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240},{118, 104, 116, 104, 123, 123, 122, 125, 130, 128, 132, 135, 131, 132, 131, 132, 135, 137, 144, 129, 129, 240}},{{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240},{102, 117, 116, 121, 117, 114, 115, 125, 126, 124, 125, 142, 133, 124, 129, 132, 134, 137, 143, 125, 125, 240}},{{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240},{116, 115, 117, 120, 121, 119, 125, 129, 123, 129, 124, 127, 128, 143, 133, 131, 136, 141, 158, 127, 131, 240}},{{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240},{112, 106, 118, 123, 115, 120, 129, 123, 130, 127, 130, 130, 131, 131, 131, 135, 134, 153, 138, 132, 127, 240}},{{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240},{107, 112, 111, 120, 115, 125, 122, 123, 132, 123, 133, 138, 125, 134, 130, 131, 135, 137, 136, 127, 121, 240}},{{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240},{111, 113, 132, 115, 121, 123, 121, 127, 135, 128, 129, 128, 133, 130, 133, 138, 134, 137, 152, 138, 124, 240}},{{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240},{114, 104, 114, 117, 125, 127, 123, 129, 123, 127, 144, 131, 138, 132, 129, 129, 132, 134, 136, 127, 121, 240}},{{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240},{100, 102, 112, 118, 115, 116, 118, 116, 121, 124, 125, 121, 125, 130, 127, 132, 133, 134, 134, 129, 132, 240}},{{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240},{106, 93, 103, 108, 124, 111, 114, 115, 120, 121, 119, 123, 131, 130, 132, 132, 132, 131, 140, 129, 131, 240}},{{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240},{108, 101, 115, 115, 115, 110, 121, 124, 124, 120, 122, 129, 124, 128, 125, 132, 135, 133, 138, 160, 119, 240}},{{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240},{112, 106, 114, 110, 128, 117, 120, 126, 124, 128, 126, 132, 129, 127, 133, 134, 136, 133, 154, 197, 129, 240}},{{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240},{102, 107, 111, 116, 116, 120, 118, 115, 120, 119, 128, 131, 131, 130, 128, 126, 126, 132, 145, 136, 133, 240}},{{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240},{111, 117, 106, 120, 123, 121, 125, 125, 130, 125, 123, 123, 127, 131, 125, 131, 135, 134, 148, 134, 132, 240}}}; const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz = 98; -const float CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[15]={0.224183f, 0.227455f, 0.241830f, 0.207155f, 0.218087f, 0.222942f, 0.232158f, 0.248203f, 0.249262f, 0.261591f, 0.246276f, 0.279163f, 0.285701f, 0.262541f, 0.271844f}; -const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[15]={7346, 7453, 7924, 6788, 7146, 7305, 7607, 8133, 8167, 8571, 8069, 9147, 9361, 8602, 8907,}; +const float CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[HRTF_LS_CHANNELS]={0.224183f, 0.227455f, 0.241830f, 0.207155f, 0.218087f, 0.222942f, 0.232158f, 0.248203f, 0.249262f, 0.261591f, 0.246276f, 0.279163f, 0.285701f, 0.262541f, 0.271844f}; +const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[HRTF_LS_CHANNELS]={7346, 7453, 7924, 6788, 7146, 7305, 7607, 8133, 8167, 8571, 8069, 9147, 9361, 8602, 8907,}; const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98},{47, 47, 47, 47, 47, 47, 51, 51, 58, 58, 58, 65, 65, 65, 65, 65, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 91, 91, 93, 93, 93, 98}}; /* Sample Rate = 32000 */ const Word16 CRendBin_Combined_BRIR_max_num_iterations_32kHz = 22; -const UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[15][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22}, {22, 22} }; const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[BINAURAL_CHANNELS] = {40, 40}; -const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[15][BINAURAL_CHANNELS][22]={{{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160},{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160}},{{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160},{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160}},{{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160},{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160}},{{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160},{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160}},{{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160},{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160}},{{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160},{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160}},{{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160},{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160}},{{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160},{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160}},{{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160},{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160}},{{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160},{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160}},{{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160},{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160}},{{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160},{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160}},{{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160},{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160}},{{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160},{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160}},{{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160},{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160}}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][22]={{{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160},{115, 117, 117, 120, 112, 118, 121, 130, 126, 130, 136, 127, 133, 135, 132, 133, 129, 137, 134, 129, 128, 160}},{{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160},{121, 106, 119, 113, 120, 123, 114, 126, 123, 125, 127, 128, 127, 134, 132, 130, 129, 139, 133, 131, 128, 160}},{{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160},{113, 103, 116, 104, 123, 123, 122, 124, 130, 128, 132, 131, 131, 132, 130, 132, 130, 135, 137, 128, 128, 160}},{{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160},{102, 116, 116, 121, 116, 114, 115, 121, 125, 123, 124, 130, 132, 122, 127, 131, 131, 135, 133, 124, 125, 160}},{{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160},{115, 115, 115, 119, 121, 119, 125, 127, 123, 129, 122, 126, 128, 134, 130, 130, 131, 140, 146, 127, 131, 160}},{{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160},{112, 106, 118, 121, 115, 117, 129, 123, 128, 126, 130, 130, 131, 131, 130, 134, 133, 149, 130, 132, 126, 160}},{{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160},{107, 112, 110, 119, 114, 124, 121, 121, 132, 122, 131, 134, 124, 133, 130, 129, 134, 134, 135, 127, 120, 160}},{{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160},{110, 113, 123, 113, 121, 120, 120, 126, 131, 123, 128, 128, 132, 130, 132, 136, 133, 136, 135, 128, 124, 160}},{{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160},{114, 101, 113, 113, 124, 126, 123, 128, 122, 127, 132, 127, 136, 128, 128, 127, 132, 132, 129, 125, 120, 160}},{{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160},{99, 100, 111, 117, 114, 114, 118, 116, 121, 124, 124, 121, 125, 130, 127, 132, 132, 130, 133, 128, 131, 160}},{{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160},{105, 93, 103, 108, 119, 110, 111, 114, 120, 121, 119, 122, 130, 128, 130, 131, 132, 131, 136, 128, 128, 160}},{{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160},{105, 100, 112, 114, 115, 108, 117, 120, 123, 117, 122, 129, 124, 128, 124, 132, 135, 131, 139, 153, 116, 160}},{{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160},{110, 106, 113, 110, 122, 116, 119, 125, 123, 128, 125, 127, 128, 127, 133, 130, 132, 132, 143, 155, 127, 160}},{{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160},{102, 107, 110, 112, 115, 117, 117, 115, 120, 118, 127, 130, 130, 129, 126, 126, 125, 130, 141, 135, 127, 160}},{{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160},{110, 117, 106, 118, 118, 116, 121, 124, 128, 125, 122, 122, 126, 131, 124, 130, 133, 131, 139, 134, 131, 160}}}; const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz = 97; -const float CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[15]={0.224190f, 0.227445f, 0.241827f, 0.207131f, 0.218113f, 0.222941f, 0.232139f, 0.248192f, 0.249239f, 0.261572f, 0.246309f, 0.279145f, 0.285786f, 0.262528f, 0.271847f}; -const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[15]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907,}; +const float CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[HRTF_LS_CHANNELS]={0.224190f, 0.227445f, 0.241827f, 0.207131f, 0.218113f, 0.222941f, 0.232139f, 0.248192f, 0.249239f, 0.261572f, 0.246309f, 0.279145f, 0.285786f, 0.262528f, 0.271847f}; +const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[HRTF_LS_CHANNELS]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907,}; const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[BINAURAL_CHANNELS][40]={{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97},{47, 47, 47, 47, 47, 47, 50, 50, 56, 56, 56, 63, 63, 63, 63, 63, 72, 72, 72, 74, 74, 77, 77, 79, 81, 81, 81, 81, 87, 87, 87, 87, 87, 87, 93, 93, 93, 93, 93, 97}}; /* Sample Rate = 16000 */ const Word16 CRendBin_Combined_BRIR_max_num_iterations_16kHz = 23; -const UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[15][BINAURAL_CHANNELS]={{23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23} }; +const UWord16 CRendBin_Combined_BRIR_num_iterations_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS]={{23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23}, {23, 23} }; const UWord16 CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[BINAURAL_CHANNELS] = {40, 40}; -const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[15][BINAURAL_CHANNELS][23]={{{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80},{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80}},{{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80},{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80}},{{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80},{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80}},{{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80},{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80}},{{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80},{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80}},{{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80},{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80}},{{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80},{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80}},{{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80},{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80}},{{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80},{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80}},{{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80},{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80}},{{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80},{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80}},{{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80},{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80}},{{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80},{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80}},{{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80},{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80}},{{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80},{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80}}}; +const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][23]={{{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80},{77, 76, 77, 77, 77, 76, 77, 76, 77, 76, 77, 77, 77, 78, 76, 76, 77, 77, 77, 77, 77, 76, 80}},{{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80},{76, 77, 77, 75, 77, 78, 77, 76, 77, 77, 76, 77, 77, 77, 77, 77, 76, 77, 76, 76, 77, 78, 80}},{{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80},{77, 76, 76, 78, 75, 76, 74, 78, 77, 76, 77, 77, 77, 76, 76, 77, 78, 78, 77, 77, 77, 77, 80}},{{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80},{76, 76, 76, 76, 77, 77, 76, 78, 77, 77, 77, 77, 78, 78, 77, 77, 77, 77, 77, 78, 77, 78, 80}},{{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80},{76, 77, 77, 76, 77, 77, 75, 77, 77, 77, 76, 77, 77, 77, 77, 78, 77, 77, 77, 77, 76, 76, 80}},{{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80},{77, 76, 77, 77, 77, 77, 77, 77, 76, 78, 76, 78, 75, 76, 77, 77, 76, 76, 77, 78, 78, 77, 80}},{{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80},{77, 77, 75, 76, 76, 77, 77, 77, 77, 77, 77, 75, 77, 76, 76, 76, 77, 77, 76, 77, 76, 77, 80}},{{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80},{75, 76, 77, 77, 75, 77, 75, 76, 76, 77, 77, 77, 78, 78, 77, 77, 76, 77, 78, 78, 78, 76, 80}},{{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80},{77, 77, 77, 76, 77, 77, 76, 76, 76, 77, 77, 75, 76, 78, 78, 77, 77, 78, 78, 77, 76, 76, 80}},{{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80},{76, 75, 76, 76, 77, 77, 77, 77, 77, 77, 74, 78, 77, 78, 78, 77, 76, 77, 77, 77, 77, 76, 80}},{{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80},{76, 76, 77, 76, 77, 77, 76, 76, 76, 76, 77, 77, 76, 76, 77, 75, 77, 76, 76, 76, 77, 77, 80}},{{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80},{76, 76, 77, 75, 78, 77, 77, 77, 77, 77, 77, 77, 77, 76, 78, 77, 76, 78, 76, 77, 76, 77, 80}},{{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80},{76, 77, 77, 76, 76, 77, 77, 75, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 77, 76, 76, 78, 80}},{{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80},{74, 76, 74, 76, 75, 76, 76, 76, 76, 77, 77, 78, 77, 78, 75, 76, 77, 76, 78, 76, 78, 77, 80}},{{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80},{76, 77, 77, 77, 76, 78, 77, 76, 75, 77, 77, 77, 76, 78, 77, 78, 78, 78, 77, 76, 77, 75, 80}}}; const UWord16 CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz = 77; -const float CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[15]={0.223532f, 0.226827f, 0.248830f, 0.208782f, 0.220391f, 0.219790f, 0.231187f, 0.248730f, 0.251408f, 0.263698f, 0.243858f, 0.281483f, 0.283080f, 0.261660f, 0.273527f}; -const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[15]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907}; +const float CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[HRTF_LS_CHANNELS]={0.223532f, 0.226827f, 0.248830f, 0.208782f, 0.220391f, 0.219790f, 0.231187f, 0.248730f, 0.251408f, 0.263698f, 0.243858f, 0.281483f, 0.283080f, 0.261660f, 0.273527f}; +const Word16 CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[HRTF_LS_CHANNELS]={7346, 7452, 7924, 6787, 7147, 7305, 7606, 8132, 8167, 8571, 8071, 9147, 9364, 8602, 8907}; const UWord16 CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[BINAURAL_CHANNELS][40]={{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77},{46, 46, 46, 46, 46, 46, 46, 49, 49, 53, 53, 53, 55, 55, 61, 61, 61, 65, 67, 67, 67, 67, 67, 67, 69, 72, 72, 72, 73, 73, 75, 75, 75, 75, 75, 75, 75, 75, 75, 77}}; //BRIR and HRIR coeff tables in Q29 -const Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][2955] ={ +const Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955] ={ { { -4881767, @@ -9213,7 +9213,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][295 0, 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][2955] ={ +const Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2955] ={ { { 5294084, @@ -18185,7 +18185,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][295 0, 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][2819] ={ +const Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2819] ={ { { -4883915, @@ -26737,7 +26737,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][281 0, 0, 0, 0, 0, 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][2819] ={ +const Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][2819] ={ { { 5241471, @@ -35289,7 +35289,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][281 0, 0, 0, 0, 0, 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][1774] ={ +const Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1774] ={ { { 5815386, @@ -40721,7 +40721,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][177 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][1774] ={ +const Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][1774] ={ { { -2848100, @@ -46153,7 +46153,7 @@ const Word32 CRendBin_Combined_BRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][177 0, 0, 0, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240] ={ { { 591356864, @@ -46965,7 +46965,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_re_48kHz_fx[15][BINAURAL_CHANNELS][240 -40265, 80531, 23622, -60130, 4295, 62277, 0, -26844, 38118, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][240] ={ { { 11671574, @@ -47777,7 +47777,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_im_48kHz_fx[15][BINAURAL_CHANNELS][240 74088, 16643, -84826, -23085, 49392, -11811, -51540, 14496, 30602, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160] ={ { { 684059456, @@ -48349,7 +48349,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_re_32kHz_fx[15][BINAURAL_CHANNELS][160 -338522336, -360246272, -386598592, -406292640, -400060640, -361901472, -311420032, -275072800, -260514992, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][160] ={ { { 12131672, @@ -48921,7 +48921,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_im_32kHz_fx[15][BINAURAL_CHANNELS][160 -154181280, -140419664, -114481280, -68539624, -9762461, 36551784, 49731428, 34809636, 11406359, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80] ={ { { 665281280, @@ -49253,7 +49253,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_re_16kHz_fx[15][BINAURAL_CHANNELS][80] 47567300, 14498199, -13151190, -28034862, -46559592, -86153288, -128819488, -143185616, -134899024, }, }, }; -const Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[HRTF_LS_CHANNELS][BINAURAL_CHANNELS][80] ={ { { 12014097, @@ -49585,7 +49585,7 @@ const Word32 CRendBin_Combined_HRIR_coeff_im_16kHz_fx[15][BINAURAL_CHANNELS][80] -284300000, -264724608, -235417888, -208847072, -196258528, -178760304, -131210712, -66350264, -17217988, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[16][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][240] ={ { { 523696096, @@ -50451,7 +50451,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[16][BINAURAL_CHANNELS][240] ={ 40212704, 35827544, 37678676, 43050604, 45202920, 52891448, 79491256, 120323512, 151594096, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[16][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][240] ={ { { -94963336, @@ -51317,7 +51317,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[16][BINAURAL_CHANNELS][240] ={ 50771344, 46590196, 50434728, 51454780, 54419384, 66729296, 78190416, 67669360, 27167816, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[16][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][160] ={ { { 500112448, @@ -51927,7 +51927,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[16][BINAURAL_CHANNELS][160] ={ 147960544, 147701776, 143530832, 130539624, 107595912, 81434192, 62075700, 53886272, 52787832, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[16][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][160] ={ { { -95109368, @@ -52537,7 +52537,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[16][BINAURAL_CHANNELS][160] ={ 11628087, -2854006, -20797842, -39668316, -51709260, -50203336, -36630704, -19493246, -5658620, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[16][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][80] ={ { { 474517120, @@ -52891,7 +52891,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[16][BINAURAL_CHANNELS][80] ={ -74211128, -74067784, -72268728, -71680320, -70314520, -61509300, -43222404, -22516366, -9305047, }, }, }; -const Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[16][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[HOA3_CHANNELS][BINAURAL_CHANNELS][80] ={ { { -95201168, @@ -53245,7 +53245,7 @@ const Word32 CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[16][BINAURAL_CHANNELS][80] ={ -7124814, -360777, 5003637, 10241886, 19488950, 31398358, 37372120, 30353608, 11592654, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[9][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][240] ={ { { 512962432, @@ -53733,7 +53733,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[9][BINAURAL_CHANNELS][240] ={ -28724742, -38796440, -25851408, -2009508, -9972914, -33472828, 14603426, 167614864, 316267424, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[9][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][240] ={ { { -150097296, @@ -54221,7 +54221,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[9][BINAURAL_CHANNELS][240] ={ 21925272, 38224672, 65255048, 67648416, 60901024, 105280384, 197452000, 226874128, 103426568, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[9][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][160] ={ { { 481896416, @@ -54565,7 +54565,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[9][BINAURAL_CHANNELS][160] ={ 83516712, 79278656, 72248864, 60511796, 45328012, 31496606, 23372138, 21165598, 21604760, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[9][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][160] ={ { { -150290032, @@ -54909,7 +54909,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[9][BINAURAL_CHANNELS][160] ={ -6684043, -15480136, -24956982, -32718524, -34671124, -29163902, -19150186, -9488120, -2658048, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[9][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][80] ={ { { 458548416, @@ -55109,7 +55109,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[9][BINAURAL_CHANNELS][80] ={ 79717816, 70102456, 60736744, 54407572, 46471008, 30596274, 10727755, -2694018, -6955163, }, }, }; -const Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[9][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[HOA2_CHANNELS][BINAURAL_CHANNELS][80] ={ { { -150242784, @@ -55309,7 +55309,7 @@ const Word32 CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[9][BINAURAL_CHANNELS][80] ={ -54154168, -55454472, -53721452, -52272436, -55008332, -56615184, -47854524, -29224568, -9227200, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[4][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][240] ={ { { 518734336, @@ -55527,7 +55527,7 @@ const Word32 CRendBin_FOA_HRIR_coeff_re_48kHz_fx[4][BINAURAL_CHANNELS][240] ={ -180487408, -169009648, -181035552, -197899744, -193123744, -179249920, -193284272, -243472032, -290958272, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[4][BINAURAL_CHANNELS][240] ={ +const Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][240] ={ { { -124898720, @@ -55745,7 +55745,7 @@ const Word32 CRendBin_FOA_HRIR_coeff_im_48kHz_fx[4][BINAURAL_CHANNELS][240] ={ -23336704, -32086090, -45628660, -37964828, -24686936, -36248452, -67124968, -75412112, -33794412, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[4][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][160] ={ { { 542228352, @@ -55899,7 +55899,7 @@ const Word32 CRendBin_FOA_HRIR_coeff_re_32kHz_fx[4][BINAURAL_CHANNELS][160] ={ -234983568, -235941344, -236356880, -230784160, -213989760, -188165200, -163468608, -148763712, -143858320, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[4][BINAURAL_CHANNELS][160] ={ +const Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][160] ={ { { -124746248, @@ -56053,7 +56053,7 @@ const Word32 CRendBin_FOA_HRIR_coeff_im_32kHz_fx[4][BINAURAL_CHANNELS][160] ={ -13269838, -4217121, 9205726, 27543626, 44898516, 51582020, 43380780, 26081188, 8227547, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[4][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][80] ={ { { 572464896, @@ -56143,7 +56143,7 @@ const Word32 CRendBin_FOA_HRIR_coeff_re_16kHz_fx[4][BINAURAL_CHANNELS][80] ={ -159711040, -163078832, -164956816, -167140800, -170631536, -168793824, -151206464, -119230440, -92601104, }, }, }; -const Word32 CRendBin_FOA_HRIR_coeff_im_16kHz_fx[4][BINAURAL_CHANNELS][80] ={ +const Word32 CRendBin_FOA_HRIR_coeff_im_16kHz_fx[FOA_CHANNELS][BINAURAL_CHANNELS][80] ={ { { -124641560, @@ -59586,6 +59586,348 @@ const Word32 CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS] -48022028, -25965224, -49312668, 19488414, 23572928, -15180562, -392990, -47734268, -2894808, 14061723, -6515466, }, }; + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +const Word32 defaultHRIR_coherence_48kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-27*/ = { + 131936432,125285536,105934832,77097344,45729324,19356880,2523696,0,0, + 0,1602425,4763253,5796595,5698884,5608690,5175704,3880368,2303444, + 1553033,1902670,2661537,3300414,3919560,4475624,4485288,3976468,3688169, + 3682129,3375844,2619661,1976758,1906026,2165066,2186943,1765500,1162325, + 671759,348160,140123,27783,0,0,0,148981,534991, + 939926,1281242,1547798,1665910,1550617,1228897,835102,478486,185757, + 0,0,0,0,4294,124554,284273,410840,479828, + 507343,493652,417417,278367,114890,0,0,0,0, + 0,0,0,0,0,29125,130728,242531,313264, + 326954,282528,204816,121735,46976,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,31943,114353,173543, + 205218,205755,176362,128043,69927,20803,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,3355,38117,83214,127372,170993,215553,257966, + 294607,327222,360643,395137,425738,452447,480096,507208,525462, + 533247,534186,526804,505463,469896,424799,372856,312190,242397, + 168711,95831,28319,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,102810,72074,0, + 226962,443858,219445,0,214882,1013209,77846,0,273535, + 1385798,289239,0,472983,1241648,688671,0,306821,870536, + 792153,0,115695,613375,552574,0,0,434462,205890, + 34762,26709,182938,117843,0 +}; +const Word32 defaultHRIR_left_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 8209721,8156956,8050127,7984940,7992858,8011649,7974747,7910306,7917252, + 8038476,8174723,8228729,8192717,8124794,8070352,8029995,7989956,7953608, + 7931152,7912210,7870745,7803402,7745101,7727896,7735563,7724331,7693670, + 7672548,7668253,7662666,7647508,7638633,7652147,7680265,7699593,7698955, + 7689828,7687614,7690835,7685852,7667229,7645042,7629506,7617787,7601639, + 7578545,7554822,7537315,7524279,7507108,7481430,7453328,7431803,7415991, + 7395254,7364820,7335141,7319069,7310202,7296948,7280120,7270700,7273946, + 7282989,7288836,7292510,7303600,7327768,7359376,7389357,7418784,7458856, + 7515186,7577119,7632232,7684091,7741771,7803922,7858506,7897295,7924793, + 7950529,7975309,7989134,7983815,7964337,7942418,7920028,7885853,7832460, + 7773178,7719675,7667640,7605540,7531820,7456659,7388182,7322718,7251305, + 7173342,7099371,7039023,6989942,6943645,6900871,6876377,6876200,6891753, + 6912280,6938008,6976184,7027514,7081939,7129159,7169768,7212416,7260113, + 7303961,7334160,7353923,7375390,7399868,7413919,7410756,7397888,7384995, + 7371128,7347783,7311469,7269433,7231533,7198642,7162562,7118413,7073358, + 7038218,7011467,6978885,6936976,6896929,6866243,6838636,6804318,6763793, + 6726715,6699377,6677726,6654422,6630095,6613880,6612001,6619165,6625113, + 6629517,6642997,6668750,6697196,6718344,6734173,6753895,6779589,6802146, + 6813185,6816633,6823486,6836086,6844013,6839567,6830432,6829887,6834652, + 6833897,6825424,6817447,6817430,6823444,6827572,6826137,6824845,6832135, + 6847612,6860472,6863735,6867082,6885344,6912573,6928050,6933679,6949215, + 6980018,7009084,7024486,7037715,7065515,7103221,7130283,7141717,7156523, + 7182804,7191302,7148830,7066479,6973039,6845448,6642997,6369529,6067757, + 5757018,5407708,4989863,4529504,4091224,3695693,3270760,2711684,2000297, + 1252050,651123,273904,89170,20652,2843,209,134,134, + 125,117,92,75,75,75,58,50,50, + 58,50,41,41,50,41,41,41,41, + 41,41,41,41,41,41,41,41,41, + 41,41,41,41,41 +}; +const Word32 defaultHRIR_right_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 8209721,8156956,8050144,7984965,7992850,8011640,7974756,7910323,7917252, + 8038484,8174707,8228738,8192709,8124794,8070361,8030003,7989948,7953583, + 7931127,7912202,7870737,7803402,7745101,7727896,7735563,7724331,7693679, + 7672548,7668236,7662658,7647491,7638624,7652147,7680265,7699609,7698964, + 7689820,7687597,7690827,7685844,7667229,7645050,7629472,7617779,7601639, + 7578545,7554822,7537315,7524288,7507133,7481447,7453337,7431803,7415982, + 7395229,7364812,7335141,7319077,7310185,7296931,7280120,7270700,7273955, + 7282998,7288836,7292494,7303583,7327776,7359401,7389382,7418776,7458856, + 7515186,7577127,7632241,7684082,7741787,7803939,7858523,7897295,7924793, + 7950529,7975309,7989125,7983824,7964320,7942426,7920062,7885853,7832443, + 7773194,7719675,7667640,7605556,7531829,7456675,7388199,7322726,7251305, + 7173333,7099379,7039032,6989967,6943653,6900880,6876377,6876226,6891753, + 6912271,6937999,6976184,7027514,7081931,7129151,7169768,7212416,7260122, + 7303961,7334160,7353940,7375398,7399868,7413910,7410731,7397871,7384978, + 7371145,7347791,7311477,7269450,7231542,7198633,7162554,7118413,7073358, + 7038218,7011475,6978885,6936976,6896920,6866226,6838628,6804310,6763785, + 6726707,6699369,6677709,6654414,6630095,6613889,6612010,6619148,6625071, + 6629508,6642989,6668750,6697204,6718352,6734190,6753920,6779597,6802146, + 6813210,6816641,6823495,6836095,6844030,6839559,6830457,6829904,6834677, + 6833905,6825416,6817455,6817421,6823428,6827555,6826129,6824837,6832135, + 6847620,6860472,6863735,6867082,6885336,6912582,6928059,6933679,6949232, + 6980026,7009084,7024477,7037706,7065489,7103188,7130275,7141708,7156497, + 7182812,7191285,7148847,7066488,6973047,6845439,6642997,6369529,6067757, + 5757001,5407699,4989863,4529504,4091224,3695702,3270751,2711693,2000297, + 1252050,651123,273904,89170,20652,2843,209,134,134, + 125,117,92,75,75,75,58,50,50, + 58,50,41,41,50,41,41,41,41, + 41,41,41,41,41,41,41,41,41, + 41,41,41,41,41 +}; +const Word32 defaultHRIR_coherence_32kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-27*/ = { + 131125216,129227112,119736576,105149792,87165424,65548180,45102524,26414452,12630962, + 2261837,646258,0,0,0,362790,1269699,3305916,5226035, + 5552185,5544266,5313545,5242007,4972498,4406099,3304843,2138491,1245809, + 945832,1040724,1586856,2087488,2519669,2930509,3330210,3706959,3852988, + 3845069,3506438,3230889,3049963,3020838,2972117,2692944,2226269,1634369, + 1306206,1176284,1344056,1533169,1651817,1468073,1147695,736184,393929, + 141465,23622,0,0,0,0,0,0,0, + 0,0,31004,186025,403995,663840,869999,1052669,1200174, + 1230910,1195208,1010927,774704,504121,258100,82812,13824,0, + 0,0,0,0,0,0,0,0,0, + 0,35567,94757,127104,150189,159048,139586,103616,29662, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,13287,46305,75833,95294,77980,44426,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,13153,45768,78383,106434, + 117574,114487,101871,68719,36641,6039,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,1476, + 5234,21072,40667,63619,89120,116098,144015,171932,199715, + 227901,255818,281723,304405,324941,341584,357824,373796,388962, + 403995,419296,437818,458621,488820,521301,557674,596329,636728, + 680886,727728,776315,821546,862751,897916,926773,952409,971870, + 980460,981802,955227,918049,865167,793897,713233,613106,507477, + 398224,342255,316082,334604,338228 +}; +const Word32 defaultHRIR_left_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 8747993,8732977,8657866,8592845,8534553,8549703,8574332,8613196,8612450, + 8594632,8548151,8528631,8527079,8602383,8683241,8772412,8811402,8825092, + 8787822,8745552,8699960,8676052,8653847,8634210,8606620,8577981,8553109, + 8534922,8521190,8494783,8457906,8405301,8354525,8310963,8294462,8290268, + 8294278,8284279,8267812,8241648,8222362,8207531,8203647,8196752,8187852, + 8170672,8158450,8153660,8165857,8182684,8201064,8209352,8210920,8201391, + 8193506,8188086,8186669,8185008,8178398,8165219,8147653,8126564,8107262, + 8090653,8075973,8060647,8040892,8017060,7990510,7965369,7942812,7924139, + 7905508,7885266,7858574,7828903,7797253,7770124,7745051,7723047,7698192, + 7671231,7638683,7606840,7575458,7552800,7532081,7514280,7493736,7472068, + 7448614,7429295,7412736,7405756,7399180,7393182,7382990,7372018,7362119, + 7358680,7359552,7368629,7377118,7384718,7391127,7398953,7413675,7435679, + 7462522,7492302,7520043,7544714,7568412,7592915,7621662,7651325,7681599, + 7702873,7719423,7728886,7735043,7740672,7747517,7751812,7754412,7743650, + 7728089,7705339,7680970,7656341,7632308,7603568,7571683,7527366,7481606, + 7433699,7390347,7348345,7307132,7260525,7210319,7153108,7097458,7044149, + 6995864,6948351,6898883,6845179,6788657,6732512,6680016,6632990,6592154, + 6553113,6515029,6478094,6441947,6416664,6397714,6388260,6386465,6386851, + 6388319,6391700,6396364,6411102,6429029,6451720,6471844,6489796,6501641, + 6513435,6525204,6542518,6559405,6575670,6584344,6589771,6589813,6590845, + 6592531,6595845,6596365,6592707,6580091,6564161,6543961,6524642,6505902, + 6486113,6462969,6434800,6400113,6364034,6328861,6297445,6268521,6239597, + 6208098,6172732,6136241,6100909,6071330,6044722,6020084,5990858,5959116, + 5923599,5889046,5855634,5825838,5795177,5763938,5725518,5685253,5642211, + 5600763,5560540,5523688,5486661,5449525,5408043,5366612,5325264,5291257, + 5260940,5238031,5214778,5191290,5165126,5142795,5126186,5122067,5121799, + 5124433,5124877,5123837,5133241,5151268,5182239,5223192,5269715,5328527, + 5411331,5510141,5612029,5649811,5591443,5269488,4824515,4151102,3472472, + 2790361,2355655,2029229,1865232,1832432 +}; +const Word32 defaultHRIR_right_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 8747984,8732969,8657857,8592837,8534561,8549686,8574315,8613188,8612450, + 8594632,8548151,8528622,8527070,8602392,8683241,8772404,8811402,8825109, + 8787822,8745552,8699951,8676044,8653847,8634226,8606620,8577964,8553100, + 8534914,8521190,8494808,8457931,8405310,8354525,8310963,8294471,8290276, + 8294278,8284287,8267820,8241639,8222362,8207540,8203664,8196752,8187826, + 8170663,8158450,8153685,8165873,8182684,8201064,8209360,8210945,8201416, + 8193531,8188095,8186669,8185008,8178398,8165219,8147653,8126539,8107237, + 8090644,8075973,8060664,8040875,8017043,7990510,7965369,7942812,7924122, + 7905499,7885283,7858574,7828903,7797270,7770116,7745034,7723056,7698192, + 7671222,7638675,7606840,7575466,7552809,7532089,7514280,7493736,7472068, + 7448597,7429287,7412753,7405756,7399163,7393174,7382981,7372009,7362111, + 7358680,7359560,7368637,7377126,7384718,7391135,7398970,7413692,7435679, + 7462514,7492293,7520026,7544705,7568403,7592915,7621688,7651341,7681582, + 7702873,7719423,7728877,7735026,7740663,7747517,7751829,7754437,7743650, + 7728080,7705330,7680970,7656349,7632308,7603568,7571700,7527383,7481623, + 7433716,7390363,7348353,7307132,7260525,7210327,7153125,7097475,7044149, + 6995872,6948359,6898883,6845179,6788657,6732520,6680024,6632990,6592154, + 6553113,6515037,6478102,6441947,6416664,6397714,6388269,6386457,6386843, + 6388327,6391700,6396347,6411102,6429029,6451712,6471844,6489796,6501624, + 6513427,6525213,6542518,6559405,6575653,6584327,6589763,6589813,6590845, + 6592531,6595836,6596365,6592716,6580099,6564169,6543978,6524642,6505894, + 6486122,6462994,6434817,6400122,6364034,6328852,6297428,6268521,6239597, + 6208090,6172723,6136241,6100909,6071330,6044722,6020076,5990842,5959107, + 5923599,5889037,5855617,5825829,5795169,5763921,5725518,5685253,5642194, + 5600755,5560548,5523688,5486661,5449508,5408026,5366603,5325256,5291257, + 5260949,5238040,5214778,5191281,5165134,5142795,5126194,5122075,5121799, + 5124441,5124877,5123854,5133241,5151259,5182230,5223192,5269715,5328527, + 5411340,5510149,5612037,5649820,5591435,5269472,4824498,4151094,3472472, + 2790378,2355663,2029237,1865240,1832432 +}; + +#ifndef NONBE_FIX_AVG_IAC_CLDFB_REVERB + +const Word32 defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-27*/ = { + 130123416,130123416,128225040,123478832,118732624,113118568,104033232,94947768,85862304, + 75063144,64263984,53464828,43914296,34675820,25437480,17993766,11746601,5499437, + 1532229,985023,437818,0,0,0,0,0,0, + 0,343865,773496,1203261,2004810,3054258,4103707,4777480,4887673, + 4998000,5066316,4966727,4867271,4767816,4765534,4763253,4760971,4569174, + 4329998,4090822,3659312,3099355,2539533,2037290,1621350,1205543,880065, + 916304,952677,988916,1233058,1477200,1721342,1912602,2090441,2268413, + 2427327,2573490,2719788,2859643,2989834,3120025,3219078,3193576,3168075, + 3142574,2987686,2832665,2677778,2583691,2504771,2425851,2397128,2401692, + 2406255,2356594,2225464,2094333,1933137,1651280,1369423,1087566,924357, + 761148,597940,625051,699677,774302,854295,937779,1021128,1026631, + 915230,803830,670014,446676,223338,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,5100,30735, + 56371,81872,173140,264408,355542,419698,477144,534455,552037, + 543044,533918,485599,378494,271254,173946,115964,57982,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0, + 0,0,671,1476,2415,99723,261321,423054,646795, + 963549,1280302,1632087,2124129,2616037,3108080,3841982,4575885,5309922, + 6280181,7309766,8339216,8750996,8750996 +}; +const Word32 defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 9335246,9335246,9316514,9269680,9222847,9180350,9155201,9130044,9104894, + 9126688,9148473,9170267,9191549,9212688,9233844,9234423,9221295,9208167, + 9191205,9168497,9145789,9127997,9129884,9131780,9133676,9164823,9195978, + 9227125,9267550,9310290,9353038,9385225,9410374,9435531,9445170,9431538, + 9417907,9399855,9364128,9328409,9292682,9270670,9248667,9226655,9215783, + 9207688,9199593,9183605,9162356,9141108,9116244,9085961,9055678,9028608, + 9014432,9000255,8986078,8975962,8965845,8955728,8926108,8891606,8857103, + 8819145,8778896,8738639,8710806,8701604,8692401,8686227,8692209,8698190, + 8704171,8686706,8669232,8651767,8623917,8593466,8563024,8543554,8531399, + 8519252,8509748,8504203,8498667,8489716,8467083,8444459,8421835,8399773, + 8377711,8355649,8351698,8352268,8352847,8355833,8360430,8365027,8363484, + 8352721,8341959,8331028,8319460,8307884,8296308,8292063,8287827,8283582, + 8271142,8256647,8242159,8221389,8196442,8171494,8150547,8135607,8120659, + 8106465,8095225,8083992,8072760,8043073,8013394,7983706,7949422,7913997, + 7878564,7853893,7836394,7818904,7801472,7784141,7766811,7744782,7703972, + 7663169,7622359,7580802,7539253,7497696,7474266,7455367,7436467,7415496, + 7393140,7370784,7338471,7291235,7244007,7197551,7154232,7110914,7067595, + 7046615,7025627,7004647,6977485,6948779,6920073,6878751,6829015,6779278, + 6733644,6694184,6654724,6618804,6597044,6575284,6553524,6518183,6482842, + 6447501,6401632,6353137,6304634,6267229,6237215,6207201,6181045,6160677, + 6140310,6115580,6073427,6031275,5989122,5942817,5896503,5850198,5825150, + 5805428,5785707,5765742,5745626,5725510,5693398,5643285,5593180,5544358, + 5500720,5457091,5413454,5404126,5394797,5385469,5366930,5346085,5325239, + 5282164,5224274,5166376,5115566,5075376,5035186,5002731,5001238,4999736, + 4998243,4969436,4940630,4911823,4847290,4773822,4700355,4646282,4605153, + 4564023,4540250,4542523,4544788,4536869,4488241,4439612,4390983,4285488, + 4179984,4074489,4025282,3990150,3955019,3974925,4031523,4088129,4108127, + 4073222,4038317,3957300,3691818,3426335,3160861,2774481,2388110,2001740, + 1708239,1437966,1167685,1059581,1059581 +}; +const Word32 defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ = { + 9335246,9335246,9316514,9269689,9222855,9180358,9155201,9130035,9104869, + 9126663,9148465,9170258,9191540,9212688,9233827,9234415,9221295,9208175, + 9191213,9168488,9145755,9127963,9129867,9131772,9133676,9164831,9195978, + 9227133,9267550,9310281,9353021,9385200,9410357,9435506,9445153,9431522, + 9417899,9399855,9364119,9328384,9292648,9270653,9248658,9226663,9215792, + 9207688,9199593,9183596,9162348,9141100,9116236,9085953,9055678,9028617, + 9014432,9000255,8986070,8975962,8965853,8955745,8926116,8891614,8857103, + 8819145,8778888,8738631,8710789,8701587,8692385,8686219,8692200,8698181, + 8704162,8686697,8669232,8651775,8623917,8593466,8563016,8543546,8531390, + 8519244,8509739,8504203,8498675,8489724,8467100,8444468,8421844,8399773, + 8377703,8355641,8351681,8352252,8352830,8355817,8360414,8365019,8363475, + 8352721,8341959,8331037,8319469,8307893,8296316,8292072,8287835,8283591, + 8271142,8256647,8242151,8221381,8196433,8171494,8150547,8135616,8120676, + 8106482,8095250,8084009,8072777,8043081,8013385,7983698,7949405,7913972, + 7878547,7853876,7836386,7818904,7801481,7784150,7766819,7744790,7703980, + 7663161,7622350,7580793,7539244,7497696,7474258,7455358,7436459,7415487, + 7393132,7370776,7338471,7291244,7244016,7197560,7154241,7110914,7067587, + 7046607,7025627,7004647,6977485,6948770,6920064,6878742,6829006,6779270, + 6733644,6694184,6654724,6618813,6597053,6575301,6553549,6518191,6482842, + 6447492,6401623,6353137,6304643,6267229,6237215,6207201,6181037,6160677, + 6140310,6115580,6073427,6031275,5989122,5942817,5896512,5850207,5825167, + 5805445,5785723,5765750,5745626,5725493,5693382,5643276,5593180,5544375, + 5500729,5457074,5413429,5404109,5394789,5385478,5366939,5346093,5325247, + 5282172,5224282,5166384,5115574,5075384,5035195,5002739,5001238,4999736, + 4998243,4969436,4940630,4911823,4847290,4773814,4700338,4646274,4605153, + 4564023,4540258,4542523,4544788,4536878,4488249,4439612,4390983,4285480, + 4179984,4074489,4025282,3990150,3955019,3974925,4031523,4088129,4108127, + 4073222,4038317,3957292,3691809,3426327,3160844,2774473,2388110,2001740, + 1708239,1437966,1167685,1059573,1059573 +}; +#else +/* Sample Rate = 16000 */ + +const float defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ] = + {0.983044f, 0.960794f, 0.893756f, 0.783586f, 0.638963f, 0.477338f, 0.319879f, 0.183374f, 0.075909f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.003842f, 0.025288f, 0.035886f, + 0.037785f, 0.035991f, 0.034784f, 0.035091f, 0.034683f, 0.030849f, 0.023146f, 0.014061f, 0.007275f, + 0.005053f, 0.006930f, 0.010589f, 0.013905f, 0.016288f, 0.018404f, 0.020849f, 0.023164f, 0.024149f, + 0.023098f, 0.020635f, 0.018325f, 0.017381f, 0.017611f, 0.017534f, 0.015650f, 0.011786f, 0.007342f, + 0.004290f, 0.003732f, 0.005148f, 0.006838f, 0.007172f, 0.005579f, 0.002632f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000238f, 0.001738f, 0.003011f, 0.003910f, + 0.004120f, 0.003394f, 0.001769f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, + 0.000000f, 0.002101f, 0.004247f, 0.006330f, 0.008300f, 0.010110f, 0.011735f, 0.013165f, 0.014384f, + 0.015345f, 0.015972f, 0.016191f}; + +const float defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ] = + {1.118974f, 1.115256f, 1.106210f, 1.096901f, 1.092316f, 1.094422f, 1.101140f, 1.107775f, 1.110000f, + 1.106535f, 1.099921f, 1.094914f, 1.095643f, 1.103178f, 1.114955f, 1.126292f, 1.132973f, 1.133288f, + 1.128471f, 1.121439f, 1.114842f, 1.109721f, 1.105480f, 1.100966f, 1.095650f, 1.090074f, 1.085225f, + 1.081525f, 1.078267f, 1.074026f, 1.067777f, 1.059839f, 1.051856f, 1.045772f, 1.042531f, 1.041432f, + 1.040607f, 1.038291f, 1.033910f, 1.028286f, 1.022846f, 1.018514f, 1.015152f, 1.011898f, 1.008047f, + 1.003762f, 0.999992f, 0.997770f, 0.997349f, 0.997960f, 0.998259f, 0.997177f, 0.994506f, 0.990883f, + 0.987207f, 0.984003f, 0.981133f, 0.977984f, 0.973950f, 0.968837f, 0.962915f, 0.956690f, 0.950584f, + 0.944679f, 0.938744f, 0.932399f, 0.925372f, 0.917663f, 0.909568f, 0.901511f, 0.893804f, 0.886455f, + 0.879155f, 0.871463f, 0.863142f, 0.854285f, 0.845334f, 0.836740f, 0.828656f, 0.820817f, 0.812713f, + 0.803960f, 0.794564f, 0.784952f, 0.775633f, 0.766881f, 0.758539f, 0.750156f, 0.741330f, 0.732004f, + 0.722524f, 0.713387f, 0.704919f, 0.697057f, 0.689419f, 0.681576f, 0.673350f, 0.664931f, 0.656703f, + 0.648997f, 0.641801f, 0.634760f, 0.627357f, 0.619192f, 0.610186f, 0.600526f, 0.590442f, 0.579952f, + 0.568762f, 0.556384f, 0.542389f, 0.526648f, 0.509355f, 0.490884f, 0.471542f, 0.451447f, 0.430550f, + 0.408842f, 0.386537f, 0.364126f, 0.342284f, 0.321675f, 0.302809f, 0.286016f, 0.271536f, 0.259639f, + 0.250691f, 0.245099f, 0.243192f}; + +const float defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ] = + {1.118974f, 1.115254f, 1.106207f, 1.096903f, 1.092317f, 1.094425f, 1.101145f, 1.107775f, 1.109999f, + 1.106540f, 1.099921f, 1.094912f, 1.095644f, 1.103178f, 1.114952f, 1.126292f, 1.132973f, 1.133288f, + 1.128472f, 1.121439f, 1.114842f, 1.109719f, 1.105481f, 1.100965f, 1.095650f, 1.090072f, 1.085224f, + 1.081527f, 1.078270f, 1.074025f, 1.067775f, 1.059840f, 1.051856f, 1.045772f, 1.042533f, 1.041433f, + 1.040611f, 1.038292f, 1.033911f, 1.028286f, 1.022844f, 1.018512f, 1.015153f, 1.011899f, 1.008050f, + 1.003762f, 0.999995f, 0.997769f, 0.997349f, 0.997959f, 0.998259f, 0.997178f, 0.994509f, 0.990883f, + 0.987204f, 0.984003f, 0.981133f, 0.977983f, 0.973949f, 0.968836f, 0.962914f, 0.956689f, 0.950583f, + 0.944681f, 0.938745f, 0.932399f, 0.925373f, 0.917662f, 0.909567f, 0.901511f, 0.893804f, 0.886456f, + 0.879153f, 0.871467f, 0.863138f, 0.854286f, 0.845334f, 0.836740f, 0.828656f, 0.820816f, 0.812712f, + 0.803961f, 0.794567f, 0.784951f, 0.775631f, 0.766882f, 0.758540f, 0.750158f, 0.741330f, 0.732005f, + 0.722523f, 0.713388f, 0.704920f, 0.697057f, 0.689418f, 0.681575f, 0.673352f, 0.664930f, 0.656706f, + 0.648998f, 0.641802f, 0.634762f, 0.627355f, 0.619192f, 0.610187f, 0.600527f, 0.590442f, 0.579953f, + 0.568763f, 0.556383f, 0.542389f, 0.526646f, 0.509355f, 0.490883f, 0.471543f, 0.451446f, 0.430550f, + 0.408843f, 0.386537f, 0.364127f, 0.342285f, 0.321676f, 0.302809f, 0.286016f, 0.271535f, 0.259640f, + 0.250692f, 0.245099f, 0.243192f}; + + +#endif +#endif + Word32 sine_table_Q31 [361] = { 187, -37478868, -74946000, -112390808, -149800880, -187165824, -224473232, -261712288, -298872128, -335940416, -372906880, @@ -59648,4 +59990,5 @@ Word32 cosine_table_Q31 [181] = { -2121044608, -2126584448, -2131476608, -2135719552, -2139311744, -2142252544, -2144540544, -2146175488, -2147156608, -2147483647, }; + #undef WMC_TOOL_SKIP diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index a3f7bab5d8ac67690446a78360991b2ce9e52f4e..2a661121b66a34d9df11511eaba324dc4d36b89d 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -93,6 +93,7 @@ extern const Word16 HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS]; extern const Word32 SincTable_fx[321]; +#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES extern const Word32 defaultHRIR_coherence_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-27*/ extern const Word32 defaultHRIR_left_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ extern const Word32 defaultHRIR_right_avg_power_48kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ @@ -101,9 +102,16 @@ extern const Word32 defaultHRIR_coherence_32kHz_fx[LR_IAC_LENGTH_NR_FC]; / extern const Word32 defaultHRIR_left_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ extern const Word32 defaultHRIR_right_avg_power_32kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB +extern const Word32 defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-27*/ +extern const Word32 defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-23*/ +extern const Word32 defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC_16KHZ]; /*Q-23*/ +#else extern const Word32 defaultHRIR_coherence_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-27*/ extern const Word32 defaultHRIR_left_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ extern const Word32 defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC]; /*Q-23*/ +#endif +#endif /*----------------------------------------------------------------------------------* * t-design and SN3D normalization table *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index 1fe8e6a3845f863f2a60b772e6458429e8ec6123..df3dc4e2259621851c7a865414695a1871da9127 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -207,6 +207,7 @@ const Word32 SincTable_fx[321] /*Q31*/ = { 8716980, 8185692, 7649294, 7108665, 6564643, 6017979, 5469361, 4919434, 4368840, 3818118, 3267783, 2718370, 2170290, 1624034, 1079948, 538481, }; +#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES const Word32 defaultHRIR_coherence_48kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-27*/ = { 131936432,125285536,105934832,77097344,45729324,19356880,2523696,0,0, 0,1602425,4763253,5796595,5698884,5608690,5175704,3880368,2303444, @@ -486,6 +487,7 @@ const Word32 defaultHRIR_right_avg_power_16kHz_fx[LR_IAC_LENGTH_NR_FC] /*Q-23*/ 4073222,4038317,3957292,3691809,3426327,3160844,2774473,2388110,2001740, 1708239,1437966,1167685,1059573,1059573 }; +#endif /*----------------------------------------------------------------------------------* * t-design and SN3D normalization table *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index fc434df90f13b3895fb624b1324563570c560ecb..bcc470ead3faf705a00093e23d6408edc8971856 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1296,6 +1296,9 @@ typedef struct ivas_binaural_td_rendering_struct TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */ TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + TDREND_HRFILT_FiltSet_t **pHrFiltSet_p; /* pointer to HR filter set */ +#endif Word16 UseCommonDistAttenModel; /* Use common dist atten model (TRUE/FALSE) */ Word16 DistAttenEnabled; /* (TRUE/FALSE) */ @@ -1307,8 +1310,11 @@ typedef struct { Word32 binaural_latency_ns; BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + TDREND_HRFILT_FiltSet_t **hHrtfTD; +#else TDREND_HRFILT_FiltSet_t *hHrtfTD; - +#endif } TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; @@ -1330,6 +1336,9 @@ typedef struct ivas_hrtfs_structure Word16 max_num_iterations; Word16 inv_diffuse_weight_fx[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] Q15 */ Word32 latency_s_fx; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + Word16 init_from_rom; +#endif Word16 gain_lfe_fx; // Q14 } HRTFS_DATA, *HRTFS_HANDLE; /* Main Crend structure */ @@ -1580,7 +1589,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; Word32 *hoa_dec_mtx; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index aea39eaa9ed83fd9b27f54119e1484fa40cf415c..4b4d5c4567eff6c4d972a662efc00d7b464e3451 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -55,11 +55,13 @@ * Local constants *-------------------------------------------------------------------*/ -/* Maximum buffer length (per channel) in samples. - * Keep this separate from L_FRAME48k in case we want to support different size later */ -#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +/* Maximum buffer length (total) in samples. */ +#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING #define MAX_BIN_DELAY_SAMPLES 150 /* Maximum supported rendering latency for binaural IRs */ - +#else +#define MAX_BIN_DELAY_SAMPLES 50 /* Maximum supported rendering latency for binaural IRs */ +#endif /*-------------------------------------------------------------------* * Local types @@ -207,6 +209,17 @@ typedef struct MASA_EXT_REND_HANDLE hMasaExtRend; MASA_PREREND_HANDLE hMasaPrerend; } input_masa; + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +typedef struct hrtf_handles +{ + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; + IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv; + IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin; + IVAS_DEC_HRTF_HANDLE hHrtfTD; +} hrtf_handles; +#endif + struct IVAS_REND { Word32 sampleRateOut; @@ -238,13 +251,26 @@ struct IVAS_REND RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ Word16 num_subframes; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hrtf_handles hHrtfs; +#else + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; + IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv; + IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin; + IVAS_DEC_HRTF_HANDLE hHrtfTD; +#endif }; /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig, hrtf_handles *hHrtfs ); +#else static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig ); +#endif + static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut ); static void intermidiate_ext_dirac_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA renderer structure */ @@ -1414,7 +1440,9 @@ static ivas_error initIsmMasaRendering( IF( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputIsm->tdRendWrapper.hHrtfTD = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1437,7 +1465,12 @@ static ivas_error setRendInputActiveIsm( void *input, const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) + RENDER_CONFIG_DATA *hRendCfg +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + , + hrtf_handles *hrtfs +#endif +) { ivas_error error; rendering_context rendCtx; @@ -1446,6 +1479,19 @@ static ivas_error setRendInputActiveIsm( #ifdef SPLIT_REND_WITH_HEAD_ROT Word16 i; #endif + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + Word16 num_src; + Word16 ivas_format; + IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + { + ivas_format = MC_FORMAT; + } + ELSE + { + ivas_format = ISM_FORMAT; + } + + inputIsm = (input_ism *) input; rendCtx = inputIsm->base.ctx; outConfig = *rendCtx.pOutConfig; @@ -1477,7 +1523,11 @@ static ivas_error setRendInputActiveIsm( #ifdef SPLIT_REND_WITH_HEAD_ROT FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + inputIsm->splitTdRendWrappers[i].hHrtfTD = &hrtfs->hHrtfTD; +#else inputIsm->splitTdRendWrappers[i] = defaultTdRendWrapper(); +#endif } #endif @@ -1486,85 +1536,152 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; move32(); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + inputIsm->tdRendWrapper.hHrtfTD = &hrtfs->hHrtfTD; +#endif + test(); - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ){ #ifdef SPLIT_REND_WITH_HEAD_ROT - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ){ + test(); + test(); + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) +#else + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) +#endif + { +#ifndef SPLIT_REND_WITH_HEAD_ROT +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#endif + { return error; -} + } #else - IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ){ + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) + { return error; -} + } + + Word16 nchan_rend = num_src; + move16(); + + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ + } + + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + } + + /* Open TD renderer wrappers */ + FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) + { + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) + { + return error; + } + + /* Assert same delay as main TD renderer */ + assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); + + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) + { + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + } + } #endif -} -ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) -{ - IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) - { - return error; } -} -ELSE -{ - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - Word16 ivas_format; - IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) + ELSE IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA1 ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_MASA2 ) ) { - ivas_format = MC_FORMAT; + IF( NE_32( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } } ELSE { - ivas_format = ISM_FORMAT; - } - - move16(); - IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) - { - return error; - } - +#ifndef SPLIT_REND_WITH_HEAD_ROT + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) + { + return error; + } + Word16 nchan_rend = num_src; + move16(); - Word16 nchan_rend = num_src; - move16(); + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ + } - test(); - IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p != NULL ) + FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { - IF( Src_p->SrcSpatial_p != NULL ) + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; + IF( Src_p != NULL ) { - Src_p->SrcSpatial_p->q_Pos_p = Q31; + IF( Src_p->SrcSpatial_p != NULL ) + { + Src_p->SrcSpatial_p->q_Pos_p = Q31; + move16(); + } + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; + SrcSpatial_p->q_Pos_p = Q31; move16(); } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; - SrcSpatial_p->q_Pos_p = Q31; - move16(); } - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* Open TD renderer wrappers */ - FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) - { - if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#else + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) { return error; } - /* Assert same delay as main TD renderer */ - assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns ); + Word16 nchan_rend = num_src; + move16(); + + test(); + IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ + } FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) { - TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]]; + TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]]; IF( Src_p != NULL ) { IF( Src_p->SrcSpatial_p != NULL ) @@ -1572,25 +1689,34 @@ ELSE Src_p->SrcSpatial_p->q_Pos_p = Q31; move16(); } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p; + TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p; SrcSpatial_p->q_Pos_p = Q31; move16(); } } - } - -#endif - IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - return error; + IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + ELSE IF( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) +#endif + { + return error; + } } +#endif } -} -return IVAS_ERR_OK; + return IVAS_ERR_OK; } static void clearInputIsm( @@ -1619,14 +1745,18 @@ static void clearInputIsm( IF( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputIsm->tdRendWrapper.hHrtfTD = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { ivas_td_binaural_close_fx( &inputIsm->splitTdRendWrappers[i].hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputIsm->splitTdRendWrappers[i].hHrtfTD = NULL; +#endif } #endif @@ -2405,7 +2535,10 @@ static ivas_error initMcBinauralRendering( const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, - UWord8 reconfigureFlag ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IVAS_DEC_HRTF_CREND_HANDLE hMixconv, +#endif + uint8_t reconfigureFlag ) { ivas_error error; Word32 binauralDelayNs; @@ -2442,7 +2575,9 @@ static ivas_error initMcBinauralRendering( IF( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) { ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputMc->tdRendWrapper.hHrtfTD = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2453,7 +2588,9 @@ static ivas_error initMcBinauralRendering( IF( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; +#endif } } } @@ -2532,7 +2669,7 @@ static ivas_error initMcBinauralRendering( /* Open TD renderer wrappers */ FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { - IF( ( error = ivas_td_binaural_open_ext_fx( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) { return error; } @@ -2576,9 +2713,30 @@ static ivas_error initMcBinauralRendering( { /* open CREND */ #ifdef SPLIT_REND_WITH_HEAD_ROT - IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ), IVAS_ERR_OK ) ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, + hMixconv, + outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ), + IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, + NULL, + outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ), + IVAS_ERR_OK ) ) +#endif +#else +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, + hMixconv, + outSampleRate ) ), + IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( EQ_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, + NULL, + outSampleRate ) ), + IVAS_ERR_OK ) ) + +#endif #endif { return error; @@ -2635,7 +2793,9 @@ static ivas_error initMcMasaRendering( IF( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputMc->tdRendWrapper.hHrtfTD = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2726,7 +2886,12 @@ static ivas_error setRendInputActiveMc( void *input, const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) + RENDER_CONFIG_DATA *hRendCfg +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + , + hrtf_handles *hrtfs +#endif +) { #ifdef SPLIT_REND_WITH_HEAD_ROT Word16 i; @@ -2761,7 +2926,15 @@ static ivas_error setRendInputActiveMc( setZeroPanMatrix_fx( inputMc->panGains_fx ); inputMc->customLsInput = defaultCustomLs(); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( hrtfs->hHrtfTD ) + { + inputMc->tdRendWrapper.binaural_latency_ns = Mult_32_32( hrtfs->hHrtfTD->latency_s_fx, 1000000000 ); + } + inputMc->tdRendWrapper.hHrtfTD = &hrtfs->hHrtfTD; +#else inputMc->tdRendWrapper = defaultTdRendWrapper(); +#endif inputMc->crendWrapper = NULL; inputMc->hReverb = NULL; inputMc->hMcMasa = NULL; @@ -2784,7 +2957,15 @@ static ivas_error setRendInputActiveMc( #ifdef SPLIT_REND_WITH_HEAD_ROT FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( hrtfs->hHrtfTD ) + { + inputMc->splitTdRendWrappers[i].binaural_latency_ns = Mult_32_32( hrtfs->hHrtfTD->latency_s_fx, 1000000000 ); + } + inputMc->splitTdRendWrappers[i].hHrtfTD = &hrtfs->hHrtfTD; +#else inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper(); +#endif } IF( EQ_32( getAudioConfigType( outConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) ) @@ -2792,7 +2973,15 @@ static ivas_error setRendInputActiveMc( IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #endif { - IF( NE_32( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ), IVAS_ERR_OK ) ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, + hrtfs->hSetOfHRTF, + FALSE ) ), + IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ), + IVAS_ERR_OK ) ) +#endif { return error; } @@ -2844,17 +3033,26 @@ static void clearInputMc( IF( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputMc->tdRendWrapper.hBinRendererTd ); +#ifndef NONBE_FIX_BINARY_BINAURAL_READING inputMc->tdRendWrapper.hHrtfTD = NULL; +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING IF( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) { ivas_td_binaural_close_fx( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } +#else + IF( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + ivas_td_binaural_close_fx( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); + } +#endif } #endif @@ -2952,10 +3150,18 @@ static ivas_error initSbaPanGainsForSbaOut( return error; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +static ivas_error updateSbaPanGains( + input_sba *inputSba, + const AUDIO_CONFIG outConfig, + RENDER_CONFIG_DATA *hRendCfg, + IVAS_DEC_HRTF_CREND_HANDLE hMixconv ) +#else static ivas_error updateSbaPanGains( input_sba *inputSba, const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) +#endif { ivas_error error; AUDIO_CONFIG inConfig; @@ -3017,19 +3223,25 @@ static ivas_error updateSbaPanGains( else #endif { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING #ifdef SPLIT_REND_WITH_HEAD_ROT - IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) - { - return error; - } +#else + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + +#endif +#else +#ifdef SPLIT_REND_WITH_HEAD_ROT + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) #else IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#endif +#endif { return error; } -#endif } } BREAK; @@ -3039,17 +3251,22 @@ static ivas_error updateSbaPanGains( { return error; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +#ifdef SPLIT_REND_WITH_HEAD_ROT + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#endif +#else #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) - { - return error; - } #else IF( NE_32( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#endif +#endif { return error; } -#endif BREAK; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -3096,7 +3313,13 @@ static ivas_error setRendInputActiveSba( void *input, const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) + RENDER_CONFIG_DATA *hRendCfg +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + , + hrtf_handles *hrtfs +#endif + +) { ivas_error error; rendering_context rendCtx; @@ -3143,6 +3366,9 @@ static ivas_error setRendInputActiveSba( { initRotGains_fx( inputSba->rot_gains_prev_fx[pos_idx] ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + inputSba->cldfbRendWrapper.hHrtfFastConv = hrtfs->hHrtfFastConv; +#endif #else initRotGains_fx( inputSba->rot_gains_prev_fx ); #endif @@ -3155,8 +3381,11 @@ static ivas_error setRendInputActiveSba( return error; } } - +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg, hrtfs->hSetOfHRTF ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -3195,7 +3424,13 @@ static ivas_error setRendInputActiveMasa( void *input, const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, - RENDER_CONFIG_DATA *hRendCfg ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */ + RENDER_CONFIG_DATA *hRendCfg +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + , + hrtf_handles *hrtfs +#endif + + ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */ { ivas_error error; rendering_context rendCtx; @@ -3246,7 +3481,11 @@ static ivas_error setRendInputActiveMasa( } ELSE { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = initMasaExtRenderer( inputMasa, outConfig, hrtfs ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = initMasaExtRenderer( inputMasa, outConfig ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -3286,6 +3525,9 @@ ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const Word32 outputSampleRate, const AUDIO_CONFIG outConfig, +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + const bool asHrtfBinary, +#endif const Word16 nonDiegeticPan, const Word32 nonDiegeticPanGain, /* Q31 */ const Word16 num_subframes ) @@ -3437,6 +3679,31 @@ ivas_error IVAS_REND_Open( move16(); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hIvasRend->hHrtfs.hHrtfFastConv = NULL; + hIvasRend->hHrtfs.hHrtfParambin = NULL; + hIvasRend->hHrtfs.hHrtfTD = NULL; + hIvasRend->hHrtfs.hSetOfHRTF = NULL; + IF( asHrtfBinary ) + { + IF( NE_32( ( error = ivas_HRTF_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ) ), IVAS_ERR_OK ) ) + { + return error; + } + IF( NE_32( ( error = ivas_HRTF_CRend_binary_open_fx( &( hIvasRend->hHrtfs.hSetOfHRTF ) ) ), IVAS_ERR_OK ) ) + { + return error; + } + IF( NE_32( ( error = ivas_HRTF_fastconv_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfFastConv ) ) ), IVAS_ERR_OK ) ) + { + return error; + } + IF( NE_32( ( error = ivas_HRTF_parambin_binary_open_fx( &( hIvasRend->hHrtfs.hHrtfParambin ) ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif return IVAS_ERR_OK; } @@ -3583,7 +3850,11 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( /* Input inactive, skip. */ CONTINUE; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig, NULL ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -3964,7 +4235,11 @@ ivas_error IVAS_REND_AddInput_fx( Word32 maxNumInputsOfType; void *inputsArray; Word32 inputStructSize; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles *hrtfs ); +#else ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); +#endif Word32 inputIndex; /* Validate function arguments */ @@ -4034,8 +4309,11 @@ ivas_error IVAS_REND_AddInput_fx( *inputId = makeInputId( inConfig, inputIndex ); move16(); - +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = activateInput( (UWord8 *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -4101,7 +4379,15 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( IF( EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) #endif { - IF( NE_32( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ), IVAS_ERR_OK ) ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, + hIvasRend->hHrtfs.hSetOfHRTF, + FALSE ) ), + IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ), + IVAS_ERR_OK ) ) +#endif { return error; } @@ -4932,7 +5218,15 @@ ivas_error IVAS_REND_SetHeadRotation( { IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), IVAS_ERR_OK ) ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, + hIvasRend->hHrtfs.hSetOfHRTF, + TRUE ) ), + IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), + IVAS_ERR_OK ) ) +#endif { return error; } @@ -5036,7 +5330,16 @@ ivas_error IVAS_REND_DisableHeadRotation( { IF( NE_32( hIvasRend->inputsMc[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), IVAS_ERR_OK ) ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, + hIvasRend->hHrtfs.hSetOfHRTF, + TRUE ) ), + IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ), + IVAS_ERR_OK ) ) + +#endif { return error; @@ -5985,10 +6288,7 @@ static ivas_error renderIsmToBinauralRoom( IF( NE_32( ( error = ivas_rend_crendProcessSubframe( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, *ismInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else /* render 7_1_4 with BRIRs */ - IF( NE_32( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, *ismInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -6801,9 +7101,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, p_tmpRendBuffer_fx, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer_fx, p_tmpRendBuffer_fx, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -6946,9 +7244,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpRendBuffer, p_tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -7079,9 +7375,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, *mcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -7799,9 +8093,7 @@ static ivas_error renderSbaToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, output_fx, output_fx, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, output_fx, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, NULL, output_fx, output_fx, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -7930,10 +8222,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT IF( NE_32( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate, 0 ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ), - IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_crendProcessSubframe( sbaInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, p_tmpCrendBuffer, sbaInput->base.inputBuffer.config.numSamplesPerChannel, *sbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) #endif { return error; @@ -9203,11 +9492,20 @@ void IVAS_REND_Close( ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); #endif - closeHeadRotation( hIvasRend ); ivas_external_orientation_close_fx( &hIvasRend->hExternalOrientationData ); ivas_combined_orientation_close_fx( &hIvasRend->hCombinedOrientationData ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + /* Fastconv HRTF memories */ + ivas_binaural_hrtf_close( &hIvasRend->hHrtfs.hHrtfFastConv ); + + /* Parametric binauralizer HRTF filters */ + ivas_HRTF_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfTD ) ); + ivas_HRTF_CRend_binary_close_fx( &( hIvasRend->hHrtfs.hSetOfHRTF ) ); + ivas_HRTF_fastconv_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfFastConv ) ); + ivas_HRTF_parambin_binary_close_fx( &( hIvasRend->hHrtfs.hHrtfParambin ) ); +#endif free( hIvasRend ); *phIvasRend = NULL; @@ -9353,6 +9651,95 @@ void IVAS_REND_cldfbSynthesis_wrapper( #endif +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +/*---------------------------------------------------------------------* + * IVAS_REND_GetHrtfHandle( ) + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetHrtfHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ +) +{ + if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfTD == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + *hHrtfTD = &hIvasRend->hHrtfs.hHrtfTD; + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_GetHrtfCRendHandle( ) + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetHrtfCRendHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ +) +{ + if ( hIvasRend == NULL || hIvasRend->hHrtfs.hSetOfHRTF == NULL ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + *hSetOfHRTF = &hIvasRend->hHrtfs.hSetOfHRTF; + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_GetHrtfFastConvHandle( ) + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetHrtfFastConvHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ +) +{ + if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfFastConv == NULL ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + *hHrtfFastConv = &hIvasRend->hHrtfs.hHrtfFastConv; + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_GetHrtfParamBinHandle( ) + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetHrtfParamBinHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +) +{ + if ( hIvasRend == NULL || hIvasRend->hHrtfs.hHrtfParambin == NULL ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + *hHrtfParambin = &hIvasRend->hHrtfs.hHrtfParambin; + + return IVAS_ERR_OK; +} +#endif + static ivas_error ivas_masa_ext_rend_dirac_rend_init( input_masa *inputMasa ) { @@ -9806,8 +10193,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( error = IVAS_ERR_OK; move32(); +#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 ); move32(); @@ -9981,7 +10371,12 @@ static ivas_error ivas_masa_ext_rend_parambin_init( static ivas_error initMasaExtRenderer( input_masa *inputMasa, - const AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + , + hrtf_handles *hrtfs +#endif +) { Word16 i; ivas_error error; @@ -10011,7 +10406,11 @@ static ivas_error initMasaExtRenderer( hMasaExtRend->hDiracDecBin = NULL; #endif hMasaExtRend->hReverb = NULL; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + hMasaExtRend->hHrtfParambin = &hrtfs->hHrtfParambin; +#else hMasaExtRend->hHrtfParambin = NULL; +#endif hMasaExtRend->hVBAPdata = NULL; hMasaExtRend->hoa_dec_mtx = NULL; @@ -10110,7 +10509,11 @@ static ivas_error initMasaExtRenderer( { IF( NE_16( hMasaExtRend->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( inputMasa->hMasaExtRend->hHrtfParambin ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &inputMasa->hMasaExtRend->hHrtfParambin ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -10204,7 +10607,11 @@ static void freeMasaExtRenderer( IF( hMasaExtRend->hHrtfParambin != NULL ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + ivas_HRTF_parambin_binary_close_fx( hMasaExtRend->hHrtfParambin ); +#else ivas_HRTF_parambin_binary_close_fx( &hMasaExtRend->hHrtfParambin ); +#endif } IF( hMasaExtRend->hVBAPdata != NULL ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 54903bc5c0f0660e5729385353bd998c158f228d..eea8a954830f339a6a90679395c3245912af76bc 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -116,6 +116,9 @@ ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const Word32 outputSampleRate, /* i : output sampling rate */ const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + const bool asHrtfBinary, /* i : load hrtf binary file */ +#endif const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31 */ const Word16 num_subframes /* i : number of subframes */ @@ -184,6 +187,35 @@ ivas_error IVAS_REND_GetDelay_fx( Word16 *nSamples, /* o : Renderer delay in samples */ Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ ); +ivas_error IVAS_REND_GetDelay( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + int16_t *nSamples, /* o : Renderer delay in samples */ + int32_t *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ +); + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +/*! r: error code */ +ivas_error IVAS_REND_GetHrtfHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ +); + +/*! r: error code */ +ivas_error IVAS_REND_GetHrtfCRendHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ +); + +ivas_error IVAS_REND_GetHrtfFastConvHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ +); + +ivas_error IVAS_REND_GetHrtfParamBinHandle( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ +); +#endif /* Functions to be called during rendering */ diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index c2e3d8a2ae53745336dfedd66904388a85fd7355..8f7f60e59a26976f9da7b24b4e2a39c6d137e0ec 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -35,6 +35,9 @@ #include "prot_fx.h" #include "ivas_prot_rend_fx.h" #include "ivas_prot_fx.h" +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#include "ivas_rom_binaural_crend_head.h" +#endif /*---------------------------------------------------------------------* * Local structures @@ -189,6 +192,16 @@ static ivas_error check_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header ) { /* Check the renderer type */ + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) && + ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) && + ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) && + ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); + } +#else if ( ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV_ROOM ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) && @@ -196,7 +209,7 @@ static ivas_error check_hrtf_binary_header( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); } - +#endif /* Check the output format of the decoder */ if ( ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_FOA ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED ) ) @@ -225,7 +238,7 @@ static ivas_error read_hrtf_binary_header( FILE *f_hrtf ) { /* HRTF Header */ - /* Renderer type (4 bytes) : See "RENDERER_TYPE" */ + /* Renderer type (4 bytes) : See "HRTF_READER_RENDERER_TYPE" */ /* Input configuration (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG" */ /* Sampling Frequency (4 bytes) */ /* Raw data size (4 bytes) */ @@ -332,6 +345,7 @@ static void LoadBSplineBinaryITD( return; } + /*-------------------------------------------------------------------* * LoadBSplineBinary() * @@ -348,7 +362,10 @@ static ivas_error LoadBSplineBinary( float f_tmp_latency_s; + +#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES float f_tmp_lr_energy_and_iac_dyn[LR_IAC_LENGTH_NR_FC]; +#endif fread( &f_tmp_latency_s, sizeof( float ), 1, f_hrtf ); HrFiltSet_p->latency_s_fx = float_to_fix( f_tmp_latency_s, Q31 ); @@ -534,11 +551,16 @@ static ivas_error LoadBSplineBinary( LoadBSplineBinaryITD( &HrFiltSet_p->ModelParamsITD, f_hrtf ); } +#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES /* left/right energy and interaural coherence for late reverb */ FOR( i = 0; i < 3; i++ ) { fread( f_tmp_lr_energy_and_iac_dyn, sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( Word32 ) ); + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } IF( i == 2 ) { floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ @@ -549,11 +571,286 @@ static ivas_error LoadBSplineBinary( } HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; } +#endif + + return IVAS_ERR_OK; +} + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +/*-------------------------------------------------------------------* + * set_default_reverb_iac_energy() + * + * Loads reverb data from file. + --------------------------------------------------------------------*/ + +static ivas_error set_default_reverb_iac_energy( + IVAS_DEC_HRTF_HANDLE HrFiltSet_p /* i/o: HR filter model parameter structure */ +) +{ + int16_t i; +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + int16_t lr_iac_len; +#endif + + if ( HrFiltSet_p == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + lr_iac_len = LR_IAC_LENGTH_NR_FC; + if ( HrFiltSet_p->SampleRate == 16000 ) + { + lr_iac_len = LR_IAC_LENGTH_NR_FC_16KHZ; + } +#endif + + if ( HrFiltSet_p->ModelParams.modelROM == 0 ) + { + for ( i = 0; i < 3; i++ ) + { +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( lr_iac_len * sizeof( float ) ); +#else + HrFiltSet_p->lr_energy_and_iac_dyn[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) ); +#endif +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } +#endif + } + switch ( HrFiltSet_p->SampleRate ) + { + case 48000: + mvl2l( defaultHRIR_left_avg_power_48kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_right_avg_power_48kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_coherence_48kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], LR_IAC_LENGTH_NR_FC ); + break; + case 32000: + mvl2l( defaultHRIR_left_avg_power_32kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_right_avg_power_32kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_coherence_32kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], LR_IAC_LENGTH_NR_FC ); + break; + case 16000: +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + floatToFixed_arr32( defaultHRIR_coherence_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], Q27, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], Q23, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], Q23, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ +#else + mvl2l( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_right_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], LR_IAC_LENGTH_NR_FC ); + mvl2l( defaultHRIR_coherence_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], LR_IAC_LENGTH_NR_FC ); +#endif + break; + } + } + else + { + switch ( HrFiltSet_p->SampleRate ) + { + case 48000: + HrFiltSet_p->lr_energy_and_iac_fx[0] = defaultHRIR_left_avg_power_48kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[1] = defaultHRIR_right_avg_power_48kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_48kHz_fx; + break; + case 32000: + HrFiltSet_p->lr_energy_and_iac_fx[0] = defaultHRIR_left_avg_power_32kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[1] = defaultHRIR_right_avg_power_32kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_32kHz_fx; + break; + case 16000: +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + for ( i = 0; i < 3; i++ ) + { + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( lr_iac_len * sizeof( float ) ); + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } + } + floatToFixed_arr32( defaultHRIR_coherence_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[2], Q27, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[1], Q23, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + floatToFixed_arr32( defaultHRIR_left_avg_power_16kHz_fx, HrFiltSet_p->lr_energy_and_iac_dyn_fx[0], Q23, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + HrFiltSet_p->lr_energy_and_iac_fx[0] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[0]; + HrFiltSet_p->lr_energy_and_iac_fx[1] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[1]; + HrFiltSet_p->lr_energy_and_iac_fx[2] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[2]; +#else + HrFiltSet_p->lr_energy_and_iac_fx[0] = defaultHRIR_left_avg_power_16kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[1] = defaultHRIR_right_avg_power_16kHz_fx; + HrFiltSet_p->lr_energy_and_iac_fx[2] = defaultHRIR_coherence_16kHz_fx; +#endif + + + break; + } + } + + return IVAS_ERR_OK; +} + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + +/*-------------------------------------------------------------------* + * load_reverb_from_binary() + * + * Loads reverb data from file. + --------------------------------------------------------------------*/ + +static ivas_error load_reverb_from_binary( + IVAS_DEC_HRTF_HANDLE HrFiltSet_p, /* i/o: HR filter model parameter structure */ + FILE *f_hrtf /* i : HR filter data file handle */ +) +{ + int16_t i; + bool is_reverb; + ivas_error header_check_result; + ivas_hrtfs_file_header_t hrtfs_file_header; + int16_t hrtf_id; + ivas_hrtfs_header_t hrtf_header; + int32_t hrtf_data_size_max; + char *hrtf_data; +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + int16_t lr_iac_len; + float f_tmp_lr_energy_and_iac_dyn[LR_IAC_LENGTH_NR_FC]; + + if ( HrFiltSet_p == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + lr_iac_len = LR_IAC_LENGTH_NR_FC; + if ( HrFiltSet_p->SampleRate == 16000 ) + { + lr_iac_len = LR_IAC_LENGTH_NR_FC_16KHZ; + } +#endif + + header_check_result = IVAS_ERR_OK; + + if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) + { + return header_check_result; + } + + is_reverb = FALSE; + hrtf_data_size_max = hrtfs_file_header.max_data_size; + + /* Allocate the memory */ + + if ( hrtf_data_size_max == 0 ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (hrtf_data_size_max)" ); + } + + hrtf_data = (char *) malloc( hrtf_data_size_max ); + if ( hrtf_data == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } + + for ( hrtf_id = 0; ( hrtf_id < hrtfs_file_header.nb_hrtf ) && ( !is_reverb ); hrtf_id++ ) + { + if ( read_hrtf_binary_header( &hrtf_header, f_hrtf ) != IVAS_ERR_OK ) + { + free( hrtf_data ); + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "HRTF binary file not compliant (number of HRTF)" ); + } + + if ( ( header_check_result = check_hrtf_binary_header( &hrtf_header ) ) != IVAS_ERR_OK ) + { + free( hrtf_data ); + return header_check_result; + } + + is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); + if ( !is_reverb ) + { + if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) + { + free( hrtf_data ); + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); + } + } + } + + free( hrtf_data ); + + if ( is_reverb ) + { + /* left/right energy and interaural coherence for late reverb */ + FOR( i = 0; i < 3; i++ ) + { +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( lr_iac_len * sizeof( Word32 ) ); + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } + fread( f_tmp_lr_energy_and_iac_dyn, sizeof( const float ), lr_iac_len, f_hrtf ); + IF( i == 2 ) + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + } + ELSE + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, lr_iac_len ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + } + HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; +#else + HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] = (Word32 *) malloc( LR_IAC_LENGTH_NR_FC_16KHZ * sizeof( Word32 ) ); + if ( HrFiltSet_p->lr_energy_and_iac_dyn_fx[i] == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); + } + fread( f_tmp_lr_energy_and_iac_dyn, sizeof( const float ), LR_IAC_LENGTH_NR_FC_16KHZ, f_hrtf ); + IF( i == 2 ) + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q27, LR_IAC_LENGTH_NR_FC_16KHZ ); /* tables from which lr_energy_and_iac is updated has Q27 for i=2 */ + } + ELSE + { + floatToFixed_arr32( f_tmp_lr_energy_and_iac_dyn, HrFiltSet_p->lr_energy_and_iac_dyn_fx[i], Q23, LR_IAC_LENGTH_NR_FC_16KHZ ); /* tables from which lr_energy_and_iac is updated has Q23 for i=0,1 */ + } + HrFiltSet_p->lr_energy_and_iac_fx[i] = (const Word32 *) HrFiltSet_p->lr_energy_and_iac_dyn_fx[i]; +#endif + } + } + else + { + if ( ( header_check_result = set_default_reverb_iac_energy( HrFiltSet_p ) ) != IVAS_ERR_OK ) + { + return header_check_result; + } + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA; +#else + return IVAS_ERR_FAILED_FILE_READ; +#endif + } return IVAS_ERR_OK; } +#endif +/*---------------------------------------------------------------------* + * load_reverb_binary() + * + * Load HRTF binary data into the HRTF handle + *---------------------------------------------------------------------*/ +ivas_error load_reverb_binary( + IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ + const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ +) +{ + fseek( hrtfReader->file, 0, SEEK_SET ); + + return load_reverb_from_binary( hHrtf, hrtfReader->file ); +} +#endif /*-------------------------------------------------------------------* * TDREND_MIX_LoadHRTF() * @@ -566,7 +863,9 @@ static ivas_error TDREND_MIX_LoadHRTF( ) { int16_t tmp; +#ifndef NONBE_FIX_BINARY_BINAURAL_READING ivas_error error; +#endif bool is_tdrend; ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; @@ -575,12 +874,36 @@ static ivas_error TDREND_MIX_LoadHRTF( int32_t hrtf_data_size_max; char *hrtf_data; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + header_check_result = IVAS_ERR_OK; +#else error = IVAS_ERR_OK; - +#endif if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + + /* try if it is old format for BE tests*/ + fseek( f_hrtf, 0, SEEK_SET ); + if ( fread( &tmp, 1, sizeof( int16_t ), f_hrtf ) == 0 ) + { + header_check_result = IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); + } + + HrFiltSet_p->FilterMethod = (TDREND_HRFILT_Method_t) tmp; + + if ( HrFiltSet_p->FilterMethod != TDREND_HRFILT_Method_BSplineModel ) + { + header_check_result = IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "The HR filter set file is not a supported type." ); + } + else + { + header_check_result = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); + } + return header_check_result; +#endif } is_tdrend = FALSE; @@ -611,7 +934,11 @@ static ivas_error TDREND_MIX_LoadHRTF( return header_check_result; } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + is_tdrend = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD ); +#else is_tdrend = ( hrtf_header.rend_type == RENDERER_BINAURAL_OBJECTS_TD ); +#endif if ( !is_tdrend ) { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -634,19 +961,35 @@ static ivas_error TDREND_MIX_LoadHRTF( if ( HrFiltSet_p->FilterMethod != TDREND_HRFILT_Method_BSplineModel ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + header_check_result = IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "The HR filter set file is not a supported type." ); +#else error = IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "The HR filter set file is not a supported type." ); +#endif } else { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + header_check_result = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); +#else error = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); +#endif } } else { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA; +#else return IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "HR filter not found in binary file." ); +#endif } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return header_check_result; +#else return error; +#endif } @@ -737,7 +1080,88 @@ static void HRTF_energy_sections_precalc( return; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +/*---------------------------------------------------------------------* + * dealloc_HRTF_binary() + * + * Deallocated memory allocated by load_HRTF_binary + *---------------------------------------------------------------------*/ +void destroy_td_hrtf( + IVAS_DEC_HRTF_HANDLE *hHrtf /* i/o: HRTF handle */ +) +{ + int16_t i; + + if ( ( hHrtf == NULL ) || ( *hHrtf == NULL ) ) + { + return; + } + + if ( !( *hHrtf )->ModelParams.modelROM ) + { + if ( ( *hHrtf )->ModelParams.UseItdModel ) + { + free( ( *hHrtf )->ModelParamsITD.elevKSeq_dyn_fx ); + free( ( *hHrtf )->ModelParamsITD.azimKSeq_dyn_fx ); + free( ( *hHrtf )->ModelParamsITD.W_dyn_fx ); + free( ( *hHrtf )->ModelParamsITD.azimBsShape_dyn_fx ); + free( ( *hHrtf )->ModelParamsITD.elevBsShape_dyn_fx ); + } + free( ( *hHrtf )->ModelParams.elevKSeq_dyn_fx ); + free( ( *hHrtf )->ModelParams.azim_start_idx_dyn ); + free( ( *hHrtf )->ModelParams.azimDim2_dyn ); + free( ( *hHrtf )->ModelParams.azimDim3_dyn ); + free( ( *hHrtf )->ModelParams.AlphaL_dyn_fx ); + free( ( *hHrtf )->ModelParams.AlphaR_dyn_fx ); + free( ( *hHrtf )->ModelParams.azimSegSamples_dyn ); + + free( ( *hHrtf )->ModelParams.azimShapeIdx_dyn ); + free( ( *hHrtf )->ModelParams.azimShapeSampFactor_dyn ); + free( ( *hHrtf )->ModelParams.elevBsShape_dyn_fx ); + + for ( i = 0; i < ( *hHrtf )->ModelParams.num_unique_azim_splines; i++ ) + { + free( ( *hHrtf )->ModelParams.azimBsShape_dyn_fx[i] ); + } + free( ( *hHrtf )->ModelParams.azimBsShape_dyn_fx ); + + free( (void *) ( *hHrtf )->ModelParams.azimBsShape_fx ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ + for ( i = 0; i < ( *hHrtf )->ModelParams.elevDim3; i++ ) + { + free( ( *hHrtf )->ModelParams.azimKSeq_fx[i] ); + } + free( ( *hHrtf )->ModelParams.azimKSeq_fx ); + + free( ( *hHrtf )->ModelParams.EL_dyn_fx ); + free( ( *hHrtf )->ModelParams.ER_dyn_fx ); + + free( ( *hHrtf )->ModelEval.hrfModL_fx ); + free( ( *hHrtf )->ModelEval.hrfModR_fx ); + + for ( i = 0; i < 3; i++ ) + { + free( ( *hHrtf )->lr_energy_and_iac_dyn_fx[i] ); + } + } +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + else + { + for ( i = 0; i < 3; i++ ) + { + if ( ( *hHrtf )->lr_energy_and_iac_dyn_fx[i] ) + { + free( ( *hHrtf )->lr_energy_and_iac_dyn_fx[i] ); + } + } + } +#endif + + ivas_HRTF_binary_close_fx( hHrtf ); + + return; +} +#else /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * @@ -802,9 +1226,22 @@ ivas_error dealloc_HRTF_binary( free( hHrtf->lr_energy_and_iac_dyn_fx[i] ); } } +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB + else + { + for ( i = 0; i < 3; i++ ) + { + if ( ( *hHrtf )->lr_energy_and_iac_dyn_fx[i] ) + { + free( ( *hHrtf )->lr_energy_and_iac_dyn_fx[i] ); + } + } + } +#endif return error; } +#endif /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() @@ -829,7 +1266,11 @@ static ivas_error create_HRTF_from_rawdata( { if ( ( ( *hHRTF ) = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) { +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary data\n" ); +#else return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Can not allocate memory for HRTF binary data\n" ); +#endif } if ( ( error = ivas_hrtf_init( *hHRTF ) ) != IVAS_ERR_OK ) @@ -842,6 +1283,9 @@ static ivas_error create_HRTF_from_rawdata( return IVAS_ERR_INTERNAL; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + ( *hHRTF )->init_from_rom = 0; +#endif hrtf_data_rptr = hrtf_data; /* latency_s */ @@ -1070,10 +1514,14 @@ static ivas_error create_HRTF_from_rawdata( static ivas_error create_fastconv_HRTF_from_rawdata( - HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ - char *hrtf_data, /* i : pointer to binary file */ - RENDERER_TYPE rend_type, /* i : Renderer type */ - BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */ + HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ + char *hrtf_data, /* i : pointer to binary file */ +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + HRTF_READER_RENDERER_TYPE rend_type, /* i : Renderer type */ +#else + RENDERER_TYPE rend_type, /* i : Renderer type */ +#endif + BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */ ) { int16_t i, j; @@ -1082,24 +1530,63 @@ static ivas_error create_fastconv_HRTF_from_rawdata( float f_tmp_ntaps_max[BINAURAL_NTAPS_MAX]; float f_tmp_brir_reverb[CLDFB_NO_CHANNELS_MAX]; char *hrtf_data_rptr; +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + ivas_error error; +#endif + ( *hHRTF )->allocate_init_flag = 0; + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) + { + if ( ( error = ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) + { + if ( ( error = ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV_ROOM, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" ); + } +#else ivas_allocate_binaural_hrtf_fx( *hHRTF, 0, input_cfg, rend_type, ( *hHRTF )->allocate_init_flag ); +#endif hrtf_data_rptr = hrtf_data; +#if !defined NONBE_FIX_BINARY_BINAURAL_READING || !defined USE_NEW_HRTF_BINARY_FILE_FORMAT /* BINAURAL_CONVBANDS */ if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); +#endif - /* HRIR */ +/* HRIR */ +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) +#else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) +#endif { f_tmp = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); ( *hHRTF )->FASTCONV_HRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); +#if defined NONBE_FIX_BINARY_BINAURAL_READING && defined USE_NEW_HRTF_BINARY_FILE_FORMAT + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); +#endif if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { @@ -1150,13 +1637,25 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) +#else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) +#endif { /* HRIR_HOA3 */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_HOA3_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); +#if defined NONBE_FIX_BINARY_BINAURAL_READING && defined USE_NEW_HRTF_BINARY_FILE_FORMAT + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); +#endif + if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" ); @@ -1205,12 +1704,25 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) +#else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) +#endif { /* HRIR_HOA2 */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_HOA2_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); + +#if defined NONBE_FIX_BINARY_BINAURAL_READING && defined USE_NEW_HRTF_BINARY_FILE_FORMAT + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); +#endif + if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); @@ -1260,12 +1772,25 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) +#else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) +#endif { /* HRIR_FOA */ f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_FOA_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); + +#if defined NONBE_FIX_BINARY_BINAURAL_READING && defined USE_NEW_HRTF_BINARY_FILE_FORMAT + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); +#endif + if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" ); @@ -1315,13 +1840,25 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } - /* BRIR */ +/* BRIR */ +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) +#else else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) +#endif { f_tmp = *( (float *) ( hrtf_data_rptr ) ); ( *hHRTF )->FASTCONV_BRIR_latency_s_fx = (Word32) ( f_tmp * 1000000000 ); hrtf_data_rptr += sizeof( float ); +#if defined NONBE_FIX_BINARY_BINAURAL_READING && defined USE_NEW_HRTF_BINARY_FILE_FORMAT + if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); + } + hrtf_data_rptr += sizeof( uint16_t ); +#endif + if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); @@ -1378,6 +1915,17 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); + +#ifdef FIX_OLD_BINARY_FILE // old binary file is wrong + extern const Word32 fastconvReverberationTimes_fx[CLDFB_NO_CHANNELS_MAX]; + memcpy( f_tmp_brir_reverb, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); + + memcpy( f_tmp_brir_reverb, fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); + floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); +#else memcpy( f_tmp_brir_reverb, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationTimes_fx, Q31, CLDFB_NO_CHANNELS_MAX ); @@ -1385,6 +1933,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( memcpy( f_tmp_brir_reverb, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); floatToFixed_arrL( f_tmp_brir_reverb, ( *hHRTF )->fastconvReverberationEneCorrections_fx, Q31, CLDFB_NO_CHANNELS_MAX ); +#endif } return IVAS_ERR_OK; @@ -1408,6 +1957,9 @@ ivas_error load_fastconv_HRTF_from_binary( ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; int16_t hrtf_id; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + int16_t asFastconv = 0; +#endif f_hrtf = hrtfReader->file; @@ -1439,7 +1991,11 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" ); } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) ) +#else if ( ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) +#endif { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { @@ -1453,6 +2009,9 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + asFastconv = 1; +#endif } else { @@ -1461,7 +2020,18 @@ ivas_error load_fastconv_HRTF_from_binary( } free( hrtf_data ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( asFastconv ) + { + return IVAS_ERR_OK; + } + else + { + return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA; + } +#else return IVAS_ERR_OK; +#endif } @@ -1565,6 +2135,9 @@ ivas_error load_parambin_HRTF_from_binary( ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; int16_t hrtf_id; +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + int16_t asParam = 0; +#endif f_hrtf = hrtfReader->file; @@ -1599,7 +2172,12 @@ ivas_error load_parambin_HRTF_from_binary( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" ); } + +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ +#else if ( hrtf_header.rend_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ +#endif { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { @@ -1613,6 +2191,9 @@ ivas_error load_parambin_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" ); } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + asParam = 1; +#endif } else { @@ -1620,8 +2201,18 @@ ivas_error load_parambin_HRTF_from_binary( } } free( hrtf_data ); - +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + if ( asParam ) + { + return IVAS_ERR_OK; + } + else + { + return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA; + } +#else return IVAS_ERR_OK; +#endif } @@ -1681,7 +2272,11 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = NULL; if ( hrtf_header.frequency == output_Fs ) { +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) +#else if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV ) +#endif { if ( hrtf_header.input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { @@ -1700,7 +2295,11 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = &( ( *hSetOfHRTF ).hHRTF_hrir_foa ); } } +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES + else if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) +#else else if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) +#endif { if ( hrtf_header.input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { @@ -1725,13 +2324,15 @@ ivas_error create_SetOfHRTF_from_binary( } free( hrtf_data ); - if ( ( ( *hSetOfHRTF ).hHRTF_hrir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_brir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_hoa3 == NULL ) ) +#ifndef NONBE_FIX_BINARY_BINAURAL_READING + if ( ( ( *hSetOfHRTF ).hHRTF_hrir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_brir_combined == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_foa == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_hoa2 == NULL ) || ( ( *hSetOfHRTF ).hHRTF_hrir_hoa3 == NULL ) ) { if ( destroy_SetOfHRTF( hSetOfHRTF ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create all the HRTF from binary file" ); } } +#endif return IVAS_ERR_OK; } @@ -1741,43 +2342,54 @@ ivas_error create_SetOfHRTF_from_binary( * Destroy the HRTF CRend handle *---------------------------------------------------------------------*/ -static ivas_error destroy_HRTF( - HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */ -) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +static void destroy_HRTF +#else +static ivas_error destroy_HRTF +#endif + ( + HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */ + ) { uint16_t i, j; - if ( *hHRTF != NULL && hHRTF != NULL ) +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + test(); + test(); + IF( *hHRTF != NULL && hHRTF != NULL && ( *hHRTF )->init_from_rom == 0 ) +#else + IF( *hHRTF != NULL && hHRTF != NULL ) +#endif { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + FOR( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) + IF( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) { free( ( *hHRTF )->pIndex_frequency_max[i][j] ); } - if ( ( *hHRTF )->pOut_to_bin_re_fx[i][j] != NULL ) + IF( ( *hHRTF )->pOut_to_bin_re_fx[i][j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_re_fx[i][j] ); } - if ( ( *hHRTF )->pOut_to_bin_im_fx[i][j] != NULL ) + IF( ( *hHRTF )->pOut_to_bin_im_fx[i][j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_im_fx[i][j] ); } } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) + IF( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) { free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); } - if ( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] != NULL ) + IF( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_diffuse_re_fx[j] ); } - if ( ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j] != NULL ) + IF( ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j] != NULL ) { free( ( *hHRTF )->pOut_to_bin_diffuse_im_fx[j] ); } @@ -1787,14 +2399,73 @@ static ivas_error destroy_HRTF( *hHRTF = NULL; } +#ifdef NONBE_FIX_BINARY_BINAURAL_READING + return; +#else return IVAS_ERR_OK; +#endif } /*---------------------------------------------------------------------* * destroy_SetOfHRTF() * * Destroy the HRTF data set. *---------------------------------------------------------------------*/ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +void destroy_SetOfHRTF( + HRTFS_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */ +) +{ + test(); + IF( ( hSetOfHRTF != NULL ) && ( *hSetOfHRTF != NULL ) ) + { + destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_combined ) ); + destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa3 ) ); + destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_hoa2 ) ); + destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_hrir_foa ) ); + destroy_HRTF( &( ( *hSetOfHRTF )->hHRTF_brir_combined ) ); + } + + ivas_HRTF_CRend_binary_close_fx( hSetOfHRTF ); + + return; +} + + +/*---------------------------------------------------------------------* + * destroy_fastconv_hrtf() + * + * Destroy the HRTF data set. + *---------------------------------------------------------------------*/ + +void destroy_fastconv_hrtf( + IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* i/o: FastConv HRTF handle */ +) +{ + /* Fastconv HRTF memories */ + ivas_binaural_hrtf_close( hHrtfFastConv ); + + /* Fastconv HRTF filters */ + ivas_HRTF_fastconv_binary_close_fx( hHrtfFastConv ); + return; +} + + +/*---------------------------------------------------------------------* + * destroy_parambin_hrtf() + * + * Destroy the HRTF data set. + *---------------------------------------------------------------------*/ + +void destroy_parambin_hrtf( + IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* i/o: Parambin HRTF handle */ +) +{ + ivas_HRTF_parambin_binary_close_fx( hHrtfParambin ); + + return; +} +#else ivas_error destroy_SetOfHRTF( HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ) @@ -1810,3 +2481,4 @@ ivas_error destroy_SetOfHRTF( return IVAS_ERR_OK; } +#endif diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index 104cc5c7a8a93f778a0e3e78438a4660576e77c4..96bb09736f38b051dd5c346b2dd673ddaa4656b8 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -47,6 +47,21 @@ typedef struct ivas_hrtfs_header_t } ivas_hrtfs_header_t; +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +typedef enum +{ + HRTF_READER_RENDERER_BINAURAL_INVALID, + HRTF_READER_RENDERER_BINAURAL_FASTCONV, + HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM, + HRTF_READER_RENDERER_BINAURAL_PARAMETRIC, + HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM, + HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD, + HRTF_READER_RENDERER_BINAURAL_MIXER_CONV, + HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM, + HRTF_READER_RENDERER_BINAURAL_REVERB_ALL +} HRTF_READER_RENDERER_TYPE; +#endif + /*---------------------------------------------------------------------* * hrtfFileReader_open() * @@ -79,6 +94,19 @@ ivas_error load_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +/*---------------------------------------------------------------------* + * load_reverb_from_binary() + * + * Load reverb binary data into the HRTF handle + *---------------------------------------------------------------------*/ + +ivas_error load_reverb_binary( + IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ + const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ +); +#endif + /*---------------------------------------------------------------------* * create_SetOfHRTF_from_binary() * @@ -98,10 +126,16 @@ ivas_error create_SetOfHRTF_from_binary( * Destroy the HRTF data set. *---------------------------------------------------------------------*/ + +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +void destroy_SetOfHRTF( + IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */ +); +#else ivas_error destroy_SetOfHRTF( IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ); - +#endif /*---------------------------------------------------------------------* * load_fastconv_HRTF_from_binary() @@ -114,6 +148,17 @@ ivas_error load_fastconv_HRTF_from_binary( const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +/*---------------------------------------------------------------------* + * destroy_fastconv_hrtf() + * + * free memory allocated for FastConv HRTF binary data into the handle + *---------------------------------------------------------------------*/ + +void destroy_fastconv_hrtf( + IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* i/o: FastConv HRTF handle */ +); +#endif /*---------------------------------------------------------------------* * load_parambin_HRTF_from_binary() @@ -132,9 +177,30 @@ ivas_error load_parambin_HRTF_from_binary( * * Deallocated memory allocated by load_HRTF_binary *---------------------------------------------------------------------*/ +#ifdef NONBE_FIX_BINARY_BINAURAL_READING +/*---------------------------------------------------------------------* + * destroy_parambin_hrtf() + * + * free memory allocated for Parambin HRTF binary data into the handle + *---------------------------------------------------------------------*/ + +void destroy_parambin_hrtf( + IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* i/o: Parambin HRTF handle */ +); +/*---------------------------------------------------------------------* + * destroy_td_hrtf() + * + * Destroy the HRTF TD handle + *---------------------------------------------------------------------*/ + +void destroy_td_hrtf( + IVAS_DEC_HRTF_HANDLE *hHRTF /* i/o: HRTF handle */ +); + +#else ivas_error dealloc_HRTF_binary( IVAS_DEC_HRTF_HANDLE hHrtf /* i/o: HRTF handle */ ); - +#endif #endif /* IVAS_HRTF_FILE_READER_H */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 92c1a2fedaeeea30a34e56f5cdbd0d1444940224..a1f806d6bb7fa575b612dca73f8a2530b2e078b9 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -440,7 +440,11 @@ static ivas_error read_bin_bits( *pTarget = 0; for ( n = 0; n < nBits; n++ ) { +#ifdef FIX_WARNING_RENDER_CONFIG + nByte = (uint32_t) ( ( this->readOffset + n ) >> 3 ); +#else nByte = ( this->readOffset + n ) >> 3; +#endif bit = this->pBitstream[nByte] >> ( 7 - ( ( this->readOffset + n ) % 8 ) ) & 1; *pTarget = ( *pTarget << 1 ) + bit; }