Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ /*#define DEBUG_MODE_LFE */ /* define to output LFE relevant parameters */ /*#define DEBUG_MODE_JBM */ /* define to output JBM relevant parameters */ #endif #ifdef DEBUG_MODE_MDCT Loading lib_dec/lib_dec.c +42 −5 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ struct IVAS_DEC bool Opt_VOIP; /* flag indicating VOIP mode with JBM */ int16_t tsm_scale; /* scale for TSM operation */ int16_t tsm_max_scaling; #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */ #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING float tsm_quality; #endif Loading Loading @@ -174,6 +177,9 @@ ivas_error IVAS_DEC_Open( #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #endif #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE hIvasDec->timeScalingDone = 0; #endif hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; Loading Loading @@ -1134,19 +1140,26 @@ ivas_error IVAS_DEC_GetSamples( return IVAS_ERR_UNKNOWN; } assert( nTimeScalerOutSamples <= APA_BUF ); #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE hIvasDec->timeScalingDone = 1; #endif } else { nTimeScalerOutSamples = hIvasDec->nSamplesFrame * nTransportChannels; } nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; #ifdef DEBUG_MODE_JBM dbgwrite( &nTimeScalerOutSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_nTimeScaleOutSamples.dat" ); #endif /* render IVAS frames */ if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) { return error; } #ifdef DEBUG_MODE_JBM dbgwrite( &nResidualSamples, sizeof( int16_t ), 1, 1, "./res/JBM_nResidualSamples.dat" ); #endif if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { /* feed residual samples to TSM for the next call */ Loading Loading @@ -2632,7 +2645,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint32_t extBufferedTime_ms, scale, maxScaling; JB4_DATAUNIT_HANDLE dataUnit; uint16_t extBufferedSamples; #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE int16_t timeScalingDone; #endif int16_t result; ivas_error error; int16_t nSamplesRendered; Loading @@ -2641,7 +2656,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE timeScalingDone = 0; #endif nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nSamplesRendered = 0; Loading Loading @@ -2673,6 +2690,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; dataUnit = NULL; /* pop one access unit from the jitter buffer */ result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling ); if ( result != 0 ) Loading @@ -2681,17 +2699,30 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; /* avoid time scaling multiple times in one sound card slot */ #ifdef DEBUG_MODE_JBM dbgwrite( &extBufferedSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_extBufferedSamples.dat" ); dbgwrite( &systemTimestamp_ms, sizeof( uint32_t ), 1, 1, "./res/JBM_systemTimestamp.dat" ); dbgwrite( &scale, sizeof( uint32_t ), 1, 1, "./res/JBM_scale.dat" ); dbgwrite( &maxScaling, sizeof( uint32_t ), 1, 1, "./res/JBM_maxScale.dat" ); #endif /* avoid time scaling multiple times within one 20ms frame*/ if ( scale != 100U ) { #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE if ( hIvasDec->timeScalingDone ) #else if ( timeScalingDone ) #endif { scale = 100; } #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE else { timeScalingDone = 1; } #endif } /* limit scale to range supported by time scaler */ Loading Loading @@ -2821,8 +2852,14 @@ static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered ) { hIvasDec->hVoIP->nSamplesRendered20ms = ( hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered ) % hIvasDec->hVoIP->nSamplesFrame; int16_t nSamplesRenderedTotal; nSamplesRenderedTotal = hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered; /* we have crossed a 20ms border, reset the time scaling done flag */ if ( nSamplesRenderedTotal >= hIvasDec->hVoIP->nSamplesFrame ) { hIvasDec->timeScalingDone = 0; } hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; } #endif Loading Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ /*#define DEBUG_MODE_LFE */ /* define to output LFE relevant parameters */ /*#define DEBUG_MODE_JBM */ /* define to output JBM relevant parameters */ #endif #ifdef DEBUG_MODE_MDCT Loading
lib_dec/lib_dec.c +42 −5 Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ struct IVAS_DEC bool Opt_VOIP; /* flag indicating VOIP mode with JBM */ int16_t tsm_scale; /* scale for TSM operation */ int16_t tsm_max_scaling; #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */ #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING float tsm_quality; #endif Loading Loading @@ -174,6 +177,9 @@ ivas_error IVAS_DEC_Open( #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #endif #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE hIvasDec->timeScalingDone = 0; #endif hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; Loading Loading @@ -1134,19 +1140,26 @@ ivas_error IVAS_DEC_GetSamples( return IVAS_ERR_UNKNOWN; } assert( nTimeScalerOutSamples <= APA_BUF ); #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE hIvasDec->timeScalingDone = 1; #endif } else { nTimeScalerOutSamples = hIvasDec->nSamplesFrame * nTransportChannels; } nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; #ifdef DEBUG_MODE_JBM dbgwrite( &nTimeScalerOutSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_nTimeScaleOutSamples.dat" ); #endif /* render IVAS frames */ if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) { return error; } #ifdef DEBUG_MODE_JBM dbgwrite( &nResidualSamples, sizeof( int16_t ), 1, 1, "./res/JBM_nResidualSamples.dat" ); #endif if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { /* feed residual samples to TSM for the next call */ Loading Loading @@ -2632,7 +2645,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint32_t extBufferedTime_ms, scale, maxScaling; JB4_DATAUNIT_HANDLE dataUnit; uint16_t extBufferedSamples; #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE int16_t timeScalingDone; #endif int16_t result; ivas_error error; int16_t nSamplesRendered; Loading @@ -2641,7 +2656,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; hVoIP = hIvasDec->hVoIP; #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE timeScalingDone = 0; #endif nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nSamplesRendered = 0; Loading Loading @@ -2673,6 +2690,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; dataUnit = NULL; /* pop one access unit from the jitter buffer */ result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling ); if ( result != 0 ) Loading @@ -2681,17 +2699,30 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; /* avoid time scaling multiple times in one sound card slot */ #ifdef DEBUG_MODE_JBM dbgwrite( &extBufferedSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_extBufferedSamples.dat" ); dbgwrite( &systemTimestamp_ms, sizeof( uint32_t ), 1, 1, "./res/JBM_systemTimestamp.dat" ); dbgwrite( &scale, sizeof( uint32_t ), 1, 1, "./res/JBM_scale.dat" ); dbgwrite( &maxScaling, sizeof( uint32_t ), 1, 1, "./res/JBM_maxScale.dat" ); #endif /* avoid time scaling multiple times within one 20ms frame*/ if ( scale != 100U ) { #ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE if ( hIvasDec->timeScalingDone ) #else if ( timeScalingDone ) #endif { scale = 100; } #ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE else { timeScalingDone = 1; } #endif } /* limit scale to range supported by time scaler */ Loading Loading @@ -2821,8 +2852,14 @@ static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered ) { hIvasDec->hVoIP->nSamplesRendered20ms = ( hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered ) % hIvasDec->hVoIP->nSamplesFrame; int16_t nSamplesRenderedTotal; nSamplesRenderedTotal = hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered; /* we have crossed a 20ms border, reset the time scaling done flag */ if ( nSamplesRenderedTotal >= hIvasDec->hVoIP->nSamplesFrame ) { hIvasDec->timeScalingDone = 0; } hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; } #endif Loading