From 07289e7ead607e79736de0966e794bd41d302f67 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Aug 2025 15:41:00 +0200 Subject: [PATCH] port MRs --- apps/decoder.c | 14 ++- lib_com/options.h | 1 + lib_dec/lib_dec.h | 4 + lib_dec/lib_dec_fx.c | 251 +++++++++++++++++++++++++++++++------------ 4 files changed, 202 insertions(+), 68 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index b75a280e5..95b39a5b2 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -459,7 +459,19 @@ int main( } } +#ifdef FIX_VOIP_FUNCTIONS + /*-----------------------------------------------------------------* + * Print config information + *-----------------------------------------------------------------*/ + + if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } +#else IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ); +#endif /*-------------------------------------------------------------------* * Load renderer configuration from file @@ -537,7 +549,7 @@ int main( if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "\nIVAS_DEC_SetRenderFramesize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } diff --git a/lib_com/options.h b/lib_com/options.h index 031644459..2cc2ae440 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -138,6 +138,7 @@ #define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ #define FIX_1101_CLEANING_JBM_CALL /* VA: issue 1101: remove obsolete call of ivas_jbm_dec_tc_buffer_open() */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ +#define FIX_VOIP_FUNCTIONS /* VA: fix data type mismatch in IVAS_DEC_VoIP_SetScale() + add sanity checks to API functions */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index e4901c6ed..2e8457373 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -436,7 +436,11 @@ const char *IVAS_DEC_GetErrorMessage( ivas_error error /* i : decoder error code enum */ ); +#ifdef FIX_VOIP_FUNCTIONS +ivas_error IVAS_DEC_PrintConfig( +#else void IVAS_DEC_PrintConfig( +#endif const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */ const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */ const bool voipMode diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 651a8fc8b..bd5c953ff 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -152,6 +152,7 @@ ivas_error IVAS_DEC_Open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" ); } + hIvasDec = *phIvasDec; hIvasDec->hVoIP = NULL; hIvasDec->apaExecBuffer_fx = NULL; @@ -197,6 +198,7 @@ ivas_error IVAS_DEC_Open( move16(); move16(); move16(); + /*-----------------------------------------------------------------* * Initialize IVAS-codec decoder state *-----------------------------------------------------------------*/ @@ -453,19 +455,19 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const Word16 tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ - const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ - const Word16 enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const UWord32 sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ + const Word16 tsmEnabled, /* i : enable time scale modification */ + const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ + const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */ + const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */ + const Word16 enableExternalOrientation, /* i : enable external orientations */ + const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */ - const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */ + const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */ const Word16 Opt_dpid_on, /* i : enable directivity pattern option */ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ const Word16 delayCompensationEnabled /* i : enable delay compensation */ @@ -475,8 +477,6 @@ ivas_error IVAS_DEC_Configure( DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; - error = IVAS_ERR_OK; - move32(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -614,9 +614,10 @@ ivas_error IVAS_DEC_Configure( move16(); move16(); - return error; + return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_EnableSplitRendering( ) * @@ -629,6 +630,7 @@ ivas_error IVAS_DEC_EnableSplitRendering( { DECODER_CONFIG_HANDLE hDecoderConfig; + test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -652,7 +654,7 @@ ivas_error IVAS_DEC_EnableSplitRendering( * Get the 5ms flag *---------------------------------------------------------------------*/ -Word16 get_render_frame_size_ms( +static Word16 get_render_frame_size_ms( const IVAS_RENDER_FRAMESIZE render_framesize ) { IF( EQ_16( render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) ) @@ -667,6 +669,7 @@ Word16 get_render_frame_size_ms( { return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 2 ); } + return 0; } @@ -698,7 +701,6 @@ ivas_error IVAS_DEC_SetRenderFramesize( hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_framesize; } - hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize; move16(); @@ -729,6 +731,7 @@ ivas_error IVAS_DEC_GetRenderFramesize( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * @@ -736,11 +739,12 @@ ivas_error IVAS_DEC_GetRenderFramesize( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetRenderFramesizeSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *render_framesize /* o : render framesize in samples Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *render_framesize /* o : render framesize in samples Q0 */ ) { Word16 tmp; + test(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL ) @@ -778,8 +782,8 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetRenderFramesizeMs( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - UWord32 *render_framesize /* o : render framesize in samples Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + UWord32 *render_framesize /* o : render framesize in samples Q0 */ ) { test(); @@ -802,8 +806,8 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetReferencesUpdateFrequency( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - Word16 *update_frequency /* o : update frequency Q0 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + Word16 *update_frequency /* o : update frequency Q0 */ ) { test(); @@ -874,9 +878,6 @@ ivas_error IVAS_DEC_EnableVoIP( DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; - error = IVAS_ERR_OK; - move32(); - test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -934,7 +935,7 @@ ivas_error IVAS_DEC_EnableVoIP( return IVAS_ERR_FAILED_ALLOC; } - return error; + return IVAS_ERR_OK; } @@ -1312,23 +1313,8 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Word32 *pOutput[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES]; Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - - FOR( Word32 i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ ) - { - FOR( Word32 j = 0; j < CLDFB_NO_COL_MAX; j++ ) - { - FOR( Word32 k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) - { - Cldfb_RealBuffer_Binaural[i][j][k] = 0; - Cldfb_ImagBuffer_Binaural[i][j][k] = 0; - move32(); - move32(); - } - } - } - Word16 numSamplesPerChannelToDecode; - Word16 i, j; + Word16 i, j, k; ivas_error error; ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; Word16 max_band; @@ -1339,7 +1325,14 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Word16 ro_md_flag; IVAS_QUATERNION Quaternion; - error = IVAS_ERR_OK; +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif st_ivas = hIvasDec->st_ivas; output_config = st_ivas->hDecoderConfig->output_config; output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -1348,11 +1341,25 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( *needNewFrame = false; hSplitBinRend = st_ivas->hSplitBinRend; - if ( ( error = isar_set_split_rend_setup( hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) + IF( ( error = isar_set_split_rend_setup( hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) { return error; } + FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ ) + { + FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) + { + FOR( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + { + Cldfb_RealBuffer_Binaural[i][j][k] = 0; + Cldfb_ImagBuffer_Binaural[i][j][k] = 0; + move32(); + move32(); + } + } + } + FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ ) { FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ ) @@ -1381,6 +1388,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return IVAS_ERR_WRONG_PARAMS; } + test(); IF( st_ivas->hTcBuffer == NULL || hIvasDec->hasBeenFedFrame ) { slots_rendered = 0; @@ -1388,11 +1396,12 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( ELSE { /* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */ + test(); IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); // TODO remove division } - else + ELSE { slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; } @@ -1766,7 +1775,6 @@ static ivas_error IVAS_DEC_GetTcSamples( Decoder_Struct *st_ivas; ivas_error error; - test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1959,6 +1967,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( { *nSamplesBuffered = 0; move16(); + test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1990,6 +1999,7 @@ ivas_error IVAS_DEC_GetNumObjects( { #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT Word16 is_masa_ism; + is_masa_ism = 0; move16(); #endif @@ -2047,6 +2057,14 @@ ivas_error IVAS_DEC_GetFormat( IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */ ) { +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif IF( hIvasDec->hasDecodedFirstGoodFrame ) { *format = mapIvasFormat( hIvasDec->st_ivas->ivas_format ); @@ -2148,6 +2166,14 @@ ivas_error IVAS_DEC_GetNumOutputChannels( Word16 *numOutputChannels /* o : number of PCM output channels */ ) { +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif IF( hIvasDec->hasDecodedFirstGoodFrame ) { *numOutputChannels = hIvasDec->st_ivas->hDecoderConfig->nchan_out; @@ -2491,8 +2517,10 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + orientation.q_fact = Q29; move16(); + /* Move external orientation data to the decoder handle (invert orientations) */ QuaternionInverse_fx( orientation, &hExternalOrientationData->Quaternions[subframe_idx] ); @@ -2668,6 +2696,7 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfStatisticsHandle( ) * @@ -2689,6 +2718,7 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * copyRendererConfigStruct( ) * @@ -2752,14 +2782,16 @@ ivas_error IVAS_DEC_GetRenderConfig( return copyRendererConfigStruct( hIvasDec->st_ivas->hRenderConfig, hRCout ); } + /*! r: error code*/ ivas_error IVAS_DEC_GetDefaultRenderConfig( - IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ + IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ ) { RENDER_CONFIG_DATA RCin; RENDER_CONFIG_HANDLE hRCin = &RCin; ivas_error error; + IF( NE_32( ( error = ivas_render_config_init_from_rom_fx( &hRCin ) ), IVAS_ERR_OK ) ) { return error; @@ -3051,7 +3083,7 @@ static bool isSidFrame( static void bsCompactToSerial( const UWord8 *compact, UWord16 *serial, - UWord16 num_bits ) + const UWord16 num_bits ) { /* Bitstream conversion is not counted towards complexity and memory usage */ #define WMC_TOOL_SKIP @@ -3105,16 +3137,25 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( Word16 partialCopyFrameType, partialCopyOffset; Word16 result; +#ifdef FIX_VOIP_FUNCTIONS + test(); + test(); + IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || au == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif IF( auSize == 0 ) { return IVAS_ERR_OK; /* ignore empty/NO_DATA frame - shouldn't be transmitted in RTP */ } + IF( GT_16( shr( add( auSize, 7 ), 3 ), (Word16) MAX_AU_SIZE ) ) { return IVAS_ERR_INVALID_BITSTREAM; } - partialCopyFrameType = 0; move16(); partialCopyOffset = 0; @@ -3194,6 +3235,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * @@ -3206,12 +3248,15 @@ ivas_error IVAS_DEC_VoIP_SetScale( const Word16 scale /* i : TSM scale to set in percent of the default frame size */ ) { - ivas_error error; - - error = IVAS_ERR_OK; - move32(); +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) +#endif + IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; } @@ -3223,26 +3268,39 @@ ivas_error IVAS_DEC_VoIP_SetScale( move16(); } - return error; + return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_SetScale( ) + * IVAS_DEC_TSM_SetQuality( ) + * + * set the quality theshold for the time scale modiciation that is used + * to determine if the TSM yielded a signal that satisfies the minimum + * quality requirements. + * quality is lower limit for minimum quality + * Range is [-2;2] - where positive values allow + * only pasting with same phase information + * Negative values would yield cross phased pasting + * When not setting the minimum quality with this function the default + * value used is 1.0f * - * Set the TSM scale *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_TSM_SetQuality( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const Word16 quality /* i : target TSM quality Q14 */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const Word16 quality /* i : target TSM quality Q14 */ ) { - ivas_error error; - - error = IVAS_ERR_OK; - move32(); +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } - IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) +#endif + IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; } @@ -3252,7 +3310,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( move16(); } - return error; + return IVAS_ERR_OK; } @@ -3285,6 +3343,15 @@ ivas_error IVAS_DEC_VoIP_GetSamples( Word16 nSamplesRendered; UWord8 nOutChannels; +#ifdef FIX_VOIP_FUNCTIONS + test(); + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; @@ -3468,6 +3535,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * update_voip_rendered20ms( ) * @@ -3479,7 +3547,9 @@ static void update_voip_rendered20ms( const Word16 nSamplesRendered ) { Word16 nSamplesRenderedTotal; + nSamplesRenderedTotal = add( hIvasDec->hVoIP->nSamplesRendered20ms, nSamplesRendered ); + /* we have crossed a 20ms border, reset the time scaling done flag */ IF( GE_16( nSamplesRenderedTotal, hIvasDec->hVoIP->nSamplesFrame ) ) { @@ -3494,6 +3564,8 @@ static void update_voip_rendered20ms( { hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame ); } + + return; } @@ -3514,6 +3586,14 @@ ivas_error IVAS_DEC_Flush( UWord16 nSamplesToRender; UWord16 nSamplesFlushedLocal; +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif *nSamplesFlushed = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); move16(); @@ -3522,6 +3602,7 @@ ivas_error IVAS_DEC_Flush( /* render IVAS frames */ error = IVAS_ERR_OK; + move16(); test(); IF( GT_16( nSamplesToRender, 0 ) && NE_16( (Word16) hIvasDec->st_ivas->ivas_format, (Word16) MONO_FORMAT ) ) @@ -3548,6 +3629,14 @@ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const Word16 nSamplesAsked ) { +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif test(); return ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 && LT_16( hIvasDec->nSamplesAvailableNext, nSamplesAsked ) ); } @@ -3669,7 +3758,13 @@ ivas_error IVAS_DEC_GetJbmData( ) { +#ifdef FIX_VOIP_FUNCTIONS + test(); + test(); + IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || JbmTraceData == NULL ) +#else IF( hIvasDec->hVoIP == NULL ) +#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -3899,14 +3994,30 @@ static ivas_error printConfigInfo_dec( * Print decoder set-up info *---------------------------------------------------------------------*/ +#ifdef FIX_VOIP_FUNCTIONS +ivas_error IVAS_DEC_PrintConfig( +#else void IVAS_DEC_PrintConfig( +#endif const IVAS_DEC_HANDLE hIvasDec, const bool quietModeEnabled, const bool voipMode ) { +#ifdef FIX_VOIP_FUNCTIONS + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + +#endif printConfigInfo_dec( hIvasDec->st_ivas, hIvasDec->bitstreamformat, voipMode, quietModeEnabled ); +#ifdef FIX_VOIP_FUNCTIONS + return IVAS_ERR_OK; +#else return; +#endif } @@ -4224,10 +4335,11 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader( ISAR_SPLIT_REND_CODEC *pCodec, /* o : pointer to codec setting */ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o : pointer to pose correction mode */ Word16 *pIsar_frame_size_ms, /* o : pointer to ISAR frame size setting */ - Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ + Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */ Word16 *pLc3plusHighRes ) { - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + test(); + IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -4259,6 +4371,8 @@ ivas_error IVAS_DEC_GetCldfbSamples( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; Word16 ch, b, slot_idx, num_chs, maxBand, num_samples; + test(); + test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hSplitBinRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -4370,6 +4484,7 @@ int16_t IVAS_DEC_is_split_rendering_enabled( { Decoder_Struct *st_ivas; + test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -4449,6 +4564,7 @@ static ivas_error ivas_dec_reconfig_split_rend( move16(); } + test(); IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL ) { IF( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL ) @@ -4597,6 +4713,7 @@ Word16 IVAS_DEC_is_split_rendering_coded_out( { Decoder_Struct *st_ivas; + test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; -- GitLab