Loading apps/decoder.c +13 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -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 ############################ */ Loading lib_dec/lib_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -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 Loading lib_dec/lib_dec_fx.c +184 −67 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -197,6 +198,7 @@ ivas_error IVAS_DEC_Open( move16(); move16(); move16(); /*-----------------------------------------------------------------* * Initialize IVAS-codec decoder state *-----------------------------------------------------------------*/ Loading Loading @@ -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 ) { Loading Loading @@ -614,9 +614,10 @@ ivas_error IVAS_DEC_Configure( move16(); move16(); return error; return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_EnableSplitRendering( ) * Loading @@ -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; Loading @@ -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 ) ) Loading @@ -667,6 +669,7 @@ Word16 get_render_frame_size_ms( { return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 2 ); } return 0; } Loading Loading @@ -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(); Loading Loading @@ -729,6 +731,7 @@ ivas_error IVAS_DEC_GetRenderFramesize( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * Loading @@ -741,6 +744,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( ) { Word16 tmp; test(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL ) Loading Loading @@ -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 ) { Loading Loading @@ -934,7 +935,7 @@ ivas_error IVAS_DEC_EnableVoIP( return IVAS_ERR_FAILED_ALLOC; } return error; return IVAS_ERR_OK; } Loading Loading @@ -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; Loading @@ -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; Loading @@ -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++ ) Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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 ) { Loading Loading @@ -1959,6 +1967,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( { *nSamplesBuffered = 0; move16(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { Loading Loading @@ -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 Loading Loading @@ -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 ); Loading Loading @@ -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; Loading Loading @@ -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] ); Loading Loading @@ -2668,6 +2696,7 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfStatisticsHandle( ) * Loading @@ -2689,6 +2718,7 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * copyRendererConfigStruct( ) * Loading Loading @@ -2752,6 +2782,7 @@ 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 */ Loading @@ -2760,6 +2791,7 @@ ivas_error IVAS_DEC_GetDefaultRenderConfig( 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; Loading Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -3194,6 +3235,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * Loading @@ -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; } Loading @@ -3223,13 +3268,23 @@ 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( Loading @@ -3237,12 +3292,15 @@ ivas_error IVAS_DEC_TSM_SetQuality( 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; } Loading @@ -3252,7 +3310,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( move16(); } return error; return IVAS_ERR_OK; } Loading Loading @@ -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; Loading Loading @@ -3468,6 +3535,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * update_voip_rendered20ms( ) * Loading @@ -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 ) ) { Loading @@ -3494,6 +3564,8 @@ static void update_voip_rendered20ms( { hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame ); } return; } Loading @@ -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(); Loading @@ -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 ) ) Loading @@ -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 ) ); } Loading Loading @@ -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; } Loading Loading @@ -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 } Loading Loading @@ -4227,7 +4338,8 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader( 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; } Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 ) Loading Loading @@ -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; Loading Loading
apps/decoder.c +13 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -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 ############################ */ Loading
lib_dec/lib_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
lib_dec/lib_dec_fx.c +184 −67 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -197,6 +198,7 @@ ivas_error IVAS_DEC_Open( move16(); move16(); move16(); /*-----------------------------------------------------------------* * Initialize IVAS-codec decoder state *-----------------------------------------------------------------*/ Loading Loading @@ -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 ) { Loading Loading @@ -614,9 +614,10 @@ ivas_error IVAS_DEC_Configure( move16(); move16(); return error; return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_EnableSplitRendering( ) * Loading @@ -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; Loading @@ -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 ) ) Loading @@ -667,6 +669,7 @@ Word16 get_render_frame_size_ms( { return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 2 ); } return 0; } Loading Loading @@ -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(); Loading Loading @@ -729,6 +731,7 @@ ivas_error IVAS_DEC_GetRenderFramesize( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesizeSamples( ) * Loading @@ -741,6 +744,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples( ) { Word16 tmp; test(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL ) Loading Loading @@ -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 ) { Loading Loading @@ -934,7 +935,7 @@ ivas_error IVAS_DEC_EnableVoIP( return IVAS_ERR_FAILED_ALLOC; } return error; return IVAS_ERR_OK; } Loading Loading @@ -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; Loading @@ -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; Loading @@ -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++ ) Loading Loading @@ -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; Loading @@ -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; } Loading Loading @@ -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 ) { Loading Loading @@ -1959,6 +1967,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( { *nSamplesBuffered = 0; move16(); test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { Loading Loading @@ -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 Loading Loading @@ -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 ); Loading Loading @@ -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; Loading Loading @@ -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] ); Loading Loading @@ -2668,6 +2696,7 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfStatisticsHandle( ) * Loading @@ -2689,6 +2718,7 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * copyRendererConfigStruct( ) * Loading Loading @@ -2752,6 +2782,7 @@ 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 */ Loading @@ -2760,6 +2791,7 @@ ivas_error IVAS_DEC_GetDefaultRenderConfig( 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; Loading Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -3194,6 +3235,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * Loading @@ -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; } Loading @@ -3223,13 +3268,23 @@ 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( Loading @@ -3237,12 +3292,15 @@ ivas_error IVAS_DEC_TSM_SetQuality( 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; } Loading @@ -3252,7 +3310,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( move16(); } return error; return IVAS_ERR_OK; } Loading Loading @@ -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; Loading Loading @@ -3468,6 +3535,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * update_voip_rendered20ms( ) * Loading @@ -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 ) ) { Loading @@ -3494,6 +3564,8 @@ static void update_voip_rendered20ms( { hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame ); } return; } Loading @@ -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(); Loading @@ -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 ) ) Loading @@ -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 ) ); } Loading Loading @@ -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; } Loading Loading @@ -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 } Loading Loading @@ -4227,7 +4338,8 @@ ivas_error IVAS_DEC_GetSplitRendBitstreamHeader( 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; } Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 ) Loading Loading @@ -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; Loading