diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 995f3320138bef0f9eccc710c39cf30dd0e35426..eb66d5d930d6129112eeee612069f1d8e4e8bdbb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information - IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF a31272de16bd1b556269a50bc179321a60f2a500 + IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF main include: - local: .gitlab-ci/variables.yml @@ -548,81 +548,69 @@ renderer-smoke-test: junit: - report-junit.xml -# test renderer executable with cmake + asan -renderer-asan: +.renderer-sanitizer-job: extends: - .test-job-linux - .rules-merge-request-to-main needs: ["build-codec-linux-cmake"] stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - + timeout: "30 minutes" artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" expire_in: 1 week when: always paths: - report-junit.xml - expose_as: "renderer asan pytest results" + - report.html reports: junit: - report-junit.xml + before_script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=$SANITIZER_BUILD_STRING -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - cmake --build cmake-build -- -j + # rename files to fit naming convention + # en- and decoder needed because of split rendering testcases + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref + - mv IVAS_rend IVAS_rend_ref + - mv ISAR_post_rend ISAR_post_rend_ref + - testcase_timeout=180 + +# test renderer executable with cmake + asan +renderer-asan: + extends: + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "asan" + script: + - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + artifacts: + expose_as: "renderer asan result" + # test renderer executable with cmake + msan renderer-msan: extends: - - .test-job-linux - - .rules-merge-request-to-main - needs: ["build-codec-linux-cmake"] - stage: test + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "msan" script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - + - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer msan pytest results" - reports: - junit: - - report-junit.xml + expose_as: "renderer msan result" + # test renderer executable with cmake + usan renderer-usan: extends: - - .test-job-linux - - .rules-merge-request-to-main - needs: ["build-codec-linux-cmake"] - stage: test + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "usan" script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout - - grep_exit_code=0 - - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? - - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi - + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer usan pytest results" - reports: - junit: - - report-junit.xml + expose_as: "renderer usan result" + # compare renderer bitexactness between target and source branch renderer-pytest-on-merge-request: @@ -741,6 +729,7 @@ split-rendering-pytest-on-merge-request: - mv IVAS_cod IVAS_cod_ref - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref + - mv ISAR_post_rend ISAR_post_rend_ref ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - if [ $ref_using_main == 0 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts @@ -1266,6 +1255,7 @@ ivas-conformance: - cp -force IVAS_cod.exe IVAS_cod_ref.exe - cp -force IVAS_dec.exe IVAS_dec_ref.exe - cp -force IVAS_rend.exe IVAS_rend_ref.exe + - cp -force ISAR_post_rend.exe ISAR_post_rend_ref.exe # Reference creation - python scripts/prepare_combined_format_inputs.py @@ -1331,6 +1321,7 @@ ivas-conformance: expire_in: 1 week when: always paths: + - report_cmd.html - report-junit.xml - report.html - Readme_IVAS_dec.txt @@ -1359,6 +1350,7 @@ ivas-conformance-linux: - cp IVAS_cod IVAS_cod_ref - cp IVAS_dec IVAS_dec_ref - cp IVAS_rend IVAS_rend_ref + - cp ISAR_post_rend ISAR_post_rend_ref # Reference creation - python3 scripts/prepare_combined_format_inputs.py diff --git a/apps/decoder.c b/apps/decoder.c index 6a1d823f7633824bea45e828548a824a4cd5f2cd..71379c6575451f68f2ee8c76a656db9f46fcd232 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1858,13 +1858,13 @@ static ivas_error initOnFirstGoodFrame( return error; } - int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); + /* Write zeros to the output audio buffer */ + int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } - memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { @@ -1888,7 +1888,6 @@ static ivas_error initOnFirstGoodFrame( } else { - if ( *pRemainingDelayNumSamples < *numOutSamples ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) diff --git a/apps/encoder.c b/apps/encoder.c index 9bf625bc972c3e94cff543cfe01b5b47f93ec185..61bb8ebb3f0d24c4835755b0b69ced48636add72 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -15,6 +15,7 @@ the software. This notice grants no license of any kind, including but not limited to patent license, nor is any license granted by implication, estoppel or otherwise. + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making Contributors are required to enter into the IVAS codec Public Collaboration agreement before making contributions. diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index a901a294c128171cbf61054705e7e86560900249..2744c3bbe5855eb06393bc3ac5a418cfef302c3e 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -681,9 +681,7 @@ int main( int argc, char **argv ) { -#ifdef FIX_1335_EXTREND_RETCODE bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ -#endif ISAR_POST_REND_HANDLE hIsarPostRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; @@ -1225,10 +1223,8 @@ int main( * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ -#ifdef FIX_1335_EXTREND_RETCODE mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ -#endif cleanup: free( inpInt16Buffer ); @@ -1259,11 +1255,7 @@ cleanup: print_mem( NULL ); #endif -#ifdef FIX_1335_EXTREND_RETCODE return mainFailed ? -1 : 0; -#else - return 0; -#endif } diff --git a/apps/renderer.c b/apps/renderer.c index b90244b3ad1c60b2bf037194f2697507d9c6cc8b..8e44fd6cc19cf316afea7a5563e67c357acdf3d6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -659,9 +659,7 @@ int main( int argc, char **argv ) { -#ifdef FIX_1335_EXTREND_RETCODE bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ -#endif IVAS_REND_HANDLE hIvasRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; @@ -1083,18 +1081,19 @@ int main( fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); goto cleanup; } -#ifdef NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND + if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] ); goto cleanup; } + if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } -#endif + if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; @@ -1979,10 +1978,8 @@ int main( * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ -#ifdef FIX_1335_EXTREND_RETCODE mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ -#endif cleanup: free( inpInt16Buffer ); @@ -2039,11 +2036,7 @@ cleanup: print_mem( NULL ); #endif -#ifdef FIX_1335_EXTREND_RETCODE return mainFailed ? -1 : 0; -#else - return 0; -#endif } @@ -3498,14 +3491,20 @@ static void parseCombinedFormatInput( inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects; +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + inConfig->ambisonicsBuses[0].gain_dB = 0.f; +#else inConfig->ambisonicsBuses[0].gain_dB = -6.f; +#endif *configString += 4; +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS /* Modify input gain for objects too */ for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) { inConfig->audioObjects[i].gain_dB = -6.f; } +#endif } else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) { diff --git a/ci/remove_unsupported_testcases.py b/ci/remove_unsupported_testcases.py index 28dc94c18be82224c143a37abd6a1d36eca758ee..66b62b04ef34c216f1ef84c269450af79c39b83d 100644 --- a/ci/remove_unsupported_testcases.py +++ b/ci/remove_unsupported_testcases.py @@ -35,12 +35,9 @@ import argparse TESTCASES = [ # self_test.prm "stereo bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, EXT out", - "Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND)", "Multi-channel 5_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 32kHz out, EXT out", - "Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv)", "Multi-channel 7_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 16kHz out, EXT out", "Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, EXT out", - "Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin)", "Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5", "Multi-channel 5_1_2 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, EXT out", "Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5", diff --git a/lib_com/options.h b/lib_com/options.h index 05773f3307f858df1c320e4501a3a75ba7cbf529..edd60e4680f719806fef9ec40b0e5f974fa712d7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/*#define DEBUGGING*/ /* Activate debugging part of the code */ +/*#define DEBUGGING*/ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ @@ -77,7 +77,8 @@ #endif #ifdef DEBUG_MODE_MDCT -/*#define DEBUG_PLOT_BITS*/ +#define DEBUG_PLOT_BITS +#define DEBUG_OSBA_MD_BITS #endif #ifdef DEBUG_MODE_DFT @@ -161,9 +162,7 @@ /*#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 FIX_1335_EXTREND_RETCODE /* FhG: Add modification of returncode for external renderer when an error occurs */ -#define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */ - +/*#define CODE_IMPROVEMENTS*/ /* FhG: Small code improvements that do not change the functionality */ /* #################### End BE switches ################################## */ @@ -174,10 +173,9 @@ #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_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_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ -#define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ -#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ -#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ +#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ +#define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ +#define NONBE_1352_HARMONIZE_OSBA_LOUDNESS /* FhG: do not scale OSBA inputs by 0.5 any more */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/tools.c b/lib_com/tools.c index 024fe71c7a75323e93db2f805cdeaedc9781c0f6..cb1d1216294bbc815b258866a51a99d99d822298 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -1742,6 +1742,11 @@ double anint( int16_t is_numeric_float( float x ) { +#ifdef CODE_IMPROVEMENTS +#define WMC_TOOL_SKIP + return (int16_t) ( !isnan( x ) && !isinf( x ) ); +#undef WMC_TOOL_SKIP +#else #ifndef BASOP_NOGLOB union float_int #else /* BASOP_NOGLOB */ @@ -1755,6 +1760,7 @@ int16_t is_numeric_float( float_int.float_val = x; return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 ); +#endif } /*-------------------------------------------------------------------* diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 6336e911fc6b8eb867fc68727ab7d1be7c41506d..012183c5ac9e392b1114723e5a698c8df7a87118 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -820,7 +820,7 @@ int16_t make_dirs( const char *const pathname ) if ( sep != 0 ) { - temp = calloc( 1, strlen( pathname ) + 1 ); + temp = calloc( strlen( pathname ) + 1, sizeof( char ) ); p = pathname; while ( ( p = strchr( p, sep ) ) != NULL ) { diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index c371d0c9f9000b0cf083ce39370cc7c32f475bfe..0fb28ddb2d27b73558c6944576de9c1cf9112bee 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1506,7 +1506,11 @@ void decoder_tcx_tns( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && whitenedDomain ) || ( L_spec > L_frameTCX ) ) +#else if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 ) || ( L_spec > L_frameTCX ) ) +#endif { L = L_spec; } @@ -1548,7 +1552,11 @@ void decoder_tcx_tns( if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( st->element_mode == EVS_MONO || ( L_spec < L_frameTCX && !whitenedDomain ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#else if ( st->element_mode == EVS_MONO || L_spec < L_frameTCX ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#endif { tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index cc27fec5f9580b7373f641232479c8c379d7ab91..88141656c84a071de48ceba2cf6d07a15bcdf32b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2453,14 +2453,10 @@ void ivas_dirac_dec_render_sf( /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); -#ifdef NONBE_1250_MCMASA_LS_OUTPUT if ( hDirACRend->hOutSetup.num_lfe > 0 ) { mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); } -#else - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); -#endif for ( ch = 0; ch < outchannels; ch++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7b4b631f4075e0d0f0ecc53b1c478a17ae72c819..a303c6d65b0f55de9ebaeb761d3b060081f6b8c0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2782,7 +2782,7 @@ void ivas_destroy_dec( ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); /* Crend handle */ - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 7472690650963f06c709a1ae643c6556af5abf18..a76db363061b54ef55b49b11622d8385fc4c75b6 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -253,7 +253,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } /* close the crend binaural renderer */ - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2c6a571c75c529410b464bcd0da9a1ddc21dd4f0..317bb0057df58907fefe001a57e1ada5ddf8343d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,6 +1110,12 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } +#if defined( NONBE_1339_FIXOSBA_EXT_LOUDNESS ) && !defined( NONBE_1352_HARMONIZE_OSBA_LOUDNESS ) + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + } +#endif } else { @@ -1122,6 +1128,12 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } else { @@ -1144,6 +1156,12 @@ ivas_error ivas_jbm_dec_render( set_zero( p_output[n], *nSamplesRendered ); } } +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } } else if ( st_ivas->ivas_format == MC_FORMAT ) @@ -1504,13 +1522,11 @@ ivas_error ivas_jbm_dec_flush_renderer( if ( ism_mode_old == ISM_MASA_MODE_DISC ) { float *tc_local[MAX_NUM_OBJECTS]; -#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH int16_t last_dirac_md_idx; uint16_t nSamplesAvailableNext; ISM_MODE ism_mode_orig; RENDERER_TYPE renderer_type_orig; int32_t ivas_total_brate; -#endif /* copy from ISM delay buffer to the correct place in TCs */ for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) @@ -1519,7 +1535,6 @@ ivas_error ivas_jbm_dec_flush_renderer( mvr2r( st_ivas->hMasaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); } -#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH /* to render flushed samples, use configuration from the last received frame */ ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; renderer_type_orig = st_ivas->renderer_type; @@ -1546,12 +1561,6 @@ ivas_error ivas_jbm_dec_flush_renderer( st_ivas->ism_mode = ism_mode_orig; st_ivas->renderer_type = renderer_type_orig; st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; -#else - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -2262,16 +2271,13 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available; float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1]; -#endif ivas_error error; DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP num_tc_buffer_mem = 0; n_samples_still_available = 0; @@ -2290,7 +2296,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } } -#endif /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { @@ -2330,12 +2335,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->nchan_buffer_full = nchan_full; hTcBuffer->n_samples_granularity = n_samples_granularity; -#ifndef NONBE_1324_TC_BUFFER_MEMOERY_KEEP -#ifdef DEBUGGING - /* what is remaining from last frames needs always be smaller than n_samples_granularity */ - assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); -#endif -#endif /* reallocate TC audio buffers */ ivas_jbm_dec_tc_audio_deallocate( hTcBuffer ); @@ -2345,14 +2344,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( return error; } -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* propagate samples of the TC buffer from the previous frame */ for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ ) { mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available ); } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 6d406fccc1b3961b9c01a534b6a021f6c5dae36c..8fb966c36518fb51edbce486791ec79dd5ba17b3 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1161,6 +1161,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) { ivas_binRenderer_close( &st_ivas->hBinRenderer ); + if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { efap_free_data( &st_ivas->hEFAPdata ); @@ -1169,7 +1170,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 7bb81b4afff23312b8a6f6ec1404164aa7a371bb..7ba536809ca7f5f5988fcb7bb17e4e2be0d280d6 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -943,15 +943,7 @@ void ivas_mdct_core_reconstruct( /* Postfiltering */ post_decoder( st, synth_buf, pit_gain[ch], pitch[ch], x[ch][0], st->p_bpf_noise_buf ); -#ifndef FIX_938_COMPILER_WARNING - if ( signal_outFB[ch] ) - { -#endif - mvr2r( synthFB, signal_outFB[ch], st->hTcxDec->L_frameTCX ); -#ifndef FIX_938_COMPILER_WARNING - } -#endif - + mvr2r( synthFB, signal_outFB[ch], st->hTcxDec->L_frameTCX ); #ifdef DEBUG_PLC_INFO { int16_t i; diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index afa273fdbbe25ec2021be6237c0233efd30f5d57..ab1b378ab6eac2daa36f7c9ce5989cbbca85f8ca 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -183,12 +183,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_RealBuffer[b] ); - +#else + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] + + Cldfb_RealBuffer[b]; +#endif st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); +#else + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] + + Cldfb_ImagBuffer[b]; +#endif } } } @@ -205,7 +214,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; +#else + output_f[n][i] = output_f[channel_offset + n][i] + p_sepobj[n][i]; +#endif } } } @@ -295,7 +308,9 @@ ivas_error ivas_osba_render_sf( v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); +#endif } return IVAS_ERR_OK; @@ -338,10 +353,12 @@ void ivas_osba_stereo_add_channels( } } +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS for ( n = 0; n < nchan_out; n++ ) { v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); } +#endif return; } diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index fb1a338ee6b9e86dc0cd728e9f0e59f42624e6b1..951ae35b70ddaf5b2c5937ed790f0ee92ca14330 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -565,6 +565,12 @@ void writeTCXparam( nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, flag_ctx_hm ? &hm_cfg[k] : NULL ); } } +#ifdef DEBUG_PLOT_BITS + if ( core == TCX_10_CORE ) + { + dbgwrite( &nbits_tcx, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + } +#endif } } #ifdef DEBUG_PLOT_BITS @@ -576,6 +582,15 @@ void writeTCXparam( dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_TNS" ); } } + else + { + if ( nSubframes == 1 ) + { + tmp = 0; + dbgwrite( &nbits_tcx, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + } + } #endif return; diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index db2e60fada703ae07198684798ebe0859e058598..8f6eb68b96a4efa2f43c9f3e87361b48b2a11ff0 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -412,6 +412,11 @@ ivas_error ivas_enc( /* get SBA TCs */ ivas_sba_getTCs( &data_f[n], st_ivas, input_frame ); } +#ifdef DEBUG_OSBA_MD_BITS + { + dbgwrite( &nb_bits_metadata[0], sizeof( int16_t ), hEncoderConfig->nchan_ism + 1, 1, "./res/osba_md_bits" ); + } +#endif /* core-coding of transport channels */ if ( st_ivas->nSCE == 1 ) diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 27f1a0ad3ce7f4ca30c6d4861bd4e261ad1b0bed..4a46bd7b2f7045b8568f50b98bf97c8e550a9707 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -471,6 +471,10 @@ void ivas_mct_core_enc( /*write IGF data to bitstream*/ for ( ch = 0; ch < nChannels; ch++ ) { +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif + st = sts[ch]; if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) @@ -478,6 +482,10 @@ void ivas_mct_core_enc( continue; } enc_prm_igf_mdct( st, hBstr ); +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_IGF" ); +#endif } } diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 8085fea23142b6919af287743b44bb40d653b2aa..0c669b581a4010aa9552aa087aee536e14ea5723 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -1146,6 +1146,9 @@ void ivas_mdct_core_whitening_enc( skipped_first_channel = 0; for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif st = sts[ch]; if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) @@ -1170,6 +1173,11 @@ void ivas_mdct_core_whitening_enc( } encode_lpc_avq( hBstr, num_sns, param_lpc[ch], st->core, st->element_mode ); +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_SNS" ); +#endif + st->side_bits_frame_channel += hBstr->nb_bits_tot - nbits_start_sns; } } diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index fa97984539101d7e80145469c21457c2f5532687..d97697434da3ff65ea66c67691ab0226cd639a84 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -411,16 +411,25 @@ void stereo_coder_tcx( nAvailBitsMS[k] = ( ( mct_on ? 2 * sts[0]->bits_frame_channel : sts[0]->bits_frame_nominal ) - sts[0]->side_bits_frame_channel - sts[1]->side_bits_frame_channel - ( nSubframes == 2 ? OFFSET_BITS_TCX10 : OFFSET_BITS_TCX20 ) ) / nSubframes; - MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); - - if ( sts[0]->igf ) + if ( mct_on && nAvailBitsMS[k] <= 0 ) /*Force M/S when bit-budget is low for MCT*/ { - IGFEncStereoEncoder( sfbConf, sts[0]->hIGFEnc, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], &ms_mask[k][0], - &hStereoMdct->IGFStereoMode[k], hStereoMdct->mdct_stereo_mode[k], sts[0]->core == TCX_20_CORE, sts[0]->last_core == ACELP_CORE ); + hStereoMdct->mdct_stereo_mode[k] = 1; + hStereoMdct->IGFStereoMode[k] = 1; + set_s( ms_mask[k], 1, sfbConf->sfbCnt ); } else { - hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; + MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); + + if ( sts[0]->igf ) + { + IGFEncStereoEncoder( sfbConf, sts[0]->hIGFEnc, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], &ms_mask[k][0], + &hStereoMdct->IGFStereoMode[k], hStereoMdct->mdct_stereo_mode[k], sts[0]->core == TCX_20_CORE, sts[0]->last_core == ACELP_CORE ); + } + else + { + hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; + } } if ( hStereoMdct->mdct_stereo_mode[k] != SMDCT_DUAL_MONO || hStereoMdct->IGFStereoMode[k] != SMDCT_DUAL_MONO ) diff --git a/lib_lc3plus/ari_codec.c b/lib_lc3plus/ari_codec.c index 5ba87a32bc3b07eeeb825fe2cb6c6271ec9db0a3..2a76ecac8338b848957fd73b96f480d930038317 100644 --- a/lib_lc3plus/ari_codec.c +++ b/lib_lc3plus/ari_codec.c @@ -705,7 +705,7 @@ void ac_shift_fl(Encoder_State_fl* st) st->carry_count = st->carry_count + 1; } - st->low = st->low << 8; + st->low = (LC3_INT)((LC3_UINT32)st->low << 8); st->low = (st->low) & (16777215); /* 2^24 - 1 */ } diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3.c index 56a39286f84a23ee09d244e0bc5fd057ba248b08..b275ed8084fc1b1caa5cce48e6ef18db7fa1af86 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3.c @@ -88,9 +88,9 @@ static int null_in_list(void **list, int n) /* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ void *balloc(void *base, size_t *base_size, size_t size) { - uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & (uintptr_t)(~3); assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ - *base_size = (*base_size + size + 3) & ~3; + *base_size = (*base_size + size + 3) & (uintptr_t)(~3); return (void *)ptr; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 8455901f4d0d9642ba1a05221c19ca14e40640ef..b120fd6c6ac24a56830faed20d530b387a29c4cb 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1076,6 +1076,11 @@ ivas_error ivas_rend_initCrendWrapper( ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + ( *pCrend )->hCrend[pos_idx] = NULL; + } + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hCrend = NULL; @@ -1340,8 +1345,7 @@ ivas_error ivas_rend_openCrend( *------------------------------------------------------------------------*/ void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses ) + CREND_WRAPPER_HANDLE *pCrend ) { int16_t i; int16_t pos_idx; @@ -1357,7 +1361,7 @@ void ivas_rend_closeCrend( ivas_hrtf_close( &( *pCrend )->hHrtfCrend ); } - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { hCrend = ( *pCrend )->hCrend[pos_idx]; if ( hCrend != NULL ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 121d9128816dc8b855b84e580eb5d872ccf9a1d9..bb936d4b14b85a1eac27874a27c08884f57de35b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -903,9 +903,8 @@ ivas_error ivas_rend_openCrend( const int16_t num_poses ); -void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses +void ivas_rend_closeCrend( + CREND_WRAPPER_HANDLE *pCrend ); ivas_error ivas_Crend_hrtf_init( diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index bf6776ab043ac11929235199df66ef07f6fd9e43..b14a5303a0f40b052ce7224d39247b7346f6abec 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -163,9 +163,15 @@ const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3*DIRAC_MAX_NUM_DECORR_F const float * const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS] = { +#ifdef CODE_IMPROVEMENTS + ap_lattice_coeffs_1, + ap_lattice_coeffs_2, + ap_lattice_coeffs_3, +#else &ap_lattice_coeffs_1[0], &ap_lattice_coeffs_2[0], &ap_lattice_coeffs_3[0], +#endif }; const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 08f6c7fbbcd5a43ae123dae6853dd80b1e730984..d9866de0506d69dab80fcab91c815c8ec85ada04 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1263,7 +1263,7 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } - ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputIsm->crendWrapper ); ivas_reverb_close( &inputIsm->hReverb ); @@ -1390,7 +1390,7 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ - ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputIsm->crendWrapper ); ivas_reverb_close( &inputIsm->hReverb ); @@ -2088,7 +2088,7 @@ static ivas_error initMcBinauralRendering( /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2180,7 +2180,7 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); ivas_reverb_close( &inputMc->hReverb ); @@ -2365,7 +2365,7 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); ivas_reverb_close( &inputMc->hReverb ); @@ -2582,7 +2582,7 @@ static ivas_error initSbaMasaRendering( { ivas_error error; - ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { @@ -2660,7 +2660,7 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ - ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { @@ -3291,31 +3291,78 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } +#ifdef CODE_IMPROVEMENTS +static void *getInputByIndex( + void *inputsArray, + const size_t index, + const IVAS_REND_AudioConfigType inputType ) +{ + switch ( inputType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + return (input_mc *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + return (input_sba *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + return (input_ism *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + return (input_masa *) inputsArray + index; + default: + /* this should be unreachable */ + assert( 0 ); + return NULL; + } +} +#endif static ivas_error findFreeInputSlot( +#ifdef CODE_IMPROVEMENTS + void *inputs, + const IVAS_REND_AudioConfigType inputType, +#else const void *inputs, const int32_t inputStructSize, +#endif const int32_t maxInputs, int32_t *inputIndex ) { +#ifdef CODE_IMPROVEMENTS + /* Using a void pointer and a separately provided type is a hack for this function + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - memory alignments of original input type and input_base are the same + */ +#else /* Using a void pointer and a separately provided size is a hack for this function to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). Assumptions: - input_base is always the first member in the input struct - provided size is correct */ +#endif int32_t i; bool canAddInput; +#ifndef CODE_IMPROVEMENTS const uint8_t *pByte; +#endif const input_base *pInputBase; canAddInput = false; /* Find first unused input in array */ +#ifdef CODE_IMPROVEMENTS + for ( i = 0; i < maxInputs; ++i ) +#else for ( i = 0, pByte = inputs; i < maxInputs; ++i, pByte += inputStructSize ) +#endif { +#ifdef CODE_IMPROVEMENTS + pInputBase = (const input_base *) getInputByIndex( inputs, i, inputType ); +#else pInputBase = (const input_base *) pByte; +#endif if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { @@ -3457,7 +3504,11 @@ ivas_error IVAS_REND_AddInput( ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; +#ifdef CODE_IMPROVEMENTS + IVAS_REND_AudioConfigType inputType; +#else int32_t inputStructSize; +#endif ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); int32_t inputIndex; @@ -3478,44 +3529,65 @@ ivas_error IVAS_REND_AddInput( } } +#ifdef CODE_IMPROVEMENTS + inputType = getAudioConfigType( inConfig ); + switch ( inputType ) +#else switch ( getAudioConfigType( inConfig ) ) +#endif { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; inputsArray = hIvasRend->inputsIsm; +#ifndef CODE_IMPROVEMENTS inputStructSize = sizeof( *hIvasRend->inputsIsm ); +#endif activateInput = setRendInputActiveIsm; break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; inputsArray = hIvasRend->inputsMc; +#ifndef CODE_IMPROVEMENTS inputStructSize = sizeof( *hIvasRend->inputsMc ); +#endif activateInput = setRendInputActiveMc; break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; inputsArray = hIvasRend->inputsSba; +#ifndef CODE_IMPROVEMENTS inputStructSize = sizeof( *hIvasRend->inputsSba ); +#endif activateInput = setRendInputActiveSba; break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; inputsArray = hIvasRend->inputsMasa; +#ifndef CODE_IMPROVEMENTS inputStructSize = sizeof( *hIvasRend->inputsMasa ); +#endif activateInput = setRendInputActiveMasa; break; default: return IVAS_ERR_INVALID_INPUT_FORMAT; } - /* Find first free input in array corresponding to input type */ + /* Find first free input in array corresponding to input type */ +#ifdef CODE_IMPROVEMENTS + if ( ( error = findFreeInputSlot( inputsArray, inputType, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) +#else if ( ( error = findFreeInputSlot( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) +#endif { return error; } *inputId = makeInputId( inConfig, inputIndex ); +#ifdef CODE_IMPROVEMENTS + if ( ( error = activateInput( getInputByIndex( inputsArray, inputIndex, inputType ), inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) +#else if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_util/aeid_file_reader.c b/lib_util/aeid_file_reader.c index e569dbdc7c50b3cf6685a6a882a608e43545f9a6..6f877452e5c1021124bfeb16e88b1f91dc84d562 100644 --- a/lib_util/aeid_file_reader.c +++ b/lib_util/aeid_file_reader.c @@ -69,9 +69,9 @@ ivas_error aeidFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( aeidFileReader ), 1 ); + self = calloc( 1, sizeof( aeidFileReader ) ); self->aeidFile = aeidFile; - self->file_path = calloc( sizeof( char ), strlen( aeidFilePath ) + 1 ); + self->file_path = calloc( strlen( aeidFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, aeidFilePath ); *aeidReader = self; diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index 1b52daaa772cf7bf0487f178202f1107c59af36c..92bfe8978993ec074d8c9da86549a4d567b52073 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -94,7 +94,7 @@ ivas_error AudioFileReader_open( { return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileReader ), 1 ); + self = calloc( 1, sizeof( AudioFileReader ) ); self->samplingRate = 0; self->numChannels = 0; diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index 321063101959dc6ecab0a60103f1f2de3246a52e..eb93018341780d232df13483268f295577e21cae 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -89,7 +89,7 @@ ivas_error AudioFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileWriter ), 1 ); + self = calloc( 1, sizeof( AudioFileWriter ) ); if ( self == NULL ) { return IVAS_ERR_FAILED_ALLOC; diff --git a/lib_util/bitstream_reader.c b/lib_util/bitstream_reader.c index a250a34a70323023220c7345f0c7424ff730af18..c6fe784fbde9de4ec48281e50048066bc9909f19 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -203,16 +203,15 @@ static void init_for_mime( BS_READER_HANDLE hBsReader ) static ivas_error init_for_format( BS_READER_HANDLE *phBsReader, BS_READER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsReader ) = (BS_READER_HANDLE) malloc( sizeof( struct BS_Reader ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsReader ) = (BS_READER_HANDLE) calloc( 1, sizeof( struct BS_Reader ) ); if ( *phBsReader == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream reader" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_READER_HANDLE hBsReader = *phBsReader; - memset( hBsReader, 0, sizeof( struct BS_Reader ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/bitstream_writer.c b/lib_util/bitstream_writer.c index 8c4b64cd4816649cb6833ccd6bda13270eb0e179..bff9f461b15992ed3c953a83a19f2c22cc496ed6 100644 --- a/lib_util/bitstream_writer.c +++ b/lib_util/bitstream_writer.c @@ -156,16 +156,15 @@ static void init_for_mime( BS_WRITER_HANDLE hBsWriter ) static ivas_error init_for_format( BS_WRITER_HANDLE *phBsWriter, BS_WRITER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsWriter ) = (BS_WRITER_HANDLE) malloc( sizeof( struct BS_Writer ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsWriter ) = (BS_WRITER_HANDLE) calloc( 1, sizeof( struct BS_Writer ) ); if ( *phBsWriter == NULL ) { IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream writer" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_WRITER_HANDLE hBsWriter = *phBsWriter; - memset( hBsWriter, 0, sizeof( struct BS_Writer ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/g192.c b/lib_util/g192.c index f61971ef1484dea45713df0b0e6c21200cd0d24c..a96a8ee56dc1ea4997e164f35c70beedd178dad7 100644 --- a/lib_util/g192.c +++ b/lib_util/g192.c @@ -62,7 +62,7 @@ *-----------------------------------------------------------------------*/ /* main handle */ -struct __G192 +struct G192_STRUCT { FILE *file; int16_t ownFileHandle; /* flag whether FILE handle created by instance or externally */ @@ -79,12 +79,11 @@ G192_ERROR G192_Reader_Open_filename( const char *filename ) { /* create handle */ - *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct __G192 ) ); + *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct G192_STRUCT ) ); if ( !phG192 ) { return G192_MEMORY_ERROR; } - memset( *phG192, 0, sizeof( struct __G192 ) ); /* open file stream */ ( *phG192 )->file = fopen( filename, "rb" ); @@ -422,7 +421,7 @@ G192_ERROR G192_Writer_Open_filename( const char *filename ) { /* create handle */ - *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct __G192 ) ); + *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct G192_STRUCT ) ); if ( !phG192 ) { return G192_MEMORY_ERROR; diff --git a/lib_util/g192.h b/lib_util/g192.h index 8014f523687f9c50404d39dbe3e1242b00f813c7..751f1324fb286131ba1cd8fd23d68622e69fce3c 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -67,8 +67,8 @@ typedef enum _G192_ERROR *-----------------------------------------------------------------------*/ /* main handle */ -struct __G192; -typedef struct __G192 *G192_HANDLE; +struct G192_STRUCT; +typedef struct G192_STRUCT *G192_HANDLE; /*-----------------------------------------------------------------------* diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 53a5d340e127a20607d955035ba57b1c901cedbf..3347a0c9ab5999930526f84ad7ae3df1465e3e4a 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -83,9 +83,9 @@ ivas_error hrtfFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( hrtfFileReader ), 1 ); + self = calloc( 1, sizeof( hrtfFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *hrtfReader = self; diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 088a4134f95145390a45fd695678ccf866bd7499..83a32b7a01553f5a7616571b1b3ae90642414532 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -72,9 +72,9 @@ IsmFileReader *IsmFileReader_open( return NULL; } - self = calloc( sizeof( IsmFileReader ), 1 ); + self = calloc( 1, sizeof( IsmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index fff4cc4ff014e8eaac96950d115440bf8ee975d8..10efc1ea3d4b73e31a9e6d30173e835d10fccd92 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -81,9 +81,9 @@ ivas_error IsmFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( IsmFileWriter ), 1 ); + self = calloc( 1, sizeof( IsmFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *ismWriter = self; diff --git a/lib_util/jbm_file_reader.c b/lib_util/jbm_file_reader.c index b657ab78929f906eb29dd6c3435af8a7f91c73ca..68caf5ae73fc93637fbe3f08d7a4b1513bd284bc 100644 --- a/lib_util/jbm_file_reader.c +++ b/lib_util/jbm_file_reader.c @@ -68,9 +68,9 @@ JbmFileReader *JbmFileReader_open( return NULL; } - self = calloc( sizeof( JbmFileReader ), 1 ); + self = calloc( 1, sizeof( JbmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/jbm_file_writer.c b/lib_util/jbm_file_writer.c index 76a5a67d2566db5d87ecefb0bb7d21bbeb9afcaf..9d11dad90490e74e44a1f8afc25e70e8fc196493 100644 --- a/lib_util/jbm_file_writer.c +++ b/lib_util/jbm_file_writer.c @@ -77,9 +77,9 @@ ivas_error JbmOffsetFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( JbmOffsetFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmOffsetFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmOffsetFilename ) + 1 ); + self->file_path = calloc( strlen( jbmOffsetFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmOffsetFilename ); *jbmOffsetWriter = self; @@ -204,9 +204,9 @@ ivas_error JbmTraceFileWriter_open( fprintf( file, "#rtpSeqNo;rtpTs;rcvTime;playTime;active\n" ); - self = calloc( sizeof( JbmTraceFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmTraceFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmTraceFilename ) + 1 ); + self->file_path = calloc( strlen( jbmTraceFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmTraceFilename ); *jbmTraceWriter = self; diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 1629a6d59ed108d6fc40295ba8adbe8b41797523..d874342c11b839c9526f361f8df35bba42423f25 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -70,9 +70,9 @@ ivas_error CustomLsReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( LsCustomFileReader ), 1 ); + self = calloc( 1, sizeof( LsCustomFileReader ) ); self->file = lsFile; - self->file_path = calloc( sizeof( char ), strlen( LsFilePath ) + 1 ); + self->file_path = calloc( strlen( LsFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, LsFilePath ); *hLsCustomReader = self; diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 2cb76f96e6e105fc1c0fa0511000d17d6584e5e1..1122878f8a5c8f84d8f50d73c33d644926bc5084 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -70,7 +70,7 @@ MasaFileReader *MasaFileReader_open( return NULL; } - self = calloc( sizeof( MasaFileReader ), 1 ); + self = calloc( 1, sizeof( MasaFileReader ) ); self->file = file; generate_gridEq( &self->sph_grid16 ); diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 8cac01ff5ab2ad8963d7850cfe367c2590640fb1..3f269a68717c6d1a55196bb04c5304bb1315dcb7 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -212,14 +212,14 @@ ivas_error MasaFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( MasaFileWriter ), 1 ); + self = calloc( 1, sizeof( MasaFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); if ( !delayCompensationEnabled ) { - self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); + self->delayStorage = calloc( 1, sizeof( MASA_META_DELAY_STORAGE ) ); self->delayStorage->prevDelay = DELAY_MASA_PARAM_DEC_SFR; } diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 9bdd20e45343aac7bf6828575850638678267184..ee2a9c12a5695cb469962508449e0101fcc4794f 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -317,7 +317,11 @@ static bool readByte( FILE *file, uint8_t *value ) static bool readLong( FILE *file, uint16_t *value ) { char buffer[4] = { 0 }; +#ifdef CODE_IMPROVEMENTS + if ( fread( buffer, 1, 4, file ) != 1U ) +#else if ( fread( buffer, 4, 1, file ) != 1U ) +#endif { return false; } diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 9963e722bae33266b9edaecb07f2920be73123db..2dde08ecc3936931f11956757739ede7521439a9 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -76,13 +76,13 @@ ivas_error ObjectEditFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = (ObjectEditFileReader *) calloc( sizeof( ObjectEditFileReader ), 1 ); + self = (ObjectEditFileReader *) calloc( 1, sizeof( ObjectEditFileReader ) ); self->maxLineLen = 256; self->editFileHandle = fileHandle; - self->inLine = (char *) calloc( sizeof( char ), self->maxLineLen ); + self->inLine = (char *) calloc( self->maxLineLen, sizeof( char ) ); - self->readInfo = (ReadObjectEditInfo *) calloc( sizeof( ReadObjectEditInfo ), 1 ); + self->readInfo = (ReadObjectEditInfo *) calloc( 1, sizeof( ReadObjectEditInfo ) ); self->readInfo->bg_gain = 0.0f; self->readInfo->bg_gain_edited = false; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index dd3e84ac8700575362f5a97adbeba571b7dfd69a..7729efbc7cb0ffe9ca4174f7aa12ea7012c5a67c 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1398,7 +1398,7 @@ ivas_error RenderConfigReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - pSelf = calloc( sizeof( RenderConfigReader ), 1 ); + pSelf = calloc( 1, sizeof( RenderConfigReader ) ); pSelf->pConfigFile = pConfigFile; pSelf->nFG = 0; pSelf->pFG = NULL; diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index f659fbb9fa558c8312f2b8c1c3b909f73b980474..024b0837374c9ccbefd5519817ba00dd7e4981ba 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -72,10 +72,10 @@ ivas_error RotationFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( RotFileReader ), 1 ); + self = calloc( 1, sizeof( RotFileReader ) ); self->trajFile = trajFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); self->fileRewind = false; diff --git a/lib_util/rtpdump.c b/lib_util/rtpdump.c index e3eb4c1f4acb3329e0183bd97f820b318cb81400..ac143bb8f622da3759734c8e9e693d3d747595b2 100644 --- a/lib_util/rtpdump.c +++ b/lib_util/rtpdump.c @@ -80,7 +80,11 @@ static unsigned char *parseByte( unsigned char *buffer, unsigned char *value ) static int readLong( FILE *file, unsigned int *value ) { char buffer[4] = { 0 }; +#ifdef CODE_IMPROVEMENTS + if ( fread( buffer, 1, 4, file ) != 1U ) +#else if ( fread( buffer, 4, 1, file ) != 1U ) +#endif { return -1; } @@ -96,7 +100,7 @@ static int readLong( FILE *file, unsigned int *value ) static int readShort( FILE *file, unsigned short *value ) { char buffer[2] = { 0 }; - if ( fread( buffer, 2, 1, file ) != 1U ) + if ( fread( buffer, 1, 2, file ) != 1U ) { return -1; } diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 70e695048ef0b88f8a1550f418f9c65f54c6687f..07b71e2219933dd8738a02d5be5a3b2b2c40f2f2 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -76,10 +76,10 @@ ivas_error SplitRendBFIFileReader_open( txtfile = ( strcmp( bfiFilePath + strlen( bfiFilePath ) - 4, ".txt" ) ? false : true ); - self = calloc( sizeof( SplitRendBFIFileReader ), 1 ); + self = calloc( 1, sizeof( SplitRendBFIFileReader ) ); self->bfiFile = bfiFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( bfiFilePath ) + 1 ); + self->file_path = calloc( strlen( bfiFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, bfiFilePath ); self->fileRewind = false; self->txtfile = txtfile; diff --git a/lib_util/tinywavein_c.h b/lib_util/tinywavein_c.h index b86d97c9640f1e91427a4b6cf8731df62a1596bb..179c676a81b274098fabbe5050c2c977572c82ec 100644 --- a/lib_util/tinywavein_c.h +++ b/lib_util/tinywavein_c.h @@ -54,14 +54,22 @@ #define __TWI_SUCCESS ( 0 ) #define __TWI_ERROR ( -1 ) +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveInHandle +#else typedef struct __tinyWaveInHandle +#endif { FILE *theFile; fpos_t dataChunkPos; uint32_t position; uint32_t length; uint32_t bps; +#ifdef CODE_IMPROVEMENTS +} tinyWaveInHandle, WAVEFILEIN; +#else } __tinyWaveInHandle, WAVEFILEIN; +#endif typedef struct { diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index 693beccf9557dfaf7d6a507cb614064f76049f03..e7d568dc83c48adf46dc0fcbb3dff7f20fdcaa5c 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -70,15 +70,27 @@ #endif #endif +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutHeader +#else typedef struct __tinyWaveOutHeader +#endif { uint32_t riffType; /* 'RIFF' */ uint32_t riffSize; /* file size */ uint32_t waveType; /* 'WAVE' */ +#ifdef CODE_IMPROVEMENTS +} tinyWaveOutHeader; +#else } __tinyWaveOutHeader; +#endif +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutFmtChunk +#else typedef struct __tinyWaveOutFmtChunk +#endif { uint32_t formatType; uint32_t formatSize; @@ -91,16 +103,31 @@ typedef struct __tinyWaveOutFmtChunk uint16_t bitsPerSample; /* wav fmt ext hdr here */ +#ifdef CODE_IMPROVEMENTS +} tinyWaveOutFmtChunk; +#else } __tinyWaveOutFmtChunk; +#endif -typedef struct __tinyWaveOutDataChunk +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutDataChunk +#else +typedef struct tinyWaveOutDataChunk +#endif { uint32_t dataType; uint32_t dataSize; - +#ifdef CODE_IMPROVEMENTS +} tinyWaveOutDataChunk; +#else } __tinyWaveOutDataChunk; +#endif +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutHandle +#else typedef struct __tinyWaveOutHandle +#endif { FILE *theFile; uint32_t dataSize; @@ -109,7 +136,11 @@ typedef struct __tinyWaveOutHandle uint32_t dataChunkOffset; uint32_t bps; uint32_t clipCount; +#ifdef CODE_IMPROVEMENTS +} tinyWaveOutHandle, WAVEFILEOUT; +#else } __tinyWaveOutHandle, WAVEFILEOUT; +#endif /*--- local protos --------------------------------------------------*/ static __inline uint32_t BigEndian32( char, char, char, char ); @@ -132,9 +163,15 @@ static WAVEFILEOUT *CreateBWF( /* ,const uint32_t writeWaveExt */ ) { WAVEFILEOUT *self; +#ifdef CODE_IMPROVEMENTS + tinyWaveOutHeader whdr; + tinyWaveOutFmtChunk wfch; + tinyWaveOutDataChunk wdch; +#else __tinyWaveOutHeader whdr; __tinyWaveOutFmtChunk wfch; __tinyWaveOutDataChunk wdch; +#endif uint32_t blockAlignment = 0; uint32_t ByteCnt = 0; /* Byte counter for fwrite */ diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index 653fc0f2f6f99f6d0d274cbe2adfc63d33123edb..65182061e2d1a486dd59b54020e150d01a019082 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -73,9 +73,9 @@ TsmScaleFileReader *TsmScaleFileReader_open( return NULL; } - self = calloc( sizeof( TsmScaleFileReader ), 1 ); + self = calloc( 1, sizeof( TsmScaleFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index 8a46a97d1d2f8920bd5daf2d90283ac13c9087b1..5f6116c747d519bb738eb0d90c419f3d85f9e771 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -68,9 +68,9 @@ ivas_error Vector3PairFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( Vector3PairFileReader ), 1 ); + self = calloc( 1, sizeof( Vector3PairFileReader ) ); self->trajFile = trajFile; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); *vector3PairReader = self; diff --git a/readme.txt b/readme.txt index 1741f84191fd04ddade71a4a0d911a27bfb15adb..608ebe56c0d3a58e98c9a4d8dc466b041b50b44c 100644 --- a/readme.txt +++ b/readme.txt @@ -571,6 +571,17 @@ columns are the Euler angles yaw, pitch, and roll. The rotations are applied in The yaw angle rotates around the z axis, the pitch angle rotates aroud the new y axis, and the roll angle rotates around the new x axis. +In case of 6 DoF support for rendering, the head rotation trajectory file may also include a listener +position in absolute Cartesian coordinates on the x-, y- and z-axis. Note that the listener position is +expressed in absolute coordinates, while the listener orientation is expressed as scene displacement. +An example line from a headtracking file of a listener facing forward, positioned at x=3.0, y=4.0 and z=0, +could be: + +-3.0,0.0,0.0,0.0,3.0,4.0,0.0 + +Note that the listener position applies for listener orientation expressed both in Quaternions and Euler angles. + + For the Head rotation operation modes, external trajectory files are available: headrot.csv diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 8074cbfda1e0b463dee313f69d5e748a37b18fb6..91f8c5e88daaf9bf96d0e25687bf0f0247b0fb99 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1437,15 +1437,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 // Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) ../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid1.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:200,0:100,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) ../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid2.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:100,0:300 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid3.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:100,2:500,1:200 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 8c1897f0e11bbbc111a92a63efb7de50c63cf52b..7cd4b5a8bb689361fe59e51597bc64ddf06bbb5a 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1437,15 +1437,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 // Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) ../IVAS_cod -mc 5_1 512000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid1.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51wav_MC51_512000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51wav_MC51_512000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) ../IVAS_cod -mc 5_1 64000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid2.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_64000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_64000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid3.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_32000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_32000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit diff --git a/scripts/dly_error_profiles/dly_error_profile_I1.dat b/scripts/dly_error_profiles/dly_error_profile_I1.dat new file mode 100644 index 0000000000000000000000000000000000000000..ecf898b34b2f9bbd04195bc7b0d4b9891b3765f9 --- /dev/null +++ b/scripts/dly_error_profiles/dly_error_profile_I1.dat @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:854e83b31b5aa6f120e793336e8732281681fc242c86819496901a8c2a65558f +size 25512 diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index ea2a893d1993fc2750a128ffdeb7b71f21033244..d44aff06996dd9c812d29804c36602f9c3c18c38 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -57,6 +57,10 @@ find lib_lc3plus -name '*.[ch]' -type f -print0 | \ xargs -0 -I {} \ sed -i 's/^#[[:space:]]\+/#/' {} +# fix for sanitizer issues +sed -i 's/st->low << 8/(LC3_INT)((LC3_UINT32)st->low << 8)/' lib_lc3plus/ari_codec.c +sed -i 's/~3/(uintptr_t)(~3)/' lib_lc3plus/lc3.c + # Add .clang-format file to lib_lc3plus to disable formatting there printf "Disabling clang-format in lib_lc3plus directory\n" printf ' diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 9176feaa1f9d988f81ae7959102471044a5e456b..1e66afd606b98804429e02538d97f2843593f4fd 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -67,53 +67,54 @@ from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties, get_split_idx -def run_cmd(cmd, test_info, env=None): - logging.info(f"\nRunning command\n{' '.join(cmd)}\n") +def _run_cmd(cmd, env, test_info=None): + """ + Helper function for running some command. + Raises a SystemError if either the return code is non-zero or a USAN printout is detected + """ + proc = sp.run(cmd, capture_output=True, text=True, env=env) + stdout = proc.stdout + proc.stderr + + # check for USAN error first + if "UndefinedBehaviorSanitizer" in stdout: + error = f"USAN error detected in stdout of command: {' '.join(cmd)}\n{stdout}" + if test_info is not None: + test_info.error = error + raise SystemError(error) + + # then handle possible crash try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) + proc.check_returncode() except sp.CalledProcessError as e: - test_info.error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - raise SystemError(test_info.error) + error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" + if test_info is not None: + test_info.error = error + raise SystemError(error) + + +def run_cmd(cmd, test_info, env=None): + logging.info(f"\nRunning command\n{' '.join(cmd)}\n") + _run_cmd(cmd, env, test_info) def run_isar_ext_rend_cmd(cmd, env=None): logging.info(f"\nRunning ISAR EXT REND command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_ivas_isar_enc_cmd(cmd, env=None): logging.info(f"\nRunning IVAS ISAR encoder command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_ivas_isar_dec_cmd(cmd, env=None): logging.info(f"\nDUT decoder command:\n\t{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_isar_post_rend_cmd(cmd, env=None): logging.info(f"\nRunning ISAR post renderer command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def check_BE( @@ -251,7 +252,7 @@ def run_renderer( for k, v in FORMAT_TO_METADATA_FILES_LTV.items(): format_to_file[k] = str(v).replace( str(LTV_DIR), str(test_info.config.option.ltv_dir) - ) + ) else: format_to_file = FORMAT_TO_FILE_LTV format_to_metadata_files = FORMAT_TO_METADATA_FILES_LTV diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index f9a1e86fc7c591c5020bb08eaa774035e3527caa..ccc6a9b5c8aa6fc231373952097eaa12dff88df2 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -191,15 +191,17 @@ def run_full_chain_split_rendering( with TemporaryDirectory() as tmp_dir: tmp_dir = Path(tmp_dir) cut_in_file = tmp_dir.joinpath("cut_input.wav") - # ivas_bitstream = tmp_dir.joinpath("ivas.192") - ivas_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_ivas.192" - # split_bitstream = tmp_dir.joinpath("split.bit") - split_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split.bit" + + renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") + filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_full_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" + + ivas_bitstream_stem = f"{filename_base}.192" + # NOTE: the split bitstream files need to have ".bit" extension otherwise the conformance test breaks + split_bitstream_stem = f"{filename_base}.splt.bit" if renderer_fmt == "BINAURAL_SPLIT_PCM": - # split_md_file = tmp_dir.joinpath("split_md.bin") - split_md_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split_md.bit" + split_md_file_stem = f"{filename_base}.spltmd.bit" - out_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_.wav" + out_file_stem = f"{filename_base}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF @@ -270,8 +272,8 @@ def run_full_chain_split_rendering( # run split renderer cmd = SPLIT_POST_REND_CMD[:] - # if test_info.config.option.create_ref: - # cmd[0] += BIN_SUFFIX_MERGETARGET + if test_info.config.option.create_ref: + cmd[0] += BIN_SUFFIX_MERGETARGET cmd[0] += binary_suffix cmd[4] = str(split_bitstream) cmd[6] = renderer_fmt @@ -365,7 +367,9 @@ def run_external_split_rendering( split_bitstream = tmp_dir.joinpath("split.bit") if renderer_fmt == "BINAURAL_SPLIT_PCM": split_md_file = tmp_dir.joinpath("split_md.bin") - out_file_stem = f"{in_fmt}_{renderer_fmt}_split_ext_config_{render_config.stem}_postrfr_{pre_rend_fr}_prerfr_{post_rend_fr}.wav" + + renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") + out_file_stem = f"{in_fmt}_{renderer_fmt_for_filename}_ext_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF @@ -416,8 +420,8 @@ def run_external_split_rendering( # run split renderer cmd = SPLIT_POST_REND_CMD[:] - # if test_info.config.option.create_ref: - # cmd[0] += BIN_SUFFIX_MERGETARGET + if test_info.config.option.create_ref: + cmd[0] += BIN_SUFFIX_MERGETARGET cmd[0] += binary_suffix cmd[4] = str(split_bitstream) cmd[6] = renderer_fmt @@ -450,7 +454,7 @@ def run_external_split_rendering( cut, cut_fs = readfile(out_file) - if get_mld == False: + if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs )