Loading apps/decoder.c +93 −77 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include "lib_dec.h" #include <string.h> #include <assert.h> #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" Loading Loading @@ -97,7 +96,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; AUDIO_CONFIG outputFormat; AUDIO_CONFIG outputConfig; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; Loading @@ -113,12 +112,10 @@ typedef struct char *jbmTraceFilename; #endif char *jbmOffsetFilename; char *FEPatterFileName; char *FEPatternFileName; float FER; bool hrtfReaderEnabled; char *hrtfFileName; bool hrtfCRendReaderEnabled; char *hrtfCRendFileName; IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; Loading @@ -139,6 +136,7 @@ typedef struct #endif #ifdef DEBUG_JBM_CMD_OPTION bool noBadFrameDelay; uint16_t frontendFetchSizeMs; #endif #ifdef VARIABLE_SPEED_DECODING bool variableSpeedMode; Loading @@ -146,11 +144,7 @@ typedef struct char *tsmScaleFileName; uint16_t tsmScale; #endif #ifdef DEBUG_JBM_CMD_OPTION uint16_t frontendFetchSizeMs; #endif #endif #ifdef CONTROL_METADATA_REVERB uint16_t acousticEnvironmentId; #ifdef CONTROL_METADATA_DIRECTIVITY Loading @@ -166,6 +160,7 @@ typedef struct *------------------------------------------------------------------------------------------*/ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, Loading @@ -174,6 +169,7 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotF #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING Loading Loading @@ -282,7 +278,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); Loading @@ -304,9 +300,9 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { Loading @@ -328,7 +324,7 @@ int main( if ( arg.enableReferenceRotation ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); goto cleanup; Loading @@ -355,7 +351,7 @@ int main( if ( arg.enableReferenceVectorTracking ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); goto cleanup; Loading Loading @@ -408,9 +404,9 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { Loading @@ -430,12 +426,13 @@ int main( *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { arg.enableHeadRotation = true; } #endif if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -540,9 +537,9 @@ int main( * Open Error pattern file for simulation *-----------------------------------------------------------------*/ if ( arg.FEPatterFileName != NULL ) if ( arg.FEPatternFileName != NULL ) { if ( ( FEC_pattern = fopen( arg.FEPatterFileName, "rb" ) ) == NULL ) if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL ) { fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" ); usage_dec(); Loading @@ -558,20 +555,20 @@ int main( * Print information about FEC *-----------------------------------------------------------------*/ if ( !arg.voipMode && ( arg.FEPatterFileName != NULL || arg.FER > 0 ) ) if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) ) { if ( arg.FEPatterFileName != NULL ) if ( arg.FEPatternFileName != NULL ) { fprintf( stdout, "FEC: %s\n", arg.FEPatterFileName ); fprintf( stdout, "FEC: %s\n", arg.FEPatternFileName ); } else { fprintf( stdout, "FEC: %.2f %%\n", arg.FER ); } } #else /* DEBUGGING */ #else IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ); #endif /* DEBUGGING */ #endif /*-------------------------------------------------------------------* * Load renderer configuration from file Loading @@ -583,12 +580,11 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); goto cleanup; } #else if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) Loading Loading @@ -623,7 +619,7 @@ int main( #endif #ifdef CONTROL_METADATA_REVERB if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) { Loading Loading @@ -679,7 +675,11 @@ int main( { IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); 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; } if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) { Loading @@ -687,29 +687,42 @@ int main( goto cleanup; } IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL; IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName ); goto cleanup; } IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); goto cleanup; } IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); goto cleanup; } } Loading @@ -726,16 +739,12 @@ int main( #ifdef VARIABLE_SPEED_DECODING else if ( arg.variableSpeedMode ) { error = decodeVariableSpeed( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); error = decodeVariableSpeed( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); } #endif else { error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, #ifdef SPLIT_REND_WITH_HEAD_ROT splitRendBitsBuf, #endif Loading Loading @@ -941,7 +950,7 @@ static bool parseCmdlIVAS_dec( #endif #endif arg->output_Fs = 48000; arg->outputFormat = AUDIO_CONFIG_MONO; arg->outputConfig = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; Loading @@ -964,14 +973,11 @@ static bool parseCmdlIVAS_dec( arg->jbmOffsetFilename = NULL; arg->FER = 0.f; arg->FEPatterFileName = NULL; arg->FEPatternFileName = NULL; arg->hrtfReaderEnabled = false; arg->hrtfFileName = NULL; arg->hrtfCRendReaderEnabled = false; arg->hrtfCRendFileName = NULL; arg->customLsOutputEnabled = false; arg->customLsSetupFilename = NULL; Loading Loading @@ -1104,7 +1110,7 @@ static bool parseCmdlIVAS_dec( ftmp = 0.0f; if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) { arg->FEPatterFileName = argv[i + 1]; arg->FEPatternFileName = argv[i + 1]; } else { Loading Loading @@ -1411,14 +1417,14 @@ static bool parseCmdlIVAS_dec( if ( i < argc - 3 ) { arg->outputFormat = cmdline2config( argv[i] ); if ( arg->outputFormat == AUDIO_CONFIG_LS_CUSTOM ) arg->outputConfig = cmdline2config( argv[i] ); if ( arg->outputConfig == AUDIO_CONFIG_LS_CUSTOM ) { arg->customLsOutputEnabled = true; arg->customLsSetupFilename = argv[i]; } i++; if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != AUDIO_CONFIG_STEREO ) ) if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != AUDIO_CONFIG_STEREO ) ) { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); Loading @@ -1427,11 +1433,11 @@ static bool parseCmdlIVAS_dec( } else { arg->outputFormat = AUDIO_CONFIG_MONO; arg->outputConfig = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_EVS; if ( ( arg->Opt_non_diegetic_pan ) ) { arg->outputFormat = AUDIO_CONFIG_STEREO; arg->outputConfig = AUDIO_CONFIG_STEREO; } } Loading Loading @@ -1635,8 +1641,8 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) if ( ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { pFullDelayNumSamples[0] = 0; } Loading @@ -1663,32 +1669,42 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); return error; } *ppAfWriter = NULL; } else { if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); assert( arg.outputMdFilename != NULL ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); return error; } } #endif Loading Loading @@ -1746,7 +1762,7 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, pBsFormat ) ) != IVAS_ERR_OK ) { Loading Loading @@ -2132,7 +2148,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) Loading @@ -2143,7 +2159,7 @@ static ivas_error decodeG192( } else { if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) Loading Loading @@ -2172,7 +2188,7 @@ static ivas_error decodeG192( } /* Write MASA/ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM Loading Loading @@ -2285,7 +2301,7 @@ static ivas_error decodeG192( } /* Print output metadata file name(s) */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { Loading Loading @@ -2770,7 +2786,7 @@ static ivas_error decodeVoIP( } /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { int16_t i; Loading Loading @@ -3217,7 +3233,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) Loading Loading @@ -3405,7 +3421,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) Loading Loading @@ -3491,7 +3507,7 @@ static ivas_error decodeVariableSpeed( } /* Print output metadata file name(s) */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { Loading apps/renderer.c +8 −3 Original line number Diff line number Diff line Loading @@ -3691,8 +3691,10 @@ static void convertInputBuffer( { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; numFloatPcmSamples = numFloatSamplesPerChannel >> 1; numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Analysis*/ assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ); for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) Loading @@ -3711,6 +3713,7 @@ static void convertInputBuffer( ++i; } } for ( chnl = 0; chnl < numChannels; ++chnl ) { for ( slotIdx = 0; slotIdx < IVAS_CLDFB_NO_COL_MAX; slotIdx++ ) Loading Loading @@ -3779,8 +3782,10 @@ static void convertOutputBuffer( float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; float re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; float im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; numPcmSamples = numSamplesPerChannel >> 1; numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Synthesis*/ for ( chnl = 0; chnl < numChannels; ++chnl ) { Loading lib_com/ivas_cov_smooth.c +25 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,12 @@ #include "wmc_auto.h" #include "prot.h" /*-----------------------------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------------------------*/ #define BAND_SMOOTH_REST_START_IDX ( 2 ) #ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() Loading Loading @@ -147,24 +152,36 @@ static void ivas_set_up_cov_smoothing( * To calculate the update factor *-----------------------------------------------------------------------------------------*/ static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) { float update_factor_temp = 0.0f; int16_t k; for ( k = 0; k < active_bins; k++ ) { update_factor_temp += p_bin_to_band[k]; } return update_factor_temp; } /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_smoothning_factor() * * To calculate the Smoothning factor *-----------------------------------------------------------------------------------------*/ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) { float smooth_fact; *Smoothing_factor = update_factor / min_pool_size; Loading @@ -180,12 +197,16 @@ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float upd } *Smoothing_factor *= ( j + 1 ) * smooth_fact; } if ( *Smoothing_factor > max_update_rate ) { *Smoothing_factor = max_update_rate; } return; } /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * Loading Loading @@ -223,6 +244,8 @@ static void ivas_set_up_cov_smoothing( } hCovState->prior_bank_idx = -1; return; } #endif Loading lib_com/ivas_fb_mixer.c +2 −2 Original line number Diff line number Diff line Loading @@ -612,8 +612,8 @@ static if ( hFbMixer->first_frame[ch] == 0 ) { fade_start_offset = (int16_t) hFbMixer->cross_fade_start_offset; fade_end_offset = (int16_t) hFbMixer->cross_fade_end_offset; fade_start_offset = hFbMixer->cross_fade_start_offset; fade_end_offset = hFbMixer->cross_fade_end_offset; for ( k = 0; k < fade_start_offset; k++ ) { Loading lib_com/ivas_prot.h +74 −85 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
apps/decoder.c +93 −77 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include "lib_dec.h" #include <string.h> #include <assert.h> #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" Loading Loading @@ -97,7 +96,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; AUDIO_CONFIG outputFormat; AUDIO_CONFIG outputConfig; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; Loading @@ -113,12 +112,10 @@ typedef struct char *jbmTraceFilename; #endif char *jbmOffsetFilename; char *FEPatterFileName; char *FEPatternFileName; float FER; bool hrtfReaderEnabled; char *hrtfFileName; bool hrtfCRendReaderEnabled; char *hrtfCRendFileName; IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; Loading @@ -139,6 +136,7 @@ typedef struct #endif #ifdef DEBUG_JBM_CMD_OPTION bool noBadFrameDelay; uint16_t frontendFetchSizeMs; #endif #ifdef VARIABLE_SPEED_DECODING bool variableSpeedMode; Loading @@ -146,11 +144,7 @@ typedef struct char *tsmScaleFileName; uint16_t tsmScale; #endif #ifdef DEBUG_JBM_CMD_OPTION uint16_t frontendFetchSizeMs; #endif #endif #ifdef CONTROL_METADATA_REVERB uint16_t acousticEnvironmentId; #ifdef CONTROL_METADATA_DIRECTIVITY Loading @@ -166,6 +160,7 @@ typedef struct *------------------------------------------------------------------------------------------*/ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, Loading @@ -174,6 +169,7 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotF #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING Loading Loading @@ -282,7 +278,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); Loading @@ -304,9 +300,9 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { Loading @@ -328,7 +324,7 @@ int main( if ( arg.enableReferenceRotation ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); goto cleanup; Loading @@ -355,7 +351,7 @@ int main( if ( arg.enableReferenceVectorTracking ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); goto cleanup; Loading Loading @@ -408,9 +404,9 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { Loading @@ -430,12 +426,13 @@ int main( *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { arg.enableHeadRotation = true; } #endif if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -540,9 +537,9 @@ int main( * Open Error pattern file for simulation *-----------------------------------------------------------------*/ if ( arg.FEPatterFileName != NULL ) if ( arg.FEPatternFileName != NULL ) { if ( ( FEC_pattern = fopen( arg.FEPatterFileName, "rb" ) ) == NULL ) if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL ) { fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" ); usage_dec(); Loading @@ -558,20 +555,20 @@ int main( * Print information about FEC *-----------------------------------------------------------------*/ if ( !arg.voipMode && ( arg.FEPatterFileName != NULL || arg.FER > 0 ) ) if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) ) { if ( arg.FEPatterFileName != NULL ) if ( arg.FEPatternFileName != NULL ) { fprintf( stdout, "FEC: %s\n", arg.FEPatterFileName ); fprintf( stdout, "FEC: %s\n", arg.FEPatternFileName ); } else { fprintf( stdout, "FEC: %.2f %%\n", arg.FER ); } } #else /* DEBUGGING */ #else IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ); #endif /* DEBUGGING */ #endif /*-------------------------------------------------------------------* * Load renderer configuration from file Loading @@ -583,12 +580,11 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); goto cleanup; } #else if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) Loading Loading @@ -623,7 +619,7 @@ int main( #endif #ifdef CONTROL_METADATA_REVERB if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) { Loading Loading @@ -679,7 +675,11 @@ int main( { IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); 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; } if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) { Loading @@ -687,29 +687,42 @@ int main( goto cleanup; } IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL; IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName ); goto cleanup; } IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); goto cleanup; } IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ); 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; } 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.hrtfCRendFileName ); fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); goto cleanup; } } Loading @@ -726,16 +739,12 @@ int main( #ifdef VARIABLE_SPEED_DECODING else if ( arg.variableSpeedMode ) { error = decodeVariableSpeed( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); error = decodeVariableSpeed( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); } #endif else { error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, #ifdef SPLIT_REND_WITH_HEAD_ROT splitRendBitsBuf, #endif Loading Loading @@ -941,7 +950,7 @@ static bool parseCmdlIVAS_dec( #endif #endif arg->output_Fs = 48000; arg->outputFormat = AUDIO_CONFIG_MONO; arg->outputConfig = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; Loading @@ -964,14 +973,11 @@ static bool parseCmdlIVAS_dec( arg->jbmOffsetFilename = NULL; arg->FER = 0.f; arg->FEPatterFileName = NULL; arg->FEPatternFileName = NULL; arg->hrtfReaderEnabled = false; arg->hrtfFileName = NULL; arg->hrtfCRendReaderEnabled = false; arg->hrtfCRendFileName = NULL; arg->customLsOutputEnabled = false; arg->customLsSetupFilename = NULL; Loading Loading @@ -1104,7 +1110,7 @@ static bool parseCmdlIVAS_dec( ftmp = 0.0f; if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) { arg->FEPatterFileName = argv[i + 1]; arg->FEPatternFileName = argv[i + 1]; } else { Loading Loading @@ -1411,14 +1417,14 @@ static bool parseCmdlIVAS_dec( if ( i < argc - 3 ) { arg->outputFormat = cmdline2config( argv[i] ); if ( arg->outputFormat == AUDIO_CONFIG_LS_CUSTOM ) arg->outputConfig = cmdline2config( argv[i] ); if ( arg->outputConfig == AUDIO_CONFIG_LS_CUSTOM ) { arg->customLsOutputEnabled = true; arg->customLsSetupFilename = argv[i]; } i++; if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != AUDIO_CONFIG_STEREO ) ) if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != AUDIO_CONFIG_STEREO ) ) { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); Loading @@ -1427,11 +1433,11 @@ static bool parseCmdlIVAS_dec( } else { arg->outputFormat = AUDIO_CONFIG_MONO; arg->outputConfig = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_EVS; if ( ( arg->Opt_non_diegetic_pan ) ) { arg->outputFormat = AUDIO_CONFIG_STEREO; arg->outputConfig = AUDIO_CONFIG_STEREO; } } Loading Loading @@ -1635,8 +1641,8 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) if ( ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { pFullDelayNumSamples[0] = 0; } Loading @@ -1663,32 +1669,42 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); return error; } *ppAfWriter = NULL; } else { if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); assert( arg.outputMdFilename != NULL ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); return error; } } #endif Loading Loading @@ -1746,7 +1762,7 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, pBsFormat ) ) != IVAS_ERR_OK ) { Loading Loading @@ -2132,7 +2148,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) Loading @@ -2143,7 +2159,7 @@ static ivas_error decodeG192( } else { if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) Loading Loading @@ -2172,7 +2188,7 @@ static ivas_error decodeG192( } /* Write MASA/ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM Loading Loading @@ -2285,7 +2301,7 @@ static ivas_error decodeG192( } /* Print output metadata file name(s) */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { Loading Loading @@ -2770,7 +2786,7 @@ static ivas_error decodeVoIP( } /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { int16_t i; Loading Loading @@ -3217,7 +3233,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) Loading Loading @@ -3405,7 +3421,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) Loading Loading @@ -3491,7 +3507,7 @@ static ivas_error decodeVariableSpeed( } /* Print output metadata file name(s) */ if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { Loading
apps/renderer.c +8 −3 Original line number Diff line number Diff line Loading @@ -3691,8 +3691,10 @@ static void convertInputBuffer( { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; numFloatPcmSamples = numFloatSamplesPerChannel >> 1; numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Analysis*/ assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ); for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) Loading @@ -3711,6 +3713,7 @@ static void convertInputBuffer( ++i; } } for ( chnl = 0; chnl < numChannels; ++chnl ) { for ( slotIdx = 0; slotIdx < IVAS_CLDFB_NO_COL_MAX; slotIdx++ ) Loading Loading @@ -3779,8 +3782,10 @@ static void convertOutputBuffer( float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; float re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; float im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; numPcmSamples = numSamplesPerChannel >> 1; numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Synthesis*/ for ( chnl = 0; chnl < numChannels; ++chnl ) { Loading
lib_com/ivas_cov_smooth.c +25 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,12 @@ #include "wmc_auto.h" #include "prot.h" /*-----------------------------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------------------------*/ #define BAND_SMOOTH_REST_START_IDX ( 2 ) #ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() Loading Loading @@ -147,24 +152,36 @@ static void ivas_set_up_cov_smoothing( * To calculate the update factor *-----------------------------------------------------------------------------------------*/ static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) { float update_factor_temp = 0.0f; int16_t k; for ( k = 0; k < active_bins; k++ ) { update_factor_temp += p_bin_to_band[k]; } return update_factor_temp; } /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_smoothning_factor() * * To calculate the Smoothning factor *-----------------------------------------------------------------------------------------*/ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) { float smooth_fact; *Smoothing_factor = update_factor / min_pool_size; Loading @@ -180,12 +197,16 @@ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float upd } *Smoothing_factor *= ( j + 1 ) * smooth_fact; } if ( *Smoothing_factor > max_update_rate ) { *Smoothing_factor = max_update_rate; } return; } /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * Loading Loading @@ -223,6 +244,8 @@ static void ivas_set_up_cov_smoothing( } hCovState->prior_bank_idx = -1; return; } #endif Loading
lib_com/ivas_fb_mixer.c +2 −2 Original line number Diff line number Diff line Loading @@ -612,8 +612,8 @@ static if ( hFbMixer->first_frame[ch] == 0 ) { fade_start_offset = (int16_t) hFbMixer->cross_fade_start_offset; fade_end_offset = (int16_t) hFbMixer->cross_fade_end_offset; fade_start_offset = hFbMixer->cross_fade_start_offset; fade_end_offset = hFbMixer->cross_fade_end_offset; for ( k = 0; k < fade_start_offset; k++ ) { Loading
lib_com/ivas_prot.h +74 −85 File changed.Preview size limit exceeded, changes collapsed. Show changes