diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15cb7a656978a37059e6cfb8d115ca7da909f2dc..97d547d5c5cd79ddd336ea0f66a92b762e3bdd99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,9 +23,11 @@ variables: - 'test-long-self-test' - 'ivas-conformance' - 'ivas-conformance-linux' + - 'check-float-reference' GIT_CLEAN_FLAGS: -ffdxq TESTCASE_TIMEOUT_STV_SANITIZERS: 180 TESTCASE_TIMEOUT_LTV_SANITIZERS: 1200 + BASOP_REFERENCE_BRANCH: "ivas-float-update" default: @@ -63,6 +65,10 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' variables: IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test -- Linux: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'trigger' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-float-reference' + variables: + IVAS_PIPELINE_NAME: 'check-float-reference: $CI_COMMIT_BRANCH' stages: @@ -257,6 +263,8 @@ stages: when: never - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' when: never + - if: $MANUAL_PIPELINE_TYPE == 'check-float-reference' + when: never - when: on_success .rules-merge-request: @@ -396,7 +404,6 @@ check-self-test-names-pre: script: - python3 ci/check_self_test_names.py scripts/config/self_test.prm 135 - branch-is-up-to-date-with-main-post: extends: - .rules-merge-request @@ -408,6 +415,52 @@ branch-is-up-to-date-with-main-post: - echo $commits_behind_count - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi; +# for merges to basop-ci-branch, run the long test suite in reference generation mode to catch problems already here and not only in the BASOP repo +check-compatibility-with-basop-reference-branch: + extends: + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "basop-ci-branch" + changes: + - tests/**/* + - scripts/**/* + - ci/**/* + - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'check-float-reference' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + tags: + - ivas-linux-fast + script: + - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch + - make -j -C ivas-basop + - cp ivas-basop/IVAS_cod ./IVAS_cod_ref + - cp ivas-basop/IVAS_dec ./IVAS_dec_ref + - cp ivas-basop/IVAS_cod ./IVAS_cod # Not used but needed to launch the pytest + - cp ivas-basop/IVAS_dec ./IVAS_dec # Not used but needed to launch the pytest + - python3 ci/remove_unsupported_testcases.py scripts/config/self_test.prm + - python3 tests/create_short_testvectors.py + - exit_code1=0 + - exit_code2=0 + - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref --html=report1.html --self-contained-html --junit-xml=report-junit1.xml || exit_code1=$? + - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 -m create_ref_part2 --html=report2.html --self-contained-html --junit-xml=report-junit2.xml || exit_code2=$? + - zero_errors=$(cat report-junit1.xml report-junit2.xml | grep -c 'errors="0"') || true + - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi + - exit 0 + artifacts: + name: "check-float-reference--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: 1 month + paths: + - report-junit1.xml + - report-junit2.xml + - report1.html + - report2.html + expose_as: "check-float-reference results" + reports: + junit: + - report-junit1.xml + - report-junit2.xml + # --------------------------------------------------------------- # Build jobs # --------------------------------------------------------------- @@ -2297,7 +2350,7 @@ complexity-stereo-in-ext-out: - *complexity-measurements-prepare-artifacts - exit $ret_val -complexity-ism-in-binaural_room_reverb-out: +complexity-ism-in-binaural-out: extends: - .complexity-template rules: @@ -2306,7 +2359,22 @@ complexity-ism-in-binaural_room_reverb-out: start_in: 1 hour script: - in_format=ISM - - out_format=BINAURAL_ROOM_REVERB + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-ism-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 2 hours + script: + - in_format=ISM + - out_format=BINAURAL_ROOM_IR - ret_val=0 - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" || ret_val=$? - *complexity-measurements-prepare-artifacts @@ -2318,7 +2386,7 @@ complexity-ism-in-ext-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 3 hour + start_in: 3 hours script: - in_format=ISM - out_format=EXT @@ -2342,13 +2410,28 @@ complexity-sba-hoa3-in-ext-out: - *complexity-measurements-prepare-artifacts - exit $ret_val -complexity-sba-hoa3-in-binaural_room_ir-out: +complexity-sba-hoa3-in-binaural-out: extends: - .complexity-template rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed start_in: 5 hours + script: + - in_format=HOA3 + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + +complexity-sba-hoa3-in-binaural_room_ir-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 6 hours script: - in_format=HOA3 - out_format=BINAURAL_ROOM_IR @@ -2363,7 +2446,7 @@ complexity-mc-in-ext-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 6 hours + start_in: 7 hours script: - in_format=MC - out_format=EXT @@ -2372,13 +2455,28 @@ complexity-mc-in-ext-out: - *complexity-measurements-prepare-artifacts - exit $ret_val +complexity-mc-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 8 hours + script: + - in_format=MC + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + complexity-mc-in-binaural_room_ir-out: extends: - .complexity-template rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 7 hours + start_in: 9 hours script: - in_format=MC - out_format=BINAURAL_ROOM_IR @@ -2393,7 +2491,7 @@ complexity-masa-in-ext-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 8 hours + start_in: 10 hours script: - in_format=MASA - out_format=EXT @@ -2408,7 +2506,7 @@ complexity-masa-in-binaural-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 9 hours + start_in: 11 hours script: - in_format=MASA - out_format=BINAURAL @@ -2423,7 +2521,7 @@ complexity-masa-in-hoa3-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 10 hours + start_in: 12 hours script: - in_format=MASA - out_format=HOA3 @@ -2438,7 +2536,7 @@ complexity-omasa-in-ext-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 11 hours + start_in: 13 hours script: - in_format=OMASA - out_format=EXT @@ -2453,7 +2551,7 @@ complexity-omasa-in-binaural-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 12 hours + start_in: 14 hours script: - in_format=OMASA - out_format=BINAURAL @@ -2462,13 +2560,28 @@ complexity-omasa-in-binaural-out: - *complexity-measurements-prepare-artifacts - exit $ret_val +complexity-omasa-in-hoa3-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 15 hours + script: + - in_format=OMASA + - out_format=HOA3 + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + complexity-StereoDmxEVS-stereo-in-mono-out: extends: - .complexity-template rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 13 hours + start_in: 16 hours script: - in_format=StereoDmxEVS - out_format=mono @@ -2483,7 +2596,7 @@ complexity-osba-in-ext-out: rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 14 hours + start_in: 17 hours script: - in_format=OSBA - out_format=EXT @@ -2492,13 +2605,28 @@ complexity-osba-in-ext-out: - *complexity-measurements-prepare-artifacts - exit $ret_val +complexity-osba-in-binaural-out: + extends: + - .complexity-template + rules: + - if: $MEASURE_COMPLEXITY_LINUX + when: delayed + start_in: 18 hours + script: + - in_format=OSBA + - out_format=BINAURAL + - ret_val=0 + - bash ci/complexity_measurements/getWmops.sh "$in_format" "$out_format" || ret_val=$? + - *complexity-measurements-prepare-artifacts + - exit $ret_val + complexity-osba-in-binaural_room_ir-out: extends: - .complexity-template rules: - if: $MEASURE_COMPLEXITY_LINUX when: delayed - start_in: 15 hours + start_in: 19 hours script: - in_format=OSBA - out_format=BINAURAL_ROOM_IR diff --git a/apps/renderer.c b/apps/renderer.c index cf97acf947dccd8a056e9ee66e64132628702abd..e734aeb8ab3119f621b48cd75ced640dfec20d11 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -169,6 +169,10 @@ typedef struct char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientation_tracking; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + int16_t Opt_Headrotation; + int16_t Opt_ExternalOrientation; +#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; IVAS_REND_COMPLEXITY_LEVEL complexityLevel; @@ -882,7 +886,11 @@ int main( const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -2510,7 +2518,12 @@ static CmdlnArgs defaultArgs( clearString( args.renderConfigFilePath ); clearString( args.externalOrientationFilePath ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args.Opt_Headrotation = 0; + args.Opt_ExternalOrientation = 0; +#endif args.orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; + args.nonDiegeticPan = 0; args.nonDiegeticPanGain = 0.f; @@ -2598,6 +2611,9 @@ static void parseOption( break; case CmdLnOptionId_trajFile: assert( numOptionValues == 1 ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args->Opt_Headrotation = 1; +#endif strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_outputMetadata: @@ -2618,6 +2634,9 @@ static void parseOption( break; case CmdLnOptionId_exteriorOrientationFile: assert( numOptionValues == 1 ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args->Opt_ExternalOrientation = 1; +#endif strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_customHrtfFile: @@ -2742,6 +2761,13 @@ static CmdlnArgs parseCmdlnArgs( exit( -1 ); /* Error printout handled by failing function */ } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + args.Opt_Headrotation = 1; + } +#endif + return args; } diff --git a/ci/setup_pages.py b/ci/setup_pages.py index e810047c908d5697638274fc78fa6502fe7bb8f1..01c16fcb679c0f2e071f596c1cf16ede536b7bd5 100755 --- a/ci/setup_pages.py +++ b/ci/setup_pages.py @@ -20,18 +20,23 @@ JOBS_FLOAT_REPO = { # "complexity-masa-in-7_1_4-out": "[OLD] Masa in, 7_1_4 out", # current ones "complexity-stereo-in-ext-out": "Stereo in, EXT out", - "complexity-ism-in-binaural_room_reverb-out": "ISM in, BINAURAL_ROOM_REVERB out", + "complexity-ism-in-binaural-out": "ISM in, BINAURAL out", + "complexity-ism-in-binaural_room_ir-out": "ISM in, BINAURAL_ROOM_IR out", "complexity-ism-in-ext-out": "ISM in, EXT out", "complexity-sba-hoa3-in-ext-out": "HOA3 in, EXT out", + "complexity-sba-hoa3-in-binaural-out": "HOA3 in, BINAURAL out", "complexity-sba-hoa3-in-binaural_room_ir-out": "HOA3 in, BINAURAL_ROOM_IR out", "complexity-mc-in-ext-out": "MC in, EXT out", + "complexity-mc-in-binaural-out": "MC in, BINAURAL out", "complexity-mc-in-binaural_room_ir-out": "MC in, BINAURAL_ROOM_IR out", "complexity-masa-in-ext-out": "MASA in, EXT out", "complexity-masa-in-binaural-out": "MASA in, BINAURAL out", "complexity-masa-in-hoa3-out": "MASA in, HOA3 out", "complexity-omasa-in-ext-out": "OMASA in, EXT out", "complexity-omasa-in-binaural-out": "OMASA in, BINAURAL out", + "complexity-omasa-in-hoa3-out": "OMASA in, HOA3 out", "complexity-osba-in-ext-out": "OSBA in, EXT out", + "complexity-osba-in-binaural-out": "OSBA in, BINAURAL out", "complexity-osba-in-binaural_room_ir-out": "OSBA in, BINAURAL_ROOM_IR out", "complexity-StereoDmxEVS-stereo-in-mono-out": "StereoDmxEVS, Stereo in, Mono out", # "timeless" jobs (not complexity) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index ca3c963003e4a4b744ea442c13a022a5beee488b..775a8a0e01a5eb7d878e512df72cb26f3b3fa379 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -563,6 +563,10 @@ enum #define INT_FS_12k8 12800 /* internal sampling frequency */ #define M 16 /* order of the LP filter @ 12.8kHz */ +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +#define MAX_LP_FILTER_ORDER 20 /* Max order of an LP filter */ +#endif + #define L_FRAME 256 /* frame size at 12.8kHz */ #define NB_SUBFR 4 /* number of subframes per frame */ #define L_SUBFR ( L_FRAME / NB_SUBFR ) /* subframe size */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index fbe82c07a2215cf533fe3db3bdf5205a9cdad87a..8c72cf280832915c449e188d673effd07a338a6c 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1444,7 +1444,11 @@ typedef enum /* LFE PLC */ #define LFE_PLC_BUFLEN 240 #define LFE_PLC_FS 1600 +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +#define L_FRAME_1k6 ( LFE_PLC_FS / FRAMES_PER_SEC ) +#else #define L_FRAME_1k6 ( 20 * LFE_PLC_FS / 1000 ) +#endif #define LFE_PLC_LENANA LFE_PLC_BUFLEN #define LFE_PLC_FDEL 300 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 11454d3eb7d17efa6f3f8287d4b31abd8cafb732..dc5ef18862cbb77bb5d46580a5d041e0fc45a853 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5496,7 +5496,11 @@ void ivas_lfe_dec( void ivas_lfe_tdplc( LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ - const float *prevsynth, /* i : previous frame synthesis */ +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT + float *prevsynth, /* i : previous frame synthesis */ +#else + double *prevsynth, /* i : previous frame synthesis */ +#endif float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ); diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 744fdf25b0dd3104c0e4020b4d516530b43fc045..5abf3cffd4d8b06b8382d90dce495801a67bfbad 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -1876,6 +1876,7 @@ const float ivas_param_mc_dmx_fac_CICP19_3tc[36] = 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f /*Ct*/ }; +#ifndef FIX_1157_OBSOLETE_DMX_TABLE const float ivas_param_mc_dmx_fac_CICP19_4tc[48] = { 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, /*Lht*/ @@ -1883,6 +1884,7 @@ const float ivas_param_mc_dmx_fac_CICP19_4tc[48] = 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lut*/ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rut*/ }; +#endif /* Coefficient for Parametric MC ILD factorization */ const float ivas_param_mc_ild_fac_CICP6_2tc[6] = @@ -3129,6 +3131,26 @@ const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +const float hamm_lfe_plc[LFE_PLC_LENANA / 2] = +{ + 0.08000000000000002f, 0.08015895227847719f, 0.08063569926248770f, 0.08142991147368656f, 0.08254104003450596f, 0.08396831704748331f, 0.08571075612595230f, 0.08776715307573196f, + 0.09013608672734141f, 0.09281591991816535f, 0.09580480062389246f, 0.09910066323844335f, 0.10270123000150438f, 0.10660401257268071f, 0.11080631375118072f, 0.11530522933984272f, + 0.12009765015221685f, 0.12518026416131367f, 0.13054955878853602f, 0.13620182333121073f, 0.14213315152704381f, 0.14833944425372619f, 0.15481641236182375f, 0.16155957963899570f, + 0.16856428590349043f, 0.17582569022478273f, 0.18333877426912554f, 0.19109834576770490f, 0.19909904210500018f, 0.20733533402487142f, 0.21580152945181053f, 0.22449177742471671f, + 0.23340007214047787f, 0.24252025710456171f, 0.25184602938575001f, 0.26137094397207467f, 0.27108841822494550f, 0.28099173642839037f, 0.29107405443026624f, 0.30132840437223085f, + 0.31174769950520753f, 0.32232473908701620f, 0.33305221335878232f, 0.34392270859668939f, 0.35492871223557998f, 0.36606261806086549f, 0.37731673146515798f, 0.38868327476598852f, + 0.40015439258093899f, 0.41172215725647360f, 0.42337857434671339f, 0.43511558813837425f, 0.44692508721804453f, 0.45879891007795709f, 0.47072885075638249f, 0.48270666450874267f, + 0.49472407350552849f, 0.50677277255308162f, 0.51884443483328757f, 0.53093071765821398f, 0.54302326823571601f, 0.55511372944202464f, 0.56719374559732838f, 0.57925496824035816f, + 0.59128906189798180f, 0.60328770984582458f, 0.61524261985593010f, 0.62714552992749328f, 0.63898821399670414f, 0.65076248762175315f, 0.66246021363907504f, 0.67407330778691554f, + 0.68559374429233988f, 0.69701356141781945f, 0.70832486696356345f, 0.71951984372179334f, 0.73059075487919101f, 0.74152994936378558f, 0.75232986713258543f, 0.76298304439630038f, + 0.77348211877754336f, 0.78381983439894576f, 0.79398904689767136f, 0.80398272836286389f, 0.81379397219261318f, 0.82341599786708708f, 0.83284215563452701f, 0.84206593110687011f, + 0.85108094976182280f, 0.85988098134827329f, 0.86845994419199846f, 0.87681190939868969f, 0.88493110495139349f, 0.89281191969953333f, 0.90044890723675941f, 0.90783678966494241f, + 0.91497046124171255f, 0.92184499190902180f, 0.92845563070029180f, 0.93479780902379184f, 0.94086714381997805f, 0.94665944059061280f, 0.95217069629756890f, 0.95739710212931617f, + 0.96233504613317988f, 0.96698111571154954f, 0.97133209998031445f, 0.97538499198789563f, 0.97913699079334116f, 0.98258550340204664f, 0.98572814655776630f, 0.98856274838967395f, + 0.99108734991333569f, 0.99330020638455863f, 0.99519978850517732f, 0.99678478347994692f, 0.99805409592381300f, 0.99900684861892730f, 0.99964238312089115f, 0.99996026021380402f +}; +#else const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196, @@ -3147,7 +3169,7 @@ const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395, 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402 }; - +#endif /*------------------------------------------------------------------------------------------* * MDFT/iMDFT ROM tables diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 774aef466aecbcc547d4015c028af5ed1e16e083..749ae47b7560b97ba05b89710bf8b9bcf69c4d76 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -361,7 +361,11 @@ extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const float ivas_lfe_lpf_delay[2]; +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +extern const float hamm_lfe_plc[LFE_PLC_LENANA / 2]; +#else extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2]; +#endif extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1]; diff --git a/lib_com/lpc_tools.c b/lib_com/lpc_tools.c index 9926cd6596363f57ea4b88854f940834c5ace59e..fa3923f8ca022cb6a32b9bece40ec99c95a10e38 100644 --- a/lib_com/lpc_tools.c +++ b/lib_com/lpc_tools.c @@ -131,7 +131,7 @@ void autocorr( * of input signal *---------------------------------------------------------------------*/ -/*! r: energy of prediction error */ +/*! r: stability flag */ int16_t lev_dur( float *a, /* o : LP coefficients (a[0] = 1.0) */ const float *r, /* i : vector of autocorrelations */ diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 631159857446d9e6ae8b06f5089426953b719260..89963d1df81c686bdcb882ad19abe4b923513243 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -959,14 +959,22 @@ void isp2isf( * * Convert from LPC to reflection coeff *-------------------------------------------------------------------*/ - +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT void a2rc( +#else +/*! r: stability flag */ +uint16_t a2rc( +#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ ) { +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT float f[M]; +#else + float f[MAX_LP_FILTER_ORDER]; +#endif int16_t m, j, n; float km, denom, x; @@ -985,8 +993,11 @@ void a2rc( { refl[j] = 0.f; } - +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT return; +#else + return 0; +#endif } refl[m] = -km; @@ -1006,7 +1017,11 @@ void a2rc( } } +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT return; +#else + return 1; +#endif } diff --git a/lib_com/options.h b/lib_com/options.h index e50a0608cb43b49c963da9b796976154a708d2ea..c313a39f88e1926b2ecbf092ac8ce70815c30385 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,11 @@ #define FIX_1123_PARAMBIN_16BIT_ROM /* FhG,Nok: issue 1123: update ParamBin ROM tables and scripts to generate 16 bit tables instead of float */ #define FIX_RETURN /* VA: fix location of function returns */ #endif +#define FIX_1129_EXT_REND_OUTPUT_HIGH /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */ #define FIX_1152_UNINIT_VAL_IN_ITD_VAD_COMPUTATION /* FhG: fix uninitialized value being used in ITD VAD mid signal computation that does not affect synthesis, but crashes BASOPs */ +#define FIX_1157_OBSOLETE_DMX_TABLE /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */ +#define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */ +#define FIX_1159_SPLIT_RENDERING_CONFIG /* VA: issue 1159: Execute split rendering config only for split rendering outputs. */ /* #################### End BE switches ################################## */ @@ -179,6 +183,11 @@ /* all switches in this category should start with "NONBE_" */ #define NONBE_FIX_1141_OSBA_ROOM_RENDERING /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */ +#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ +#define NONBE_FIX_1143_MASA_BRSW /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */ + + +#define NONE_BE_FIX_816_LFE_PLC_FLOAT /* DLB: issue 816: reduce required precision to float for LFE-PLC*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index d26a2a42abe0d51e2befdf8e7a241ff3592f2ddc..4f4222b2f90fdff3e2ec854ea838154f5be56b92 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2998,7 +2998,12 @@ void a2isf( const float *old_isf, const int16_t lpcOrder ); +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT void a2rc( +#else +/*! r: stability flag */ +uint16_t a2rc( +#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index d74cbc7772b5579c5d58f236f4ad24e92d458104..99509970cb4f005f550a02fbf6eebb859c1f0e2c 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -45,19 +45,26 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) -#define LFE_PLC_LPCORD ( 20 ) -#define LFE_PLC_MAXITER ( 10 ) +#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT +#define LFE_PLC_LPCORD ( 20 ) +#else +#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) +#endif #define POW_THR ( 1.0e-8f ) #define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL ) #define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) ) #define LFE_PLC_MUTE_THR ( 10 ) -#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ - -#define MAX_LEN_LP 960 - -#define EPS_STOP 1e-5 +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ +#define EPS_STOP 1e-5f +#else +#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ +#define MAX_LEN_LP 960 +#define EPS_STOP 1e-5 +#endif +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT /*------------------------------------------------------------------------------------------* * Static function declarations * @@ -202,10 +209,12 @@ static int16_t d_lev_dur( } rc[i - 1] = ( -s ) / err; + if ( fabs( rc[i - 1] ) > 0.99945f ) { flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ } + for ( j = 1; j <= i / 2; j++ ) { l = i - j; @@ -231,13 +240,82 @@ static int16_t d_lev_dur( return ( flag ); } +#else +/*---------------------------------------------------------------------* + * lfeplc_lev_dur() + * + * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations + * of input signal + *---------------------------------------------------------------------*/ + +/*! r: stability flag */ +static int16_t lfeplc_lev_dur( + float *a_out, /* o : LP coefficients (a[0] = 1.0) */ + const float *r, /* i : vector of autocorrelations */ + const int16_t m /* i : order of LP filter */ +) +{ + int16_t i, j, l; + float buf[TCXLTP_LTP_ORDER]; + float *rc; /* reflection coefficients 0,...,m-1 */ + float s, at, err; + float a[LFE_PLC_LPCORD + 1]; + + set_f( a, 0.f, LFE_PLC_LPCORD + 1 ); + set_f( a_out, 0.f, LFE_PLC_LPCORD + 1 ); + rc = &buf[0]; + a[0] = 1.f; + err = r[0]; + a_out[0] = a[0]; + rc[0] = ( -r[1] ) / r[0]; + s = r[1]; + a[1] = rc[0]; + a_out[1] = a[1]; + + i = 1; + while ( i < m ) + { + for ( j = 1; j <= i / 2; j++ ) + { + l = i - j; + at = a[j] + rc[i - 1] * a[l]; + a[l] += rc[i - 1] * a[j]; + a[j] = at; + } + + a[i] = rc[i - 1]; + err += rc[i - 1] * s; + s = 0.f; + i++; + for ( j = 0; j < i; j++ ) + { + s += r[i - j] * a[j]; + } + rc[i - 1] = ( -s ) / err; + if ( fabsf( rc[i - 1] ) > 0.99945f ) + { + return 1; + } + else + { + for ( j = 0; j <= m; j++ ) + { + a_out[j] = a[j]; + } + } + } + + return 0; +} + +#endif +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT /*-------------------------------------------------------------------* * a2rc() * * Convert from LPC to reflection coeff *-------------------------------------------------------------------*/ - static uint16_t d_a2rc( const double *a, /* i : LPC coefficients */ double *refl, /* o : Reflection co-efficients */ @@ -245,8 +323,8 @@ static uint16_t d_a2rc( ) { double ff[LFE_PLC_LPCORD]; - int16_t m, j, n; double km, denom, x; + int16_t m, j, n; for ( m = 0; m < lpcorder; m++ ) { @@ -286,7 +364,6 @@ static uint16_t d_a2rc( return 1; } - static void d_syn_filt( const double a[], /* i : LP filter coefficients */ const int16_t m, /* i : order of LP filter */ @@ -328,7 +405,7 @@ static void d_syn_filt( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function check_stab() @@ -336,17 +413,31 @@ static void d_syn_filt( * LPC filter stability check applying given sharpening value delta *-----------------------------------------------------------------------------------------*/ +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT static uint16_t check_stab( const double *a, double delta ) { double amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; - int16_t i; double fac; double fac1; +#else +static uint16_t check_stab( + const float *a, + const float delta ) +{ + float amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; + float fac; + float fac1; +#endif + int16_t i; uint16_t stable; +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT fac = 1.0 + delta; +#else + fac = 1.0f + delta; +#endif fac1 = fac; for ( i = 0; i < LFE_PLC_LPCORD; i++ ) @@ -354,7 +445,12 @@ static uint16_t check_stab( amod[i] = a[i] * fac; fac *= fac1; } + +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT stable = d_a2rc( amod, refl, LFE_PLC_LPCORD ); +#else + stable = a2rc( amod, refl, LFE_PLC_LPCORD ); +#endif return stable; } @@ -366,16 +462,30 @@ static uint16_t check_stab( * Find maximum LPC filter sharpening by iteration to get a filter that is almost instable *-----------------------------------------------------------------------------------------*/ +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT static double find_max_delta( double *a ) { double delta; double eps; - uint16_t stable; double fac; +#else +static float find_max_delta( + float *a ) +{ + float delta; + float eps; + float fac; +#endif + uint16_t stable; +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT delta = 0.0; eps = 0.01; +#else + delta = 0.0f; + eps = 0.01f; +#endif fac = 2; stable = FALSE; @@ -385,7 +495,11 @@ static double find_max_delta( eps *= fac; stable = TRUE; } +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT fac = 0.5; +#else + fac = 0.5f; +#endif if ( stable ) { @@ -407,6 +521,7 @@ static double find_max_delta( delta += eps; stable = check_stab( a, delta ); +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT if ( !stable ) { if ( fabs( eps ) > EPS_STOP ) @@ -426,6 +541,27 @@ static double find_max_delta( } eps = fabs( eps ) * fac; } +#else + if ( !stable ) + { + if ( fabsf( eps ) > EPS_STOP ) + { + eps = -fabsf( eps ) * fac; + } + else + { + eps = -fabsf( eps ); + } + } + else + { + if ( fabsf( eps ) < EPS_STOP ) + { + break; + } + eps = fabsf( eps ) * fac; + } +#endif } return delta; @@ -440,28 +576,54 @@ static double find_max_delta( static void recover_samples( const int16_t bfi_count, +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT const float *outbuf, +#else + float *outbuf, +#endif float *rec_frame ) { int16_t i; float zeroes[LFE_PLC_RECLEN]; +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT double delta, fac, att; double d_outbuf[LFE_PLC_BUFLEN], d_r[LFE_PLC_LPCORD + 1], d_a[LFE_PLC_LPCORD + 1], d_pee[LFE_PLC_LPCORD + 1]; + mvr2d( outbuf, d_outbuf, LFE_PLC_BUFLEN ); d_autocorr( d_outbuf, d_r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc, 0, 1, 1 ); +#else + float delta, fac, att; + float r[LFE_PLC_LPCORD + 1], a[LFE_PLC_LPCORD + 1]; + + autocorr( outbuf, r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, hamm_lfe_plc, 0, 1, 1 ); +#endif +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT if ( d_r[0] < POW_THR * LFE_PLC_BUFLEN ) +#else + if ( r[0] < POW_THR * LFE_PLC_BUFLEN ) +#endif { set_zero( rec_frame, LFE_PLC_RECLEN ); return; } + +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT d_lev_dur( d_a, d_r, LFE_PLC_LPCORD, d_pee ); delta = find_max_delta( d_a + 1 ); fac = 1.0 + delta; att = 1.0; +#else + lfeplc_lev_dur( a, r, LFE_PLC_LPCORD ); + + delta = find_max_delta( a + 1 ); + + fac = 1.0f + delta; + att = 1.0f; +#endif if ( bfi_count >= LFE_PLC_MUTE_THR ) { @@ -471,12 +633,22 @@ static void recover_samples( for ( i = 1; i <= LFE_PLC_LPCORD; i++ ) { +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT d_a[i] = d_a[i] * fac; fac *= att * ( 1.0 + delta ); +#else + a[i] = a[i] * fac; + fac *= att * ( 1.0f + delta ); +#endif } set_zero( zeroes, LFE_PLC_RECLEN ); + +#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT d_syn_filt( d_a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD ); +#else + syn_filt( a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, 0 ); +#endif return; } @@ -489,8 +661,12 @@ static void recover_samples( *-----------------------------------------------------------------------------------------*/ void ivas_lfe_tdplc( - LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ - const float *prevsynth, /* i : previous frame synthesis */ + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT + float *prevsynth, /* i : previous frame synthesis */ +#else + double *prevsynth, /* i : previous frame synthesis */ +#endif float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 50cd432deaf0630db12f525a909ed395f7637abb..544f3d36bfba6da5fdde037eda6ba8a87bdcafe9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1393,11 +1393,16 @@ ivas_error ivas_masa_dec_reconfigure( sts = st_ivas->hCPE[cpe_id]->hCoreCoder; sts[0]->bit_stream = bit_stream + num_bits; num_bits += (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); +#ifdef NONBE_FIX_1143_MASA_BRSW + if ( ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate >= MASA_STEREO_MIN_BITRATE ) || + ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == FRAME_NO_DATA ) || + ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == IVAS_SID_5k2 ) ) +#else if ( ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate >= MASA_STEREO_MIN_BITRATE ) || ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == FRAME_NO_DATA ) ) +#endif { st_ivas->hCPE[cpe_id]->nchan_out = 1; - if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) ) { if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 961faa49122a1b7620d6bcf9a8e544c67b51bab3..b100848685f9edc2a3b2961318fc7e9f4e6c8002 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -993,7 +993,7 @@ typedef struct decoder_config_structure int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ float non_diegetic_pan_gain; /* non diegetic panning gain*/ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ + int16_t Opt_ExternalOrientation; /* indicates whether external orientations are used */ int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ #ifdef DEBUGGING diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f975814e2f1cdf14ea693f3f1b57052e24cced45..c95d24f0ea586fd3d313c9cfdc4001ff8a2b7f7a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -484,11 +484,13 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->render_framesize = renderFramesize; } +#ifndef FIX_1135_EXT_RENDERER_HANDLES if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { hDecoderConfig->Opt_Headrotation = TRUE; } +#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) { @@ -2228,10 +2230,17 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; } - if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG + if ( is_split_rendering_enabled( hIvasDec->st_ivas->hDecoderConfig, hRenderConfig ) ) { - return error; +#endif + if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index e43317b6e9af31ee21e22fb2af610fbe9b875c40..1868162771a6f015aab7d59f300ab0315f726cd7 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -932,6 +932,7 @@ void swb_tbe_dec( } a2rc( hBWE_TD->cur_sub_Aq + 1, refl, M ); + tilt_para = 6.6956f * ( 1.0f + refl[0] ) * ( 1.0f + refl[0] ) - 3.8714f * ( 1.0f + refl[0] ) + 1.3041f; if ( st->last_extl != SWB_TBE && st->last_extl != FB_TBE ) { diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index dafb2cc64253fe47bb129f8457e0aa36dc680466..18e68b709d0f268ddf418211d7f0dcdecc6119ce 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -164,7 +164,11 @@ static void ivas_lfe_enc_quant( } else { +#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT + shift = (int16_t) floorf( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); +#else shift = (int16_t) floor( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); +#endif } shift = max( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, min( max_shift, shift ) ); diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 4c6dd483e17c2a15c6bd222ac7b7b3be627b25fa..a869227497d9ddcdaea8abffb61b660bb778937c 100755 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -3297,7 +3297,7 @@ static float stereo_dft_calc_mean_ipd_change( ipd_mean_change /= gipd_band_max; #ifdef DEBUG_MODE_DFT - dbgwrite( ipd_change, sizeof( float ), hStereoDft->gipd_band_max, 1, "res/stereo_dft_ipd_change.pcm" ); + dbgwrite( ipd_change, sizeof( float ), gipd_band_max, 1, "res/stereo_dft_ipd_change.pcm" ); dbgwrite( &ipd_mean_change, sizeof( float ), 1, 1, "res/stereo_dft_ipd_mean_change.pcm" ); #endif diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 0f32dd9985e29b0ee8fa38cedf11669f6ced0657..f8221df11d4f569f7f55388c9b8f247497a21a97 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -291,7 +291,7 @@ static int16_t stereo_dft_enc_itd_vad( #ifdef FIX_1152_UNINIT_VAL_IN_ITD_VAD_COMPUTATION /* Spd is later only used starting at itd_vad_band_tbl[0], so only compute values starting from there */ /* -> this avoids uninitialized values in Spd_L and Spd_R at index 0 to be used */ - for ( i = itd_vad_band_tbl[0]; i <= STEREO_DFT_N_16k_ENC / 2; i++ ) + for ( i = itd_vad_band_tbl[0]; i < STEREO_DFT_N_16k_ENC / 2; i++ ) #else for ( i = 0; i <= STEREO_DFT_N_16k_ENC / 2; i++ ) #endif diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index 6f2b686638fd58371f013ce140dbfdbf2811e109..ca96a9b0a8a524cb6a53ed66b7a212455e7b5769 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -793,6 +793,7 @@ void swb_tbe_enc( { lsf_diff[i] = lsf_shb[i] - lsf_shb[i - 1]; } + a2rc( hBWE_TD->cur_sub_Aq + 1, refl, M ); /* LSP interpolation for 13.2 kbps and 16.4 kbps */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9c0b1c8374b6c143c6d51f2ed1530e56b52408eb..75816d6519a1a134b6a58782d4addaefe19e0627 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -217,7 +217,18 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { +#ifdef NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + } + else + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + } +#else mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#endif /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d091f05c0c8d6df2bd514facf285a800435e85e8..aa0281255047a3a0e92e8588610e976865699add 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -204,7 +204,11 @@ struct IVAS_REND AUDIO_CONFIG outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + SPLIT_REND_WRAPPER *splitRendWrapper; +#else SPLIT_REND_WRAPPER splitRendWrapper; +#endif IVAS_REND_AudioBuffer splitRendEncBuffer; IVAS_REND_HeadRotData headRotData; @@ -605,7 +609,9 @@ static ivas_error validateOutputSampleRate( /* Otherwise rendering to binaural, support the same set as IVAS decoder */ switch ( sampleRate ) { +#ifndef FIX_1159_SPLIT_RENDERING_CONFIG case 8000: +#endif case 16000: case 32000: case 48000: @@ -1109,7 +1115,11 @@ static ivas_error initHeadRotation( static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL ) +#else if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) +#endif { free( hIvasRend->headRotData.hOrientationTracker ); } @@ -1218,7 +1228,11 @@ static rendering_context getRendCtx( ctx.pHeadRotData = &hIvasRend->headRotData; ctx.hhRendererConfig = &hIvasRend->hRendererConfig; ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ctx.pSplitRendWrapper = hIvasRend->splitRendWrapper; +#else ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper; +#endif ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData; return ctx; @@ -1264,7 +1278,11 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -1368,7 +1386,11 @@ static ivas_error setRendInputActiveIsm( } else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1391,7 +1413,11 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -2089,7 +2115,11 @@ static ivas_error initMcBinauralRendering( /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2181,7 +2211,11 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2366,7 +2400,11 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2529,6 +2567,9 @@ static ivas_error updateSbaPanGains( break; } case IVAS_AUDIO_CONFIG_BINAURAL: +#ifdef FIX_1129_EXT_REND_OUTPUT_HIGH + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: +#endif if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -2538,20 +2579,30 @@ static ivas_error updateSbaPanGains( } else { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) +#endif { return error; } } break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: +#ifndef FIX_1129_EXT_REND_OUTPUT_HIGH case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: +#endif if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2583,7 +2634,11 @@ static ivas_error initSbaMasaRendering( { ivas_error error; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { @@ -2661,7 +2716,11 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ); +#endif if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { @@ -2753,13 +2812,18 @@ static void clearInputMasa( *------------------------------------------------------------------------*/ ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE *phIvasRend, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const bool asHrtfBinary, - const int16_t nonDiegeticPan, - const float nonDiegeticPanGain, - const int16_t num_subframes ) + IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ + const int32_t outputSampleRate, /* i : output sampling rate */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const bool asHrtfBinary, /* i : load hrtf binary file */ + const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ + const float nonDiegeticPanGain, /* i : non-diegetic panning gain */ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + const int16_t Opt_Headrotation, /* i : indicates whether head-rotation is used */ + const int16_t Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ +#endif + const int16_t num_subframes /* i : number of subframes */ +) { int16_t i; int16_t j; @@ -2813,22 +2877,46 @@ ivas_error IVAS_REND_Open( } /* Initialize headrotation data */ - if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->headRotData.headRotEnabled = 0; + if ( Opt_Headrotation ) { - return error; +#endif + if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif /* Initialize external orientation data */ - if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->hExternalOrientationData = NULL; + if ( Opt_ExternalOrientation ) { - return error; +#endif + if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif /* Initilize combined orientation data */ - if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->hCombinedOrientationData = NULL; + if ( Opt_Headrotation || Opt_ExternalOrientation ) { - return error; +#endif + if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif /* Initialize EFAP */ if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) @@ -2837,7 +2925,21 @@ ivas_error IVAS_REND_Open( } /* Initialize inputs */ + +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->splitRendWrapper = NULL; + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + if ( ( hIvasRend->splitRendWrapper = (SPLIT_REND_WRAPPER *) malloc( sizeof( SPLIT_REND_WRAPPER ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS renderer handle" ); + } + + isar_init_split_rend_handles( hIvasRend->splitRendWrapper ); + } +#else isar_init_split_rend_handles( &hIvasRend->splitRendWrapper ); +#endif hIvasRend->splitRendEncBuffer.data = NULL; for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) @@ -2928,10 +3030,18 @@ ivas_error IVAS_REND_Open( return error; } } - if ( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK ) + +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - return error; +#endif + if ( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif return IVAS_ERR_OK; } @@ -3444,7 +3554,11 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ivas_pre_rend_init( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -3862,7 +3976,11 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) +#else if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) +#endif { if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { @@ -4137,7 +4255,7 @@ ivas_error IVAS_REND_InitConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) { @@ -4200,7 +4318,7 @@ ivas_error IVAS_REND_GetRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ) { @@ -4350,10 +4468,17 @@ ivas_error IVAS_REND_FeedRenderConfig( hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; - if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - return error; +#endif + if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG } +#endif /* Must re-initialize split rendering config in case renderer config is updated after adding renderer inputs */ /* if its not initialized yet then no need to re-initialize, initialization will happen while adding inputs*/ @@ -4361,9 +4486,22 @@ ivas_error IVAS_REND_FeedRenderConfig( { int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend->splitRendWrapper != NULL ) + { + ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + free( hIvasRend->splitRendWrapper ); + hIvasRend->splitRendWrapper = NULL; + } +#else ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); +#endif +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ivas_pre_rend_init( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -4520,6 +4658,13 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend->headRotData.headRotEnabled == 0 ) + { + return IVAS_ERR_OK; + } +#endif + return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); } @@ -5152,7 +5297,11 @@ static ivas_error renderIsmToBinauralRoom( hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -5766,7 +5915,11 @@ static ivas_error renderMcToBinaural( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -5855,7 +6008,11 @@ static ivas_error renderMcToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -5946,7 +6103,11 @@ static ivas_error renderMcCustomLsToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6552,7 +6713,11 @@ static ivas_error renderSbaToBinaural( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6629,7 +6794,11 @@ static ivas_error renderSbaToBinauralRoom( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( *hCombinedOrientationData != NULL ) +#else if ( hCombinedOrientationData != NULL ) +#endif { for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6754,11 +6923,19 @@ static ivas_error renderInputSba( case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderSbaToSplitBinaural( sbaInput, outConfig, outAudio ); break; +#ifdef FIX_1129_EXT_REND_OUTPUT_HIGH + case IVAS_AUDIO_CONFIG_BINAURAL: + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); + break; + case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: +#else case IVAS_AUDIO_CONFIG_BINAURAL: error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: +#endif error = renderSbaToBinauralRoom( sbaInput, outConfig, outAudio ); break; default: @@ -7370,10 +7547,19 @@ static ivas_error getSamplesInternal( ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t num_poses_orig; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + num_poses_orig = hIvasRend->splitRendWrapper->multiBinPoseData.num_poses; +#else num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; +#endif outAudio = hIvasRend->splitRendEncBuffer; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + ISAR_PRE_REND_GetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper->multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis ); + assert( num_poses_orig == hIvasRend->splitRendWrapper->multiBinPoseData.num_poses && "number of poses should not change dynamically" ); +#else ISAR_PRE_REND_GetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper.multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis ); assert( num_poses_orig == hIvasRend->splitRendWrapper.multiBinPoseData.num_poses && "number of poses should not change dynamically" ); +#endif /* Clear output buffer for split rendering bitstream */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); @@ -7438,7 +7624,11 @@ static ivas_error getSamplesInternal( } } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( hIvasRend->splitRendWrapper, +#else if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, +#endif hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, @@ -7610,7 +7800,16 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); /* Split binaural rendering */ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend->splitRendWrapper != NULL ) + { + ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + free( hIvasRend->splitRendWrapper ); + hIvasRend->splitRendWrapper = NULL; + } +#else ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); +#endif closeHeadRotation( hIvasRend ); @@ -7785,7 +7984,7 @@ int32_t IVAS_REND_GetCntFramesLimited( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ ) { @@ -7807,7 +8006,7 @@ ivas_error IVAS_REND_GetHrtfHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfCRendHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ ) { @@ -7829,7 +8028,7 @@ ivas_error IVAS_REND_GetHrtfCRendHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfFastConvHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ ) { @@ -7851,7 +8050,7 @@ ivas_error IVAS_REND_GetHrtfFastConvHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfParamBinHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ) { @@ -7872,7 +8071,7 @@ ivas_error IVAS_REND_GetHrtfParamBinHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfStatisticsHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ ) { @@ -8258,6 +8457,9 @@ static ivas_error ivas_masa_ext_rend_parambin_init( int32_t output_Fs; RENDERER_TYPE renderer_type; int16_t j, k, bin; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + int16_t num_poses; +#endif float binCenterFreq, tmpFloat; ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; @@ -8272,7 +8474,17 @@ static ivas_error ivas_masa_ext_rend_parambin_init( nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands; renderer_type = inputMasa->hMasaExtRend->renderer_type; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + num_poses = 1; + if ( inputMasa->base.ctx.pSplitRendWrapper != NULL ) + { + num_poses = inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; + } + + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) +#else for ( pos_idx = 0; pos_idx < inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; pos_idx++ ) +#endif { hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin[pos_idx]; @@ -8331,7 +8543,18 @@ static ivas_error ivas_masa_ext_rend_parambin_init( } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { +#ifdef NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART + if ( *inputMasa->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + } + else + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + } +#else mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#endif if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 81bedc3bcf237545b9c374acad6a27b1900138e2..299e4ede26fbe5b9992f4a3749a9d204d1dccca1 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -113,6 +113,10 @@ ivas_error IVAS_REND_Open( const bool asHrtfBinary, /* i : load hrtf binary file */ const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ const float nonDiegeticPanGain, /* i : non-diegetic panning gain */ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + const int16_t Opt_Headrotation, /* i : indicates whether head-rotation is used */ + const int16_t Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ +#endif const int16_t num_subframes /* i : number of subframes */ ); @@ -239,12 +243,12 @@ ivas_error IVAS_REND_InitConfig( ); ivas_error IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); ivas_error IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); diff --git a/scripts/diff_complexity.py b/scripts/diff_complexity.py new file mode 100755 index 0000000000000000000000000000000000000000..1193b5b1c4b5b29a4d7c31104f7dc1e8288e4a4f --- /dev/null +++ b/scripts/diff_complexity.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python3 +""" +(C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository. All Rights Reserved. + +This software is protected by copyright law and by international treaties. +The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +contributors to this repository retain full ownership rights in their respective contributions in +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 +contributions. + +This software is provided "AS IS", without any express or implied warranties. The software is in the +development stage. It is intended exclusively for experts who have experience with such software and +solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +and fitness for a particular purpose are hereby disclaimed and excluded. + +Any dispute, controversy or claim arising under or in relation to providing this software shall be +submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +the United Nations Convention on Contracts on the International Sales of Goods. +""" + +""" + Script to diff IVAS logs produced by WMC tool instrumented binaries + Recommended script usage is adding to path via symlink to somewhere in your $PATH, e.g.: + + ln -s diff_complexity.py ~/bin/cdiff + + This allows: + cdiff +""" +import argparse +import re +from io import StringIO +from shutil import get_terminal_size + +import pandas as pd + +REGEX_WMOPS_TABLE = r"\s?\w+(\s+\w+\.\w+)(\s+\w+\.\w+){3,6}" +REGEX_ROM = ( + r"((\w+\s+\w+)|(\w+\s+\w+\s+)\(.+\))\s?size\s+\(.+\/(\w+)\/.+\)\:\s(\d+)\s+\w+" +) +REGEX_MAX_MEM = r"(Maximum\s+.+)\s+size\:\s+(\d+)" + +PD_STRING_KWARGS = { + "index": False, + "justify": "center", + "max_colwidth": 30, +} +NOCOLOUR = "\x1b[0m" +RED = "\x1b[31m" +GREEN = "\x1b[32m" +BLUE = "\x1b[34m" + + +def log2df(log_file): + """ + Parse a WMC tool logfile to a pandas dataframe + """ + with open(log_file, "r") as log: + logfile = "".join(line for line in log) + + wmops = [ + re.sub(r"\s+", ",", w.group().strip()) + for w in re.finditer(REGEX_WMOPS_TABLE, logfile) + ] + memory = [m.expand(r"\1 (\4), \5") for m in re.finditer(REGEX_ROM, logfile)] + memory.extend([m.expand(r"\1, \2") for m in re.finditer(REGEX_MAX_MEM, logfile)]) + + if not wmops or not memory: + raise ValueError(f"Error parsing {log_file}!") + + wmops = pd.read_csv( + StringIO("\n".join(wmops)), + header=None, + names=[ + "Routine", + "Calls", + "WMOPs min", + "WMOPs max", + "WMOPs avg", + "WMOPs(cum) min", + "WMOPs(cum) max", + "WMOPs(cum) avg", + ], + ) + memory = pd.read_csv( + StringIO("\n".join(memory)), header=None, names=["Type", "Words"] + ) + return wmops, memory + + +def main(bsl, cut, out_file, quiet=False, verbose=False): + if not quiet: + print(GREEN + f"Baseline conditon: {bsl}" + NOCOLOUR) + print(RED + f"Condition under test: {cut}" + NOCOLOUR) + + bsl_wmops, bsl_mem = log2df(bsl) + cut_wmops, cut_mem = log2df(cut) + + if verbose: + PD_STRING_KWARGS["line_width"] = get_terminal_size()[0] + # outer merge on routines, only identical rows are tagged "BOTH" + merge = ( + pd.merge( + cut_wmops.set_index("Routine").drop("total").reset_index(), + bsl_wmops.set_index("Routine").drop("total").reset_index(), + how="outer", + indicator="Source", + ) + .sort_values(["Routine", "Source"], ascending=[True, False]) + .set_index("Source") + ) + merge.index = merge.index.rename_categories( + { + "left_only": RED + "CUT", + "right_only": GREEN + "BSL", + "both": BLUE + "BOTH", + } + ) + + unique = ( + merge.drop(BLUE + "BOTH", errors="ignore") + .reset_index() + .sort_values(["Routine", "Source"], ascending=[True, False]) + ) + common = ( + merge.drop(GREEN + "BSL", errors="ignore") + .drop(RED + "CUT", errors="ignore") + .reset_index() + .sort_values("Routine", ascending=False) + ) + + if not unique.empty: + print( + "Complexity difference of routines".center( + PD_STRING_KWARGS["line_width"], "-" + ) + ) + print(unique.to_string(**PD_STRING_KWARGS) + NOCOLOUR) + + if not common.empty: + print( + "Routines with no differences".center( + PD_STRING_KWARGS["line_width"], "-" + ) + ) + print(common.to_string(**PD_STRING_KWARGS) + NOCOLOUR) + else: + print( + "No differences in complexity of routines".center( + PD_STRING_KWARGS["line_width"], "-" + ) + ) + print(merge.to_string(**PD_STRING_KWARGS)) + SEPARATOR = "_" * PD_STRING_KWARGS["line_width"] + print(NOCOLOUR + SEPARATOR) + + table_wmops = pd.concat( + [ + bsl_wmops.iloc[-1][2:5], + cut_wmops.iloc[-1][2:5], + cut_wmops.iloc[-1][2:5] - bsl_wmops.iloc[-1][2:5], + ], + axis=1, + ) + table_wmops.columns = ["BSL", "CUT", "CUT - BSL"] + + table_mem = pd.concat( + [ + bsl_mem.iloc[:, 1], + cut_mem.iloc[:, 1], + cut_mem.iloc[:, 1] - bsl_mem.iloc[:, 1], + ], + axis=1, + ) + table_mem.set_index(bsl_mem.iloc[:, 0], inplace=True) + table_mem.columns = ["BSL", "CUT", "CUT - BSL"] + + table = pd.concat([table_wmops, table_mem]) + + def fmt_diff(x): + if isinstance(x, int): + fmt = "{}" + else: + fmt = "{:.3f}" + + if x > 0: + return RED + fmt.format(x) + NOCOLOUR + if x < 0: + return GREEN + fmt.format(x) + NOCOLOUR + else: + return BLUE + fmt.format(x) + NOCOLOUR + + table["CUT - BSL"] = table["CUT - BSL"].apply(fmt_diff) + + if not quiet: + print() + print(table.to_string(justify="left")) + + if out_file: + table.to_csv(out_file) + elif not quiet: + print("\nNo output file specified - console output only!") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="WMC TOOL instrumented log file diff tool" + ) + + parser.add_argument( + "bsl", + type=str, + help="input logfile for baseline condition", + ) + + parser.add_argument( + "cut", + type=str, + help="input logfile for condition under test", + ) + + parser.add_argument( + "-o", + "--outfile", + required=False, + type=str, + help="output csv table", + ) + + parser.add_argument( + "-q", + "--quiet", + required=False, + action="store_true", + help="no console output", + default=False, + ) + + parser.add_argument( + "-v", + "--verbose", + required=False, + action="store_true", + help="print detailed info about routines", + default=False, + ) + + args = parser.parse_args() + + if args.verbose and args.quiet: + print("Both verbose and quiet options specified, defaulting to verbose") + args.quiet = False + + main(args.bsl, args.cut, args.outfile, args.quiet, args.verbose) diff --git a/scripts/find_unused_symbols.sh b/scripts/find_unused_symbols.sh index e184dbd69160f209eec1ad59ee76be34125ca457..259c4efe6f3aeb155bea7ccd4764313e6bf89657 100755 --- a/scripts/find_unused_symbols.sh +++ b/scripts/find_unused_symbols.sh @@ -76,7 +76,7 @@ fi # print C-code directory echo "C-code directory set to ${WORKDIR}" WORKDIR_EXE=${WORKDIR//" "/"\ "} -EXECUTABLES="${WORKDIR_EXE}/IVAS_cod ${WORKDIR_EXE}/IVAS_dec ${WORKDIR_EXE}/IVAS_rend" +EXECUTABLES="${WORKDIR_EXE}/IVAS_cod ${WORKDIR_EXE}/IVAS_dec ${WORKDIR_EXE}/IVAS_rend ${WORKDIR_EXE}/ISAR_post_rend" # build if [ $compile -ne 0 ]; then diff --git a/scripts/tools/Darwin/mld b/scripts/tools/Darwin/mld new file mode 100755 index 0000000000000000000000000000000000000000..6c7e35f818071959cabbb7b9d9b8f65b28a10532 Binary files /dev/null and b/scripts/tools/Darwin/mld differ