Loading lib_dec/ivas_binRenderer_internal.c +2 −3 Original line number Diff line number Diff line Loading @@ -565,8 +565,7 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ const RENDERER_TYPE renderer_type /* i : renderer type */ , const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t allocate_init_flag /* i : Memory allocation flag */ ) { Loading lib_util/hrtf_file_reader.c +94 −6 Original line number Diff line number Diff line Loading @@ -1881,6 +1881,9 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #ifdef FIX_1123_FASTCONV_16BIT_FMT float scaleFactor; int16_t *ptW16; float latency_s; uint16_t ntaps; uint16_t nbchan; #else int32_t *ptW32; #endif Loading @@ -1892,6 +1895,85 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ( *hHRTF )->allocate_init_flag = 0; #ifdef FIX_1123_FASTCONV_16BIT_FMT hrtf_data_rptr = hrtf_data; /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); /* latency_s */ latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ ); hrtf_data_rptr += sizeof( Word32 ); 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 ); nbchan = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); ntaps = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { if ( HRTF_LS_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir = ntaps; ( *hHRTF )->FASTCONV_HRIR_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { if ( HOA3_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_hoa3 = ntaps; ( *hHRTF )->FASTCONV_HOA3_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( HOA2_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_hoa2 = ntaps; ( *hHRTF )->FASTCONV_HOA2_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { if ( FOA_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_foa = ntaps; ( *hHRTF )->FASTCONV_FOA_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { if ( HRTF_LS_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); } ( *hHRTF )->ntaps_brir = ntaps; ( *hHRTF )->FASTCONV_BRIR_latency_s = latency_s; } else { return IVAS_ERROR( IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, "Can not read hrtf binary file : wrong render type and input config couple " ); } #else if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } #endif if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) { if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) Loading @@ -1910,11 +1992,13 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" ); } #ifndef FIX_1123_FASTCONV_16BIT_FMT hrtf_data_rptr = hrtf_data; #endif /* HRIR */ if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -1944,7 +2028,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2056,6 +2140,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2085,6 +2170,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ Loading Loading @@ -2197,6 +2283,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading @@ -2216,7 +2303,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); } hrtf_data_rptr += sizeof( uint16_t ); #ifdef FIX_1123_FASTCONV_16BIT_FMT ( *hHRTF )->ntaps_hrir_hoa2 = *( (uint16_t *) ( hrtf_data_rptr ) ); #else Loading @@ -2226,7 +2312,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2338,6 +2424,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2368,7 +2455,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2481,6 +2568,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( /* BRIR */ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2510,7 +2598,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* BRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading
lib_dec/ivas_binRenderer_internal.c +2 −3 Original line number Diff line number Diff line Loading @@ -565,8 +565,7 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ const RENDERER_TYPE renderer_type /* i : renderer type */ , const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t allocate_init_flag /* i : Memory allocation flag */ ) { Loading
lib_util/hrtf_file_reader.c +94 −6 Original line number Diff line number Diff line Loading @@ -1881,6 +1881,9 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #ifdef FIX_1123_FASTCONV_16BIT_FMT float scaleFactor; int16_t *ptW16; float latency_s; uint16_t ntaps; uint16_t nbchan; #else int32_t *ptW32; #endif Loading @@ -1892,6 +1895,85 @@ static ivas_error create_fastconv_HRTF_from_rawdata( ( *hHRTF )->allocate_init_flag = 0; #ifdef FIX_1123_FASTCONV_16BIT_FMT hrtf_data_rptr = hrtf_data; /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); /* latency_s */ latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ ); hrtf_data_rptr += sizeof( Word32 ); 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 ); nbchan = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); ntaps = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { if ( HRTF_LS_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir = ntaps; ( *hHRTF )->FASTCONV_HRIR_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { if ( HOA3_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_hoa3 = ntaps; ( *hHRTF )->FASTCONV_HOA3_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( HOA2_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_hoa2 = ntaps; ( *hHRTF )->FASTCONV_HOA2_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { if ( FOA_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" ); } ( *hHRTF )->ntaps_hrir_foa = ntaps; ( *hHRTF )->FASTCONV_FOA_latency_s = latency_s; } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { if ( HRTF_LS_CHANNELS != nbchan ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" ); } ( *hHRTF )->ntaps_brir = ntaps; ( *hHRTF )->FASTCONV_BRIR_latency_s = latency_s; } else { return IVAS_ERROR( IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, "Can not read hrtf binary file : wrong render type and input config couple " ); } #else if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" ); } #endif if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) { if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) Loading @@ -1910,11 +1992,13 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" ); } #ifndef FIX_1123_FASTCONV_16BIT_FMT hrtf_data_rptr = hrtf_data; #endif /* HRIR */ if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -1944,7 +2028,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2056,6 +2140,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2085,6 +2170,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ Loading Loading @@ -2197,6 +2283,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading @@ -2216,7 +2303,6 @@ static ivas_error create_fastconv_HRTF_from_rawdata( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" ); } hrtf_data_rptr += sizeof( uint16_t ); #ifdef FIX_1123_FASTCONV_16BIT_FMT ( *hHRTF )->ntaps_hrir_hoa2 = *( (uint16_t *) ( hrtf_data_rptr ) ); #else Loading @@ -2226,7 +2312,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2338,6 +2424,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2368,7 +2455,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* HRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading Loading @@ -2481,6 +2568,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( /* BRIR */ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { #ifndef FIX_1123_FASTCONV_16BIT_FMT /* latency_s Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( Word16 ); Loading Loading @@ -2510,7 +2598,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } #endif hrtf_data_rptr += sizeof( uint16_t ); #endif /* BRIR Q factor*/ factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); Loading