Loading apps/decoder.c +69 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ #endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include <math.h> #endif #include "vector3_pair_file_reader.h" #ifdef DEBUGGING Loading Loading @@ -1224,7 +1225,9 @@ static bool parseCmdlIVAS_dec( i++; int32_t tmp = 100; arg->tsmEnabled = true; #ifndef NONBE_UNIFIED_DECODING_PATHS arg->enable5ms = true; #endif if ( i < argc - 3 ) { if ( !is_digits_only( argv[i] ) ) Loading Loading @@ -2120,6 +2123,7 @@ static ivas_error decodeG192( /* we always start with needing a new frame */ needNewFrame = true; #ifndef FIX_899_VARIABLE_SPEED_DECODING #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING /*------------------------------------------------------------------------------------------* Loading @@ -2146,6 +2150,7 @@ static ivas_error decodeG192( } } #endif #endif #endif if ( !arg.quietModeEnabled ) Loading Loading @@ -2191,6 +2196,45 @@ static ivas_error decodeG192( } #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING /*------------------------------------------------------------------------------------------* * Open TSM scale file or set global TSM scale *------------------------------------------------------------------------------------------*/ if ( arg.tsmEnabled ) { if ( arg.tsmScaleFileEnabled ) { if ( ( tsmScaleFileReader = TsmScaleFileReader_open( arg.tsmScaleFileName ) ) == NULL ) { fprintf( stderr, "\nError: Can't open TSM scale file %s \n\n", arg.tsmScaleFileName ); goto cleanup; } } else { int16_t maxScaling; /* max scaling as abs diff to the normal frame size in samples */ maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } /* set lowest possbile TSM quality to make sure it is applied as much as possible */ if ( ( error = IVAS_DEC_TSM_SetQuality( hIvasDec, -2.0f ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_TSM_SetQuality failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif #endif #endif /*------------------------------------------------------------------------------------------* * Loop for every packet (frame) of bitstream data * - Read the bitstream packet Loading Loading @@ -2343,7 +2387,14 @@ static ivas_error decodeG192( fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); goto cleanup; } #ifdef FIX_899_VARIABLE_SPEED_DECODING int16_t maxScaling; /* max scaling as abs diff to the normal frame size in samples */ maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -2415,6 +2466,22 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING if ( needNewFrame ) { frame++; if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); #ifdef DEBUGGING if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) { fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); } #endif } } #endif } while ( nSamplesRendered < nOutSamples && error == IVAS_ERR_OK ); Loading Loading @@ -2538,6 +2605,7 @@ static ivas_error decodeG192( } } vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; #ifndef FIX_899_VARIABLE_SPEED_DECODING if ( needNewFrame ) { frame++; Loading @@ -2552,6 +2620,7 @@ static ivas_error decodeG192( #endif } } #endif #ifdef WMOPS if ( vec_pos_update == 0 ) { Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ #define FIX_643_PCA_OPTION /* VA: issue 643: rename PCA bypass command-line option */ /* #################### End BE switches ################################## */ #define FIX_899_VARIABLE_SPEED_DECODING /* FhG: Fix variable speed decoding */ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt selection floating point code */ Loading lib_dec/lib_dec.c +49 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,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 FIX_899_VARIABLE_SPEED_DECODING float tsm_quality; #endif float *apaExecBuffer; /* Buffer for APA scaling */ PCMDSP_APA_HANDLE hTimeScaler; bool needNewFrame; Loading Loading @@ -163,6 +166,10 @@ ivas_error IVAS_DEC_Open( hIvasDec->apaExecBuffer = NULL; hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #endif hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; hIvasDec->nSamplesAvailableNext = 0; Loading Loading @@ -488,7 +495,12 @@ ivas_error IVAS_DEC_Configure( hIvasDec->nSamplesAvailableNext = 0; hIvasDec->nSamplesRendered = 0; hIvasDec->tsm_scale = 100; #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #else hIvasDec->tsm_max_scaling = 100; #endif return error; } Loading Loading @@ -2528,8 +2540,8 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( ivas_error IVAS_DEC_VoIP_SetScale( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t maxScaling, const int16_t scale /* i : TSM scale to set */ const int16_t maxScaling, /* i : max allowed absolute difference in samples from the default 20ms frame size */ const int16_t scale /* i : TSM scale to set in percent of the default frame size */ ) { ivas_error error; Loading @@ -2549,6 +2561,36 @@ ivas_error IVAS_DEC_VoIP_SetScale( return error; } #ifdef FIX_899_VARIABLE_SPEED_DECODING /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * * Set the TSM scale *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) { return IVAS_ERR_TSM_NOT_ENABLED; } else { hIvasDec->tsm_quality = quality; } return error; } #endif /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetSamples( ) Loading Loading @@ -3634,7 +3676,11 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( uint16_t wss, css; float startQuality; #ifdef FIX_899_VARIABLE_SPEED_DECODING startQuality = hIvasDec->tsm_quality; #else startQuality = 1.0f; #endif apa_buffer_size = APA_BUF_PER_CHANNEL; /* get current renderer type*/ Loading lib_dec/lib_dec.h +7 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,13 @@ ivas_error IVAS_DEC_VoIP_SetScale( const int16_t scale /* i : TSM scale to set */ ); #ifdef FIX_899_VARIABLE_SPEED_DECODING ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ ); #endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading Loading
apps/decoder.c +69 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ #endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include <math.h> #endif #include "vector3_pair_file_reader.h" #ifdef DEBUGGING Loading Loading @@ -1224,7 +1225,9 @@ static bool parseCmdlIVAS_dec( i++; int32_t tmp = 100; arg->tsmEnabled = true; #ifndef NONBE_UNIFIED_DECODING_PATHS arg->enable5ms = true; #endif if ( i < argc - 3 ) { if ( !is_digits_only( argv[i] ) ) Loading Loading @@ -2120,6 +2123,7 @@ static ivas_error decodeG192( /* we always start with needing a new frame */ needNewFrame = true; #ifndef FIX_899_VARIABLE_SPEED_DECODING #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING /*------------------------------------------------------------------------------------------* Loading @@ -2146,6 +2150,7 @@ static ivas_error decodeG192( } } #endif #endif #endif if ( !arg.quietModeEnabled ) Loading Loading @@ -2191,6 +2196,45 @@ static ivas_error decodeG192( } #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING /*------------------------------------------------------------------------------------------* * Open TSM scale file or set global TSM scale *------------------------------------------------------------------------------------------*/ if ( arg.tsmEnabled ) { if ( arg.tsmScaleFileEnabled ) { if ( ( tsmScaleFileReader = TsmScaleFileReader_open( arg.tsmScaleFileName ) ) == NULL ) { fprintf( stderr, "\nError: Can't open TSM scale file %s \n\n", arg.tsmScaleFileName ); goto cleanup; } } else { int16_t maxScaling; /* max scaling as abs diff to the normal frame size in samples */ maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } /* set lowest possbile TSM quality to make sure it is applied as much as possible */ if ( ( error = IVAS_DEC_TSM_SetQuality( hIvasDec, -2.0f ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_TSM_SetQuality failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif #endif #endif /*------------------------------------------------------------------------------------------* * Loop for every packet (frame) of bitstream data * - Read the bitstream packet Loading Loading @@ -2343,7 +2387,14 @@ static ivas_error decodeG192( fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); goto cleanup; } #ifdef FIX_899_VARIABLE_SPEED_DECODING int16_t maxScaling; /* max scaling as abs diff to the normal frame size in samples */ maxScaling = (int16_t) ceilf( (float) abs( arg.tsmScale - 100 ) / 100.0f * (float) ( nOutSamples * vec_pos_len ) ); if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, maxScaling, arg.tsmScale ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nIVAS_DEC_VoIP_SetScale failed: %s \n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -2415,6 +2466,22 @@ static ivas_error decodeG192( #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif #ifdef FIX_899_VARIABLE_SPEED_DECODING if ( needNewFrame ) { frame++; if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); #ifdef DEBUGGING if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) { fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); } #endif } } #endif } while ( nSamplesRendered < nOutSamples && error == IVAS_ERR_OK ); Loading Loading @@ -2538,6 +2605,7 @@ static ivas_error decodeG192( } } vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; #ifndef FIX_899_VARIABLE_SPEED_DECODING if ( needNewFrame ) { frame++; Loading @@ -2552,6 +2620,7 @@ static ivas_error decodeG192( #endif } } #endif #ifdef WMOPS if ( vec_pos_update == 0 ) { Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ #define FIX_643_PCA_OPTION /* VA: issue 643: rename PCA bypass command-line option */ /* #################### End BE switches ################################## */ #define FIX_899_VARIABLE_SPEED_DECODING /* FhG: Fix variable speed decoding */ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt selection floating point code */ Loading
lib_dec/lib_dec.c +49 −3 Original line number Diff line number Diff line Loading @@ -78,6 +78,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 FIX_899_VARIABLE_SPEED_DECODING float tsm_quality; #endif float *apaExecBuffer; /* Buffer for APA scaling */ PCMDSP_APA_HANDLE hTimeScaler; bool needNewFrame; Loading Loading @@ -163,6 +166,10 @@ ivas_error IVAS_DEC_Open( hIvasDec->apaExecBuffer = NULL; hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #endif hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; hIvasDec->nSamplesAvailableNext = 0; Loading Loading @@ -488,7 +495,12 @@ ivas_error IVAS_DEC_Configure( hIvasDec->nSamplesAvailableNext = 0; hIvasDec->nSamplesRendered = 0; hIvasDec->tsm_scale = 100; #ifdef FIX_899_VARIABLE_SPEED_DECODING hIvasDec->tsm_max_scaling = 0; hIvasDec->tsm_quality = 1.0f; #else hIvasDec->tsm_max_scaling = 100; #endif return error; } Loading Loading @@ -2528,8 +2540,8 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( ivas_error IVAS_DEC_VoIP_SetScale( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t maxScaling, const int16_t scale /* i : TSM scale to set */ const int16_t maxScaling, /* i : max allowed absolute difference in samples from the default 20ms frame size */ const int16_t scale /* i : TSM scale to set in percent of the default frame size */ ) { ivas_error error; Loading @@ -2549,6 +2561,36 @@ ivas_error IVAS_DEC_VoIP_SetScale( return error; } #ifdef FIX_899_VARIABLE_SPEED_DECODING /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * * Set the TSM scale *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) { return IVAS_ERR_TSM_NOT_ENABLED; } else { hIvasDec->tsm_quality = quality; } return error; } #endif /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetSamples( ) Loading Loading @@ -3634,7 +3676,11 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( uint16_t wss, css; float startQuality; #ifdef FIX_899_VARIABLE_SPEED_DECODING startQuality = hIvasDec->tsm_quality; #else startQuality = 1.0f; #endif apa_buffer_size = APA_BUF_PER_CHANNEL; /* get current renderer type*/ Loading
lib_dec/lib_dec.h +7 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,13 @@ ivas_error IVAS_DEC_VoIP_SetScale( const int16_t scale /* i : TSM scale to set */ ); #ifdef FIX_899_VARIABLE_SPEED_DECODING ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ ); #endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading