diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3fbcc0b1b994f7c6724ef8696166f178ec5d59e..c333b8e46fb7582259dbc0bd30f98be4399d1ff8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: - 'test-branch-vs-input-passthrough' GIT_CLEAN_FLAGS: -ffdxq - TESTCASE_TIMEOUT_STV_SANITIZERS: 180 + TESTCASE_TIMEOUT_STV_SANITIZERS: 240 TESTCASE_TIMEOUT_LTV_SANITIZERS: 2400 BASOP_REFERENCE_BRANCH: "ivas-float-update" SCALE_FACTOR: "3.162" @@ -2458,9 +2458,8 @@ coverage-test-on-main-scheduled: - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID) - echo $job_id - - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip - - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html - - ls + - curl --silent --show-error --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip + - unzip -qq artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html - public_dir="$CI_JOB_NAME-public" # if is needed to catch case when no artifact is there (first run), similarly as above @@ -2483,7 +2482,6 @@ coverage-test-on-main-scheduled: - fi - fi - - ls wmops - rm artifacts.zip - rm -rf $public_dir @@ -2496,8 +2494,6 @@ coverage-test-on-main-scheduled: - mkdir $public_dir/logs # first move logs - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g") - - echo $log_files - - ls wmops/logs - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done # copy index page blueprint - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html @@ -2505,7 +2501,6 @@ coverage-test-on-main-scheduled: - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html # do separately here to avoid overwrite complaints by mv - mv -f ci/complexity_measurements/style.css ${public_dir}/ - - ls $public_dir .complexity-template: extends: diff --git a/apps/decoder.c b/apps/decoder.c index dbd92244ded83d335caedabb58e58af019a954c8..c2d49eb68d964db8cdb2d73435dc7ea7fa260262 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -69,22 +69,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ -#define MIN_NUM_BITS_ACTIVE_FRAME 56 -#define NUM_BITS_SID_IVAS_5K2 104 -#define MAX_OUTPUT_PCM_BUFFER_SIZE ( ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) * IVAS_MAX_FRAME_SIZE ) - -#define ORIENT_TRK_NONE ( 0 ) -#define ORIENT_TRK_REF ( 1 ) -#define ORIENT_TRK_AVG ( 2 ) -#define ORIENT_TRK_REF_VEC ( 3 ) -#define ORIENT_TRK_REF_VEC_LEV ( 4 ) - -#ifdef VARIABLE_SPEED_DECODING -#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 +#ifdef DEBUGGING +#define MIN_NUM_BITS_ACTIVE_FRAME 56 +#define NUM_BITS_SID_IVAS_5K2 104 #endif -#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 -#define HEADROTATION_FETCH_FRAMESIZE_MS 5 -#define DEFAULT_FETCH_FRAMESIZE_MS 20 /*------------------------------------------------------------------------------------------* @@ -129,7 +117,7 @@ typedef struct IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; - int16_t orientation_tracking; + IVAS_HEAD_ORIENT_TRK_T orientation_tracking; bool non_diegetic_pan_enabled; float non_diegetic_pan_gain; bool renderConfigEnabled; @@ -183,7 +171,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec ); +static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); @@ -359,7 +347,7 @@ int main( } /* sanity check */ - if ( arg.orientation_tracking != ORIENT_TRK_REF ) + if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF ) { fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); goto cleanup; @@ -386,7 +374,7 @@ int main( } /* sanity check */ - if ( arg.orientation_tracking != ORIENT_TRK_REF_VEC && arg.orientation_tracking != ORIENT_TRK_REF_VEC_LEV ) + if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV ) { fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); goto cleanup; @@ -445,18 +433,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 +740,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 @@ -770,7 +752,7 @@ int main( if ( arg.voipMode ) { - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec ); + error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf ); } else { @@ -968,6 +950,10 @@ static bool parseCmdlIVAS_dec( int16_t i; char argv_to_upper[FILENAME_MAX]; + /*-----------------------------------------------------------------* + * Set default values + *-----------------------------------------------------------------*/ + #ifdef DEBUGGING float ftmp; @@ -976,7 +962,7 @@ static bool parseCmdlIVAS_dec( arg->agcBitstream = NULL; #endif #endif - arg->output_Fs = 48000; + arg->output_Fs = IVAS_MAX_SAMPLING_RATE; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; @@ -986,7 +972,7 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; - arg->orientation_tracking = ORIENT_TRK_NONE; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; arg->enableReferenceVectorTracking = false; @@ -1064,30 +1050,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++; } @@ -1198,9 +1172,9 @@ static bool parseCmdlIVAS_dec( } arg->tsmScale = (uint16_t) tmp; - if ( arg->tsmScale < 50 || arg->tsmScale > 150 ) + if ( arg->tsmScale < IVAS_TIME_SCALE_MIN || arg->tsmScale > IVAS_TIME_SCALE_MAX ) { - fprintf( stderr, "Error: Scaling factor value must be 50 <= fac <= 150!\n\n" ); + fprintf( stderr, "Error: Scaling factor value must be IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX!\n\n" ); usage_dec(); return false; } @@ -1237,10 +1211,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; } @@ -1275,23 +1247,23 @@ static bool parseCmdlIVAS_dec( if ( strcmp( argv_to_upper, "NONE" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_NONE; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; } else if ( strcmp( argv_to_upper, "REF" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF; } else if ( strcmp( argv_to_upper, "AVG" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_AVG; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_AVG; } else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF_VEC; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC; } else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF_VEC_LEV; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV; } else { @@ -1686,7 +1658,7 @@ static void usage_dec( void ) #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING fprintf( stdout, "-VS fac : Variable Speed mode: change speed of playout fac as integer in percent.\n" ); - fprintf( stdout, " 50 <= fac <= 150; fac<100 faster, fac>100 slower\n" ); + fprintf( stdout, " IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX; fac<100 faster, fac>100 slower\n" ); #endif #endif fprintf( stdout, "-fr L : render frame size in ms L=(5,10,20), default is 20)\n" ); @@ -1822,15 +1794,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 +1851,6 @@ static ivas_error initOnFirstGoodFrame( } } -#ifdef LIB_DEC_REVISION int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { @@ -1896,15 +1858,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 +2078,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 +2087,6 @@ static ivas_error decodeG192( } } -#endif #endif if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK ) { @@ -3023,14 +2980,15 @@ static ivas_error decodeVoIP( RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, - IVAS_DEC_HANDLE hIvasDec ) + IVAS_DEC_HANDLE hIvasDec, + int16_t *pcmBuf ) { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ ivas_error error = IVAS_ERR_OK; uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; - uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; + uint32_t systemTimeInc_ms = (uint32_t) ( 1000 / IVAS_NUM_FRAMES_PER_SEC ); int32_t nFramesFed = 0; uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; @@ -3044,7 +3002,6 @@ static ivas_error decodeVoIP( MasaFileWriter *masaWriter = NULL; uint16_t numObj = 0; - int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; AudioFileWriter *afWriter = NULL; #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriter *jbmTraceWriter = NULL; @@ -3445,12 +3402,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 +3414,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/apps/encoder.c b/apps/encoder.c index c91acdea23727619a4798430ea3c14c370d80ee1..9bf625bc972c3e94cff543cfe01b5b47f93ec185 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -154,7 +154,6 @@ typedef struct * Local functions prototypes *------------------------------------------------------------------------------------------*/ -static void initArgStruct( EncArguments *arg ); static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg ); static void usage_enc( void ); static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter ); @@ -207,8 +206,6 @@ int main( reset_mem( USE_BYTES ); #endif - initArgStruct( &arg ); - /*------------------------------------------------------------------------------------------* * Parse command-line arguments *------------------------------------------------------------------------------------------*/ @@ -878,14 +875,29 @@ cleanup: * Local functions *-------------------------------------------------------------------*/ -#define IVAS_DEFAULT_AGC ( 0 ) +/*---------------------------------------------------------------------* + * parseCmdlIVAS_enc() + * + * Encoder command-line parsing + *---------------------------------------------------------------------*/ -static void initArgStruct( EncArguments *arg ) +static bool parseCmdlIVAS_enc( + int16_t argc, + char *argv[], + EncArguments *arg ) { - /* Set default values here */ + int16_t i, j; + char argv_to_upper[FILENAME_MAX]; + char stmp[FILENAME_MAX]; + int32_t tmp; + + /*-----------------------------------------------------------------* + * Set default values + *-----------------------------------------------------------------*/ + arg->inputWavFilename = NULL; arg->outputBitstreamFilename = NULL; - arg->inputFs = 0; + arg->inputFs = IVAS_MAX_SAMPLING_RATE; arg->inputFormat = IVAS_ENC_INPUT_MONO; arg->is_binaural = false; arg->inputFormatConfig.stereoToMonoDownmix = false; @@ -919,25 +931,9 @@ static void initArgStruct( EncArguments *arg ) #endif arg->pca = false; - return; -} - - -/*---------------------------------------------------------------------* - * parseCmdlIVAS_enc() - * - * Encoder command-line parsing - *---------------------------------------------------------------------*/ - -static bool parseCmdlIVAS_enc( - int16_t argc, - char *argv[], - EncArguments *arg ) -{ - int16_t i, j; - char argv_to_upper[FILENAME_MAX]; - char stmp[FILENAME_MAX]; - int32_t tmp; + /*-----------------------------------------------------------------* + * Initialization + *-----------------------------------------------------------------*/ if ( argc < 5 ) { diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 64aab53ed057511ce8f8a2079e1b6903933aadc9..aa004c4cc3a094b1c256d47ea4ffe01871a27b07 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -945,7 +945,7 @@ int main( memset( outBuffer.data, 0, outBuffer.config.numSamplesPerChannel * outBuffer.config.numChannels * sizeof( float ) ); - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + bitsBufferSize = ISAR_SPLIT_REND_BITS_BUFF_SIZE; if ( bitsBufferSize > 0 ) { @@ -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/apps/renderer.c b/apps/renderer.c index 775a9d6ee930b1c47be50ed13eee4f104a8bb5fa..1fb83acc5ae1689af041495acb51c5cd2e031916 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -168,7 +168,7 @@ typedef struct char externalOrientationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; - int8_t orientation_tracking; + IVAS_HEAD_ORIENT_TRK_T orientation_tracking; int16_t Opt_Headrotation; int16_t Opt_ExternalOrientation; int16_t nonDiegeticPan; @@ -1436,7 +1436,7 @@ int main( if ( is_split_pre_rend_mode( &args ) ) { - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + bitsBufferSize = ISAR_SPLIT_REND_BITS_BUFF_SIZE; } else { @@ -2268,7 +2268,7 @@ static bool parseRenderFramesize( static bool parseOrientationTracking( char *value, - int8_t *orientation_tracking ) + IVAS_HEAD_ORIENT_TRK_T *orientation_tracking ) { to_upper( value ); diff --git a/ci/complexity_measurements/check_for_changes.py b/ci/complexity_measurements/check_for_changes.py index 498d0d1a4d3aae4262b529b63d894ebd4833bc23..424b474b716074bdf8c8215ec18850a996655acb 100644 --- a/ci/complexity_measurements/check_for_changes.py +++ b/ci/complexity_measurements/check_for_changes.py @@ -53,10 +53,6 @@ def check_linewise_logfile(filepath, cols): changes_found = True break - if changes_found: - print("Previous log line:", prev) - print("Current log line:", curr) - return changes_found diff --git a/ci/complexity_measurements/genWebpageData.py b/ci/complexity_measurements/genWebpageData.py index cb46bf056e2794f84c79237327911a73bbb1f2a0..f567dd1d2302ff4c23501173b85a14ad2fe4e717 100644 --- a/ci/complexity_measurements/genWebpageData.py +++ b/ci/complexity_measurements/genWebpageData.py @@ -47,9 +47,6 @@ RUNS_KEYS_WMOPS = RUNS_KEYS_COMMON + [ "worstCaseEnc", "worstCaseDec", "worstCaseCodec", - "worstCaseEncRs", - "worstCaseDecRs", - "worstCaseCodecRs", "fixpointScalingFac", ] RUNS_KEYS_WMOPS_PER_OP = [ @@ -82,9 +79,9 @@ RUNS_KEYS = { "wmops_per_op": RUNS_KEYS_WMOPS_PER_OP, } RUNS_LINE_IDX = { - "wmops": [2, 1, 0, 4, 6, 8, 12, 14, 16, 10, 18], - "rom": [2, 1, 0, 4, 6, 8, 10, 12, 14, 16, 18, 20], - "ram": [2, 1, 0, 4, 6, 9, 11, 14, 16, 18], + "wmops": [2, 1, 0, 18, 4, 6, 8, 10], + "rom": [2, 1, 0, 20, 4, 6, 8, 10, 12, 14, 16, 18], + "ram": [2, 1, 0, 18, 4, 6, 9, 11, 14, 16], "wmops_per_op": [0, 4], } diff --git a/ci/complexity_measurements/getWmops.sh b/ci/complexity_measurements/getWmops.sh index 148092eb1a0011bc3ddba1a8d695efc2f76c9ea9..8087cae67b6dbfba55310f55c40ab4ed6f220227 100755 --- a/ci/complexity_measurements/getWmops.sh +++ b/ci/complexity_measurements/getWmops.sh @@ -89,7 +89,6 @@ ret_val_script=$? # for wmops and RAM graphs, split by levels split_suffixes=("_rate_sw" "_level_1" "_level_2" "_level_3") for suffix in "${split_suffixes[@]}"; do - echo "$suffix" wmopsFilenameFlc_split="${wmopsFilenameFlc}_WMOPS${suffix}.csv" wmopsFilenameFlcLast_split="${wmopsFilenameFlcLast}_WMOPS${suffix}.csv" @@ -135,12 +134,14 @@ else python3 ci/complexity_measurements/genWebpageData.py --wmops_per_op_log ${wmopsFilenameFlc}_WMOPS.csv --rom_log ${log_rom_all} fi -ret_val=0 python3 ${scriptDir}/check_for_changes.py --wmops_logfiles $(ls ${destDir}/wmops/log_wmops_all*.txt) --ram_logfiles $(ls ${destDir}/wmops/log_ram_all*.txt) --rom_logfile ${destDir}/wmops/log_rom_all.txt -if [ "$?" != "0" ]; then - ret_val=123 -elif [ "$ret_val_script" != "0" ]; then +ret_val_changes=$? + +ret_val=0 +if [ "$ret_val_script" != "0" ]; then ret_val=1 +elif [ "$ret_val_changes" != "0" ]; then + ret_val=123 fi exit $ret_val diff --git a/ci/complexity_measurements/parseNewsletterRam.py b/ci/complexity_measurements/parseNewsletterRam.py index b7bb4a8517acd31aa33e27120fbd9634e4d6c215..c6d10681a43f163a24781e13b75c8535e69a48aa 100755 --- a/ci/complexity_measurements/parseNewsletterRam.py +++ b/ci/complexity_measurements/parseNewsletterRam.py @@ -40,6 +40,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilenameHEAP = sys.argv[1] newsletterFilenameSTACK = sys.argv[2] @@ -135,23 +141,23 @@ for key in ram_table: print( - revision, # string revision $tmp[1] - shortDate, # string shortDate $tmp[2] - fullDate, # string fullDate $tmp[3] - max_total_encdec[1], # value maxTotalRamCodecScore $tmp[4] - max_total_enc[0], # string maxTotalRamEnc $tmp[5] - max_total_enc[1], # value maxTotalRamEnc $tmp[6] - max_total_dec[0], # string maxTotalRamDec $tmp[7] - max_total_dec[1], # value maxTotalRamDecScore $tmp[8] - max_stack_encdec[1], # value maxStackCodecScore $tmp[9] - max_stack_enc[0], # string maxStackEnc $tmp[10] - max_stack_enc[1], # value maxStackEncScore $tmp[11] - max_stack_dec[0], # string maxStackDec $tmp[12] - max_stack_dec[1], # value maxStackDecScore $tmp[13] - max_heap_encdec[1], # value maxHeapCodecScore $tmp[14] - max_heap_enc[0], # string maxHeapEnc $tmp[15] - max_heap_enc[1], # value maxHeapEncScore $tmp[16] - max_heap_dec[0], # string maxHeapDec $tmp[17] - max_heap_dec[1], # value maxHeapDecScore $tmp[19] - newsletterFilenameLast, # string logFile $tmp[19] + revision, # string revision + shortDate, # string shortDate + fullDate, # string fullDate + max_total_encdec[1], # value maxTotalRamCodecScore + max_total_enc[0], # string maxTotalRamEnc + max_total_enc[1], # value maxTotalRamEnc + max_total_dec[0], # string maxTotalRamDec + max_total_dec[1], # value maxTotalRamDecScore + max_stack_encdec[1], # value maxStackCodecScore + max_stack_enc[0], # string maxStackEnc + max_stack_enc[1], # value maxStackEncScore + max_stack_dec[0], # string maxStackDec + max_stack_dec[1], # value maxStackDecScore + max_heap_encdec[1], # value maxHeapCodecScore + max_heap_enc[0], # string maxHeapEnc + max_heap_enc[1], # value maxHeapEncScore + max_heap_dec[0], # string maxHeapDec + max_heap_dec[1], # value maxHeapDecScore + newsletterFilenameLast, # string logFile ) diff --git a/ci/complexity_measurements/parseNewsletterRom.py b/ci/complexity_measurements/parseNewsletterRom.py index 41501282bba1de3d6a7d763e16d10663d3305181..ab61c93a01980b8001ea12b2c4d09726e1da7853 100755 --- a/ci/complexity_measurements/parseNewsletterRom.py +++ b/ci/complexity_measurements/parseNewsletterRom.py @@ -41,6 +41,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilenamePROM = sys.argv[1] newsletterFilenameTROM = sys.argv[2] @@ -140,25 +146,25 @@ for key in rom_table: print( - revision, # string revision $tmp[1] - shortDate, # string shortDate $tmp[2] - fullDate, # string fullDate $tmp[3] - max_total_encdec[1], # value maxTotalRomCodecScore $tmp[4] - max_prom_enc[0], # string maxPROMEnc $tmp[5] - max_prom_enc[1], # value maxPROMEncScore $tmp[6] - max_prom_dec[0], # string maxPROMDec $tmp[7] - max_prom_dec[1], # value maxPROMDecScore $tmp[8] - max_prom_com[0], # string maxPROMCom $tmp[9] - max_prom_com[1], # value maxPROMComScore $tmp[10] - max_prom_rend[0], # string maxPROMRend $tmp[11] - max_prom_rend[1], # value maxPROMRendScore $tmp[12] - max_trom_enc[0], # string maxTROMEnc $tmp[13] - max_trom_enc[1], # value maxTROMEncScore $tmp[14] - max_trom_dec[0], # string maxTROMDec $tmp[15] - max_trom_dec[1], # value maxTROMDecScore $tmp[16] - max_trom_com[0], # string maxTROMCom $tmp[17] - max_trom_com[1], # value maxTROMComScore $tmp[18] - max_trom_rend[0], # string maxTROMRend $tmp[19] - max_trom_rend[1], # value maxTROMRendScore $tmp[20] - newsletterFilenameLast, # string logFile $tmp[21] + revision, # string revision + shortDate, # string shortDate + fullDate, # string fullDate + max_total_encdec[1], # value maxTotalRomCodecScore + max_prom_enc[0], # string maxPROMEnc + max_prom_enc[1], # value maxPROMEncScore + max_prom_dec[0], # string maxPROMDec + max_prom_dec[1], # value maxPROMDecScore + max_prom_com[0], # string maxPROMCom + max_prom_com[1], # value maxPROMComScore + max_prom_rend[0], # string maxPROMRend + max_prom_rend[1], # value maxPROMRendScore + max_trom_enc[0], # string maxTROMEnc + max_trom_enc[1], # value maxTROMEncScore + max_trom_dec[0], # string maxTROMDec + max_trom_dec[1], # value maxTROMDecScore + max_trom_com[0], # string maxTROMCom + max_trom_com[1], # value maxTROMComScore + max_trom_rend[0], # string maxTROMRend + max_trom_rend[1], # value maxTROMRendScore + newsletterFilenameLast, # string logFile ) diff --git a/ci/complexity_measurements/parseNewsletterWmops.py b/ci/complexity_measurements/parseNewsletterWmops.py index 4579ccae8f6b98bb1bb0954c191c1bc96eaed55b..26635071bacc9e0d5b4bc578d8069fb6c4279cfa 100755 --- a/ci/complexity_measurements/parseNewsletterWmops.py +++ b/ci/complexity_measurements/parseNewsletterWmops.py @@ -40,6 +40,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilename = sys.argv[1] newsletterFilenameLast = sys.argv[2] @@ -67,6 +73,9 @@ with open(newsletterFilename, "r") as csvfile: max_total[0] = re.sub(" ", "_", row[0]) max_total[1] = float(row[3]) +# NOTE: there is a repetiion of some values here. This has historical reasons. +# The repeated values are ignored in the later processing, but to not break the file format +# this is kept as is. print( revision, shortDate, diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 7e3e86ec43e6a81e100c12327d2299bfc0497e4c..dd1f707ffb1ba7b4780b49a37617a37f4c9aa1fc 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -44,24 +44,27 @@ * Common API constants *----------------------------------------------------------------------------------*/ -#define IVAS_NUM_FRAMES_PER_SEC 50 -#define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) -#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) +#define IVAS_NUM_FRAMES_PER_SEC 50 /* number of frames per second */ +#define IVAS_MAX_SAMPLING_RATE 48000 /* maximum supported sampling rate in Hz */ +#define IVAS_MAX_FRAME_SIZE ( IVAS_MAX_SAMPLING_RATE / IVAS_NUM_FRAMES_PER_SEC ) /* maximum frame buffer length (per channel) in samples */ +#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) /* maximum bits per frame; corresponds to maximum bitrate of 512 kbps */ #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 -#define IVAS_MAX_OUTPUT_CHANNELS 16 +#define IVAS_MAX_OUTPUT_CHANNELS 16 /* Note: there is an exception for OSBA and EXT otuput where it can be 20 (HOA3 + 4 ISM channels) */ #define IVAS_CLDFB_NO_COL_MAX 16 #define IVAS_CLDFB_NO_CHANNELS_MAX 60 +/* Renderer constants */ #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 #define IVAS_ROOM_ABS_COEFF 6 +#define IVAS_REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ +#define IVAS_ER_LIST_HEIGHT 1.6f -/* Maximum buffer length (per channel) in samples */ -#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +/* JBM constants for adaptive-playout */ +#define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ +#define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */ -/* Frame size required when rendering to binaural */ -#define BINAURAL_RENDERING_FRAME_SIZE_MS 5 /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations @@ -174,12 +177,12 @@ typedef enum typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; -typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; +typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; typedef struct ivas_hrtf_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -typedef struct ivas_hrtfs_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE; -typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; +typedef struct ivas_hrtf_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; +typedef struct ivas_hrtf_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; +typedef struct ivas_hrtf_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE; +typedef struct ivas_cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; @@ -228,7 +231,7 @@ typedef enum _ivas_binaural_renderer_type #define ISAR_MAX_SPLIT_REND_BITRATE 768000 #define ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) ISAR_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #define ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 -#define SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#define ISAR_SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) typedef enum { @@ -306,8 +309,8 @@ typedef enum IVAS_RENDER_TYPE_OVERRIDE_FASTCONV } IVAS_RENDER_TYPE_OVERRIDE; -#endif +#endif typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ @@ -350,6 +353,7 @@ typedef struct { IVAS_REND_AudioBufferConfig config; float *data; + } IVAS_REND_AudioBuffer; #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 8a9e8dea1924480f48ec57f3d0555b274c4e373b..d2c2db4900af8458e78632f5d67bbd3674a80d58 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -133,7 +133,7 @@ typedef enum #define MAX_INTERN_CHANNELS 16 /* Maximum number of intern channels (HOA 3rd order) */ #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ #define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ -#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order), == IVAS_MAX_OUTPUT_CHANNELS */ +#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) without separate objects in combined formats */ #define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN 2 /* Maximum number of output channels with non diegetic panning */ #define BINAURAL_CHANNELS 2 /* number of channels for binaural output configuration */ @@ -1490,7 +1490,6 @@ typedef enum #define HRTF_SH_CHANNELS HOA3_CHANNELS #define HRTF_LS_CHANNELS 15 #define HRTF_NUM_BINS 60 -#define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ #define LOW_BIT_RATE_BINAURAL_EQ_BINS 17 /* Number of bins in an EQ applied at low bit rates in binauralization */ #define LOW_BIT_RATE_BINAURAL_EQ_OFFSET 14 /* Offset of bins where the low-bit-rate EQ starts*/ @@ -1722,9 +1721,7 @@ typedef enum *----------------------------------------------------------------------------------*/ #define ER_RADIUS (1.0f) -#define ER_LIST_ORIGIN_X (0.0f) -#define ER_LIST_ORIGIN_Y (0.0f) -#define ER_LIST_HEIGHT (1.6f) +#define ER_LIST_HEIGHT IVAS_ER_LIST_HEIGHT /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fb8973884e0d6072e11721aa1a78f7e85bbd864d..f5e239f3b0634de8f42f932e8399101cb4b6af2a 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 */ ); @@ -806,12 +804,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( @@ -896,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( @@ -5808,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 23a9a303de024d9dd1365cf7113a47909c21fc16..80cd7a383bbd806dfa0f5fa82fac8262234d7590 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 ################################## */ @@ -171,11 +170,7 @@ /* 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 */ -#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_com/stat_com.h b/lib_com/stat_com.h index 622a07eb1f84f4effef66fd4f09ded4af332e43c..4f459ef531af9409ffe1733321edba991b965cad 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -573,7 +573,7 @@ typedef struct } FrameSizeParams; -typedef struct cldfb_filter_bank_struct +typedef struct ivas_cldfb_filter_bank_struct { int16_t no_channels; int16_t no_col; diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index ccb840404f9e58408cf21593892029e5ae5bfa31..f9ab923be7a3d6631b70d0af15e719b3bd3e9d5f 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_init_dec.c b/lib_dec/ivas_init_dec.c index aac6720870adeffc57f7256c376e544e8dfb385b..0d3610065b7597d8d40e52eb6a0179075f70b516 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 e7c793caf3b12202f04b08b34f54f605491ebd19..7472690650963f06c709a1ae643c6556af5abf18 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 93202b94cf4be011f19d3dce226026341ba3ad90..52e9bd0d4c42e8dfc9577de9cdd84b85bc2cfb8f 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 4d381bc980151e80faa7d864389d1cb45aef3fd1..9b310da630365a96347b4530682ead30941514de 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 ); @@ -2088,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 */ @@ -2112,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 /*--------------------------------------------------------------------------* @@ -2885,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 ) { @@ -2967,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 ) { @@ -2976,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_masa_dec.c b/lib_dec/ivas_masa_dec.c index 62e711718a6791a1936b064fc67314703101e66c..34d528b0e3d8687e9f6a0ee67a505b3505aed97e 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 048f26e3793a5c1faf855fc2717e2339acfaa2eb..8b33aebe631dc14a7eb9d46b4c851fbddba3aa0a 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 81bd4023a4042ed86b75f0dfc67e49ec93243a91..c06e8b3fa18632bff589fa6d452bcd57394a3f1b 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 4c2ace3908d87e207b260bd1605d7d72f12daf99..3300eb7965b34dcf949d2370339bcd3b357db8ac 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 597480b8eacb3f164ec4f752e9a97999113d0c03..ff47b1b9a77fa56f539ca737a201d2fff16f22b5 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" ); } @@ -185,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]; @@ -202,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()*/ @@ -212,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 b468df043993c4d2c19114735ca1808b1a0ab95b..beaf645fa0d1bfad365e0136c0f1025bd71ab945 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/ivas_output_config.c b/lib_dec/ivas_output_config.c index 305d99ef994f9720defb93e4d00454a5223658ff..430b57afa20dbbe874fe3b7c78638efa2e1d7c97 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -481,11 +481,10 @@ void ivas_renderer_select( } -#ifdef NONBE_1303_REND_GRANULARITY /*-------------------------------------------------------------------------* * 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 */ @@ -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 2164e490d425e88a6226aa426ed73318a339baa5..ade8e11b020756b9b0dff0cec52800e2410b7335 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 205bc77859b29600c31d51af54718c96006e863c..98dc1ad3fa7e31c6b606e448b48887915d8725c1 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/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 26c380e38a16e5230fc773e090514e64042d1d92..a728cb53d346366279f716c756017a71eda89711 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -39,9 +39,9 @@ #ifndef JBM_PCMDSP_APA_H #define JBM_PCMDSP_APA_H JBM_PCMDSP_APA_H +#include "common_api_types.h" #include -#include -#include "options.h" + /* ******************************************************************************** @@ -50,17 +50,17 @@ */ /* size of IO buffers (a_in[], a_out[]) for apa_exec() */ -#define APA_BUF_PER_CHANNEL ( 960 * 3 ) +#define APA_BUF_PER_CHANNEL ( IVAS_MAX_FRAME_SIZE * 3 ) #define APA_MAX_NUM_CHANNELS 16 #define APA_BUF ( APA_BUF_PER_CHANNEL * APA_MAX_NUM_CHANNELS ) /* min/max sampling rate [Hz] */ #define APA_MIN_RATE 1000 -#define APA_MAX_RATE 48000 +#define APA_MAX_RATE IVAS_MAX_SAMPLING_RATE /* min/max scaling [%] */ -#define APA_MIN_SCALE 50 -#define APA_MAX_SCALE 150 +#define APA_MIN_SCALE IVAS_TIME_SCALE_MIN +#define APA_MAX_SCALE IVAS_TIME_SCALE_MAX #define APA_SM_SURROUND 1 #define APA_SM_LOGARITHMIC 2 diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 37b50287ad714e62d7754339bf05a4a26dacc877..984f22cb053bd63d8cba866d5a2c848e708c922b 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,15 +902,11 @@ 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; } -#ifdef NONBE_1303_REND_GRANULARITY /*---------------------------------------------------------------------* * renderer_type_to_mode() @@ -1022,7 +948,6 @@ static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode( return binaural_renderer; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_ReadFormat( ) @@ -1046,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 ) { @@ -1065,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; @@ -1091,43 +1009,11 @@ 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) */ + /* 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 ); -#else - 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; - } -#endif /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; @@ -1177,7 +1063,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 ) || @@ -1208,25 +1093,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 } } @@ -1255,33 +1121,26 @@ 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 ) { 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; -#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 +1149,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 +1175,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 +1182,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 +1190,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 +1215,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 ) { @@ -1484,14 +1298,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; @@ -1632,12 +1444,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; @@ -1838,13 +1648,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; @@ -1884,9 +1693,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 ); } @@ -1913,9 +1720,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; @@ -1974,20 +1778,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 { @@ -1997,32 +1789,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,41 +1807,19 @@ 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; } 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; @@ -2075,7 +1830,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( *needNewFrame = false; } -#endif *nOutSamples = nSamplesRendered; return IVAS_ERR_OK; @@ -2180,12 +1934,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 ) @@ -2289,7 +2041,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * ivas_dec_setup_all() * @@ -2302,19 +2053,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 +2073,6 @@ static ivas_error IVAS_DEC_Setup( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION /* Setup IVAS split rendering */ if ( isSplitRend ) { @@ -2345,7 +2082,6 @@ static ivas_error IVAS_DEC_Setup( } } -#endif /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling @@ -2363,9 +2099,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 +2106,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 +2126,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 +2153,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; @@ -2613,7 +2203,7 @@ ivas_error IVAS_DEC_GetFormat( /*---------------------------------------------------------------------* - * getInputBufferSize() + * getOutputBufferSize() * * Get size of output buffer in samples *---------------------------------------------------------------------*/ @@ -2785,11 +2375,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; @@ -3263,13 +2849,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 ); } @@ -3580,35 +3160,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 +3348,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( } #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * IVAS_DEC_EnableTsm( ) @@ -3832,7 +3382,6 @@ ivas_error IVAS_DEC_EnableTsm( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_TSM_SetQuality( ) @@ -3937,19 +3486,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 +3598,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif } } @@ -4070,9 +3609,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 +3622,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 +3674,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 +3716,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 +3776,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 +4183,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 +4256,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 +4275,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 +4474,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * apa_setup() * @@ -5011,122 +4484,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 2a02fd46ec55fda164b1b58f3216de3fe97bfe87..588399ef2ad1714f7934eae25ee6c785c74a696e 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 */ diff --git a/lib_isar/isar_cnst.h b/lib_isar/isar_cnst.h index a2eecd7426ea9e413e8ba695be3869fc1aaec094..b7065bac4cbb78325df48cf9008b212e883afae3 100644 --- a/lib_isar/isar_cnst.h +++ b/lib_isar/isar_cnst.h @@ -110,7 +110,7 @@ typedef enum #define ISAR_SPLIT_REND_ROT_AXIS_BITS 3 #define ISAR_SPLIT_REND_RO_FLAG_BITS 1 -#define IVAS_LC3PLUS_MAX_NUM_DECODERS 2 +#define ISAR_LC3PLUS_MAX_NUM_DECODERS 2 /*----------------------------------------------------------------------------------* * Split rendering bitrate constants diff --git a/lib_isar/isar_lc3plus_dec.c b/lib_isar/isar_lc3plus_dec.c index 01296ebaa76c2e10daacbd7d9ec0dd972f32aec2..560f34f1c46077a88416829e3c748c11caf75e2b 100644 --- a/lib_isar/isar_lc3plus_dec.c +++ b/lib_isar/isar_lc3plus_dec.c @@ -66,9 +66,9 @@ ivas_error ISAR_LC3PLUS_DEC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); } - if ( config.channels > IVAS_LC3PLUS_MAX_NUM_DECODERS ) + if ( config.channels > ISAR_LC3PLUS_MAX_NUM_DECODERS ) { - return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "Maximum number of channels exceeds IVAS_LC3PLUS_MAX_NUM_DECODERS\n" ); + return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "Maximum number of channels exceeds ISAR_LC3PLUS_MAX_NUM_DECODERS\n" ); } ( *handle )->num_decs = 0; diff --git a/lib_isar/isar_stat.h b/lib_isar/isar_stat.h index acdddd83938c685c31aec5211e335030916cc9d2..587c3c8ea7309fc6a4fe0fe3cbc66dbebfdcd0f8 100644 --- a/lib_isar/isar_stat.h +++ b/lib_isar/isar_stat.h @@ -48,9 +48,9 @@ * ISAR post rend constants *-------------------------------------------------------------------*/ -#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) +#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME_MAX * 2 ) #define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) +#define MAX_BIN_BUFFER_LENGTH ( L_FRAME_MAX * BINAURAL_CHANNELS ) #define MAX_CLDFB_BIN_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) /*-------------------------------------------------------------------* diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 7e050abc068ffad6beb394193e3b8bf346a2ad61..5dcc099fd705e6b3c940a932d4d5d0b2a5c46149 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1037,8 +1037,8 @@ ivas_error ISAR_POST_REND_FeedInputAudio( cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; - if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } @@ -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++ ) @@ -1652,8 +1651,8 @@ ivas_error ISAR_POST_REND_getSamples( cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; - if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) + if ( outAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3be1a116d7a5543c6ead08e89245837286259547..cc1bccb131955da0c19949855baa2db5f55a8f97 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 ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 98a46150c1a3310beaad952d94f5ee7333293309..2811a3c4d03ec644555e7daa56eca3dd233f1638 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -158,9 +158,9 @@ static void ivas_binaural_reverb_setPreDelay( return; } - if ( delaySamples > REVERB_PREDELAY_MAX ) + if ( delaySamples > IVAS_REVERB_PREDELAY_MAX ) { - hReverb->preDelayBufferLength = REVERB_PREDELAY_MAX; + hReverb->preDelayBufferLength = IVAS_REVERB_PREDELAY_MAX; return; } @@ -1784,7 +1784,7 @@ static ivas_error ivas_binaural_reverb_open( hReverb->numBins = numBins; hReverb->blockSize = numCldfbSlotsPerFrame; - for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) + for ( k = 0; k < IVAS_REVERB_PREDELAY_MAX + 1; k++ ) { set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index b2c0fb3cbb9df8a195d5fba59ac3c77b8b52fa7d..855d47673cf13a6c40daa4be91eb53e95b1b4739 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -47,7 +47,6 @@ *-----------------------------------------------------------------------------------------*/ #define DEFAULT_SRC_DIST ( 1.5f ) /* default source distance [m] for reverb dmx factor computing */ -#define MAX_SAMPLING_RATE ( 48000 ) #define CLDFB_CONVOLVER_NTAPS_MAX ( 16 ) #define FFT_SPECTRUM_SIZE ( 1 + ( RV_FILTER_MAX_FFT_SIZE / 2 ) ) @@ -92,7 +91,7 @@ ivas_error ivas_reverb_prepare_cldfb_params( for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); + fc[idx] = ( (float) idx + 0.5f ) * ( (float) IVAS_MAX_SAMPLING_RATE / (float) ( 2 * IVAS_CLDFB_NO_CHANNELS_MAX ) ); } ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); @@ -135,9 +134,9 @@ static void ivas_reverb_set_energies( float *avg_pwr_right ) { int16_t freq_idx; - const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); + const int16_t cldfb_freq_halfstep = IVAS_MAX_SAMPLING_RATE / ( 4 * IVAS_CLDFB_NO_CHANNELS_MAX ); float input_fc[FFT_SPECTRUM_SIZE]; - float output_fc[CLDFB_NO_CHANNELS_MAX]; + float output_fc[IVAS_CLDFB_NO_CHANNELS_MAX]; const int16_t avg_pwr_len = sampling_rate == 16000 ? LR_IAC_LENGTH_NR_FC_16KHZ : LR_IAC_LENGTH_NR_FC; for ( freq_idx = 0; freq_idx < avg_pwr_len; freq_idx++ ) @@ -145,10 +144,10 @@ static void ivas_reverb_set_energies( input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( avg_pwr_len - 1 ) ); } - for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) + for ( freq_idx = 0; freq_idx < IVAS_CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } - ivas_reverb_interpolate_acoustic_data( avg_pwr_len, input_fc, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); + ivas_reverb_interpolate_acoustic_data( avg_pwr_len, input_fc, avg_pwr_l, avg_pwr_r, IVAS_CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 8969b3188fa852766696f58b5730bbd3cccc37d0..e990c336f69e0d8c2e45520c92754ff21f3a992d 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -452,8 +452,8 @@ typedef struct ivas_binaural_reverb_struct { float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferReal[IVAS_REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferImag[IVAS_REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; @@ -495,7 +495,7 @@ typedef struct ivas_diffuse_distribution_data_structure } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; /* Parametric binaural renderer HRTF structure */ -typedef struct ivas_hrtfs_parambin_struct +typedef struct ivas_hrtf_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1026,7 +1026,7 @@ typedef struct } TDREND_MIX_Listener_t; /* HR filter */ -typedef struct TDREND_HRFILT_FiltSet_struct +typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct { int32_t SampleRate; /* Sample rate of the HR filter */ int16_t NumPos; @@ -1245,7 +1245,7 @@ typedef struct ivas_binaural_rendering_struct *------------------------------------------------------------------------------------------*/ /* Fastconv binaural data structure */ -typedef struct ivas_hrtfs_fastconv_struct +typedef struct ivas_hrtf_fastconv_struct { float FASTCONV_latency_s; float ***leftReal; @@ -1263,7 +1263,7 @@ typedef struct ivas_hrtfs_fastconv_struct } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_statistics_struct +typedef struct ivas_hrtf_statistics_struct { const float *average_energy_l; const float *average_energy_r; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e3e5c2faa2d9e2ce691a64febb02d650681791d2..2d77b66ed67f1a287b1ed9a2ef145badee6e80ca 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -51,7 +51,7 @@ *-------------------------------------------------------------------*/ /* Maximum buffer length (total) in samples. */ -#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_BUFFER_LENGTH ( L_FRAME_MAX * MAX_INPUT_CHANNELS ) #define MAX_BIN_DELAY_SAMPLES 150 /* Maximum supported rendering latency for binaural IRs */ /*-------------------------------------------------------------------* @@ -3956,8 +3956,8 @@ ivas_error IVAS_REND_FeedInputAudio( cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; - if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } @@ -5727,7 +5727,7 @@ static ivas_error renderLfeToBinaural( int16_t pose_idx, num_poses; float gain; int16_t ear_idx; - float tmpLfeBuffer[MAX_BUFFER_LENGTH_PER_CHANNEL]; + float tmpLfeBuffer[L_FRAME_MAX]; int16_t frame_size, num_cpy_smpl_cur_frame, num_cpy_smpl_prev_frame; const float *lfeInput; float *writePtr; @@ -7355,8 +7355,8 @@ static ivas_error getSamplesInternal( cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; - if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) + if ( outAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 806f7983a85f304bce0b87c181d9a238d2a8b453..f71a1a5384af99db36a33a7ac77f696011c1fb36 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -41,12 +41,16 @@ * Renderer constants *---------------------------------------------------------------------*/ -#define RENDERER_MAX_ISM_INPUTS 4 +#define RENDERER_MAX_ISM_INPUTS IVAS_MAX_NUM_OBJECTS #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 #define RENDERER_MAX_INPUT_LFE_CHANNELS 4 +/* Frame size required when rendering to binaural */ +#define BINAURAL_RENDERING_FRAME_SIZE_MS 5 + + /*---------------------------------------------------------------------* * Renderer structures *---------------------------------------------------------------------*/ diff --git a/lib_util/ambi_convert.c b/lib_util/ambi_convert.c index b8208824a4050ef52cc9ef9c88f003949d7dda0c..282f4a08726273423d57d4986c8cad17d2666b1e 100644 --- a/lib_util/ambi_convert.c +++ b/lib_util/ambi_convert.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#include + #include #include #include "ambi_convert.h" diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index ca5e6e4963b676da58526fbb30a3cf07d9f34f77..1b52daaa772cf7bf0487f178202f1107c59af36c 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -32,9 +32,6 @@ #include "audio_file_reader.h" #include "tinywavein_c.h" -#include -#include -#include "wmc_auto.h" struct AudioFileReader { diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index fb7a64c425b6f648667a969290b6086c11158887..321063101959dc6ecab0a60103f1f2de3246a52e 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -32,9 +32,8 @@ #include "audio_file_writer.h" #include "tinywaveout_c.h" -#include #include -#include "wmc_auto.h" + struct AudioFileWriter { diff --git a/lib_util/bitstream_reader.c b/lib_util/bitstream_reader.c index 45c82ed4c889158c02e451c1fe0c76dd2b562670..a250a34a70323023220c7345f0c7424ff730af18 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -33,7 +33,6 @@ #include "bitstream_reader.h" #include "g192.h" #include "mime_io.h" -#include "ivas_error.h" #include "ivas_error_utils.h" #include #include diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 01d1f0307ad721fc38ffa53ff338563ab5c792ad..48c87a88eae79e998a5dc7774c9962932d7f5f5f 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -34,7 +34,6 @@ #include #include #include "ivas_prot.h" -#include "prot.h" struct LsCustomFileReader @@ -126,6 +125,13 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( float azi_tmp[IVAS_MAX_OUTPUT_CHANNELS]; float ele_tmp[IVAS_MAX_OUTPUT_CHANNELS]; + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + dup[i] = 0; + azi_tmp[i] = 0.0f; + ele_tmp[i] = 0.0f; + } + if ( *num_azi != *num_ele ) { return LS_CUSTOM_FILEREADER_NUM_SPK_MISMATCH_ERROR; @@ -150,7 +156,6 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( /* Check for and flag duplicate loudspeakers */ dup_count = 0; - set_s( dup, 0, IVAS_MAX_OUTPUT_CHANNELS ); for ( i = 0; i < *num_azi; i++ ) { for ( j = i + 1; j < *num_azi; j++ ) @@ -163,9 +168,6 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( } /* Remove duplicates from array */ - set_zero( azi_tmp, IVAS_MAX_OUTPUT_CHANNELS ); - set_zero( ele_tmp, IVAS_MAX_OUTPUT_CHANNELS ); - for ( i = 0, j = 0; i < *num_azi; i++ ) { if ( dup[i] ) @@ -179,8 +181,12 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( } ( *num_azi ) -= dup_count; - mvr2r( azi_tmp, azi, IVAS_MAX_OUTPUT_CHANNELS ); - mvr2r( ele_tmp, ele, IVAS_MAX_OUTPUT_CHANNELS ); + + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + azi[i] = azi_tmp[i]; + ele[i] = ele_tmp[i]; + } return LS_CUSTOM_FILEREADER_NO_ERROR; } @@ -237,16 +243,19 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( char line[200]; /* > (10 chars * IVAS_MAX_OUTPUT_CHANNELS) i.e. "-999, " */ const char *tok; - int16_t num_azi, num_ele, num_lfe; + int16_t i, num_azi, num_ele, num_lfe; /* initialize variables */ num_azi = 0; num_ele = 0; num_lfe = 0; - set_zero( hLsCustomData->azimuth, IVAS_MAX_OUTPUT_CHANNELS ); - set_zero( hLsCustomData->elevation, IVAS_MAX_OUTPUT_CHANNELS ); - set_s( hLsCustomData->lfe_idx, -1, IVAS_MAX_OUTPUT_CHANNELS ); + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + hLsCustomData->lfe_idx[i] = -1; + hLsCustomData->azimuth[i] = 0.0f; + hLsCustomData->elevation[i] = 0.0f; + } if ( hLsCustomReader->file == NULL ) { diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index b003110743bcff570a1621e5c64ab12264e951a7..9963e722bae33266b9edaecb07f2920be73123db 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -30,12 +30,19 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ +#include "obj_edit_file_reader.h" #include #include -#include "obj_edit_file_reader.h" -#include "prot.h" +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + /*-----------------------------------------------------------------------* * ObjectEditFileReader_open() * diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index fed68002a7071b092ef446b067fe9b8ea7bc97c1..dd3e84ac8700575362f5a97adbeba571b7dfd69a 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -35,9 +35,7 @@ #include #include #include -#include #include "cmdl_tools.h" -#include "prot.h" /*------------------------------------------------------------------------------------------* @@ -58,9 +56,9 @@ #define ACOUSTIC_DSR_MAX ( 1.0e+2f ) #define ACOUSTIC_DSR_EPSILON ( 1.0e-15f ) #define ACOUSTICPREDELAY_JOTREV_MIN ( SHORTEST_REV_DEL_LINE ) -#define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) FRAMES_PER_SEC ) -#define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * FRAMES_PER_SEC ) ) -#define ACOUSTICPREDELAY_FDREV_MAX ( (float) ( REVERB_PREDELAY_MAX ) / (float) ( 16 * FRAMES_PER_SEC ) ) +#define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) IVAS_NUM_FRAMES_PER_SEC ) +#define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * IVAS_NUM_FRAMES_PER_SEC ) ) +#define ACOUSTICPREDELAY_FDREV_MAX ( (float) ( IVAS_REVERB_PREDELAY_MAX ) / (float) ( 16 * IVAS_NUM_FRAMES_PER_SEC ) ) #define INPUTPREDELAY_MIN ( 0.0f ) #define INPUTPREDELAY_MAX ( 1.0e+2f ) @@ -69,6 +67,24 @@ #define ER_MIN_ABS_COEFF ( 0.0f ) #define ER_MAX_ABS_COEFF ( 1.0f ) +#define IVAS_ER_LIST_ORIGIN_X 0.0f +#define IVAS_ER_LIST_ORIGIN_Y 0.0f + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + /*------------------------------------------------------------------------------------------* * Local Type definitions *------------------------------------------------------------------------------------------*/ @@ -945,8 +961,30 @@ static ivas_error read_txt_bool( *pTarget = FALSE; return IVAS_ERR_OK; } + return IVAS_ERR_INVALID_RENDER_CONFIG; } + + +/*-------------------------------------------------------------------* + * usdequant_rend_cfg() + * + * Uniform scalar de-quantizer routine + *-------------------------------------------------------------------*/ + +static float usdequant_rend_cfg( + const uint32_t idx, /* i : quantizer index */ + const float qlow, /* i : lowest codebook entry (index 0) */ + const float delta /* i : quantization step */ +) +{ + float g; + + g = idx * delta + qlow; + + return ( g ); +} + /*-----------------------------------------------------------------------------------------* * Function get_bin_angle() * Gets an angle value in degrees [0,360] @@ -965,7 +1003,7 @@ static ivas_error get_bin_angle( return error; } - *pResult = usdequant( (int16_t) value, 0.0f, 20.0f ); + *pResult = usdequant_rend_cfg( value, 0.0f, 20.0f ); return IVAS_ERR_OK; } @@ -989,7 +1027,7 @@ static ivas_error get_bin_outer_attenuation( return error; } - logval = usdequant( (int16_t) value, -90.0f, 3.0f ); + logval = usdequant_rend_cfg( value, -90.0f, 3.0f ); att = powf( 10, logval / 20.0f ); *pResult = att; @@ -1015,7 +1053,7 @@ static ivas_error get_bin_max_dist( return error; } - *pResult = usdequant( (int16_t) value, 1.0f, 1.0f ); + *pResult = usdequant_rend_cfg( value, 1.0f, 1.0f ); return IVAS_ERR_OK; } @@ -1038,7 +1076,7 @@ static ivas_error get_bin_ref_dist( return error; } - *pResult = usdequant( (int16_t) value, 0.1f, 0.1f ); + *pResult = usdequant_rend_cfg( value, 0.1f, 0.1f ); return IVAS_ERR_OK; } @@ -1061,7 +1099,7 @@ static ivas_error get_bin_rolloff( return error; } - *pResult = usdequant( (int16_t) value, 0.0f, 0.1f ); + *pResult = usdequant_rend_cfg( value, 0.0f, 0.1f ); return IVAS_ERR_OK; } @@ -1807,9 +1845,9 @@ static ivas_error RenderConfigReader_readBinary( { return IVAS_ERR_FAILED_ALLOC; } - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = IVAS_ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = IVAS_ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = IVAS_ER_LIST_HEIGHT; } /* Low complexity mode */ @@ -2971,9 +3009,9 @@ ivas_error RenderConfigReader_getAcousticEnvironment( { return IVAS_ERR_FAILED_ALLOC; } - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = IVAS_ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = IVAS_ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = IVAS_ER_LIST_HEIGHT; } pAcEnv->ListenerOrigin = *pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin; for ( j = 0; j < IVAS_ROOM_ABS_COEFF; j++ ) @@ -3004,7 +3042,7 @@ ivas_error RenderConfigReader_getDirectivity( float *directivity /* o : Target directivity */ ) { - uint16_t n, m; + uint16_t n, m, i; uint16_t last_specified_id; bool idExists; @@ -3014,7 +3052,7 @@ ivas_error RenderConfigReader_getDirectivity( } if ( pRenderConfigReader->pDP == NULL ) { - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + for ( n = 0; n < IVAS_MAX_NUM_OBJECTS; n++ ) { directivity[n * 3] = 360.0f; directivity[n * 3 + 1] = 360.0f; @@ -3026,7 +3064,7 @@ ivas_error RenderConfigReader_getDirectivity( last_specified_id = id[0]; /* set unpspecified Directivity Patterns ID to last specified ID */ - for ( n = MAX_NUM_OBJECTS - 1; n > 0; n-- ) + for ( n = IVAS_MAX_NUM_OBJECTS - 1; n > 0; n-- ) { if ( id[n] != 65535 ) { @@ -3040,13 +3078,13 @@ ivas_error RenderConfigReader_getDirectivity( last_specified_id = (uint16_t) pRenderConfigReader->pDP[0].id; } - for ( ; n < MAX_NUM_OBJECTS; n++ ) + for ( ; n < IVAS_MAX_NUM_OBJECTS; n++ ) { id[n] = last_specified_id; } - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + for ( n = 0; n < IVAS_MAX_NUM_OBJECTS; n++ ) { idExists = false; for ( m = 0; m < pRenderConfigReader->nDP; m++ ) @@ -3054,7 +3092,10 @@ ivas_error RenderConfigReader_getDirectivity( if ( id[n] == pRenderConfigReader->pDP[m].id ) { idExists = true; - mvr2r( pRenderConfigReader->pDP[m].pDirectivity, directivity + ( n * 3 ), 3 ); + for ( i = 0; i < 3; i++ ) + { + directivity[n * 3 + i] = pRenderConfigReader->pDP[m].pDirectivity[i]; + } break; } } diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index b948a51524b2c6bf4412eb974e51ec8ec529f8f0..f659fbb9fa558c8312f2b8c1c3b909f73b980474 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -33,8 +33,7 @@ #include "rotation_file_reader.h" #include #include -#include -#include "prot.h" +#include struct RotFileReader diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 15d5b24d66d65136565afd2ec81b70ebd8e75362..70e695048ef0b88f8a1550f418f9c65f54c6687f 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -30,11 +30,11 @@ *******************************************************************************************************/ -#include -#include "options.h" #include "split_rend_bfi_file_reader.h" #include -#include "prot.h" +#include +#include + struct SplitRendBFIFileReader { diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 9cc6e4bf7e33946f0b77d5794bf5794cc82770a0..59dad090fab53c5d0e75de068e17c0e4c8fa6a46 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -30,10 +30,10 @@ *******************************************************************************************************/ -#include #include "split_render_file_read_write.h" +#include "ivas_error_utils.h" #include -#include "prot.h" +#include /*------------------------------------------------------------------------------------------* @@ -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 4450eeded41e6be5efceb93834b83e5d39f21c31..97ff673b36f03926e4e7168378fcdb20b54104e2 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( diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index e61f80763ddab05f01a294ae510e2059f8d0c6b3..653fc0f2f6f99f6d0d274cbe2adfc63d33123edb 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -32,10 +32,10 @@ #include "tsm_scale_file_reader.h" #include "cmdl_tools.h" -#include #include #include + #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index a6aee3eefb31c7276e2b7e0e1775e34e72da767e..8a46a97d1d2f8920bd5daf2d90283ac13c9087b1 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -31,12 +31,8 @@ *******************************************************************************************************/ #include "vector3_pair_file_reader.h" -#include #include #include -#include -#include "prot.h" -#include "options.h" /* only included to get access to the feature-defines */ struct Vector3PairFileReader diff --git a/readme.txt b/readme.txt index fa9397c31b17488b8d2826bc46a2bffbc5706ee8..f656e6ee64ab26df17f995df975c287d0a818c7c 100644 --- a/readme.txt +++ b/readme.txt @@ -397,7 +397,7 @@ Where the first two rows are comma separated azimuth and elevation positions of The output channel ordering is 0, 1, ... N-1. The third row contains an index "LFE0" (zero based) specifying the output channel to which the LFE input will be routed if present. If the third row is omitted, the LFE input is downmixed to all channels with a factor of 1/N. Position is not considered for -the LFE channel. +the LFE channel. Maximum number of supported loudskpeakers N is 16. An example custom loudspeaker layout file is available: ls_setup_16ch_8+4+4.txt