Loading apps/decoder.c +9 −27 Original line number Diff line number Diff line Loading @@ -189,18 +189,12 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_HRTF_LOAD static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif #ifdef FIX_HRTF_LOAD_JBM static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const int32_t output_Fs ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #endif #ifdef FIX_HRTF_LOAD static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const int32_t output_Fs ); #endif #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static int16_t app_own_random( int16_t *seed ); Loading Loading @@ -777,18 +771,6 @@ int main( hHrtfBinary.binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_NONE; hHrtfBinary.room_reverb_flag = 0; hHrtfBinary.intern_audio_config = IVAS_AUDIO_CONFIG_INVALID; #ifndef FIX_HRTF_LOAD_JBM if ( arg.voipMode ) { hHrtf.binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; hHrtf.binaural_renderer_old = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; if ( ( error = IVAS_DEC_LoadHrtfFromFile( &hHrtfBinary, hIvasDec, arg.output_Fs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_LoadHrtfFromFile failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif #else if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK ) { Loading Loading @@ -908,7 +890,7 @@ int main( if ( arg.voipMode ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); #else error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); Loading Loading @@ -2542,7 +2524,7 @@ static ivas_error decodeG192( #endif /* Feed into decoder */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API , isSplitRend, Loading Loading @@ -3149,7 +3131,7 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, #endif RotFileReader *headRotReader, Loading Loading @@ -3202,7 +3184,7 @@ static ivas_error decodeVoIP( int16_t vec_pos_update, vec_pos_len; int16_t nOutSamples = 0; #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD bool bitstreamReadDone = false; #endif Loading Loading @@ -3499,7 +3481,7 @@ static ivas_error decodeVoIP( #ifdef SUPPORT_JBM_TRACEFILE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #endif Loading @@ -3510,7 +3492,7 @@ static ivas_error decodeVoIP( ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #endif Loading @@ -3524,7 +3506,7 @@ static ivas_error decodeVoIP( fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( bitstreamReadDone == true ) { Loading lib_com/ivas_prot.h +6 −6 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ ivas_error ivas_dec_get_format( #endif ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -670,7 +670,7 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -1090,7 +1090,7 @@ ivas_error ivas_ism_enc_config( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -3487,7 +3487,7 @@ void ivas_sba_set_cna_cng_flag( ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesFlushed, /* o : number of samples flushed */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -4948,7 +4948,7 @@ void ivas_masa_enc_reconfigure( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -5656,7 +5656,7 @@ ivas_error ivas_omasa_enc_config( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ #define FIX_VOIP_FUNCTIONS /* VA: fix data type mismatch in IVAS_DEC_VoIP_SetScale() + add sanity checks to API functions */ #define FIX_HRTF_LOAD /* VA: issue 1187: fix memory issue when HRTFs are loaded from a binary file */ #define FIX_HRTF_LOAD_JBM /* #################### End BE switches ################################## */ Loading lib_dec/ivas_init_dec.c +11 −20 Original line number Diff line number Diff line Loading @@ -143,9 +143,6 @@ ivas_error ivas_dec_get_format( else if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ #ifndef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = 1; #endif nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) Loading @@ -156,13 +153,12 @@ ivas_error ivas_dec_get_format( st_ivas->nchan_ism = nchan_ism; st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate ); #ifdef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = nchan_ism; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } #endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { Loading Loading @@ -331,9 +327,6 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ #ifndef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = 1; #endif nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) Loading @@ -354,13 +347,11 @@ ivas_error ivas_dec_get_format( st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); } #ifdef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = nchan_ism; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } #endif } } Loading @@ -379,7 +370,7 @@ ivas_error ivas_dec_get_format( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -438,7 +429,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -460,7 +451,7 @@ ivas_error ivas_dec_setup( num_bits_read += SBA_ORDER_BITS; if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -526,7 +517,7 @@ ivas_error ivas_dec_setup( } else { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -538,7 +529,7 @@ ivas_error ivas_dec_setup( } else { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -563,7 +554,7 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -598,7 +589,7 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -648,7 +639,7 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_mc_dec_config( st_ivas, idx ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -737,7 +728,7 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -787,7 +778,7 @@ ivas_error ivas_dec_setup( last_ism_mode = st_ivas->ism_mode; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading lib_dec/ivas_ism_dec.c +45 −42 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode /* i : last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples rendered */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading @@ -67,13 +67,13 @@ static ivas_error ivas_ism_bitrate_switching_dec( int16_t tc_nchan_allocate_new; int16_t tc_granularity_new; int16_t nchan_out_buff, nchan_out_buff_old; #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; #endif #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD error = IVAS_ERR_OK; #endif nCPE_old = st_ivas->nCPE; Loading Loading @@ -111,7 +111,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; Loading Loading @@ -151,7 +151,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -324,17 +324,19 @@ static ivas_error ivas_ism_bitrate_switching_dec( * floating-point output audio buffers *-----------------------------------------------------------------*/ { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } } /*-----------------------------------------------------------------* * JBM TC buffers *-----------------------------------------------------------------*/ { int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; Loading Loading @@ -370,8 +372,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; #else return error; Loading @@ -389,7 +392,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading @@ -401,7 +404,7 @@ ivas_error ivas_ism_dec_config( ivas_error error; int16_t nchan_transport_old; #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD error = IVAS_ERR_OK; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; Loading Loading @@ -434,7 +437,7 @@ ivas_error ivas_ism_dec_config( /* ISM bit-rate switching */ if ( ( st_ivas->ism_mode != last_ism_mode ) || ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -460,7 +463,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -490,7 +493,7 @@ ivas_error ivas_ism_dec_config( break; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; #else return error; Loading Loading
apps/decoder.c +9 −27 Original line number Diff line number Diff line Loading @@ -189,18 +189,12 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_HRTF_LOAD static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif #ifdef FIX_HRTF_LOAD_JBM static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const int32_t output_Fs ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #endif #ifdef FIX_HRTF_LOAD static ivas_error IVAS_DEC_LoadHrtfFromFile( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const int32_t output_Fs ); #endif #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static int16_t app_own_random( int16_t *seed ); Loading Loading @@ -777,18 +771,6 @@ int main( hHrtfBinary.binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_NONE; hHrtfBinary.room_reverb_flag = 0; hHrtfBinary.intern_audio_config = IVAS_AUDIO_CONFIG_INVALID; #ifndef FIX_HRTF_LOAD_JBM if ( arg.voipMode ) { hHrtf.binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; hHrtf.binaural_renderer_old = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT; if ( ( error = IVAS_DEC_LoadHrtfFromFile( &hHrtfBinary, hIvasDec, arg.output_Fs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_LoadHrtfFromFile failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif #else if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK ) { Loading Loading @@ -908,7 +890,7 @@ int main( if ( arg.voipMode ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); #else error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); Loading Loading @@ -2542,7 +2524,7 @@ static ivas_error decodeG192( #endif /* Feed into decoder */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API , isSplitRend, Loading Loading @@ -3149,7 +3131,7 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, #endif RotFileReader *headRotReader, Loading Loading @@ -3202,7 +3184,7 @@ static ivas_error decodeVoIP( int16_t vec_pos_update, vec_pos_len; int16_t nOutSamples = 0; #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD bool bitstreamReadDone = false; #endif Loading Loading @@ -3499,7 +3481,7 @@ static ivas_error decodeVoIP( #ifdef SUPPORT_JBM_TRACEFILE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #endif Loading @@ -3510,7 +3492,7 @@ static ivas_error decodeVoIP( ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #endif Loading @@ -3524,7 +3506,7 @@ static ivas_error decodeVoIP( fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( bitstreamReadDone == true ) { Loading
lib_com/ivas_prot.h +6 −6 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ ivas_error ivas_dec_get_format( #endif ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -670,7 +670,7 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -1090,7 +1090,7 @@ ivas_error ivas_ism_enc_config( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -3487,7 +3487,7 @@ void ivas_sba_set_cna_cng_flag( ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesFlushed, /* o : number of samples flushed */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -4948,7 +4948,7 @@ void ivas_masa_enc_reconfigure( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -5656,7 +5656,7 @@ ivas_error ivas_omasa_enc_config( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ #define FIX_VOIP_FUNCTIONS /* VA: fix data type mismatch in IVAS_DEC_VoIP_SetScale() + add sanity checks to API functions */ #define FIX_HRTF_LOAD /* VA: issue 1187: fix memory issue when HRTFs are loaded from a binary file */ #define FIX_HRTF_LOAD_JBM /* #################### End BE switches ################################## */ Loading
lib_dec/ivas_init_dec.c +11 −20 Original line number Diff line number Diff line Loading @@ -143,9 +143,6 @@ ivas_error ivas_dec_get_format( else if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ #ifndef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = 1; #endif nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) Loading @@ -156,13 +153,12 @@ ivas_error ivas_dec_get_format( st_ivas->nchan_ism = nchan_ism; st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate ); #ifdef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = nchan_ism; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } #endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { Loading Loading @@ -331,9 +327,6 @@ ivas_error ivas_dec_get_format( if ( st_ivas->ivas_format == ISM_FORMAT ) { /* read the number of objects */ #ifndef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = 1; #endif nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) Loading @@ -354,13 +347,11 @@ ivas_error ivas_dec_get_format( st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); } #ifdef FIX_HRTF_LOAD_JBM st_ivas->nchan_transport = nchan_ism; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } #endif } } Loading @@ -379,7 +370,7 @@ ivas_error ivas_dec_get_format( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading Loading @@ -438,7 +429,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -460,7 +451,7 @@ ivas_error ivas_dec_setup( num_bits_read += SBA_ORDER_BITS; if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -526,7 +517,7 @@ ivas_error ivas_dec_setup( } else { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_masa_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -538,7 +529,7 @@ ivas_error ivas_dec_setup( } else { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -563,7 +554,7 @@ ivas_error ivas_dec_setup( /* reconfigure in case a change of operation mode is detected */ if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -598,7 +589,7 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -648,7 +639,7 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_mc_dec_config( st_ivas, idx ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -737,7 +728,7 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_sba_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -787,7 +778,7 @@ ivas_error ivas_dec_setup( last_ism_mode = st_ivas->ism_mode; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading
lib_dec/ivas_ism_dec.c +45 −42 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode /* i : last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples rendered */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading @@ -67,13 +67,13 @@ static ivas_error ivas_ism_bitrate_switching_dec( int16_t tc_nchan_allocate_new; int16_t tc_granularity_new; int16_t nchan_out_buff, nchan_out_buff_old; #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; #endif #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD error = IVAS_ERR_OK; #endif nCPE_old = st_ivas->nCPE; Loading Loading @@ -111,7 +111,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; Loading Loading @@ -151,7 +151,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -324,17 +324,19 @@ static ivas_error ivas_ism_bitrate_switching_dec( * floating-point output audio buffers *-----------------------------------------------------------------*/ { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } } /*-----------------------------------------------------------------* * JBM TC buffers *-----------------------------------------------------------------*/ { int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; Loading Loading @@ -370,8 +372,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; #else return error; Loading @@ -389,7 +392,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD , uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ Loading @@ -401,7 +404,7 @@ ivas_error ivas_ism_dec_config( ivas_error error; int16_t nchan_transport_old; #ifndef FIX_HRTF_LOAD_JBM #ifndef FIX_HRTF_LOAD error = IVAS_ERR_OK; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; Loading Loading @@ -434,7 +437,7 @@ ivas_error ivas_ism_dec_config( /* ISM bit-rate switching */ if ( ( st_ivas->ism_mode != last_ism_mode ) || ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading @@ -460,7 +463,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) Loading Loading @@ -490,7 +493,7 @@ ivas_error ivas_ism_dec_config( break; } #ifdef FIX_HRTF_LOAD_JBM #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; #else return error; Loading