Loading apps/decoder.c +33 −23 Original line number Diff line number Diff line Loading @@ -3126,6 +3126,7 @@ static ivas_error decodeVoIP( int16_t nOutSamples = 0; #ifdef FIX_CREND_SIMPLIFY_CODE bool bitstreamReadDone = false; uint16_t nSamplesRendered; #endif vec_pos_update = 0; Loading Loading @@ -3244,6 +3245,9 @@ static ivas_error decodeVoIP( while ( 1 ) { #ifdef FIX_CREND_SIMPLIFY_CODE nSamplesRendered = 0; #endif /* reference vector */ if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 ) Loading Loading @@ -3407,10 +3411,13 @@ static ivas_error decodeVoIP( /* decode and get samples */ #ifdef FIX_HRTF_LOAD while ( nSamplesRendered < nOutSamples ) { #endif #ifdef SUPPORT_JBM_TRACEFILE #ifdef FIX_CREND_SIMPLIFY_CODE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK ) #endif Loading Loading @@ -3451,6 +3458,9 @@ static ivas_error decodeVoIP( } } #endif #ifdef FIX_HRTF_LOAD } #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading lib_dec/lib_dec.c +40 −5 Original line number Diff line number Diff line Loading @@ -2979,15 +2979,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, const uint32_t systemTimestamp_ms /* i : current system timestamp */ const uint32_t systemTimestamp_ms, /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void *jbmWriter void *jbmWriter, #endif #ifdef FIX_CREND_SIMPLIFY_CODE , bool *bitstreamReadDone /* o : flag indicating that bitstream was read */ bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ uint16_t *nSamplesRendered /* o : number of samples rendered */ #endif ) { Loading @@ -2999,7 +2998,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t extBufferedSamples; int16_t result; ivas_error error; #ifndef FIX_CREND_SIMPLIFY_CODE int16_t nSamplesRendered; #endif uint8_t nOutChannels; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL ) Loading @@ -3011,7 +3012,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; #ifndef FIX_CREND_SIMPLIFY_CODE nSamplesRendered = 0; #endif if ( nSamplesPerChannel == 0 ) { Loading @@ -3019,7 +3022,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ #ifdef FIX_CREND_SIMPLIFY_CODE while ( *nSamplesRendered < nSamplesPerChannel ) #else while ( nSamplesRendered < nSamplesPerChannel ) #endif { if ( hIvasDec->nSamplesAvailableNext == 0 ) { Loading Loading @@ -3130,6 +3137,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( JB4_FreeDataUnit( hVoIP->hJBM, dataUnit ); } #ifdef FIX_HRTF_LOAD if ( hIvasDec->hasBeenFedFirstGoodFrame && *bitstreamReadDone == true ) { /* new bitstream was feeded, return for reconfiguration */ return IVAS_ERR_OK; } #endif if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; Loading @@ -3143,8 +3158,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples( /* codec mode to use not known yet - simply output silence */ /* directly set output zero */ int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); #ifdef FIX_CREND_SIMPLIFY_CODE set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); *nSamplesRendered += nSamplesToZero; #else set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); nSamplesRendered += nSamplesToZero; #endif hIvasDec->nSamplesRendered += nSamplesToZero; hIvasDec->nSamplesAvailableNext -= nSamplesToZero; update_voip_rendered20ms( hIvasDec, nSamplesToZero ); Loading @@ -3153,15 +3173,30 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { int16_t nSamplesToRender, nSamplesRendered_loop; bool tmp; #ifdef FIX_CREND_SIMPLIFY_CODE nSamplesToRender = nSamplesPerChannel - *nSamplesRendered; #else nSamplesToRender = nSamplesPerChannel - nSamplesRendered; #endif /* render IVAS frames directly to the output buffer */ #ifdef FIX_CREND_SIMPLIFY_CODE if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) #endif { return error; } #ifdef FIX_HRTF_LOAD *bitstreamReadDone = false; // temp hack until JBM API is reworked #endif #ifdef FIX_CREND_SIMPLIFY_CODE *nSamplesRendered += nSamplesRendered_loop; #else nSamplesRendered += nSamplesRendered_loop; #endif update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop ); } } Loading lib_dec/lib_dec.h +5 −5 Original line number Diff line number Diff line Loading @@ -283,14 +283,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, const uint32_t systemTimestamp_ms /* i : current system timestamp */ const uint32_t systemTimestamp_ms, /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter, #endif #ifdef FIX_CREND_SIMPLIFY_CODE , bool *bitstreamReadDone /* o : flag indicating that bitstream was read */ bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ uint16_t *nSamplesRendered /* o : number of samples rendered */ #endif ); Loading Loading
apps/decoder.c +33 −23 Original line number Diff line number Diff line Loading @@ -3126,6 +3126,7 @@ static ivas_error decodeVoIP( int16_t nOutSamples = 0; #ifdef FIX_CREND_SIMPLIFY_CODE bool bitstreamReadDone = false; uint16_t nSamplesRendered; #endif vec_pos_update = 0; Loading Loading @@ -3244,6 +3245,9 @@ static ivas_error decodeVoIP( while ( 1 ) { #ifdef FIX_CREND_SIMPLIFY_CODE nSamplesRendered = 0; #endif /* reference vector */ if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 ) Loading Loading @@ -3407,10 +3411,13 @@ static ivas_error decodeVoIP( /* decode and get samples */ #ifdef FIX_HRTF_LOAD while ( nSamplesRendered < nOutSamples ) { #endif #ifdef SUPPORT_JBM_TRACEFILE #ifdef FIX_CREND_SIMPLIFY_CODE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK ) #endif Loading Loading @@ -3451,6 +3458,9 @@ static ivas_error decodeVoIP( } } #endif #ifdef FIX_HRTF_LOAD } #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading
lib_dec/lib_dec.c +40 −5 Original line number Diff line number Diff line Loading @@ -2979,15 +2979,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, const uint32_t systemTimestamp_ms /* i : current system timestamp */ const uint32_t systemTimestamp_ms, /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void *jbmWriter void *jbmWriter, #endif #ifdef FIX_CREND_SIMPLIFY_CODE , bool *bitstreamReadDone /* o : flag indicating that bitstream was read */ bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ uint16_t *nSamplesRendered /* o : number of samples rendered */ #endif ) { Loading @@ -2999,7 +2998,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t extBufferedSamples; int16_t result; ivas_error error; #ifndef FIX_CREND_SIMPLIFY_CODE int16_t nSamplesRendered; #endif uint8_t nOutChannels; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL ) Loading @@ -3011,7 +3012,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; #ifndef FIX_CREND_SIMPLIFY_CODE nSamplesRendered = 0; #endif if ( nSamplesPerChannel == 0 ) { Loading @@ -3019,7 +3022,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ #ifdef FIX_CREND_SIMPLIFY_CODE while ( *nSamplesRendered < nSamplesPerChannel ) #else while ( nSamplesRendered < nSamplesPerChannel ) #endif { if ( hIvasDec->nSamplesAvailableNext == 0 ) { Loading Loading @@ -3130,6 +3137,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( JB4_FreeDataUnit( hVoIP->hJBM, dataUnit ); } #ifdef FIX_HRTF_LOAD if ( hIvasDec->hasBeenFedFirstGoodFrame && *bitstreamReadDone == true ) { /* new bitstream was feeded, return for reconfiguration */ return IVAS_ERR_OK; } #endif if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; Loading @@ -3143,8 +3158,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples( /* codec mode to use not known yet - simply output silence */ /* directly set output zero */ int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); #ifdef FIX_CREND_SIMPLIFY_CODE set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); *nSamplesRendered += nSamplesToZero; #else set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); nSamplesRendered += nSamplesToZero; #endif hIvasDec->nSamplesRendered += nSamplesToZero; hIvasDec->nSamplesAvailableNext -= nSamplesToZero; update_voip_rendered20ms( hIvasDec, nSamplesToZero ); Loading @@ -3153,15 +3173,30 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { int16_t nSamplesToRender, nSamplesRendered_loop; bool tmp; #ifdef FIX_CREND_SIMPLIFY_CODE nSamplesToRender = nSamplesPerChannel - *nSamplesRendered; #else nSamplesToRender = nSamplesPerChannel - nSamplesRendered; #endif /* render IVAS frames directly to the output buffer */ #ifdef FIX_CREND_SIMPLIFY_CODE if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) #endif { return error; } #ifdef FIX_HRTF_LOAD *bitstreamReadDone = false; // temp hack until JBM API is reworked #endif #ifdef FIX_CREND_SIMPLIFY_CODE *nSamplesRendered += nSamplesRendered_loop; #else nSamplesRendered += nSamplesRendered_loop; #endif update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop ); } } Loading
lib_dec/lib_dec.h +5 −5 Original line number Diff line number Diff line Loading @@ -283,14 +283,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, const uint32_t systemTimestamp_ms /* i : current system timestamp */ const uint32_t systemTimestamp_ms, /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter, #endif #ifdef FIX_CREND_SIMPLIFY_CODE , bool *bitstreamReadDone /* o : flag indicating that bitstream was read */ bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */ uint16_t *nSamplesRendered /* o : number of samples rendered */ #endif ); Loading