From bda4efb2f13c592743a082d17cb5dcb232e23418 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:42:03 +0200 Subject: [PATCH 1/6] accept LIB_DEC_REVISION --- apps/decoder.c | 44 +--- lib_com/ivas_prot.h | 5 - lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 14 - lib_dec/lib_dec.c | 575 +++++------------------------------------ lib_dec/lib_dec.h | 12 - 6 files changed, 62 insertions(+), 589 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index dbd92244de..8030842f85 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -445,18 +445,14 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, - arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } + if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -756,13 +752,11 @@ int main( } pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) ); -#ifdef LIB_DEC_REVISION if ( pcmBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); goto cleanup; } -#endif /*-----------------------------------------------------------------* * Decoding @@ -1064,30 +1058,18 @@ static bool parseCmdlIVAS_dec( if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; i++; } @@ -1237,10 +1219,8 @@ static bool parseCmdlIVAS_dec( { if ( !is_digits_only( argv[i] ) ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error: Render frame size is invalid or not specified!\n\n" ); usage_dec(); -#endif return false; } @@ -1822,15 +1802,6 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifndef LIB_DEC_REVISION - int32_t pcmFrameSize; - - if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error ); - return error; - } -#endif if ( isSplitRend ) { /* Open split rendering metadata writer */ @@ -1888,7 +1859,6 @@ static ivas_error initOnFirstGoodFrame( } } -#ifdef LIB_DEC_REVISION int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { @@ -1896,15 +1866,12 @@ static ivas_error initOnFirstGoodFrame( return error; } -#endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); -#ifdef LIB_DEC_REVISION if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } -#endif memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) @@ -2119,7 +2086,6 @@ static ivas_error decodeG192( int16_t isSplitRend, isSplitCoded; #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION if ( arg.tsmEnabled ) { if ( ( error = IVAS_DEC_EnableTsm( hIvasDec ) ) != IVAS_ERR_OK ) @@ -2129,7 +2095,6 @@ static ivas_error decodeG192( } } -#endif #endif if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK ) { @@ -3445,12 +3410,7 @@ static ivas_error decodeVoIP( { if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#else - fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); - -#endif goto cleanup; } @@ -3462,9 +3422,7 @@ static ivas_error decodeVoIP( if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#endif goto cleanup; } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fb8973884e..fe69a6610a 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -806,12 +806,7 @@ void ivas_apply_non_diegetic_panning( *----------------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_tc( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : output synthesis signals */ -#endif ); ivas_error ivas_jbm_dec_render( diff --git a/lib_com/options.h b/lib_com/options.h index 23a9a303de..5bb6286cd0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define LIB_DEC_REVISION /* VA: cleaning and simplification of lib_dec.c */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 4d381bc980..9d645cd4ed 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -66,12 +66,7 @@ static void ivas_jbm_masa_sf_to_slot_map( Decoder_Struct *st_ivas, const int16_t *--------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_tc( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : transport channel signals */ -#endif ) { int16_t n, output_frame, nchan_out; @@ -731,16 +726,7 @@ ivas_error ivas_jbm_dec_tc( * Write IVAS transport channels *----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm == 0 ) -#else - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) - { - - ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); - } - else -#endif { /* directly copy to tc buffers */ ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 37b50287ad..e238db2e67 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,9 +55,6 @@ struct IVAS_DEC_VOIP { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ -#endif JB4_HANDLE hJBM; uint16_t lastDecodedWasActive; JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ @@ -94,9 +91,6 @@ struct IVAS_DEC bool hasBeenFedFrame; bool updateOrientation; uint16_t nSamplesAvailableNext; -#ifndef LIB_DEC_REVISION - int16_t nSamplesRendered; -#endif int16_t nTransportChannelsOld; int16_t amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ int16_t sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ @@ -114,32 +108,15 @@ struct IVAS_DEC * Local function declarations *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( IVAS_DEC_VOIP *hVoIP ); -#else -static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); -#endif #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif -#ifdef LIB_DEC_REVISION static ivas_error evs_dec_main( Decoder_Struct *st_ivas ); -#else -static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); -#endif 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 ); -#ifdef LIB_DEC_REVISION static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels, const int16_t isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ); -#else -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 ); -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, const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#endif static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType ); static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset ); static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples ); @@ -191,9 +168,6 @@ ivas_error IVAS_DEC_Open( hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; hIvasDec->nSamplesAvailableNext = 0; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesFrame = 0; hIvasDec->hasBeenFedFrame = false; hIvasDec->hasBeenFedFirstGoodFrame = false; @@ -361,11 +335,7 @@ void IVAS_DEC_Close( if ( ( *phIvasDec )->hVoIP ) { -#ifdef LIB_DEC_REVISION ivas_destroy_handle_VoIP( ( *phIvasDec )->hVoIP ); -#else - IVAS_DEC_Close_VoIP( ( *phIvasDec )->hVoIP ); -#endif ( *phIvasDec )->hVoIP = NULL; } @@ -432,7 +402,6 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_UNKOWN; } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * create_flush_buffer() @@ -456,8 +425,6 @@ static ivas_error create_flush_buffer( return IVAS_ERR_OK; } -#endif - /*---------------------------------------------------------------------* * IVAS_DEC_Configure( ) @@ -467,12 +434,9 @@ static ivas_error create_flush_buffer( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable TSM */ -#endif + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -531,9 +495,6 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } -#ifndef LIB_DEC_REVISION - hDecoderConfig->Opt_tsm = (int16_t) tsmEnabled; -#endif hDecoderConfig->Opt_LsCustom = (int16_t) customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = (int16_t) enableHeadRotation; hDecoderConfig->orientation_tracking = orientation_tracking; @@ -581,25 +542,6 @@ ivas_error IVAS_DEC_Configure( } hIvasDec->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesAvailableNext = 0; - hIvasDec->nSamplesRendered = 0; - hIvasDec->tsm_scale = 100; - hIvasDec->tsm_max_scaling = 0; - hIvasDec->tsm_quality = 1.0f; - - /* Init flush buffer if necessary (only needed for binaural)*/ - if ( tsmEnabled && ( outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - if ( hIvasDec->flushbuffer == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate JBM flush buffer" ); - } - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -835,9 +777,6 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; hIvasDec->hVoIP->hCurrentDataUnit = NULL; -#ifndef LIB_DEC_REVISION - hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif hIvasDec->hVoIP->nSamplesRendered20ms = 0; #define WMC_TOOL_SKIP @@ -868,21 +807,12 @@ ivas_error IVAS_DEC_EnableVoIP( } #endif -#ifdef LIB_DEC_REVISION /* init flush buffer (needed for binaural outputs) */ if ( ( error = create_flush_buffer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in create_flush_buffer , code: %d\n", error ); return error; } -#else - if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -972,9 +902,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial( hIvasDec->needNewFrame = false; hIvasDec->hasBeenFedFrame = true; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; return IVAS_ERR_OK; @@ -1255,12 +1182,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { ivas_error error; Decoder_Struct *st_ivas; -#ifdef LIB_DEC_REVISION uint16_t nTimeScalerOutSamples; uint8_t nTransportChannels; int16_t nResidualSamples, nSamplesTcsScaled; bool isInitialized_voip; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1275,13 +1200,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #endif st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION isInitialized_voip = hIvasDec->apaExecBuffer != NULL; -#endif if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ { -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * Setup all decoder parts (IVAS decoder, ISAR) *-----------------------------------------------------------------*/ @@ -1290,34 +1212,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { return error; } -#else - uint16_t l_ts, nTimeScalerOutSamples; - uint8_t nTransportChannels; - int16_t nResidualSamples, nSamplesTcsScaled, nOutSamplesElse; - if ( isSplitRend ) - { - if ( ( error = isar_set_split_rend_setup( st_ivas->hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld ) - { - if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif - -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * IVAS decoder: decode transport channels and metadata *-----------------------------------------------------------------*/ @@ -1343,13 +1238,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { hIvasDec->hasDecodedFirstGoodFrame = true; } -#else - /* IVAS TC decoder */ - if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /*-----------------------------------------------------------------* * JBM @@ -1357,7 +1245,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( if ( st_ivas->hDecoderConfig->Opt_tsm ) { -#ifdef LIB_DEC_REVISION if ( nTransportChannels != hIvasDec->nTransportChannelsOld ) { if ( ( error = apa_setup( hIvasDec, isInitialized_voip, nTransportChannels ) ) != IVAS_ERR_OK ) @@ -1366,16 +1253,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } } -#endif if ( apa_set_scale( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef LIB_DEC_REVISION ivas_syn_output_f( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer ); -#endif if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) { return IVAS_ERR_UNKNOWN; @@ -1394,14 +1278,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( * Feed decoded transport channels samples to the renderer *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ); -#else - if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( st_ivas->hDecoderConfig->Opt_tsm ) { @@ -1913,9 +1790,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( ) { ivas_error error; -#ifndef LIB_DEC_REVISION - int16_t nSamplesToRender; -#endif uint16_t nSamplesRendered, nSamplesRendered_loop; uint8_t nOutChannels; Decoder_Struct *st_ivas; @@ -1997,32 +1871,17 @@ ivas_error IVAS_DEC_GetSamplesRenderer( /* check for possible flushed samples from a rate switch */ if ( hIvasDec->nSamplesFlushed > 0 ) { -#ifndef LIB_DEC_REVISION - void *pPcmBuffer; -#endif #ifdef DEBUGGING assert( hIvasDec->pcmType == pcmType ); #endif -#ifdef LIB_DEC_REVISION /* note: offset (rendered samples) is always 0 */ -#else - pPcmBuffer = pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ); -#endif if ( pcmType == IVAS_DEC_PCM_INT16 ) { -#ifdef LIB_DEC_REVISION mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvs2s( (int16_t *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } else if ( pcmType == IVAS_DEC_PCM_FLOAT ) { -#ifdef LIB_DEC_REVISION mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvr2r( (float *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } #ifdef DEBUGGING else @@ -2030,21 +1889,12 @@ ivas_error IVAS_DEC_GetSamplesRenderer( assert( 0 && "wrong PCM type for the flush buffer!" ); } #endif -#ifdef LIB_DEC_REVISION nSamplesRendered = hIvasDec->nSamplesFlushed; -#else - nSamplesRendered += hIvasDec->nSamplesFlushed; -#endif hIvasDec->nSamplesFlushed = 0; } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesAsked - nSamplesRendered, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - nSamplesToRender = nSamplesAsked - nSamplesRendered; - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2289,7 +2139,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * ivas_dec_setup_all() * @@ -2302,19 +2151,6 @@ static ivas_error ivas_dec_setup_all( const int16_t isSplitRend, /* i : split rendering enabled flag */ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_Setup( ) - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_Setup( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ - uint8_t *nTransportChannels /* o : number of decoded transport PCM channels */ -) -#endif { ivas_error error; @@ -2335,7 +2171,6 @@ static ivas_error IVAS_DEC_Setup( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION /* Setup IVAS split rendering */ if ( isSplitRend ) { @@ -2345,7 +2180,6 @@ static ivas_error IVAS_DEC_Setup( } } -#endif /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling @@ -2363,9 +2197,6 @@ static ivas_error IVAS_DEC_Setup( } *nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; -#ifndef LIB_DEC_REVISION - *nTcBufferGranularity = (uint16_t) st_ivas->hTcBuffer->n_samples_granularity; -#endif /*-----------------------------------------------------------------* * ISAR: @@ -2373,11 +2204,7 @@ static ivas_error IVAS_DEC_Setup( * - reconfigure the ISAR handle in case of bitrate switching (renderer might change) *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->ini_frame == 0 && isSplitRend ) -#else - if ( st_ivas->ini_frame == 0 && ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) ) ) -#endif { if ( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK ) { @@ -2397,146 +2224,6 @@ static ivas_error IVAS_DEC_Setup( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetTcSamples( ) - * - * Main function to decode to PCM data of the transport channels - *---------------------------------------------------------------------*/ - -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 */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - *nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( hIvasDec->mode == IVAS_DEC_MODE_IVAS ) - { - /* run the main IVAS decoding routine */ - if ( ( error = ivas_jbm_dec_tc( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - - hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - } - - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - hIvasDec->hasDecodedFirstGoodFrame = true; - } - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_Rendered_FeedTcSamples( ) - * - * Feed decoded transport channels samples to the renderer - *---------------------------------------------------------------------*/ - -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 */ - 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 */ -) -{ - Decoder_Struct *st_ivas; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* feed the TCs to the IVAS renderer */ - ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ); - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_GetRenderedSamples( ) - * - * Main function to render the transport channels to PCM output data - *---------------------------------------------------------------------*/ - -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 */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renderer pipeline */ - const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ - void *pcmBuf /* o : output synthesis signal */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* run the main IVAS decoding routine */ - error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); - - return error; -} - - -/*---------------------------------------------------------------------* - * 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 */ -) -{ - *nSamplesBuffered = 0; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ - if ( hIvasDec->st_ivas->hTcBuffer != NULL ) - { - *nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered; - *nSamplesBuffered += hIvasDec->hVoIP->nSamplesRendered20ms; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumObjects( ) @@ -2564,6 +2251,7 @@ ivas_error IVAS_DEC_GetNumObjects( is_masa_ism = 1; } } + if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || is_masa_ism ) { *numObjects = hIvasDec->st_ivas->nchan_ism; @@ -3580,35 +3268,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetPcmFrameSize( ) - * - * - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -) -{ - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || pcmFrameSize == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - *pcmFrameSize = hIvasDec->st_ivas->hDecoderConfig->nchan_out * hIvasDec->st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - } - else - { - *pcmFrameSize = 0; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * isSidFrame( ) @@ -3797,7 +3456,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( } #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * IVAS_DEC_EnableTsm( ) @@ -3832,7 +3490,6 @@ ivas_error IVAS_DEC_EnableTsm( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_TSM_SetQuality( ) @@ -3937,19 +3594,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesBuffered = 0; if ( hIvasDec->hasBeenFedFirstGoodFrame ) { -#ifdef LIB_DEC_REVISION /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ if ( st_ivas->hTcBuffer != NULL ) { nSamplesBuffered = st_ivas->hTcBuffer->n_samples_buffered - st_ivas->hTcBuffer->n_samples_rendered; nSamplesBuffered += hVoIP->nSamplesRendered20ms; } -#else - if ( ( error = IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } extBufferedSamples = nSamplesBuffered; @@ -4056,9 +3706,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif } } @@ -4070,9 +3717,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, ( *nSamplesRendered ) * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); *nSamplesRendered += nSamplesToZero; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered += nSamplesToZero; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesToZero; update_voip_rendered20ms( hIvasDec, nSamplesToZero ); } @@ -4086,17 +3730,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame ) { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFlushed_ref = hIvasDec->nSamplesFlushed; -#endif if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, 0, NULL ) ) != IVAS_ERR_OK ) { return error; } -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesFlushed = nSamplesFlushed_ref; -#endif *bitstreamReadDone = false; *parametersAvailableForEditing = true; return IVAS_ERR_OK; @@ -4144,20 +3782,12 @@ static void update_voip_rendered20ms( nSamplesRenderedTotal = hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered; /* we have crossed a 20ms border, reset the time scaling done flag */ -#ifdef LIB_DEC_REVISION if ( nSamplesRenderedTotal >= hIvasDec->nSamplesFrame ) -#else - if ( nSamplesRenderedTotal >= hIvasDec->hVoIP->nSamplesFrame ) -#endif { hIvasDec->timeScalingDone = 0; } -#ifdef LIB_DEC_REVISION hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->nSamplesFrame; -#else - hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; -#endif return; } @@ -4194,11 +3824,7 @@ ivas_error IVAS_DEC_Flush( error = IVAS_ERR_OK; if ( nSamplesToRender > 0 && hIvasDec->st_ivas->ivas_format != MONO_FORMAT ) { -#ifdef LIB_DEC_REVISION error = ivas_jbm_dec_render( hIvasDec->st_ivas, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); -#else - error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf ); -#endif } else { @@ -4258,11 +3884,7 @@ ivas_error IVAS_DEC_VoIP_Get_CA_offset( * Deallocate VoIP handle *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( -#else -static void IVAS_DEC_Close_VoIP( -#endif IVAS_DEC_VOIP *hVoIP /* i/o: VoIP decoder handle */ ) { @@ -4669,31 +4291,18 @@ void IVAS_DEC_PrintDisclaimer( void ) *---------------------------------------------------------------------*/ static ivas_error evs_dec_main( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i : IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, - const int16_t nOutSamples, - float *floatBuf, - int16_t *pcmBuf -#endif ) { DEC_CORE_HANDLE *hCoreCoder; float mixer_left, mixer_rigth; float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#ifdef LIB_DEC_REVISION int16_t ch, nOutSamples; -#else - int16_t ch; -#endif ivas_error error; hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifdef LIB_DEC_REVISION nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif mdct_switching_dec( hCoreCoder[0] ); @@ -4755,7 +4364,6 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm ) { /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ @@ -4775,32 +4383,6 @@ static ivas_error evs_dec_main( { ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); } -#else - if ( !st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); - } - else if ( floatBuf != NULL ) - { - /* BE workaround */ - int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; - - /* convert 'float' output data to 'short' */ -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcm_buf_local ); - - mvs2r( pcm_buf_local, floatBuf, nOutSamples * st_ivas->hDecoderConfig->nchan_out ); - } - else - { -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); - } -#endif return IVAS_ERR_OK; } @@ -5000,7 +4582,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * apa_setup() * @@ -5011,122 +4592,88 @@ static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_reconfigure() - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_VoIP_reconfigure( - IVAS_DEC_HANDLE hIvasDec, - const uint16_t nTransportChannels, - const uint16_t l_ts ) -#endif { int16_t apa_buffer_size; -#ifdef LIB_DEC_REVISION uint16_t l_ts; l_ts = (uint16_t) hIvasDec->st_ivas->hTcBuffer->n_samples_granularity; if ( !isInitialized_voip ) -#else - apa_buffer_size = hIvasDec->nSamplesFrame; - - if ( hIvasDec->apaExecBuffer == NULL ) -#endif { DECODER_CONFIG_HANDLE hDecoderConfig; -#ifndef LIB_DEC_REVISION + uint16_t wss, css; + float startQuality; - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) - { -#endif - uint16_t wss, css; - float startQuality; + startQuality = hIvasDec->tsm_quality; + apa_buffer_size = APA_BUF_PER_CHANNEL; - startQuality = hIvasDec->tsm_quality; - apa_buffer_size = APA_BUF_PER_CHANNEL; + /* get current renderer type*/ + hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; - /* get current renderer type*/ - hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; + if ( hDecoderConfig->output_Fs == 8000 ) + { + wss = 1; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 16000 ) + { + wss = 2; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 32000 ) + { + wss = 4; + css = 2; + } + else if ( hDecoderConfig->output_Fs == 48000 ) + { + wss = 6; + css = 3; + } + else + { + return IVAS_ERR_INIT_ERROR; + } - if ( hDecoderConfig->output_Fs == 8000 ) - { - wss = 1; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 16000 ) - { - wss = 2; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 32000 ) - { - wss = 4; - css = 2; - } - else if ( hDecoderConfig->output_Fs == 48000 ) - { - wss = 6; - css = 3; - } - else - { - return IVAS_ERR_INIT_ERROR; - } + if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || + apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || + apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || + apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || + apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } - if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || - apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) { return IVAS_ERR_INIT_ERROR; } + } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - } - - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } -#endif + + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } else { -#ifndef LIB_DEC_REVISION - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) + if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) { -#endif - if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - - /* realloc apa_exe_buffer */ - apa_buffer_size = APA_BUF_PER_CHANNEL; - free( hIvasDec->apaExecBuffer ); - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION + return IVAS_ERR_INIT_ERROR; } + /* realloc apa_exe_buffer */ -#endif + apa_buffer_size = APA_BUF_PER_CHANNEL; + free( hIvasDec->apaExecBuffer ); + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } hIvasDec->nTransportChannelsOld = nTransportChannels; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 2a02fd46ec..588399ef2a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -122,9 +122,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable TSM */ - #endif const IVAS_RENDER_FRAMESIZE renderFramesize,/* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -298,11 +295,9 @@ ivas_error IVAS_DEC_VoIP_SetScale( ); #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION ivas_error IVAS_DEC_EnableTsm( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -#endif /*! r: error code */ ivas_error IVAS_DEC_TSM_SetQuality( @@ -506,13 +501,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */ ); -#ifndef LIB_DEC_REVISION -/*! r: error code */ -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -); -#endif /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -- GitLab From 42cf0da8c8a96ba8e413f724488374c9de00b73e Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:48:23 +0200 Subject: [PATCH 2/6] accept NONBE_1293_CRASH_FIRST_FRAME_LOST --- apps/isar_post_rend.c | 22 +++------------ lib_com/options.h | 1 - lib_dec/lib_dec.c | 36 ------------------------- lib_isar/lib_isar_post_rend.c | 3 +-- lib_util/split_render_file_read_write.c | 11 +------- lib_util/split_render_file_read_write.h | 8 ------ 6 files changed, 5 insertions(+), 76 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 64aab53ed0..a3a3a5211e 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -985,9 +985,7 @@ int main( while ( 1 ) { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi = 0; -#endif int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; @@ -995,12 +993,10 @@ int main( if ( ( hSplitRendFileReadWrite != NULL ) && splitBinNeedsNewFrame ) { ivas_error error_tmp; + numSamplesRead = (int16_t) inBufferSize; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi ); -#else - error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); -#endif if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1067,24 +1063,13 @@ int main( /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - int16_t bfi; -#endif if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } - -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) @@ -1093,7 +1078,6 @@ int main( goto cleanup; } } -#endif for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { diff --git a/lib_com/options.h b/lib_com/options.h index 5bb6286cd0..a92f684b06 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,6 @@ /* all switches in this category should start with "NONBE_" */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ -#define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ #define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e238db2e67..2dc859e9cb 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1192,12 +1192,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; isInitialized_voip = hIvasDec->apaExecBuffer != NULL; @@ -1361,14 +1359,12 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasEditableParameters->num_obj = 0; return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1509,12 +1505,10 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1761,9 +1755,7 @@ ivas_error IVAS_DEC_PrepareRenderer( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ -#endif { ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } @@ -1848,20 +1840,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( { hIvasDec->hasBeenFedFrame = false; set_s( pcmBuf, 0, st_ivas->hDecoderConfig->nchan_out * nSamplesAsked ); -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; -#else - hIvasDec->nSamplesRendered += nSamplesAsked; - *nOutSamples = nSamplesAsked; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesAsked; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - hIvasDec->needNewFrame = true; - *needNewFrame = true; - } -#endif } else { @@ -1900,21 +1880,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } nSamplesRendered += nSamplesRendered_loop; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - nSamplesToRender -= nSamplesRendered_loop; - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - *needNewFrame = true; - hIvasDec->needNewFrame = true; - } - else - { - *needNewFrame = false; - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; @@ -1925,7 +1892,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( *needNewFrame = false; } -#endif *nOutSamples = nSamplesRendered; return IVAS_ERR_OK; @@ -2030,12 +1996,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif /* change buffer layout */ for ( i = 0; i < numSamplesPerChannelToDecode; ++i ) diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 7e050abc06..8f62c2f7b2 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1539,7 +1539,6 @@ static ivas_error renderSplitBinauralWithPostRot( } else { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; @@ -1549,7 +1548,7 @@ static ivas_error renderSplitBinauralWithPostRot( { splitBinInput->numCachedSamples -= outAudio.config.numSamplesPerChannel; } -#endif + if ( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 9cc6e4bf7e..94fefb8cb3 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -331,20 +331,12 @@ ivas_error split_rend_write_bitstream_to_file( * *-----------------------------------------------------------------------------------------*/ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ) -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ) -#endif { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; @@ -407,13 +399,12 @@ ivas_error split_rend_read_bits_from_file( *bits_read = 0; *bits_written = bit_len; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + *bfi = 0; if ( bit_len == 0 ) { *bfi = 1; } -#endif return IVAS_ERR_OK; } diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 4450eeded4..97ff673b36 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -73,20 +73,12 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_written ); /* read split rend coded bits from file */ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ); -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ); -#endif /* read split pre rend delay */ ivas_error split_rend_read_pre_rend_delay_ns( -- GitLab From cabb1ba40371805d4780c219d2838fcb42be04cf Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:55:39 +0200 Subject: [PATCH 3/6] accept NONBE_1303_REND_GRANULARITY --- lib_com/ivas_prot.h | 9 --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 42 +------------ lib_dec/ivas_ism_dec.c | 20 ------ lib_dec/ivas_ism_param_dec.c | 15 +---- lib_dec/ivas_jbm_dec.c | 29 --------- lib_dec/ivas_masa_dec.c | 31 ---------- lib_dec/ivas_mc_param_dec.c | 7 +-- lib_dec/ivas_mc_paramupmix_dec.c | 7 +-- lib_dec/ivas_mct_dec.c | 20 ------ lib_dec/ivas_objectRenderer_internal.c | 6 -- lib_dec/ivas_output_config.c | 2 - lib_dec/ivas_sba_dec.c | 64 -------------------- lib_dec/ivas_spar_decoder.c | 16 ----- lib_dec/lib_dec.c | 38 +----------- lib_rend/ivas_dirac_dec_binaural_functions.c | 15 ----- 16 files changed, 5 insertions(+), 317 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fe69a6610a..aff3ad8ec3 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -656,13 +656,11 @@ void ivas_renderer_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef NONBE_1303_REND_GRANULARITY /*! r: secondary binaural renderer type */ RENDERER_TYPE ivas_renderer_secondary_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif ivas_error ivas_mc_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -891,16 +889,9 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( -#ifdef NONBE_1303_REND_GRANULARITY const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ const int32_t output_Fs /* i : sampling rate */ -#else - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const int32_t output_Fs /* i : sampling rate */ -#endif ); ivas_error ivas_jbm_dec_tc_buffer_open( diff --git a/lib_com/options.h b/lib_com/options.h index a92f684b06..c65779e634 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ -#define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ #define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index aac6720870..0d3610065b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2119,6 +2119,7 @@ ivas_error ivas_init_decoder( { return error; } + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -2126,16 +2127,6 @@ ivas_error ivas_init_decoder( return error; } } -#ifndef NONBE_1303_REND_GRANULARITY - - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -2168,31 +2159,6 @@ ivas_error ivas_init_decoder( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifndef NONBE_1303_REND_GRANULARITY - - if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) - { - granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -2388,16 +2354,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hTcBuffer == NULL ) { /* no module has yet open the TC buffer, open a default one */ -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e7c793caf3..7472690650 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -122,24 +122,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } -#ifndef NONBE_1303_REND_GRANULARITY - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif if ( st_ivas->ism_mode != last_ism_mode ) { /* EFAP handle */ @@ -307,9 +289,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; -#ifdef NONBE_1303_REND_GRANULARITY tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 93202b94cf..52e9bd0d4c 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -403,11 +403,7 @@ ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifdef NONBE_1303_REND_GRANULARITY int16_t i, granularity; -#else - int16_t i; -#endif PARAM_ISM_DEC_HANDLE hParamIsmDec; IVAS_OUTPUT_SETUP hOutSetup; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -543,9 +539,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hParamIsmDec = hParamIsmDec; st_ivas->hSpatParamRendCom = hSpatParamRendCom; -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); -#endif if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) { @@ -585,11 +579,7 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -602,11 +592,8 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; -#ifdef NONBE_1303_REND_GRANULARITY + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9d645cd4ed..01da98fccb 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2074,7 +2074,6 @@ static void ivas_jbm_dec_copy_tc( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( -#ifdef NONBE_1303_REND_GRANULARITY const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ const int32_t output_Fs /* i : sampling rate */ @@ -2098,34 +2097,6 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } -#else - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const int32_t output_Fs /* i : sampling rate */ -) -{ - int16_t render_granularity; - - if ( rendererType == RENDERER_BINAURAL_OBJECTS_TD || rendererType == RENDERER_BINAURAL_MIXER_CONV || rendererType == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( ivas_format == MC_FORMAT ) && ( mc_mode == MC_MODE_PARAMUPMIX ) ) - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - else - { - render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - else - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - - return render_granularity; -} -#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 62e711718a..34d528b0e3 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -696,9 +696,7 @@ ivas_error ivas_masa_dec_open( if ( st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { int16_t nchan_to_allocate, nchan_transport; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -730,13 +728,9 @@ ivas_error ivas_masa_dec_open( nchan_to_allocate++; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1483,11 +1477,7 @@ ivas_error ivas_masa_dec_reconfigure( TC_BUFFER_MODE buffer_mode_new; int16_t n_samples_granularity; -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); -#endif buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); tc_nchan_transport = ivas_jbm_dec_get_num_tc_channels( st_ivas ); @@ -1502,27 +1492,6 @@ ivas_error ivas_masa_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifndef NONBE_1303_REND_GRANULARITY - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ - - if ( n_samples_granularity > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - } -#endif } else if ( st_ivas->nchan_transport == 1 && ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 048f26e379..8b33aebe63 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -437,15 +437,14 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { int16_t n_cldfb_slots; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; } + if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); @@ -460,13 +459,9 @@ ivas_error ivas_param_mc_dec_open( if ( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 81bd4023a4..c06e8b3fa1 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -374,9 +374,7 @@ ivas_error ivas_mc_paramupmix_dec_open( { int16_t nchan_to_allocate; int16_t nchan_tc; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -394,17 +392,14 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } } + st_ivas->hMCParamUpmix = hMCParamUpmix; return error; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 4c2ace3908..3300eb7965 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -789,24 +789,6 @@ static ivas_error ivas_mc_dec_reconfig( } } -#ifndef NONBE_1303_REND_GRANULARITY - /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); @@ -1293,9 +1275,7 @@ static ivas_error ivas_mc_dec_reconfig( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; -#ifdef NONBE_1303_REND_GRANULARITY tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 597480b8ea..ddc99ed2f8 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -61,13 +61,7 @@ ivas_error ivas_td_binaural_open( num_src = st_ivas->nchan_ism; } -#ifdef NONBE_1303_REND_GRANULARITY if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary ) -#else - if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary && - ( st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 - ) -#endif { return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in TD renderer" ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 305d99ef99..a53bc27aa5 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -481,7 +481,6 @@ void ivas_renderer_select( } -#ifdef NONBE_1303_REND_GRANULARITY /*-------------------------------------------------------------------------* * ivas_renderer_secondary_select() * @@ -511,4 +510,3 @@ RENDERER_TYPE ivas_renderer_secondary_select( return renderer_type; } -#endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2164e490d4..ade8e11b02 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -163,52 +163,9 @@ ivas_error ivas_sba_dec_reconfigure( /* we may need to flush only for binaural and OSBA and TSM */ if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#ifndef NONBE_1303_REND_GRANULARITY - RENDERER_TYPE renderer_type_new; - int16_t sba_order_internal; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - - /* get new renderer type */ - /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ - if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV; - } - else - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; - } - } - -#endif /* determine new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - /* this will change anyway only with binaural */ - if ( renderer_type_new == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - granularity_new *= JBM_CLDFB_SLOTS_IN_SUBFRAME; - } -#endif - -#ifdef NONBE_1303_REND_GRANULARITY if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) { /* make sure the changed number of slots in the last subframe is not lost in the following steps */ @@ -218,27 +175,6 @@ ivas_error ivas_sba_dec_reconfigure( } st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; } -#else - /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ - if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - else if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* make sure the changed number of slots in the last subframe is not lost in the following steps */ - if ( st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hSpatParamRendCom->subframe_nbslots[st_ivas->hSpatParamRendCom->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; - } - st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; - } -#endif } /* save old */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 205bc77859..98dc1ad3fa 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -228,10 +228,6 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate += st_ivas->nchan_ism; } -#ifndef NONBE_1303_REND_GRANULARITY - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - -#endif if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) ) { if ( ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) @@ -251,21 +247,9 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && - st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL && - st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - /* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */ - granularity = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); - } - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2dc859e9cb..045d93fdc4 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -907,7 +907,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial( return IVAS_ERR_OK; } -#ifdef NONBE_1303_REND_GRANULARITY /*---------------------------------------------------------------------* * renderer_type_to_mode() @@ -949,7 +948,6 @@ static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode( return binaural_renderer; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_ReadFormat( ) @@ -973,11 +971,7 @@ ivas_error IVAS_DEC_ReadFormat( MC_MODE mc_mode_old; int16_t nchan_transport_old; AUDIO_CONFIG intern_config_old, transport_config_old, output_config; -#ifdef NONBE_1303_REND_GRANULARITY RENDERER_TYPE renderer_type_old, renderer_type_sec_new, renderer_type_sec_old; -#else - RENDERER_TYPE renderer_type_old; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -992,13 +986,10 @@ ivas_error IVAS_DEC_ReadFormat( intern_config_old = st_ivas->intern_config; transport_config_old = st_ivas->transport_config; renderer_type_old = st_ivas->renderer_type; -#ifdef NONBE_1303_REND_GRANULARITY renderer_type_sec_old = ivas_renderer_secondary_select( st_ivas ); -#endif output_config = st_ivas->hDecoderConfig->output_config; - if ( st_ivas->ivas_format == MONO_FORMAT ) { return IVAS_ERR_OK; @@ -1018,13 +1009,12 @@ ivas_error IVAS_DEC_ReadFormat( /* Select binaural renderer */ ivas_renderer_select( st_ivas ); -#ifdef NONBE_1303_REND_GRANULARITY *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type ); /* Select secondary binaural renderer (used in combine formats) */ renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); -#else + switch ( st_ivas->renderer_type ) { case RENDERER_BINAURAL_OBJECTS_TD: @@ -1104,7 +1094,6 @@ ivas_error IVAS_DEC_ReadFormat( } } -#ifdef NONBE_1303_REND_GRANULARITY /* JBM: compensate when binaural renderer granularity changes (happens in bitrate switching) */ if ( st_ivas->ini_active_frame > 0 && st_ivas->hDecoderConfig->Opt_tsm && ( ( renderer_type_old != st_ivas->renderer_type ) || @@ -1135,25 +1124,6 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } -#else - if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( st_ivas->ini_active_frame > 0 && - ( ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) || - ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_MODE_DISC ) ) ) ) - { - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ - int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - st_ivas->nchan_transport = nchan_transport_old; - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif } } @@ -2915,13 +2885,7 @@ ivas_error IVAS_DEC_HRTF_binary_close( if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && st_ivas->ini_frame > 0 ) { -#ifdef NONBE_1303_REND_GRANULARITY if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) -#else - if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && - ( hIvasDec->st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 - ) -#endif { ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3be1a116d7..cc1bccb131 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -151,12 +151,10 @@ ivas_error ivas_dirac_dec_init_binaural_data( num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; } -#ifdef NONBE_1303_REND_GRANULARITY output_Fs = st_ivas->hDecoderConfig->output_Fs; nBins = st_ivas->hSpatParamRendCom->num_freq_bands; renderer_type = st_ivas->renderer_type; -#endif for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; @@ -175,11 +173,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->phHrtfParambin = NULL; } -#ifndef NONBE_1303_REND_GRANULARITY - output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - renderer_type = st_ivas->renderer_type; -#endif for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) @@ -331,15 +324,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( nchan_to_allocate = BINAURAL_CHANNELS + st_ivas->nchan_ism; } -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); -#else - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ - } -#endif if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) { -- GitLab From aeb62e4a2d294edda90be9f1b13f588295b150e2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 13:01:02 +0200 Subject: [PATCH 4/6] accept NONBE_1118_EVS_LR_HQ_BITERROR and NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT --- lib_com/ivas_prot.h | 4 +--- lib_com/options.h | 2 -- lib_dec/hq_lr_dec.c | 4 ---- lib_dec/ivas_jbm_dec.c | 6 ++---- lib_dec/ivas_objectRenderer_internal.c | 10 ++-------- lib_dec/ivas_omasa_dec.c | 7 +++---- lib_dec/lib_dec.c | 8 +------- 7 files changed, 9 insertions(+), 32 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index aff3ad8ec3..f5e239f3b0 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5794,14 +5794,12 @@ void ivas_omasa_render_objects_from_mix( const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT void ivas_omasa_gain_masa_tc( - float *output[], /* i/o : output synthesis signal */ + float *output[], /* i/o: output synthesis signal */ const float gainMasa, /* i : gain for MASA transport channels */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ); -#endif void ivas_omasa_dirac_rend_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ diff --git a/lib_com/options.h b/lib_com/options.h index c65779e634..80cd7a383b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,8 +171,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ -#define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index ccb840404f..f9ab923be7 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -635,7 +635,6 @@ void hq_lr_dec( IF( sub( i, highband ) >= 0 ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) { @@ -644,12 +643,10 @@ void hq_lr_dec( return; } -#endif enerH_fx = L_add( enerH_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } ELSE IF( sub( i, lowband ) >= 0 ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) { @@ -658,7 +655,6 @@ void hq_lr_dec( return; } -#endif enerL_fx = L_add( enerL_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 01da98fccb..9b310da630 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2842,13 +2842,12 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /* MASA transport gaining for edited disc OMASA EXT. For ISMs, only metadata is modified */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { ivas_omasa_gain_masa_tc( st_ivas->hTcBuffer->tc, st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->nchan_ism, st_ivas->hTcBuffer->n_samples_available ); } -#endif } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -2924,7 +2923,7 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /* MASA transport gaining for edited param_one OMASA EXT. For ISMs, only metadata is modified. */ if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { @@ -2933,7 +2932,6 @@ void ivas_dec_prepare_renderer( v_multc( st_ivas->hTcBuffer->tc[n], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available ); } } -#endif } else { diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ddc99ed2f8..ff47b1b9a7 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -179,11 +179,7 @@ ivas_error ivas_td_binaural_renderer_sf( if ( subframe_idx == ism_md_subframe_update_jbm ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) -#else - if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { ISM_METADATA_FRAME ismMetaData[MAX_NUM_OBJECTS]; ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; @@ -196,7 +192,7 @@ ivas_error ivas_td_binaural_renderer_sf( ismMetaData[nS].yaw = st_ivas->hIsmMetaData[nS]->edited_yaw; ismMetaData[nS].pitch = st_ivas->hIsmMetaData[nS]->edited_pitch; ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag; -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* DISC OMASA ISM gaining with TDREND is done in ivas_dec_prepare_renderer()*/ @@ -206,9 +202,7 @@ ivas_error ivas_td_binaural_renderer_sf( { ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; } -#else - ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; -#endif + hIsmMetaData[nS] = &ismMetaData[nS]; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b468df0439..beaf645fa0 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1322,7 +1322,7 @@ void ivas_omasa_render_objects_from_mix( return; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /*--------------------------------------------------------------------------* * ivas_omasa_gain_masa_tc() * @@ -1331,18 +1331,17 @@ void ivas_omasa_render_objects_from_mix( *--------------------------------------------------------------------------*/ void ivas_omasa_gain_masa_tc( - float *output[], /* i/o : output synthesis signal */ + float *output[], /* i/o: output synthesis signal */ const float gainMasa, /* i : gain */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ) { /* Edited OMASA EXT MASA transport gaining */ - for ( int16_t ch = 0; ch < 2; ch++ ) + for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) { v_multc( output[nchan_transport_ism + ch], gainMasa, output[nchan_transport_ism + ch], output_frame ); } return; } -#endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 045d93fdc4..df6cc6998f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1044,7 +1044,6 @@ ivas_error IVAS_DEC_ReadFormat( { *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; } -#endif /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; @@ -1679,13 +1678,12 @@ ivas_error IVAS_DEC_SetEditableParameters( /* Copy edited values to hIsmMetaData struct */ if ( st_ivas->hIsmMetaData[obj] != NULL ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->edited_elevation = hIvasEditableParameters.ism_metadata[obj].elevation; st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; -#endif + st_ivas->hIsmMetaData[obj]->azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->elevation = hIvasEditableParameters.ism_metadata[obj].elevation; st_ivas->hIsmMetaData[obj]->yaw = hIvasEditableParameters.ism_metadata[obj].yaw; @@ -2407,11 +2405,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( metadata->gainFactor = 1.f; metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { metadata->azimuth = st_ivas->hIsmMetaData[objectIdx]->edited_azimuth; metadata->elevation = st_ivas->hIsmMetaData[objectIdx]->edited_elevation; -- GitLab From 67510528c95e4d958dc9e6094df5584ca2aca174 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 13:03:37 +0200 Subject: [PATCH 5/6] typo in comment --- lib_dec/ivas_output_config.c | 2 +- lib_dec/lib_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index a53bc27aa5..430b57afa2 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -484,7 +484,7 @@ void ivas_renderer_select( /*-------------------------------------------------------------------------* * ivas_renderer_secondary_select() * - * Select IVAS secondary binaural renderer (used in combine formats) + * Select IVAS secondary binaural renderer (used in combined formats) *-------------------------------------------------------------------------*/ /*! r: secondary binaural renderer type */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index df6cc6998f..60a1cda5f3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1011,7 +1011,7 @@ ivas_error IVAS_DEC_ReadFormat( ivas_renderer_select( st_ivas ); *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type ); - /* Select secondary binaural renderer (used in combine formats) */ + /* Select secondary binaural renderer (used in combined formats) */ renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); -- GitLab From 3648217bbe666e7a2be8dae55c94fc1f20fbe613 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 14:02:42 +0200 Subject: [PATCH 6/6] correction (accidentally not removed #else ... #endif code) --- lib_dec/lib_dec.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 60a1cda5f3..12bc47979f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1015,36 +1015,6 @@ ivas_error IVAS_DEC_ReadFormat( renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); - switch ( st_ivas->renderer_type ) - { - case RENDERER_BINAURAL_OBJECTS_TD: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_TDREND; - break; - case RENDERER_BINAURAL_MIXER_CONV: - case RENDERER_BINAURAL_MIXER_CONV_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_CREND; - break; - case RENDERER_BINAURAL_FASTCONV: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; - break; - case RENDERER_BINAURAL_FASTCONV_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; - break; - case RENDERER_BINAURAL_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_PARAMBIN; - break; - default: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE; - break; - } - - *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE; - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL ) - { - *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; - } - /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV ) -- GitLab