Loading apps/decoder.c +38 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,19 @@ int main( } } #ifdef MEM_ALLOC_APP #if 0 /*------------------------------------------------------------------------------------------* * Initialize (allocate memory for static variables) the decoder *------------------------------------------------------------------------------------------*/ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #endif /*------------------------------------------------------------------------------------------* * Allocate output data buffer *------------------------------------------------------------------------------------------*/ Loading Loading @@ -2344,6 +2357,15 @@ static ivas_error decodeG192( } } #ifdef MEM_ALLOC_APP /* Reconfigure IVAS decoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { Loading Loading @@ -3217,6 +3239,22 @@ static ivas_error decodeVoIP( break; } #ifdef MEM_ALLOC_APP_DEC #if 0 // VE: TBC!!! //if () { hIvasDec->hasBeenFedFrame = true; } /* Reconfigure IVAS decoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #endif /* decode and get samples */ Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ #define FIX_1035_HT_OSBA /* Dlb: issue 1035: Issue with headtracking in OSBA*/ #define MEM_ALLOC_APP /* VA: call memory allocate/reallocation from the application */ #define MEM_ALLOC_APP_DEC /* VA: call memory allocate/reallocation from the application, decoder part */ /* #################### End BE switches ################################## */ Loading lib_dec/lib_dec.c +112 −7 Original line number Diff line number Diff line Loading @@ -108,11 +108,13 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); #ifndef MEM_ALLOC_APP_DEC #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, const IVAS_DEC_PCM_TYPE pcmType, void *data ); #else static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); #endif #endif 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 ); #ifdef SPLIT_REND_WITH_HEAD_ROT Loading Loading @@ -850,6 +852,9 @@ ivas_error IVAS_DEC_GetSamples( ) { ivas_error error; #ifdef MEM_ALLOC_APP_DEC Decoder_Struct *st_ivas; #endif int16_t nOutSamplesElse, nSamplesToRender; uint16_t nSamplesRendered, nSamplesRendered_loop, l_ts, nTimeScalerOutSamples; uint8_t nTransportChannels, nOutChannels; Loading @@ -865,6 +870,10 @@ ivas_error IVAS_DEC_GetSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef MEM_ALLOC_APP_DEC st_ivas = hIvasDec->st_ivas; #endif if ( hIvasDec->updateOrientation ) { /*----------------------------------------------------------------* Loading Loading @@ -918,6 +927,40 @@ ivas_error IVAS_DEC_GetSamples( /* check if we need to run the setup function */ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { #ifdef MEM_ALLOC_APP_DEC if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) // ToDo: TBD for JBM { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_Setup( hIvasDec, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Setup( hIvasDec, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) #endif { return error; } } if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; nOutChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; } else { nTransportChannels = 1; nOutChannels = 1; } } else { l_ts = st_ivas->hTcBuffer->n_samples_granularity; nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nSamplesRendered_loop = hIvasDec->nSamplesRendered; } #else /* setup */ #ifdef SPLIT_REND_WITH_HEAD_ROT Loading @@ -925,10 +968,10 @@ ivas_error IVAS_DEC_GetSamples( #else if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) #endif { return error; } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ #endif Loading Loading @@ -1196,6 +1239,68 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( * * *---------------------------------------------------------------------*/ #ifdef MEM_ALLOC_APP_DEC ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif ) { ivas_error error; uint16_t nSamplesRendered = 0; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( !hIvasDec->hasBeenFedFrame && hIvasDec->nSamplesAvailableNext == 0 ) { /* no frame was fed, do nothing */ return IVAS_ERR_OK; } if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { /* EVS decoding, do nothing */ return IVAS_ERR_OK; } else { Decoder_Struct *st_ivas; st_ivas = hIvasDec->st_ivas; /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling * - read IVAS format specific signaling * - initialize decoder in the first frame based on IVAS format and number of transport channels * - reconfigure the decoder when the number of TC or IVAS total bitrate change *----------------------------------------------------------------*/ if ( st_ivas->bfi == 0 ) { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_dec_setup( st_ivas, &nSamplesRendered, pcm_type_API_to_internal( pcmType ), data ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_dec_setup( st_ivas, &nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif { return error; } } } return IVAS_ERR_OK; } #else /* MEM_ALLOC_APP_DEC */ static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading Loading @@ -1261,7 +1366,7 @@ static ivas_error IVAS_DEC_Setup( return IVAS_ERR_OK; } #endif /* MEM_ALLOC_APP_DEC */ /*---------------------------------------------------------------------* * IVAS_DEC_GetTcSamples( ) Loading lib_dec/lib_dec.h +12 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,18 @@ void IVAS_DEC_Close( IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */ ); #ifdef MEM_ALLOC_APP_DEC /*! r: error code */ ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif ); #endif /* Decoding functions - should be called with a configured decoder handle */ Loading Loading
apps/decoder.c +38 −0 Original line number Diff line number Diff line Loading @@ -807,6 +807,19 @@ int main( } } #ifdef MEM_ALLOC_APP #if 0 /*------------------------------------------------------------------------------------------* * Initialize (allocate memory for static variables) the decoder *------------------------------------------------------------------------------------------*/ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #endif /*------------------------------------------------------------------------------------------* * Allocate output data buffer *------------------------------------------------------------------------------------------*/ Loading Loading @@ -2344,6 +2357,15 @@ static ivas_error decodeG192( } } #ifdef MEM_ALLOC_APP /* Reconfigure IVAS decoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { Loading Loading @@ -3217,6 +3239,22 @@ static ivas_error decodeVoIP( break; } #ifdef MEM_ALLOC_APP_DEC #if 0 // VE: TBC!!! //if () { hIvasDec->hasBeenFedFrame = true; } /* Reconfigure IVAS decoder handles and reallocate the memory if IVAS total bitrate has changed */ if ( ( error = IVAS_DEC_Setup( hIvasDec, NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_Setup failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif #endif /* decode and get samples */ Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ #define FIX_1035_HT_OSBA /* Dlb: issue 1035: Issue with headtracking in OSBA*/ #define MEM_ALLOC_APP /* VA: call memory allocate/reallocation from the application */ #define MEM_ALLOC_APP_DEC /* VA: call memory allocate/reallocation from the application, decoder part */ /* #################### End BE switches ################################## */ Loading
lib_dec/lib_dec.c +112 −7 Original line number Diff line number Diff line Loading @@ -108,11 +108,13 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); #ifndef MEM_ALLOC_APP_DEC #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, const IVAS_DEC_PCM_TYPE pcmType, void *data ); #else static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); #endif #endif 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 ); #ifdef SPLIT_REND_WITH_HEAD_ROT Loading Loading @@ -850,6 +852,9 @@ ivas_error IVAS_DEC_GetSamples( ) { ivas_error error; #ifdef MEM_ALLOC_APP_DEC Decoder_Struct *st_ivas; #endif int16_t nOutSamplesElse, nSamplesToRender; uint16_t nSamplesRendered, nSamplesRendered_loop, l_ts, nTimeScalerOutSamples; uint8_t nTransportChannels, nOutChannels; Loading @@ -865,6 +870,10 @@ ivas_error IVAS_DEC_GetSamples( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef MEM_ALLOC_APP_DEC st_ivas = hIvasDec->st_ivas; #endif if ( hIvasDec->updateOrientation ) { /*----------------------------------------------------------------* Loading Loading @@ -918,6 +927,40 @@ ivas_error IVAS_DEC_GetSamples( /* check if we need to run the setup function */ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { #ifdef MEM_ALLOC_APP_DEC if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) // ToDo: TBD for JBM { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = IVAS_DEC_Setup( hIvasDec, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Setup( hIvasDec, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) #endif { return error; } } if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; nOutChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; } else { nTransportChannels = 1; nOutChannels = 1; } } else { l_ts = st_ivas->hTcBuffer->n_samples_granularity; nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nSamplesRendered_loop = hIvasDec->nSamplesRendered; } #else /* setup */ #ifdef SPLIT_REND_WITH_HEAD_ROT Loading @@ -925,10 +968,10 @@ ivas_error IVAS_DEC_GetSamples( #else if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) #endif { return error; } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ #endif Loading Loading @@ -1196,6 +1239,68 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( * * *---------------------------------------------------------------------*/ #ifdef MEM_ALLOC_APP_DEC ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif ) { ivas_error error; uint16_t nSamplesRendered = 0; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } if ( !hIvasDec->hasBeenFedFrame && hIvasDec->nSamplesAvailableNext == 0 ) { /* no frame was fed, do nothing */ return IVAS_ERR_OK; } if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { /* EVS decoding, do nothing */ return IVAS_ERR_OK; } else { Decoder_Struct *st_ivas; st_ivas = hIvasDec->st_ivas; /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling * - read IVAS format specific signaling * - initialize decoder in the first frame based on IVAS format and number of transport channels * - reconfigure the decoder when the number of TC or IVAS total bitrate change *----------------------------------------------------------------*/ if ( st_ivas->bfi == 0 ) { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_dec_setup( st_ivas, &nSamplesRendered, pcm_type_API_to_internal( pcmType ), data ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_dec_setup( st_ivas, &nSamplesRendered, data ) ) != IVAS_ERR_OK ) #endif { return error; } } } return IVAS_ERR_OK; } #else /* MEM_ALLOC_APP_DEC */ static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading Loading @@ -1261,7 +1366,7 @@ static ivas_error IVAS_DEC_Setup( return IVAS_ERR_OK; } #endif /* MEM_ALLOC_APP_DEC */ /*---------------------------------------------------------------------* * IVAS_DEC_GetTcSamples( ) Loading
lib_dec/lib_dec.h +12 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,18 @@ void IVAS_DEC_Close( IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */ ); #ifdef MEM_ALLOC_APP_DEC /*! r: error code */ ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ #ifdef SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif ); #endif /* Decoding functions - should be called with a configured decoder handle */ Loading