From 55d37f954a6f6fb16061daa63aba3c01e293a549 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 19:08:11 +0200 Subject: [PATCH 1/8] Framework improvements --- apps/decoder.c | 114 ++++++------ lib_com/ivas_cov_smooth.c | 27 ++- lib_com/ivas_fb_mixer.c | 4 +- lib_com/ivas_prot.h | 3 +- lib_com/ivas_rom_com.c | 255 +++++++++++++++----------- lib_com/ivas_rom_com.h | 12 +- lib_com/lsf_tools.c | 2 +- lib_com/prot.h | 6 +- lib_com/stat_com.h | 4 +- lib_dec/FEC_clas_estim.c | 2 +- lib_dec/ivas_ism_dec.c | 8 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_mc_paramupmix_dec.c | 10 +- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_dec/ivas_range_uni_dec.c | 10 +- lib_dec/ivas_sba_rendering_internal.c | 1 + lib_dec/ivas_sns_dec.c | 19 +- lib_dec/lib_dec.c | 50 ++--- lib_dec/lib_dec.h | 2 +- lib_enc/ivas_ism_metadata_enc.c | 4 +- lib_enc/ivas_masa_enc.c | 3 +- lib_enc/ivas_mc_paramupmix_enc.c | 8 +- lib_enc/lib_enc.c | 10 +- lib_enc/pre_proc.c | 2 +- lib_enc/set_impulse.c | 8 +- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_prot_rend.h | 4 + lib_util/hrtf_file_reader.c | 45 ----- 28 files changed, 332 insertions(+), 287 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 74aa3d7376..62b66a6111 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -103,7 +103,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; - IVAS_DEC_AUDIO_CONFIG outputFormat; + IVAS_DEC_AUDIO_CONFIG outputConfig; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; @@ -119,12 +119,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; @@ -281,7 +279,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); @@ -303,9 +301,9 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -327,7 +325,7 @@ int main( if ( arg.enableReferenceRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -354,7 +352,7 @@ int main( if ( arg.enableReferenceVectorTracking ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -407,9 +405,9 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -427,13 +425,15 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ + #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_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; @@ -538,9 +538,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(); @@ -556,11 +556,11 @@ 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 { @@ -581,9 +581,9 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && + arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && + arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_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 ); @@ -653,28 +653,41 @@ 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 ); } + 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 ); } } @@ -903,7 +916,7 @@ static bool parseCmdlIVAS_dec( #endif #endif arg->output_Fs = 48000; - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputConfig = IVAS_DEC_OUTPUT_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; @@ -926,14 +939,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; @@ -1057,7 +1067,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 { @@ -1344,14 +1354,14 @@ static bool parseCmdlIVAS_dec( if ( i < argc - 3 ) { - arg->outputFormat = cmdline2config( argv[i] ); - if ( arg->outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) + arg->outputConfig = cmdline2config( argv[i] ); + if ( arg->outputConfig == IVAS_DEC_OUTPUT_LS_CUSTOM ) { arg->customLsOutputEnabled = true; arg->customLsSetupFilename = argv[i]; } i++; - if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != IVAS_DEC_OUTPUT_STEREO ) ) + if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_DEC_OUTPUT_STEREO ) ) { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); @@ -1360,11 +1370,11 @@ static bool parseCmdlIVAS_dec( } else { - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputConfig = IVAS_DEC_OUTPUT_MONO; arg->decMode = IVAS_DEC_MODE_EVS; if ( ( arg->Opt_non_diegetic_pan ) ) { - arg->outputFormat = IVAS_DEC_OUTPUT_STEREO; + arg->outputConfig = IVAS_DEC_OUTPUT_STEREO; } } @@ -1562,8 +1572,8 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || - ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || + ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { pFullDelayNumSamples[0] = 0; } @@ -1590,7 +1600,7 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1605,7 +1615,7 @@ static ivas_error initOnFirstGoodFrame( } else { - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1673,7 +1683,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 == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, pBsFormat ) ) != IVAS_ERR_OK ) { @@ -2036,7 +2046,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_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 ) @@ -2047,7 +2057,7 @@ static ivas_error decodeG192( } else { - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_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 ) @@ -2076,7 +2086,7 @@ static ivas_error decodeG192( } /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -2176,7 +2186,7 @@ static ivas_error decodeG192( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -2651,7 +2661,7 @@ static ivas_error decodeVoIP( } /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { int16_t i; @@ -3082,7 +3092,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -3261,7 +3271,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -3338,7 +3348,7 @@ static ivas_error decodeVariableSpeed( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 7211274eea..dc17fae8f2 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -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() @@ -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; @@ -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() * @@ -223,6 +244,8 @@ static void ivas_set_up_cov_smoothing( } hCovState->prior_bank_idx = -1; + + return; } #endif diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index a94a92c548..8bd14bdc42 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -603,8 +603,8 @@ static void ivas_fb_mixer_cross_fading( 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++ ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f841cbb1b6..0436aa5caa 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2604,7 +2604,7 @@ void sns_avq_dec( void sns_avq_dec_stereo( int16_t *indexl, /* i : Quantization indices (left channel) */ int16_t *indexr, /* i : Quantization indices (right channe) */ - const int16_t L_frame, + const int16_t L_frame, /* i : frame length */ float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ); @@ -3469,6 +3469,7 @@ void ivas_sba_getTCs( const int16_t input_frame /* i : frame length */ ); +/*! r: SBA DirAC stereo flag */ int16_t ivas_sba_remapTCs( float sba_data[][L_FRAME48k], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 5677a3cc9b..d0077a4956 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -5597,11 +5597,17 @@ const int16_t ivas_num_active_bands[FB - WB + 1] = IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12 }; +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + const int16_t ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 }; + const int16_t ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; /* pre-rounded codebook vectors for singed Q4.12 represantation */ -const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { +const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = +{ -1.8305664f, -2.0878906f, -0.9638672f, 2.8059082f, 2.668213f, 1.1638184f, 1.390625f, 1.217041f, 1.3850098f, 0.44555664f, -0.47045898f, -0.5307617f, -0.810791f, -1.1647949f, -1.4560547f, -1.7612305f, -2.5979004f, -3.3308105f, -1.8554688f, -0.3605957f, 1.6828613f, 2.5871582f, 0.98168945f, 0.22436523f, -0.13110352f, 0.16699219f, 1.5004883f, 0.3293457f, 0.33569336f, 1.1591797f, 0.1796875f, -0.8718262f, 1.982666f, 2.2011719f, 1.1525879f, 0.8093262f, 0.86499023f, 1.1618652f, 1.2888184f, 1.3618164f, 1.0827637f, 0.83251953f, 0.12011719f, -0.7182617f, -2.1948242f, -3.0500488f, -3.3571777f, -3.53833f, @@ -5731,7 +5737,9 @@ const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { 1.7553711f, 2.8996582f, 1.9260254f, 0.40551758f, -0.0234375f, 0.44506836f, 0.31152344f, 0.1809082f, -0.47607422f, -0.4807129f, -1.204834f, -1.3293457f, -1.2412109f, -1.0134277f, -0.89501953f, -1.2602539f, 0.2253418f, 2.2539062f, 2.265625f, 0.57128906f, -0.7661133f, -0.6245117f, 0.21313477f, 1.2248535f, 0.8737793f, -0.12524414f, -0.9609375f, -2.416504f, -1.1223145f, -0.70532227f, -0.31469727f, -0.592041f, }; -const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = +{ -1.1569824f, -0.4765625f, 0.008056641f, 0.47802734f, 0.38330078f, -0.075683594f, -0.3737793f, -0.29516602f, -0.1352539f, 0.012939453f, 0.22241211f, 0.375f, 0.31689453f, 0.20874023f, 0.2541504f, 0.25439453f, -0.40600586f, -0.22070312f, -0.04272461f, 0.15893555f, -0.25195312f, -0.6623535f, -0.27172852f, 0.28735352f, 0.35742188f, 0.20166016f, 0.052246094f, -0.3647461f, -0.4506836f, 0.1862793f, 0.66796875f, 0.7585449f, 0.02734375f, -0.2097168f, -0.39819336f, -0.54296875f, -0.46850586f, -0.25146484f, -0.26953125f, -0.07495117f, 0.375f, 0.9343262f, 0.91625977f, 0.4267578f, 0.026123047f, -0.15576172f, -0.11425781f, -0.22021484f, @@ -5797,7 +5805,9 @@ const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { 0.3227539f, -1.0678711f, -1.1435547f, 0.068603516f, 0.7546387f, 0.38745117f, 0.09008789f, -0.0007324219f, -0.12792969f, 0.076416016f, 0.24853516f, 0.28735352f, 0.076660156f, -0.041748047f, -0.01977539f, 0.08911133f, 0.6101074f, -0.22070312f, -0.5324707f, -0.119384766f, 0.10473633f, 0.16333008f, -0.15112305f, -0.34472656f, -0.39746094f, -0.43652344f, -0.23876953f, 0.0017089844f, 0.056152344f, 0.22973633f, 0.50024414f, 0.7751465f, }; -const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = +{ -0.12109375f, -0.32348633f, -0.25976562f, 0.21435547f, 0.4814453f, 0.14819336f, -0.22363281f, -0.31030273f, -0.13256836f, 0.10107422f, 0.33276367f, 0.32495117f, 0.16577148f, -0.079833984f, -0.16210938f, -0.15527344f, 0.088378906f, -0.0146484375f, -0.13378906f, -0.29003906f, 0.873291f, -0.3125f, -0.19384766f, 0.19311523f, -0.09863281f, 0.052734375f, -0.13110352f, -0.021972656f, -0.07861328f, -0.01977539f, -0.07373047f, 0.1616211f, -0.115722656f, 0.28100586f, 0.2697754f, -0.10522461f, -0.107910156f, -0.2866211f, -0.36694336f, -0.33862305f, -0.15844727f, 0.01928711f, 0.17382812f, 0.21118164f, 0.2697754f, 0.17260742f, 0.07299805f, 0.009033203f, @@ -5831,7 +5841,9 @@ const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { 0.17895508f, -0.31396484f, -0.033203125f, -0.02734375f, -0.0637207f, -0.11791992f, -0.03466797f, 0.0061035156f, 0.07324219f, 0.072753906f, 0.14916992f, 0.13671875f, 0.12524414f, 0.017333984f, -0.08178711f, -0.08618164f, 0.13330078f, -0.15893555f, -0.22045898f, -0.032226562f, -0.07739258f, -0.25463867f, -0.32299805f, -0.2614746f, 0.039794922f, 0.18554688f, 0.1262207f, -0.04321289f, -0.010498047f, 0.13330078f, 0.31860352f, 0.44506836f, }; -const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = +{ -0.0056152344f, -0.03955078f, 0.071777344f, 0.26879883f, 0.44140625f, -0.08203125f, -0.20092773f, -0.009277344f, 0.05810547f, -0.06347656f, -0.07910156f, -0.05126953f, -0.07006836f, -0.068847656f, -0.07885742f, -0.09082031f, -0.011962891f, -0.060302734f, 0.011962891f, 0.049804688f, -0.044677734f, 0.037841797f, 0.099121094f, 0.06274414f, 0.022216797f, -0.09057617f, 0.00390625f, 0.38452148f, 0.1027832f, -0.5292969f, -0.3269043f, 0.28881836f, -0.3557129f, 0.3815918f, 0.10839844f, 0.08203125f, 0.03149414f, -0.0024414062f, -0.0036621094f, -0.02758789f, -0.03125f, -0.096191406f, -0.09326172f, -0.103515625f, -0.07006836f, 0.008056641f, 0.06616211f, 0.10644531f, @@ -5869,9 +5881,11 @@ const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; + const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; -const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { +const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = +{ 1.0144043f, 1.1826172f, 0.3269043f, -0.6411133f, -1.2163086f, -1.1411133f, -1.1525879f, -0.8898926f, -0.19604492f, 0.7402344f, 1.1782227f, 1.0830078f, 0.78222656f, 0.26953125f, -0.33203125f, -1.0080566f, -0.38916016f, -0.31347656f, -1.1826172f, -2.036621f, -2.086914f, -1.8569336f, -1.637207f, -1.3156738f, -0.4182129f, 0.50634766f, 1.2770996f, 1.3771973f, 1.8566895f, 2.3503418f, 2.3015137f, 1.5678711f, 0.43652344f, 1.8859863f, 2.8059082f, 2.2385254f, 1.5480957f, 0.14331055f, 0.07299805f, -1.1218262f, -1.1103516f, -0.7336426f, -0.4194336f, -0.89624023f, -1.0429688f, -0.79785156f, -1.204834f, -1.8046875f, @@ -6001,7 +6015,9 @@ const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { 3.256836f, 3.5593262f, 2.2746582f, 1.1318359f, 0.3149414f, -0.02368164f, 0.27172852f, -0.19335938f, -0.48779297f, -0.9663086f, -0.9187012f, -1.0222168f, -1.512207f, -1.6816406f, -1.8964844f, -2.1069336f, -0.057617188f, -0.45092773f, -0.9638672f, -0.72143555f, 0.20703125f, 1.4692383f, 1.921875f, 1.6833496f, 1.3933105f, 0.6699219f, 0.17333984f, -0.43798828f, -0.9772949f, -1.1477051f, -1.3552246f, -1.4057617f, }; -const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = +{ 0.30615234f, 0.48828125f, -0.02709961f, -0.47680664f, -0.5300293f, -0.25463867f, -0.13305664f, -0.14941406f, -0.14819336f, 0.08666992f, 0.28833008f, 0.27514648f, 0.099365234f, -0.017578125f, 0.033203125f, 0.15893555f, 0.40942383f, -0.044189453f, -0.088378906f, 0.38720703f, 0.5151367f, 0.42236328f, 0.34960938f, 0.2680664f, 0.037597656f, -0.19970703f, -0.31054688f, -0.32617188f, -0.38452148f, -0.38085938f, -0.38598633f, -0.2692871f, -0.16040039f, -0.37548828f, -0.41479492f, -0.1237793f, 0.25708008f, 0.29589844f, 0.045410156f, -0.04345703f, -0.11450195f, -0.2019043f, 0.032470703f, 0.5847168f, 1.074707f, 0.3178711f, -0.43847656f, -0.73535156f, @@ -6035,7 +6051,9 @@ const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { -0.78149414f, 0.05517578f, 0.09863281f, -0.35083008f, -0.29174805f, 0.1352539f, 0.10620117f, -0.3515625f, -0.27514648f, 0.15917969f, 0.34326172f, 0.2626953f, 0.39916992f, 0.42089844f, 0.20947266f, -0.1394043f, -0.20361328f, -0.21557617f, -0.16308594f, -0.041748047f, -0.111083984f, -0.057617188f, 0.0390625f, 0.013183594f, 0.17358398f, 0.74902344f, 0.9448242f, 0.4477539f, -0.09423828f, -0.32739258f, -0.50634766f, -0.6467285f, }; -const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = { + +const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = +{ 0.15209961f, -0.12768555f, 0.09375f, -0.083496094f, -0.25390625f, 0.12524414f, 0.2993164f, -0.09863281f, -0.34814453f, -0.2434082f, -0.11254883f, -0.060058594f, 0.032470703f, 0.15527344f, 0.23413086f, 0.2355957f, -0.16235352f, -0.111083984f, -0.3173828f, -0.25634766f, 0.13842773f, 0.29858398f, 0.10498047f, 0.11743164f, 0.26611328f, 0.05444336f, -0.1459961f, -0.19238281f, 0.041748047f, 0.2097168f, 0.07421875f, -0.12011719f, -0.05078125f, 0.14770508f, -0.1003418f, -0.32104492f, -0.17504883f, -0.18652344f, -0.27148438f, -0.07788086f, 0.0036621094f, -0.04296875f, 0.10131836f, 0.34985352f, 0.3083496f, 0.10107422f, 0.0769043f, 0.13696289f, @@ -6053,7 +6071,8 @@ const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; const int16_t ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; -const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = +{ -0.11376953f, -0.06591797f, 0.041992188f, 0.044677734f, 0.17871094f, -0.02758789f, -0.32592773f, -0.21069336f, -0.049072266f, 0.0126953125f, 0.012939453f, 0.015136719f, 0.08203125f, 0.12670898f, 0.12695312f, 0.15112305f, -0.017089844f, 0.09326172f, 0.2355957f, 0.2241211f, 0.107421875f, 0.05029297f, 0.039794922f, -0.0073242188f, -0.048339844f, -0.0871582f, -0.08520508f, -0.12060547f, -0.111572266f, -0.10620117f, -0.08911133f, -0.078125f, -0.26635742f, 0.27368164f, 0.4543457f, 0.1821289f, 0.6513672f, 0.18066406f, 0.14575195f, -0.008056641f, 0.2631836f, -0.045898438f, -0.52001953f, -0.1628418f, 0.038330078f, -0.31811523f, -0.4321289f, -0.43603516f, @@ -6088,7 +6107,8 @@ const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { -0.19580078f, -0.14624023f, -0.11303711f, -0.055908203f, -0.052001953f, -0.009033203f, 0.022949219f, -0.0068359375f, -0.032470703f, 0.0017089844f, 0.045410156f, 0.025146484f, 0.039794922f, 0.07543945f, 0.1574707f, 0.24267578f, }; -const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = +{ -0.013916016f, 0.0007324219f, 0.017089844f, 0.005859375f, 0.056152344f, -0.08178711f, -0.2927246f, 0.00390625f, 0.140625f, 0.03881836f, 0.010498047f, 0.038330078f, 0.042236328f, 0.020751953f, 0.005859375f, 0.0075683594f, -0.07104492f, -0.10253906f, 0.038085938f, 0.091552734f, 0.118896484f, 0.13476562f, 0.05078125f, -0.111328125f, -0.13842773f, -0.20727539f, -0.25732422f, -0.15063477f, 0.032470703f, 0.08129883f, 0.17578125f, 0.31469727f, 0.0715332f, 0.029052734f, 0.01953125f, 0.008056641f, 0.0234375f, 0.020751953f, 0.032226562f, 0.021972656f, 0.03466797f, 0.017822266f, -0.037841797f, -0.14038086f, -0.21679688f, -0.11035156f, 0.057617188f, 0.16845703f, @@ -6125,7 +6145,8 @@ const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { const float *const ivas_sns_cdbks_side_tcx20[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1, ivas_sns_cdbks_side_tcx20_stage2 }; -const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = +{ -0.23950195f, -0.203125f, -0.17822266f, -0.1315918f, -0.123291016f, -0.095947266f, -0.106933594f, -0.16552734f, -0.14941406f, -0.075683594f, 0.026367188f, 0.1015625f, 0.17041016f, 0.2770996f, 0.37890625f, 0.5148926f, 0.12890625f, 0.20825195f, 0.22924805f, 0.2998047f, 0.24267578f, 0.14477539f, 0.07861328f, 0.024658203f, -0.076171875f, -0.18432617f, -0.26660156f, -0.33251953f, -0.2758789f, -0.13964844f, -0.030517578f, -0.05126953f, -0.14160156f, -0.13305664f, -0.111816406f, -0.037353516f, -0.038085938f, 0.051513672f, 0.07348633f, 0.0073242188f, 0.044921875f, -0.0234375f, -0.123291016f, -0.01171875f, 0.28100586f, 0.24194336f, 0.0703125f, -0.1496582f, @@ -6158,9 +6179,11 @@ const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { 0.06982422f, 0.072265625f, 0.18261719f, 0.025390625f, -0.2475586f, -0.2861328f, -0.111572266f, -0.037109375f, 0.0036621094f, 0.031982422f, 0.043945312f, 0.057373047f, 0.078125f, 0.072021484f, 0.028564453f, 0.016357422f, 0.07836914f, 0.13549805f, 0.1743164f, 0.15478516f, 0.12573242f, -0.009521484f, -0.1508789f, -0.1965332f, -0.19604492f, -0.103027344f, -0.045898438f, -0.026123047f, 0.020263672f, 0.023925781f, 0.013183594f, 0.0014648438f, 0.25341797f, 0.22558594f, 0.2241211f, 0.17114258f, 0.18164062f, 0.16894531f, 0.16503906f, 0.20239258f, 0.17041016f, 0.025878906f, -0.16625977f, -0.24121094f, -0.31982422f, -0.4008789f, -0.38256836f, -0.27783203f, -}; +} +; -const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { +const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = +{ -0.13989258f, -0.024658203f, 0.12670898f, 0.027832031f, 0.06689453f, 0.12817383f, 0.07495117f, -0.01977539f, -0.05834961f, -0.07543945f, -0.06542969f, -0.0546875f, -0.04345703f, -0.0063476562f, 0.034179688f, 0.029541016f, -0.06713867f, -0.11450195f, -0.09790039f, -0.091308594f, -0.12182617f, -0.010009766f, 0.10986328f, 0.115478516f, 0.060058594f, 0.038085938f, 0.020507812f, 0.017333984f, 0.024169922f, 0.028320312f, 0.038330078f, 0.05053711f, 0.05517578f, 0.030517578f, 0.0390625f, 0.05810547f, 0.021484375f, 0.032470703f, 0.040039062f, -0.0087890625f, -0.055908203f, -0.023925781f, 0.037109375f, 0.06347656f, 0.02709961f, -0.07373047f, -0.1274414f, -0.115234375f, @@ -6173,7 +6196,8 @@ const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; -const int16_t sns_1st_cdbk[2][2][8 * 32] = { +const int16_t sns_1st_cdbk[2][2][8 * 32] = +{ { /* split 1 */ { /* TCX 20 */ -10900, -11064, -10637, -10471, -9051, -6381, -4688, -2438, @@ -6315,7 +6339,9 @@ const int16_t sns_1st_cdbk[2][2][8 * 32] = { } } }; -const int16_t sns_1st_means_16k[2][16] = { + +const int16_t sns_1st_means_16k[2][16] = +{ { /* TCX 20 */ 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281, }, @@ -6323,7 +6349,9 @@ const int16_t sns_1st_means_16k[2][16] = { 12018, 15915, 11089, 6015, 847, -705, -539, -1548, -893, -2163, -1806, -4189, -7017, -8670, -8874, -9480, } }; -const int16_t sns_1st_means_25k6[2][16] = { + +const int16_t sns_1st_means_25k6[2][16] = +{ { /* TCX 20 */ 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749, }, @@ -6331,7 +6359,9 @@ const int16_t sns_1st_means_25k6[2][16] = { 15560, 19489, 14623, 5595, 2084, 1699, 775, -1312, -2195, -6101, -9078, -9465, -7825, -6603, -7281, -9960, } }; -const int16_t sns_1st_means_32k[2][16] = { + +const int16_t sns_1st_means_32k[2][16] = +{ { /* TCX 20 */ 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930, }, @@ -6340,100 +6370,105 @@ const int16_t sns_1st_means_32k[2][16] = { } }; -ACPL_QUANT_TABLE alpha_quant_table[] = -{ - { /* Alfa Fine */ - 33, /* nquant */ - 16, /* offset */ - { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, - -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, - +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, - +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */ - }, /* End Alfa Fine */ - { /* Alfa Coarse */ - 17, /* nquant */ - 8, /* offset */ - { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, - +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */ - } /* End Alfa Coarse */ -}; - -ACPL_QUANT_TABLE beta_quant_table[2][9] = -{ - { - { /* Beta Fine #1 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */ - }, /* End Beta Fine #1 */ - { /* Beta Fine #2 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */ - }, /* End Beta Fine #2 */ - { /* Beta Fine #3 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */ - }, /* End Beta Fine #3 */ - { /* Beta Fine #4 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */ - }, /* End Beta Fine #4 */ - { /* Beta Fine #5 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */ - }, /* End Beta Fine #5 */ - { /* Beta Fine #6 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */ - }, /* End Beta Fine #6 */ - { /* Beta Fine #7 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */ - }, /* End Beta Fine #7 */ - { /* Beta Fine #8 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */ - }, /* End Beta Fine #8 */ - { /* Beta Fine #9 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */ - } /* End Beta Fine #9 */ - }, - { - { /* Beta Coarse #1 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */ - }, /* End Beta Coarse #1 */ - { /* Beta Coarse #2 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */ - }, /* End Beta Coarse #2 */ - { /* Beta Coarse #3 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */ - }, /* End Beta Coarse #3 */ - { /* Beta Coarse #4 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */ - }, /* End Beta Coarse #4 */ - { /* Beta Coarse #5 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */ - } /* End Beta Coarse #5 */ - } + +/*------------------------------------------------------------------------------------------* + * MC ParamUpMix tables + *------------------------------------------------------------------------------------------*/ + +const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[] = +{ + { /* Alfa Fine */ + 33, /* nquant */ + 16, /* offset */ + { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, + -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, + +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, + +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */ + }, + { /* Alfa Coarse */ + 17, /* nquant */ + 8, /* offset */ + { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, + +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */ + } +}; + +const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9] = +{ + { + { /* Beta Fine #1 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */ + }, + { /* Beta Fine #2 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */ + }, + { /* Beta Fine #3 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */ + }, + { /* Beta Fine #4 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */ + }, + { /* Beta Fine #5 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */ + }, + { /* Beta Fine #6 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */ + }, + { /* Beta Fine #7 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */ + }, + { /* Beta Fine #8 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */ + }, + { /* Beta Fine #9 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */ + } + }, + { + { /* Beta Coarse #1 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */ + }, + { /* Beta Coarse #2 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */ + }, + { /* Beta Coarse #3 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */ + }, + { /* Beta Coarse #4 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */ + }, + { /* Beta Coarse #5 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */ + } + } }; /* clang-format on */ diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 8dc958e06c..c45a3d2c58 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -418,6 +418,7 @@ extern const int16_t ivas_num_active_bands[FB - WB + 1]; /*------------------------------------------------------------------------------------------* * SNS MSVQ codebooks and means *------------------------------------------------------------------------------------------*/ + extern const int16_t ivas_sns_cdbks_tcx20_levels[]; extern const int16_t ivas_sns_cdbks_tcx20_bits[]; @@ -435,13 +436,18 @@ extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; extern const float *const ivas_sns_cdbks_side_tcx20[]; extern const float *const ivas_sns_cdbks_side_tcx10[]; -extern ACPL_QUANT_TABLE alpha_quant_table[]; -extern ACPL_QUANT_TABLE beta_quant_table[2][9]; - /* means and codebooks for the split VQ in the 2-stage SNS VQ */ extern const int16_t sns_1st_cdbk[2][2][8 * 32]; extern const int16_t sns_1st_means_16k[2][16]; extern const int16_t sns_1st_means_25k6[2][16]; extern const int16_t sns_1st_means_32k[2][16]; + +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + +extern const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[]; +extern const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9]; + /* IVAS_ROM_COM_H */ #endif diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 42688ee145..4f4f6319dc 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2448,7 +2448,7 @@ void dctT2_N_apply_matrix( const float *input, /* i : input in fdcng or DCT(fdcng) domain */ float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - int16_t fdcngvq_dim, /* i : fdcng domain length */ + const int16_t fdcngvq_dim, /* i : fdcng domain length */ const float *matrix, /* i : IDCT matrix */ const int16_t matrix_row_dim, /* i : */ const DCTTYPE dcttype /* i : matrix operation type */ diff --git a/lib_com/prot.h b/lib_com/prot.h index bf9446939d..2459ba90af 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3984,7 +3984,7 @@ void set_impulse( float exc[], /* o : adaptive codebook excitation */ float y1[], /* o : filtered adaptive codebook excitation */ int16_t *imp_shape, /* o : adaptive codebook index */ - int16_t *imp_pos, /* o : position of the glotal impulse center index */ + int16_t *imp_pos, /* o : position of the glottal impulse center index */ float *gain_trans /* o : transition gain */ ); @@ -4943,7 +4943,7 @@ void FEC_encode( int16_t FEC_pos_dec( Decoder_State *st, /* i/o: decoder state structure */ - int16_t *last_pulse_pos, /* o : Last glotal pulse position in the lost ACB */ + int16_t *last_pulse_pos, /* o : Last glottal pulse position in the lost ACB */ float *enr_q, /* o : Decoded energy */ const int16_t nBits_es_Pred /* i : number of bits for Es_pred Q */ ); @@ -8149,7 +8149,7 @@ void dctT2_N_apply_matrix( const float *input, /* i : input in fdcng or DCT(fdcng) domain */ float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - int16_t fdcngvq_dim, /* i : fdcng domain length */ + const int16_t fdcngvq_dim, /* i : fdcng domain length */ const float *matrix, /* i : IDCT matrix */ const int16_t matrix_row_dim, /* i : */ const DCTTYPE dcttype /* i : matrix operation type */ diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 79976efa88..b36e31253f 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -461,7 +461,7 @@ typedef int16_t ( *TDecodeValue )( struct Decoder_State *st, int16_t index, int1 */ typedef float ( *TLinearPredictionFilter )( const int16_t order, const float parCoeff[], float *state, float x ); -/** Structure that defines mapping between a parameter and a bistream. */ +/** Structure that defines mapping between a parameter and a bitstream. */ typedef struct ParamBitMap { /** Number of bits in a bitstream required for the parameter. @@ -516,7 +516,7 @@ typedef struct ParamBitMap struct ParamsBitMap const *pSubParamBitMap; } ParamBitMap; -/** Structure that defines mapping between parameters and a bistream. */ +/** Structure that defines mapping between parameters and a bitstream. */ typedef struct ParamsBitMap { /** Number of parameters in params. */ diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index 4acd3dab9c..8d54129a7c 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -735,7 +735,7 @@ static void FEC_classificationMusic( int16_t FEC_pos_dec( Decoder_State *st, /* i/o: decoder state structure */ - int16_t *last_pulse_pos, /* o : last glotal pulse position in the lost ACB */ + int16_t *last_pulse_pos, /* o : last glottal pulse position in the lost ACB */ float *enr_q, /* o : decoded energy */ const int16_t nBits_es_Pred /* i : number of bits for Es_pred Q */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 63464def7f..94f22d0fd6 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -41,12 +41,12 @@ #include "wmc_auto.h" /*-------------------------------------------------------------------------* - * ivas_ism_bitrate_switching() + * ivas_ism_bitrate_switching_dec() * * *-------------------------------------------------------------------------*/ -static ivas_error ivas_ism_bitrate_switching( +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 */ @@ -418,7 +418,7 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } @@ -441,7 +441,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f5ed58974f..a3699bdad6 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -622,7 +622,7 @@ ivas_error ivas_ism_metadata_dec_create( /*------------------------------------------------------------------------- * decode_angle_indices() * - * Decoding of an angle + * Decoding of a position/orientation angle *-------------------------------------------------------------------------*/ static void decode_angle_indices( diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 9ae580ae3a..2f8e02aa27 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -1018,10 +1018,10 @@ static void huffman_decode( switch ( parType ) { case ALPHA: - nquant = alpha_quant_table[quant_type].nquant; + nquant = ivas_param_upmx_alpha_quant_table[quant_type].nquant; break; case BETA: - nquant = beta_quant_table[quant_type][0].nquant; + nquant = ivas_param_upmx_beta_quant_table[quant_type][0].nquant; break; default: assert( 0 ); @@ -1104,7 +1104,7 @@ static void dequant_alpha( float *v ) { int16_t iv; - ACPL_QUANT_TABLE *quant_table = &alpha_quant_table[quant_type]; + const ACPL_QUANT_TABLE *quant_table = &ivas_param_upmx_alpha_quant_table[quant_type]; for ( iv = 0; iv < ivStart; iv++ ) { @@ -1129,7 +1129,7 @@ static void dequant_beta( float *beta ) { int16_t iv; - ACPL_QUANT_TABLE *quant_table; + const ACPL_QUANT_TABLE *quant_table; for ( iv = 0; iv < ivStart; iv++ ) { @@ -1138,7 +1138,7 @@ static void dequant_beta( for ( iv = ivStart; iv < nv; iv++ ) { - quant_table = &beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]]; + quant_table = &ivas_param_upmx_beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]]; beta[iv] = quant_table->data[bq[iv]]; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index af7795f617..5998f769f1 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -3728,7 +3728,7 @@ static int16_t decode_fixed_rate_composed_index_coherence( /*-------------------------------------------------------------------* * read_coherence_data_hr_512() * - * + * Read coherence data at HR *-------------------------------------------------------------------*/ /*! r: number of bits read */ diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index db0fbddeab..6fbbaa5636 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -138,7 +138,7 @@ uint16_t rc_uni_dec_read_symbol_fastS( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -248,7 +248,7 @@ uint16_t rc_uni_dec_read_bit( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -303,7 +303,7 @@ uint16_t rc_uni_dec_read_bit_prob_fast( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -376,7 +376,7 @@ uint16_t rc_uni_dec_read_bits( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -482,7 +482,7 @@ static int16_t rc_uni_dec_read( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 643c7b5a6c..978d3152e2 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -219,6 +219,7 @@ void ivas_mc2sba( * Get TCs from Ambisonics signal in ACN *-------------------------------------------------------------------*/ +/*! r: SBA DirAC stereo flag */ int16_t ivas_sba_remapTCs( float sba_data[][L_FRAME48k], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ diff --git a/lib_dec/ivas_sns_dec.c b/lib_dec/ivas_sns_dec.c index adcfe88186..dec6d85252 100644 --- a/lib_dec/ivas_sns_dec.c +++ b/lib_dec/ivas_sns_dec.c @@ -182,11 +182,11 @@ void sns_avq_dec( *-------------------------------------------------------------------*/ void sns_avq_dec_stereo( - int16_t *indexl, /* i : Quantization indices (left channel) */ - int16_t *indexr, /* i : Quantization indices (right channe) */ - const int16_t L_frame, - float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ - float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ + int16_t *indexl, /* i : Quantization indices (left channel) */ + int16_t *indexr, /* i : Quantization indices (right channe) */ + const int16_t L_frame, /* i : frame length */ + float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ + float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ) { int16_t i, stereo_mode; @@ -232,6 +232,13 @@ void sns_avq_dec_stereo( return; } + +/*------------------------------------------------------------------- + * dequantize_sns() + * + * Dequantize SNS + *-------------------------------------------------------------------*/ + void dequantize_sns( int16_t indices[CPE_CHANNELS][NPRM_LPC_NEW], float snsQ_out[CPE_CHANNELS][NB_DIV][M], @@ -293,4 +300,6 @@ void dequantize_sns( } } } + + return; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 686a4b6da7..b351338244 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -289,82 +289,82 @@ void IVAS_DEC_Close( /*---------------------------------------------------------------------* - * mapOutputFormat() + * mapOutputConfig() * * *---------------------------------------------------------------------*/ -static AUDIO_CONFIG mapOutputFormat( - const IVAS_DEC_AUDIO_CONFIG outputFormat ) +static AUDIO_CONFIG mapOutputConfig( + const IVAS_DEC_AUDIO_CONFIG outputConfig_api ) { AUDIO_CONFIG output_config; - if ( outputFormat == IVAS_DEC_OUTPUT_EXT ) /* external renderer */ + if ( outputConfig_api == IVAS_DEC_OUTPUT_EXT ) /* external renderer */ { output_config = AUDIO_CONFIG_EXTERNAL; } - else if ( outputFormat == IVAS_DEC_OUTPUT_MONO ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_MONO ) { output_config = AUDIO_CONFIG_MONO; } - else if ( outputFormat == IVAS_DEC_OUTPUT_STEREO ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_STEREO ) { output_config = AUDIO_CONFIG_STEREO; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1 ) { output_config = AUDIO_CONFIG_5_1; } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_7_1 ) { output_config = AUDIO_CONFIG_7_1; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_2 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1_2 ) { output_config = AUDIO_CONFIG_5_1_2; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_4 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1_4 ) { output_config = AUDIO_CONFIG_5_1_4; } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1_4 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_7_1_4 ) { output_config = AUDIO_CONFIG_7_1_4; } - else if ( outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_LS_CUSTOM ) { output_config = AUDIO_CONFIG_LS_CUSTOM; } - else if ( outputFormat == IVAS_DEC_OUTPUT_FOA ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_FOA ) { output_config = AUDIO_CONFIG_FOA; } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA2 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_HOA2 ) { output_config = AUDIO_CONFIG_HOA2; } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA3 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_HOA3 ) { output_config = AUDIO_CONFIG_HOA3; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL ) { output_config = AUDIO_CONFIG_BINAURAL; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR ) { output_config = AUDIO_CONFIG_BINAURAL_ROOM_IR; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { output_config = AUDIO_CONFIG_BINAURAL_ROOM_REVERB; } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } @@ -419,7 +419,7 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const IVAS_DEC_AUDIO_CONFIG outputConfig, /* i : output configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -446,8 +446,8 @@ ivas_error IVAS_DEC_Configure( return IVAS_ERR_WRONG_PARAMS; } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputFormat == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || - ( outputFormat == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputConfig == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || + ( outputConfig == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) { return IVAS_ERR_WRONG_MODE; } @@ -456,7 +456,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig = st_ivas->hDecoderConfig; - hDecoderConfig->output_config = mapOutputFormat( outputFormat ); + hDecoderConfig->output_config = mapOutputConfig( outputConfig ); if ( hDecoderConfig->output_config == AUDIO_CONFIG_INVALID ) { return IVAS_ERR_WRONG_PARAMS; @@ -470,7 +470,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = 1; } - if ( outputFormat != IVAS_DEC_OUTPUT_EXT && outputFormat != IVAS_DEC_OUTPUT_LS_CUSTOM ) + if ( outputConfig != IVAS_DEC_OUTPUT_EXT && outputConfig != IVAS_DEC_OUTPUT_LS_CUSTOM ) { hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 9edc1a130c..78343f090a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -144,7 +144,7 @@ ivas_error IVAS_DEC_Open( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const IVAS_DEC_AUDIO_CONFIG outputConfig, /* i : output configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index ed43af153d..7cccef4592 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -502,7 +502,7 @@ ivas_error ivas_ism_metadata_enc( /* But send the flag with 1 bit */ push_next_indice( hBstr, hParamIsm->flag_noisy_speech, 1 ); - /* Loop over multiwave to write the object indices into bistream */ + /* Loop over multiwave to write the object indices into bitstream */ for ( ch = 0; ch < MAX_PARAM_ISM_WAVE; ch++ ) { for ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) @@ -514,7 +514,7 @@ ivas_error ivas_ism_metadata_enc( } } - /* Loop over bands to write the power ratio's indices into bistream */ + /* Loop over bands to write the power ratio's indices into bitstream */ for ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) { for ( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index ec8c22bcd9..76e366188e 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -1943,11 +1943,12 @@ static void copy_masa_metadata( * Compare the similarity of MASA metadata in two sub-frames *-------------------------------------------------------------------*/ +/* r: similarity decision */ static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ - const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ + const uint8_t sf2_idx /* i : index of the subframe of frame2 to inspect */ ) { uint8_t num_dir; diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 5c50c3d6bd..d8d75dbfe1 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -546,8 +546,8 @@ static void quantize_alpha( int16_t nq; const float *data; - nq = alpha_quant_table[quant_type].nquant; - data = alpha_quant_table[quant_type].data; + nq = ivas_param_upmx_alpha_quant_table[quant_type].nquant; + data = ivas_param_upmx_alpha_quant_table[quant_type].data; quantize_pars( nv, alpha, nq, data, aq, adeq ); @@ -567,7 +567,7 @@ static void quantize_beta( float *bdeq ) { int16_t iv, iq, iq0, iq1; - ACPL_QUANT_TABLE *tables = beta_quant_table[quant_type]; + const ACPL_QUANT_TABLE *tables = ivas_param_upmx_beta_quant_table[quant_type]; ACPL_QUANT_TABLE quant_table; for ( iv = 0; iv < nv; iv++ ) @@ -602,7 +602,7 @@ static void quantize_beta( } } - *pnq = beta_quant_table[quant_type][0].nquant; + *pnq = ivas_param_upmx_beta_quant_table[quant_type][0].nquant; return; } diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 5e051e41b7..9e2412c87d 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -76,7 +76,7 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ); +static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi ); static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -757,7 +757,7 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc->extMetadataApi ) ) != IVAS_ERR_OK ) { return error; } @@ -1737,7 +1737,7 @@ static ivas_error setBitrate( if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc->extMetadataApi ) ) != IVAS_ERR_OK ) { return error; } @@ -1978,7 +1978,7 @@ static ivas_error sanitizeBandwidth( static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, - const IVAS_ENC_HANDLE hIvasEnc ) + const bool extMetadataApi ) { if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) { @@ -2010,7 +2010,7 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } - if ( hIvasEnc->extMetadataApi ) + if ( extMetadataApi ) { hEncoderConfig->ism_extended_metadata_flag = ( hEncoderConfig->ivas_total_brate >= ISM_EXTENDED_METADATA_BRATE ); } diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 4a11f1b61f..c035ef5ac4 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -381,7 +381,7 @@ void pre_proc( } else if ( st->rf_mode && st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40 ) { - /* the RF config is for (n- fec_offset)th frame that will be packed along with the n-th frame bistream */ + /* the RF config is for (n- fec_offset)th frame that will be packed along with the n-th frame bitstream */ st->rf_mode = 1; st->codec_mode = MODE2; diff --git a/lib_enc/set_impulse.c b/lib_enc/set_impulse.c index 4cafeea9e8..2c8a7fdd08 100644 --- a/lib_enc/set_impulse.c +++ b/lib_enc/set_impulse.c @@ -61,10 +61,10 @@ static void convolve_tc2( const float g[], const float h[], float y[], const int /*---------------------------------------------------------------------------------------* * Function set_impulse() for TC * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * Builds glottal codebook contribution based on glotal impulses positions finding. * + * Builds glottal codebook contribution based on glottal impulses positions finding. * * * - * Returns a position of the glotal impulse center and * - * a number of the glotal impulse shape. * + * Returns a position of the glottal impulse center and * + * a number of the glottal impulse shape. * * * * |----| |----| xn * * imp_pos-> || | imp_shape-> | g1 | | * @@ -89,7 +89,7 @@ void set_impulse( float exc[], /* o : adaptive codebook excitation */ float y1[], /* o : filtered adaptive codebook excitation */ int16_t *imp_shape, /* o : adaptive codebook index */ - int16_t *imp_pos, /* o : position of the glotal impulse center index */ + int16_t *imp_pos, /* o : position of the glottal impulse center index */ float *gain_trans /* o : transition gain */ ) { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e333043560..6449e90299 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -53,7 +53,7 @@ * Initialize hHrtf handle *------------------------------------------------------------------------*/ -static ivas_error ivas_hrtf_init( +ivas_error ivas_hrtf_init( HRTFS_DATA *hHrtf /* i/o: HRTF handle */ ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7b345e6910..08b22ea94b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -843,6 +843,10 @@ void ivas_rend_closeCrend( #endif ); +ivas_error ivas_hrtf_init( + HRTFS_DATA *hHrtf /* i/o: HRTF handle */ +); + ivas_error ivas_rend_initCrendWrapper( CREND_WRAPPER_HANDLE *pCrend #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index df2c5c66f3..0793f91f8c 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -678,51 +678,6 @@ ivas_error dealloc_HRTF_binary( } -/*------------------------------------------------------------------------- - * ivas_hrtf_init() - * - * Initialize hHRTF handle - *------------------------------------------------------------------------*/ - -static ivas_error ivas_hrtf_init( - HRTFS_DATA *hHRTF /* i/o: HRTF handle */ -) -{ - int16_t i, j; - - if ( hHRTF == NULL ) - { - return IVAS_ERR_WRONG_PARAMS; - } - - hHRTF->latency_s = 0; - hHRTF->max_num_ir = 0; - hHRTF->max_num_iterations = 0; - hHRTF->index_frequency_max_diffuse = 0; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hHRTF->inv_diffuse_weight[i] = 0; - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHRTF->num_iterations[i][j] = 0; - hHRTF->pIndex_frequency_max[i][j] = NULL; - hHRTF->pOut_to_bin_re[i][j] = NULL; - hHRTF->pOut_to_bin_im[i][j] = NULL; - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHRTF->num_iterations_diffuse[j] = 0; - hHRTF->pIndex_frequency_max_diffuse[j] = NULL; - hHRTF->pOut_to_bin_diffuse_re[j] = NULL; - hHRTF->pOut_to_bin_diffuse_im[j] = NULL; - } - - return IVAS_ERR_OK; -} - - /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() * -- GitLab From d0ea56d3a350515c95d6f8ee4cd4f06804e676aa Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 2 Aug 2023 09:23:06 +0200 Subject: [PATCH 2/8] add exit codes --- apps/decoder.c | 63 ++++++++++++++----------- apps/renderer.c | 5 ++ lib_util/split_render_file_read_write.c | 5 ++ 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 8b30b25f2d..cb46245718 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "options.h" #include "lib_dec.h" #include "cmdl_tools.h" @@ -1608,13 +1607,19 @@ static ivas_error initOnFirstGoodFrame( { 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 @@ -1623,13 +1628,17 @@ static ivas_error initOnFirstGoodFrame( { 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 @@ -1756,30 +1765,30 @@ static ivas_error initOnFirstGoodFrame( if ( numInitialBadFrames > 0 ) { #endif - /* Duplicate good first frame metadata to fill the beginning of stream. */ - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; + /* Duplicate good first frame metadata to fill the beginning of stream. */ + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; #ifdef FIX_470_MASA_JBM_EXT - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - return error; - } - - for ( int16_t j = 0; j < numInitialBadFrames; ++j ) - { - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } - } + + for ( int16_t j = 0; j < numInitialBadFrames; ++j ) + { + if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + return error; + } + } #ifdef MASA_AND_OBJECTS - } + } #endif - } + } } return IVAS_ERR_OK; @@ -2235,7 +2244,7 @@ static ivas_error decodeG192( for ( i = 0; i < numObj; i++ ) { fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } + } fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } #endif @@ -3434,7 +3443,7 @@ static ivas_error decodeVariableSpeed( for ( i = 0; i < numObj; i++ ) { fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } + } fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } #endif diff --git a/apps/renderer.c b/apps/renderer.c index 17c84d9b81..a6cf81b63a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3653,8 +3653,10 @@ static void convertInputBuffer( { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + numFloatPcmSamples = numFloatSamplesPerChannel >> 1; numCldfbBands = numFloatPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Analysis*/ assert( numIntSamplesPerChannel <= MAX_OUTPUT_CHANNELS * L_FRAME48k ); for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) @@ -3673,6 +3675,7 @@ static void convertInputBuffer( ++i; } } + for ( chnl = 0; chnl < numChannels; ++chnl ) { for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) @@ -3742,8 +3745,10 @@ static void convertOutputBuffer( float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + numPcmSamples = numSamplesPerChannel >> 1; numCldfbBands = numPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Synthesis*/ for ( chnl = 0; chnl < numChannels; ++chnl ) { diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index b596a5781c..c993f51349 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -110,6 +110,11 @@ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite size_t header_len, h; char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; + if ( filename == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); hSplitRendFileReadWrite->file = fopen( filename, "wb" ); if ( hSplitRendFileReadWrite->file == NULL ) -- GitLab From 7c672fe0c3e7c09904044edf1f547ae507e889a1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 3 Aug 2023 15:16:49 +0200 Subject: [PATCH 3/8] add malloc() return errors --- lib_dec/ivas_init_dec.c | 4 ++-- lib_rend/ivas_dirac_ana.c | 15 ++++++++++++--- lib_rend/ivas_limiter.c | 21 ++++++++++++++------- lib_rend/ivas_prot_rend.h | 5 +++-- lib_rend/lib_rend.c | 12 ++++++------ 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 73c66b5379..ab845217b6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1865,9 +1865,9 @@ ivas_error ivas_init_decoder( * Allocate and initialize limiter struct *-----------------------------------------------------------------*/ - if ( ( st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ) ) == NULL ) + if ( ( error = ivas_limiter_open( &st_ivas->hLimiter, hDecoderConfig->nchan_out, output_Fs ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + return error; } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index 6d2b8861bb..dc41207be4 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -109,11 +109,17 @@ ivas_error ivas_dirac_ana_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hDirAC->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hDirAC->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hDirAC->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); } } @@ -122,7 +128,10 @@ ivas_error ivas_dirac_ana_open( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hDirAC->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); } } diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 106c433034..0953e8a825 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -101,9 +101,10 @@ static int16_t detect_strong_saturations( *-------------------------------------------------------------------*/ /*! r : limiter struct handle */ -IVAS_LIMITER_HANDLE ivas_limiter_open( - const int16_t max_num_channels, /* i : maximum number of I/O channels to be processed */ - const int32_t sampling_rate /* i : sampling rate for processing */ +ivas_error ivas_limiter_open( + IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ + const int16_t max_num_channels, /* i : maximum number of I/O channels to be processed */ + const int32_t sampling_rate /* i : sampling rate for processing */ ) { int16_t i; @@ -111,17 +112,21 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( if ( max_num_channels <= 0 || sampling_rate <= 0 ) { - return NULL; + return ( IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong parameters for Limiter\n" ) ); } if ( ( hLimiter = malloc( sizeof( IVAS_LIMITER ) ) ) == NULL ) { - return NULL; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Limiter handle\n" ) ); } hLimiter->max_num_channels = max_num_channels; hLimiter->num_channels = max_num_channels; - hLimiter->channel_ptrs = malloc( max_num_channels * sizeof( float * ) ); + + if ( ( hLimiter->channel_ptrs = malloc( max_num_channels * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Limiter handle\n" ) ); + } hLimiter->sampling_rate = sampling_rate; hLimiter->gain = 1.f; hLimiter->release_heuristic = 0.f; @@ -136,7 +141,9 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( hLimiter->channel_ptrs[i] = NULL; } - return hLimiter; + *hLimiter_out = hLimiter; + + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 16f9891915..da67c51932 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -80,8 +80,9 @@ void ivas_output_init( * Limiter prototypes *----------------------------------------------------------------------------------*/ -/*! r: limiter struct handle */ -IVAS_LIMITER_HANDLE ivas_limiter_open( + +ivas_error ivas_limiter_open( + IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ const int16_t num_channels, /* i : number of I/O channels */ const int32_t sampling_rate /* i : sampling rate for processing */ ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e30368606a..d8b9657ad2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -790,10 +790,10 @@ static ivas_error initLimiter( const int16_t numChannels, const int32_t sampleRate ) { + ivas_error error; + /* If re-initializing with unchanged values, return early */ - if ( *phLimiter != NULL && - ( *phLimiter )->num_channels == numChannels && - ( *phLimiter )->sampling_rate == sampleRate ) + if ( *phLimiter != NULL && ( *phLimiter )->num_channels == numChannels && ( *phLimiter )->sampling_rate == sampleRate ) { return IVAS_ERR_OK; } @@ -804,9 +804,9 @@ static ivas_error initLimiter( ivas_limiter_close( phLimiter ); } - if ( ( *phLimiter = ivas_limiter_open( numChannels, sampleRate ) ) == NULL ) + if ( ( error = ivas_limiter_open( phLimiter, numChannels, sampleRate ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + return error; } return IVAS_ERR_OK; @@ -8654,7 +8654,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, td_input, -- GitLab From 6d4be00615b424fc75a4f3bf06d38566ef14b63b Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 4 Aug 2023 13:21:07 +0200 Subject: [PATCH 4/8] addition of "goto cleanup;" --- apps/decoder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 5f1844ae12..af4a13baa1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -675,6 +675,7 @@ int main( if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); + goto cleanup; } IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; @@ -687,6 +688,7 @@ int main( if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); + goto cleanup; } } -- GitLab From 37be0604388c84d4c9d7e757dffd2c6ba6224bc5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 8 Aug 2023 10:08:09 +0200 Subject: [PATCH 5/8] define local functions as "static" + correct comments --- lib_dec/lib_dec.c | 49 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index cc675bfc5b..6715d6fa4b 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -97,7 +97,7 @@ struct IVAS_DEC /*---------------------------------------------------------------------* - * Local functions + * Local function declarations *---------------------------------------------------------------------*/ static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); @@ -107,14 +107,8 @@ static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, c static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); -static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); -static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); -static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); -static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); -static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, int16_t *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); + /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -180,6 +174,7 @@ ivas_error IVAS_DEC_Open( /* initialize Decoder Config. handle */ init_decoder_config( hIvasDec->st_ivas->hDecoderConfig ); + /* initialize pointers to handles to NULL */ ivas_initialize_handles_dec( st_ivas ); @@ -872,7 +867,7 @@ ivas_error IVAS_DEC_GetSamples( /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * - * Main function to decode to PCM data of the transport channels + * *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_Setup( @@ -940,7 +935,7 @@ static ivas_error IVAS_DEC_Setup( * Main function to decode to PCM data of the transport channels *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_GetTcSamples( +static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ float *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ @@ -992,7 +987,7 @@ ivas_error IVAS_DEC_GetTcSamples( * Main function to decode to PCM data of the transport channels *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_RendererFeedTcSamples( +static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call */ @@ -1024,10 +1019,10 @@ ivas_error IVAS_DEC_RendererFeedTcSamples( /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderedSamples( ) * - * Main function to decode to PCM data of the transport channels + * Main function to render the transport channels to PCM output datat *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_GetRenderedSamples( +static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ @@ -1057,7 +1052,14 @@ ivas_error IVAS_DEC_GetRenderedSamples( return error; } -ivas_error IVAS_DEC_GetBufferedNumberOfSamples( + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetBufferedNumberOfSamples( ) + * + * Returns the number of objects available in the decoded bitstream + *---------------------------------------------------------------------*/ + +static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ int16_t *nSamplesBuffered /* o : number of samples still buffered */ ) @@ -1279,6 +1281,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedHeadTrackData( ) * @@ -1341,6 +1344,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefRotData( ) * @@ -1369,6 +1373,7 @@ ivas_error IVAS_DEC_FeedRefRotData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefVectorData( ) * @@ -1379,8 +1384,8 @@ ivas_error IVAS_DEC_FeedRefRotData( ivas_error IVAS_DEC_FeedRefVectorData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ) { ivas_orient_trk_state_t *pOtr; @@ -1391,9 +1396,11 @@ ivas_error IVAS_DEC_FeedRefVectorData( } pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedExternalOrientationData( ) * @@ -1438,6 +1445,7 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) * @@ -3169,6 +3177,13 @@ ivas_error IVAS_DEC_GetSbaDebugParams( #endif /* DEBUGGING */ + +/*---------------------------------------------------------------------* + * input_format_API_to_internal() + * + * + *---------------------------------------------------------------------*/ + static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, @@ -3249,7 +3264,7 @@ static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( * *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_VoIP_reconfigure( +static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ) -- GitLab From e858538dccb0fd98b90d2bf0802cce732fc54d21 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 8 Aug 2023 10:45:57 +0200 Subject: [PATCH 6/8] clang-format --- lib_dec/lib_dec.c | 2 +- lib_rend/lib_rend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6715d6fa4b..be759fb589 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -867,7 +867,7 @@ ivas_error IVAS_DEC_GetSamples( /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * - * + * *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_Setup( diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 919ab12ef6..4495c379e7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8671,7 +8671,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t ) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, td_input, -- GitLab From 87582869c351f78faa1736f3a8d9242db363e84d Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 9 Aug 2023 18:22:12 +0200 Subject: [PATCH 7/8] clang-format --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9adb2dab63..7f2ed3d34c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8709,7 +8709,7 @@ ivas_error IVAS_REND_GetSamples( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t ) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, td_input, -- GitLab From a51f6ec6ed5eb9533b717d0c8124feca342c6289 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Aug 2023 21:02:31 +0200 Subject: [PATCH 8/8] correct variable name --- apps/decoder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 94c396e771..595ca6a714 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -142,6 +142,7 @@ typedef struct #endif #ifdef DEBUG_JBM_CMD_OPTION bool noBadFrameDelay; + uint16_t frontendFetchSizeMs; #endif #ifdef VARIABLE_SPEED_DECODING bool variableSpeedMode; @@ -149,11 +150,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 @@ -169,6 +166,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, @@ -177,6 +175,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 @@ -626,7 +625,7 @@ int main( #endif #ifdef CONTROL_METADATA_REVERB - if ( arg.outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) { @@ -644,6 +643,7 @@ int main( renderConfig.room_acoustics.override = true; } #endif + if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); -- GitLab