diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fbdfd2e66be36b383c6102e336b2ba69abc8d523..9d3a624b20d69b93b5e81c319eff9663eaa830a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -175,8 +175,8 @@ stages: .merge-request-comparison-check: &merge-request-comparison-check - echo "--------------- Running merge-request-comparison-check anchor ---------------" - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -ne 0 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi - exit 0 .update-ltv-repo: &update-ltv-repo @@ -673,9 +673,9 @@ pytest-compare-20ms-and-5ms-rendering: - if [ $zero_errors5 != 1 ]; then echo "run error in with 5ms rendering encountered"; zero_errors=0 ; fi - if [ $zero_errors10 != 1 ]; then echo "run error in with 10ms rendering encountered"; zero_errors=0 ; fi - if [ $zero_errors != 1 ]; then exit $EXIT_CODE_FAIL; fi - - if [ $exit_code5 -eq 1 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi - - if [ $exit_code10 -eq 1 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi - - if [ $exit_code -eq 1 ]; then exit $EXIT_CODE_FAIL; fi + - if [ $exit_code5 -ne 0 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi + - if [ $exit_code10 -ne 0 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi + - if [ $exit_code -ne 0 ]; then exit $EXIT_CODE_FAIL; fi artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" expire_in: 1 week @@ -1367,9 +1367,9 @@ codec-comparison-on-main-push: ### run pytest - exit_code=0 - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? - - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - if [ $exit_code -eq 1 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -ne 0 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi; allow_failure: exit_codes: @@ -1593,7 +1593,7 @@ ivas-conformance-linux: - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha" # Check for failures - - if [ $exit_code -eq 1 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -ne 0 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi artifacts: name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA" @@ -1670,7 +1670,7 @@ test-long-self-test: - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -ne 0 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi - exit 0 @@ -1735,7 +1735,7 @@ test-branch-vs-input-passthrough: - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - python3 scripts/parse_xml_report.py report-junit.xml report.csv - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi - - if [ $exit_code -eq 1 ]; then echo "Differences encountered."; exit $EXIT_CODE_NON_BE; fi + - if [ $exit_code -ne 0 ]; then echo "Differences encountered."; exit $EXIT_CODE_NON_BE; fi - exit 0 artifacts: diff --git a/apps/decoder.c b/apps/decoder.c index 53acc14adfbcc9e0362cb659d263f4d6ebf47fea..792bc268a46551ffca5e793a929d61c49f898eb9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -3895,11 +3895,7 @@ static ivas_error load_hrtf_from_file( return error; } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#else - if ( ( error = load_HRTF_binary( *hHrtfBinary->hHrtfTD, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK ) -#endif { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { @@ -3983,11 +3979,7 @@ static ivas_error load_hrtf_from_file( } } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( hHrtfBinary->hHrtfStatistics == NULL ) -#endif { if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK ) { diff --git a/apps/renderer.c b/apps/renderer.c index f0f472a07af6fe4703a2afa9cff96e7bfdb15329..a29ce5bb03238e00f4291f64bce1552576897e83 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -957,11 +957,7 @@ int main( goto cleanup; } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK ) -#else - if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK ) -#endif { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { diff --git a/ci/complexity_measurements/index_complexity.html b/ci/complexity_measurements/index_complexity.html index be435b5bea3bf65c19d1f37f40dbfc0229f10525..baa3f531c1b7357d1e67a47c5f4cb3fe859a80ee 100755 --- a/ci/complexity_measurements/index_complexity.html +++ b/ci/complexity_measurements/index_complexity.html @@ -127,16 +127,23 @@
-

IVAS FORMAT - Worst Case WMOPS Performance - per Operating Point

+

IVAS FORMAT - Worst Case WMOPS Performance per Operating Point

-
-
-
+

Encoder

-
-
-
+
+
+
+ +

Decoder

+ +
+
+
+ +
+
+

@@ -629,111 +636,78 @@ function WMOPS_perOP() { $.plot(elt, graph.displays, options); - elt.bind("plothover", function (event, pos, item) { - if (!item) { - // only remove if not in tooltip anymore - if ($('#tooltip:hover').length == 0) { - $("#tooltip").remove(); - } - previousPoint = null; - return; - } - - if (previousPoint && - (previousPoint[0] == item.datapoint[0]) && - (previousPoint[1] == item.datapoint[1])) { - return; + elt.bind("plothover", function (event, pos, item) { + if (!item) { + // only remove if not in tooltip anymore + if ($('#tooltip:hover').length == 0) { + $("#tooltip").remove(); } + previousPoint = null; + return; + } - previousPoint = item.datapoint; - $("#tooltip").remove(); - - var encData, decData; - var encRefData, decRefData; - var text = ""; - - if (Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays.length == 2) { - encData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[0]; - decData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[1]; - - var x = item.datapoint[0]; - var y = item.datapoint[1]; + if (previousPoint && + (previousPoint[0] == item.datapoint[0]) && + (previousPoint[1] == item.datapoint[1])) { + return; + } - var scoreEnc = Math.max(parseFloat(encData.data[x][1]), 0); - var scoreDec = Math.max(parseFloat(decData.data[x][1]), 0); - var scoreCodec = Math.round((scoreEnc + scoreDec) * 100) / 100; + previousPoint = item.datapoint; + $("#tooltip").remove(); - text += "Mode: " + Graphs_WMOPS_perOP.wmops_worstcase_per_op.runs[x].operatingPoint + "
"; + var encData, decData; + var encRefData, decRefData; + var text = ""; - text += "Worst case enc: " + scoreEnc + " WMOPS
"; - text += "Worst case dec: " + scoreDec + " WMOPS
"; - text += "Worst case codec: " + scoreCodec + " WMOPS

"; + var x = item.datapoint[0]; + var y = item.datapoint[1]; - var nEntriesWmopsGraph = Graphs_WMOPS.wmops_worstcase.runs.length - 1; - text += "Logfile
"; + text += "Mode: " + graph.runs[x].operatingPoint + "
"; + if (graph.displays.length == 1) { + var score = Math.max(parseFloat(graph.displays[0].data[x][1]), 0); + text += "Worst case: " + score + " WMOPS
"; + } + else if (graph.displays.length == 2) { + if ( x % 2 != 0 ) { + // these indices are for the flt ref bars + // we need to subtract 1 to get the correct id + x = x - 1; } - else if (Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays.length == 4) { - encData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[0]; - decData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[1]; - - encRefData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[2]; - decRefData = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays[3]; - - var x = item.datapoint[0]; - var y = item.datapoint[1]; - - var run = Graphs_WMOPS_perOP.wmops_worstcase_per_op.runs[x]; - var op = run.operatingPoint; - var codec = op.split(" - ")[1]; - - var scoreEnc, scoreDec; - - if (codec == "FLT REF") - { - x = (x - 1) / 2; - scoreEnc = Math.max(parseFloat(encRefData.data[x][1]), 0); - scoreDec = Math.max(parseFloat(decRefData.data[x][1]), 0); - } - else if (codec == "BASOP") { - x = x / 2; - scoreEnc = Math.max(parseFloat(encData.data[x][1]), 0); - scoreDec = Math.max(parseFloat(decData.data[x][1]), 0); - } + x = Math.floor(x / 2); + var score_basop = Math.max(parseFloat(graph.displays[0].data[x][1]), 0); + var score_flt_ref = Math.max(parseFloat(graph.displays[1].data[x][1]), 0); + text += "Worst case BASOP: " + score_basop + " WMOPS
"; + text += "Worst case FLT REF: " + score_flt_ref + " WMOPS
"; + } + var nEntriesWmopsGraph = graph.runs.length - 1; + text += "Logfile
"; - var scoreCodec = Math.round((scoreEnc + scoreDec) * 100) / 100; + showToolTip(item.pageX, item.pageY, text); - text += "Mode: " + op + "
"; + }); - text += "Worst case enc: " + scoreEnc + " WMOPS
"; - text += "Worst case dec: " + scoreDec + " WMOPS
"; - text += "Worst case codec: " + scoreCodec + " WMOPS

"; + } - var nEntriesWmopsGraph = Graphs_WMOPS.wmops_worstcase.runs.length - 1; - text += "Logfile
"; - } - showToolTip(item.pageX, item.pageY, text); - }); + $(document).ready(function () { + var displays_enc = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays.filter(function(elem) { + return elem["label"].includes("Encoder"); + }); + var displays_dec = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays.filter(function(elem) { + return elem["label"].includes("Decoder"); + }); - } + var max_enc = Math.ceil(get_max_y_val_for_plotting(displays_enc, 50)); + var max_dec = Math.ceil(get_max_y_val_for_plotting(displays_dec, 50)); - $(document).ready(function () { - // need to get worst case of enc + dec combined, because values are stacked in the graph - var displays = Graphs_WMOPS_perOP.wmops_worstcase_per_op.displays; - var encData, decData; - if (displays.length == 2) { - encData = [displays[0]]; - decData = [displays[1]]; - } - else if (displays.length == 4) { - encData = [displays[0], displays[2]]; - decData = [displays[1], displays[3]]; - } - var max_enc = get_max_y_val_for_plotting(encData, 1); - var max_dec = get_max_y_val_for_plotting(decData, 1); - var max = Math.ceil( (max_enc + max_dec ) / 50) * 50; - drawGraph($("#wmops_per_op-graph"), Graphs_WMOPS_perOP.wmops_worstcase_per_op, max); + // need to clone object and replace the displays + var graph_enc = JSON.parse(JSON.stringify(Graphs_WMOPS_perOP.wmops_worstcase_per_op)); + graph_enc.displays = displays_enc; + var graph_dec = JSON.parse(JSON.stringify(Graphs_WMOPS_perOP.wmops_worstcase_per_op)); + graph_dec.displays = displays_dec; + drawGraph($("#wmops_per_op-graph-enc"), graph_enc, max_enc); + drawGraph($("#wmops_per_op-graph-dec"), graph_dec, max_dec); }); var nEntriesWmopsGraph = Graphs_WMOPS.wmops_worstcase.runs.length - 1; @@ -743,7 +717,7 @@ function WMOPS_perOP() { Graphs_WMOPS.wmops_worstcase.runs[nEntriesWmopsGraph].fullDate + "

"; - document.getElementById("wmops_per_op-legend").innerHTML = legend; + document.getElementById("wmops_per_op-legend-enc").innerHTML = legend; } diff --git a/ci/complexity_measurements/style.css b/ci/complexity_measurements/style.css index ebce0e7677508a9642268368296a526021301688..5450bf1e8656b174862459d3306c09e9080d1f08 100755 --- a/ci/complexity_measurements/style.css +++ b/ci/complexity_measurements/style.css @@ -15,6 +15,9 @@ h1 { font-weight:700; text-align: center; } +h2 { + text-align: center; +} em { font-style: normal; font-weight: bold; @@ -51,7 +54,12 @@ hr { width:1600px; float:left; } -#wmops_per_op-graph { +#wmops_per_op-graph-enc { + height:500px; + width:2400px; + float:left; +} +#wmops_per_op-graph-dec { height:500px; width:2400px; float:left; diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 6c7e8782ed56ddbd40ff70eec4c90a07b9b926e7..6648d0783d37f52a553f6e21e31abeba41b8bbcf 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -82,9 +82,7 @@ typedef enum IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, #endif IVAS_ERR_INVALID_HRTF, -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE IVAS_ERR_INVALID_HRTF_SAMPLING_RATE, -#endif IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, IVAS_ERR_INVALID_INPUT_FORMAT, IVAS_ERR_INVALID_INDEX, @@ -269,10 +267,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) #endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE: return "Wrong sampling rate in HRTF binary file"; -#endif case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA: return "Renderer data missing in HRTF binary file"; case IVAS_ERR_INVALID_INPUT_FORMAT: diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8820a10b5ffa5e7a6169258aff34bc7c61552ff7..67c6a4b6844880cd3d2abaa632170b27fa97ff3f 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -203,9 +203,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef NONBE_1211_DTX_BR_SWITCHING const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 9a99079a85175bc8df09cd6f153c70eaddeb6ac1..ea90c9d30c78df213e9f8de4fe38671b349e5db3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE /* VA: issue 1228: Exit the processing when a HRTF binary file with wrong sampling rate is provided */ #define FIX_1225_DISCLAIMER /* VA: issue 1225: Add disclaimer for external renderer + Add info about IVAS reference version */ #define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ #define FIX_1249_REMOVE_OBSOLETE_ALLRAD_MATRIX /* VA: issue 1249: remove obsolete code around ALLRAD decoder matrix */ @@ -173,12 +172,8 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ -#define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ -#define NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX /* Ericsson: Issue 1246: High level input which triggers DTX can lead to numerical overflow in coherence calculation */ -#define NONBE_1211_DTX_BR_SWITCHING /* VA: issue 1211: fix crash in MASA DTX bitrate switching */ -#define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ +#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ #define NONBE_1230_DECODE_MASA_ISM_AZIMUTH_PREC_FROM_BASOP /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index f5cdd2a0399c77c65b261300b48d9954b5f76f70..04afc8cc4e8a5c80bb474755fa0fcf1f88be45f0 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3918,13 +3918,11 @@ void td_cng_enc_init( ); void dtx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING + Encoder_State *st, /* i/o: encoder state structure */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t vad, /* i : VAD flag for DTX */ + const float speech[] /* i : Pointer to the speech frame */ ); void dtx_hangover_control( diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 8ea0e54d822e1b0c630a02336bf62450815d33f6..8b8f467d382191ab1927157734c57519f9f88aa6 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -811,7 +811,15 @@ static void JB4_adaptActivePlayout( ( dropRateMax - dropRateMin ) / dropGapMax + dropRateMin; *scale = ( 1000 - rate ) / 10; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( currPlayoutDelay - targetMax, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = currPlayoutDelay - targetMax; +#endif } } } @@ -827,7 +835,15 @@ static void JB4_adaptActivePlayout( currPlayoutDelay < targetMaxStretch && currPlayoutDelay < (uint32_t) ( 110 + h->rfDelay / 4 ) ) { *scale = 120; +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = JB4_MIN( targetMaxStretch - currPlayoutDelay, 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = targetMaxStretch - currPlayoutDelay; +#endif } } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 560f5673e537a107d860be0fe333ee3220a43940..06ce14fb674655f02eee8a38b96eb2474f7741f3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1215,17 +1215,14 @@ ivas_error IVAS_DEC_GetEditableParameters( ) { int16_t dirac_read_idx, obj; -#ifdef NONBE_1217_INIT_OBJ_EDIT Decoder_Struct *st_ivas; ISM_MODE ism_mode; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasEditableParameters == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1217_INIT_OBJ_EDIT st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1340,114 +1337,6 @@ ivas_error IVAS_DEC_GetEditableParameters( } #endif } -#else - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) - { - return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing is not supported in this operation mode." ); - } - - if ( hIvasEditableParameters == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - hIvasEditableParameters->gain_bed = 1.0f; - hIvasEditableParameters->num_obj = hIvasDec->st_ivas->nchan_ism; - if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) - { - hIvasEditableParameters->ism_metadata[obj].azimuth = hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth; - hIvasEditableParameters->ism_metadata[obj].elevation = hIvasDec->st_ivas->hIsmMetaData[obj]->elevation; - hIvasEditableParameters->ism_metadata[obj].yaw = hIvasDec->st_ivas->hIsmMetaData[obj]->yaw; - hIvasEditableParameters->ism_metadata[obj].pitch = hIvasDec->st_ivas->hIsmMetaData[obj]->pitch; - hIvasEditableParameters->ism_metadata[obj].radius = hIvasDec->st_ivas->hIsmMetaData[obj]->radius; - hIvasEditableParameters->ism_metadata[obj].gain = hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain; - hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag; - } - - if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - hIvasEditableParameters->gain_bed = 1.0f; - } - } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM ) - { - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) - { - hIvasEditableParameters->ism_metadata[obj].azimuth = hIvasDec->st_ivas->hParamIsmDec->azimuth_values[obj]; - hIvasEditableParameters->ism_metadata[obj].elevation = hIvasDec->st_ivas->hParamIsmDec->elevation_values[obj]; - hIvasEditableParameters->ism_metadata[obj].yaw = 0.0f; - hIvasEditableParameters->ism_metadata[obj].pitch = 0.0f; - hIvasEditableParameters->ism_metadata[obj].radius = 0.0f; - hIvasEditableParameters->ism_metadata[obj].gain = 1.0f; - hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = 0; - } - } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_NONE ) - { - hIvasEditableParameters->num_obj = 0; - } -#ifdef DEBUGGING - else - { - assert( 0 && "This should never happen!" ); - } -#endif - } - else if ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) - { - /* object editing possible only in two highest OMASA modes */ - if ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) - { - hIvasEditableParameters->ism_metadata[obj].azimuth = hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth; - hIvasEditableParameters->ism_metadata[obj].elevation = hIvasDec->st_ivas->hIsmMetaData[obj]->elevation; - hIvasEditableParameters->ism_metadata[obj].yaw = hIvasDec->st_ivas->hIsmMetaData[obj]->yaw; - hIvasEditableParameters->ism_metadata[obj].pitch = hIvasDec->st_ivas->hIsmMetaData[obj]->pitch; - hIvasEditableParameters->ism_metadata[obj].radius = hIvasDec->st_ivas->hIsmMetaData[obj]->radius; - - /* reset the otherwise unused "gain" field for the object */ - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain = 1.0f; - hIvasEditableParameters->ism_metadata[obj].gain = hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain; - hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag; - } - } - else - { - /* Handle MONO output */ - if ( hIvasDec->st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) - { - dirac_read_idx = hIvasDec->st_ivas->hSpatParamRendCom->render_to_md_map[hIvasDec->st_ivas->hSpatParamRendCom->subframes_rendered]; - } - else - { - dirac_read_idx = 0; - } - - for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) - { - hIvasEditableParameters->ism_metadata[obj].azimuth = hIvasDec->st_ivas->hMasaIsmData->azimuth_ism[obj][dirac_read_idx]; - hIvasEditableParameters->ism_metadata[obj].elevation = hIvasDec->st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx]; - - hIvasEditableParameters->ism_metadata[obj].yaw = hIvasDec->st_ivas->hIsmMetaData[obj]->yaw; - hIvasEditableParameters->ism_metadata[obj].pitch = hIvasDec->st_ivas->hIsmMetaData[obj]->pitch; - hIvasEditableParameters->ism_metadata[obj].radius = hIvasDec->st_ivas->hIsmMetaData[obj]->radius; - - /* reset the otherwise unused "gain" field for the object */ - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain = 1.0f; - hIvasEditableParameters->ism_metadata[obj].gain = hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain; - hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag; - } - } - } -#endif return IVAS_ERR_OK; } @@ -1465,7 +1354,6 @@ ivas_error IVAS_DEC_SetEditableParameters( ) { int16_t dirac_read_idx, obj; -#ifdef NONBE_1217_INIT_OBJ_EDIT Decoder_Struct *st_ivas; ISM_MODE ism_mode; @@ -1696,215 +1584,6 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; } } -#else - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) - { - return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing no supported in this operation mode." ); - } - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - -#ifdef DEBUGGING - assert( hIvasEditableParameters.num_obj == hIvasDec->st_ivas->nchan_ism ); -#endif - - if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) - { - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_elevation = hIvasEditableParameters.ism_metadata[obj].elevation; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; - - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain = hIvasEditableParameters.ism_metadata[obj].gain; - - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; - - hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag = hIvasEditableParameters.ism_metadata[obj].non_diegetic_flag; - } - - if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - hIvasDec->st_ivas->hSbaIsmData->gain_bed = hIvasEditableParameters.gain_bed; - } - } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM ) - { - for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) - { - hIvasDec->st_ivas->hParamIsmDec->edited_azimuth_values[obj] = hIvasEditableParameters.ism_metadata[obj].azimuth; - hIvasDec->st_ivas->hParamIsmDec->edited_elevation_values[obj] = hIvasEditableParameters.ism_metadata[obj].elevation; - hIvasDec->st_ivas->hMasaIsmData->gain_ism_edited[obj] = hIvasEditableParameters.ism_metadata[obj].gain; - - /* Detect direction editing in Param-ISM mode */ - if ( fabsf( hIvasDec->st_ivas->hParamIsmDec->azimuth_values[obj] - hIvasEditableParameters.ism_metadata[obj].azimuth ) > OMASA_AZI_EDIT_THR || - fabsf( hIvasDec->st_ivas->hParamIsmDec->elevation_values[obj] - hIvasEditableParameters.ism_metadata[obj].elevation ) > OMASA_ELE_EDIT_THR ) - { - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 1u; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 0u; - } - - /* Detect gain editing in Param-ISM mode */ - if ( fabsf( 1.0f - hIvasEditableParameters.ism_metadata[obj].gain ) > OMASA_GAIN_EDIT_THR ) - { - hIvasDec->st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 1u; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0u; - } - } - - /* MASA is not present with the ISM format */ - hIvasDec->st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; - } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_NONE ) - { - if ( hIvasEditableParameters.num_obj != 0 ) - { - return IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED; - } - } - else - { - assert( 0 && "This should never happen!" ); - } - } - else if ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) - { - int16_t id_th; - float threshold_azi, threshold_ele; - - for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) - { - if ( hIvasDec->st_ivas->hMasaIsmData != NULL ) - { - /* copy relevant fields also to OMASA structs, but only if the value has been changed. original values are in st_ivas->hIsmMetaData */ - /* first, need to convert float values to ints used internally */ - int16_t new_azi, new_ele; - if ( hIvasEditableParameters.ism_metadata[obj].azimuth > 0.0f ) - { - new_azi = (int16_t) ( hIvasEditableParameters.ism_metadata[obj].azimuth + 0.5f ); - } - else - { - new_azi = (int16_t) ( hIvasEditableParameters.ism_metadata[obj].azimuth - 0.5f ); - } - - if ( hIvasEditableParameters.ism_metadata[obj].elevation > 0.0f ) - { - new_ele = (int16_t) ( hIvasEditableParameters.ism_metadata[obj].elevation + 0.5f ); - } - else - { - new_ele = (int16_t) ( hIvasEditableParameters.ism_metadata[obj].elevation - 0.5f ); - } - - if ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) - { - /* Handle MONO output */ - if ( hIvasDec->st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) - { - dirac_read_idx = hIvasDec->st_ivas->hSpatParamRendCom->render_to_md_map[hIvasDec->st_ivas->hSpatParamRendCom->subframes_rendered]; - } - else - { - dirac_read_idx = 0; - } - - /* determine thresholds for detecting object metadata edit for direction based on quantization resolution of the spatial direction parameters. - * these depend from the number of bits used to transmit the directions, - * which in turn depends from the object priority and importance: - * importance -> priority -> number of bits -> elevation resolution -> elevation ring index -> azimuth resolution. - * leading to elevation_resolution -> elevation threshold and azimuth resolution -> azimuth threshold */ - id_th = (int16_t) ( fabsf( (float) hIvasDec->st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx] ) / delta_theta_masa[hIvasDec->st_ivas->hMasaIsmData->bits_ism[obj] - 3] + 0.5f ); - threshold_azi = 360.0f / (float) no_phi_masa[hIvasDec->st_ivas->hMasaIsmData->bits_ism[obj] - 1][id_th]; - threshold_ele = delta_theta_masa[hIvasDec->st_ivas->hMasaIsmData->bits_ism[obj] - 3]; - - if ( ( (float) abs( new_azi - hIvasDec->st_ivas->hMasaIsmData->azimuth_ism[obj][dirac_read_idx] ) > threshold_azi ) || - ( (float) abs( new_ele - hIvasDec->st_ivas->hMasaIsmData->elevation_ism[obj][dirac_read_idx] ) > threshold_ele ) ) - { - /* at least one of the threshold is exceeded, so use new direction value and set editing detection flag */ - hIvasDec->st_ivas->hMasaIsmData->azimuth_ism_edited[obj] = new_azi; - hIvasDec->st_ivas->hMasaIsmData->elevation_ism_edited[obj] = new_ele; - - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 1u; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 0u; - } - } - else - { - /* detect editing in ISM_MASA_MODE_DISC. optionally, add quantization-resolution -based thresholds */ - if ( fabsf( hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth - hIvasEditableParameters.ism_metadata[obj].azimuth ) > OMASA_AZI_EDIT_THR || - fabsf( hIvasDec->st_ivas->hIsmMetaData[obj]->elevation - hIvasEditableParameters.ism_metadata[obj].elevation ) > OMASA_ELE_EDIT_THR ) - { - hIvasDec->st_ivas->hMasaIsmData->azimuth_ism_edited[obj] = new_azi; - hIvasDec->st_ivas->hMasaIsmData->elevation_ism_edited[obj] = new_ele; - - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 1u; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->ism_dir_is_edited[obj] = 0u; - } - } - - /* compare pre-edit gain and the edited one to detect editing */ - if ( fabsf( hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain - hIvasEditableParameters.ism_metadata[obj].gain ) > OMASA_GAIN_EDIT_THR ) - { - hIvasDec->st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 1u; - hIvasDec->st_ivas->hMasaIsmData->gain_ism_edited[obj] = hIvasEditableParameters.ism_metadata[obj].gain; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0u; - } - } - - /* Copy edited values to hIsmMetaData struct */ - if ( hIvasDec->st_ivas->hIsmMetaData[obj] != NULL ) - { - hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; - hIvasDec->st_ivas->hIsmMetaData[obj]->elevation = hIvasEditableParameters.ism_metadata[obj].elevation; - hIvasDec->st_ivas->hIsmMetaData[obj]->yaw = hIvasEditableParameters.ism_metadata[obj].yaw; - hIvasDec->st_ivas->hIsmMetaData[obj]->pitch = hIvasEditableParameters.ism_metadata[obj].pitch; - hIvasDec->st_ivas->hIsmMetaData[obj]->radius = hIvasEditableParameters.ism_metadata[obj].radius; - hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain = hIvasEditableParameters.ism_metadata[obj].gain; - hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag = hIvasEditableParameters.ism_metadata[obj].non_diegetic_flag; - } - } - - if ( fabsf( hIvasEditableParameters.gain_bed - 1.0f ) > OMASA_GAIN_EDIT_THR ) - { - hIvasDec->st_ivas->hMasaIsmData->gain_masa_edited = hIvasEditableParameters.gain_bed; - hIvasDec->st_ivas->hMasaIsmData->masa_gain_is_edited = 1u; - } - else - { - hIvasDec->st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; - } - } -#endif return IVAS_ERR_OK; } @@ -3171,11 +2850,7 @@ ivas_error IVAS_DEC_HRTF_binary_open( } } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( st_ivas->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#else - if ( st_ivas->hHrtfStatistics == NULL ) -#endif { if ( ( error = ivas_HRTF_statistics_binary_open( &st_ivas->hHrtfStatistics ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index 1791daf85176ba3c166326373e148588772ba623..1b3599910eef7f4604b7517be305cb3012436c3a 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -311,11 +311,7 @@ void amr_wb_enc( st->fd_cng_reset_flag = 0; } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, -1, -1, vad_flag_dtx, inp ); -#else - dtx( st, -1, vad_flag_dtx, inp ); -#endif /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 676fb47647290cd8b9812ee96e909fd6bfa4a8b8..37ba226601656b4197162281175dd9daec0ca7b3 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -78,43 +78,31 @@ static void update_SID_cnt( DTX_ENC_HANDLE hDtxEnc, const int32_t core_brate, co *-------------------------------------------------------------------*/ void dtx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_1211_DTX_BR_SWITCHING + Encoder_State *st, /* i/o: encoder state structure */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t vad, /* i : VAD flag for DTX */ - const float speech[] /* i : Pointer to the speech frame */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t vad, /* i : VAD flag for DTX */ + const float speech[] /* i : Pointer to the speech frame */ ) { float alpha; DTX_ENC_HANDLE hDtxEnc = st->hDtxEnc; int16_t last_br_cng_flag, last_br_flag, br_dtx_flag; -#ifdef NONBE_1211_DTX_BR_SWITCHING int32_t total_brate_ref; total_brate_ref = st->total_brate; -#endif if ( st->dtx_sce_sba != 0 ) { last_br_cng_flag = 1; last_br_flag = 1; -#ifndef NONBE_1211_DTX_BR_SWITCHING - br_dtx_flag = 1; -#endif } else { last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); -#ifdef NONBE_1211_DTX_BR_SWITCHING last_br_flag = ( st->element_mode == EVS_MONO && st->last_total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && last_ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || st->lp_noise < 15; -#else - last_br_flag = st->last_total_brate <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate <= MAX_BRATE_DTX_IVAS ); - br_dtx_flag = 0; -#endif } /* Initialization */ @@ -188,9 +176,7 @@ void dtx( * Select SID or FRAME_NO_DATA frame if DTX is enabled *------------------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING br_dtx_flag = 1; -#endif if ( st->dtx_sce_sba == 0 ) { br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= MAX_BRATE_DTX_EVS ) || @@ -279,12 +265,10 @@ void dtx( reset_indices_enc( st->hBstr, st->hBstr->nb_ind_tot ); } } -#ifdef NONBE_1211_DTX_BR_SWITCHING else if ( st->element_mode != EVS_MONO ) { st->total_brate = total_brate_ref; } -#endif /*------------------------------------------------------------------------* * Reset counters when in active frame (neither SID nor FRAME_NO_DATA frame) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 39e0cb110b6e8745d79131286ff8a7e3dfa00557..97d6643c08572d5c06888dfa9db71c039b6ab06d 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -109,10 +109,8 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ -#ifdef NONBE_1211_DTX_BR_SWITCHING - const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ -#endif - const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ + const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ ) { float *inp_12k8, *new_inp_12k8; /* pointers to current frame and new data */ @@ -547,11 +545,7 @@ ivas_error pre_proc_front_ivas( st->cng_type = LP_CNG; } -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, last_ivas_total_brate, ivas_total_brate, *vad_flag_dtx, inp_12k8 ); -#else - dtx( st, ivas_total_brate, *vad_flag_dtx, inp_12k8 ); -#endif if ( hCPE != NULL && hCPE->hStereoDft != NULL && st->core_brate == SID_2k40 ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f1e0cebd28c4dac049f6259e1fec871f91f59692..f2ede33d056a279ad12a0538788ed74ecf5ca0d2 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -478,11 +478,7 @@ ivas_error ivas_cpe_enc( error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, st_ivas->hEncoderConfig->last_ivas_total_brate, ivas_total_brate ); -#else - fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate ); -#endif if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 2b0f688226d355786fc0a075400f56f6c3c39715..61e9e54d675949f12a9f803e621d75e12c740133 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -172,12 +172,8 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; } -#ifdef NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* sanity check: highest bitrates in ISM */ if ( st->is_ism_format && st->tcxonly && st->total_brate > MAX_ACELP_BRATE_ISM ) -#else - if ( st->is_ism_format && st->tcxonly ) -#endif { st->core = TCX_20_CORE; } diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 02e767d7d973f20bcb4ee849bf970ecf706422bb..c430fbb5b02fb7118fe9a1146acb44b17d2d84bc 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -423,11 +423,7 @@ ivas_error front_vad_spar( noise_est_down( fr_bands[0], hFrontVad->hNoiseEst->bckr, tmpN, tmpE, st->min_band, st->max_band, &hFrontVad->hNoiseEst->totalNoise, Etot[0], &hFrontVad->hNoiseEst->Etot_last, &hFrontVad->hNoiseEst->Etot_v_h2 ); corr_shift = correlation_shift( hFrontVad->hNoiseEst->totalNoise ); -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, hEncoderConfig->last_ivas_total_brate, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8 ); -#else - dtx( st, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8 ); -#endif /* linear prediction analysis */ alw_pitch_lag_12k8[0] = st->old_pitch_la; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index da0fe388ddcdfcbb266384cc7205de9da014e1e2..c92431b7a8c8eb02004beeabc3622793bee3ed03 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -179,11 +179,7 @@ ivas_error ivas_ism_enc( error = pre_proc_front_ivas( hSCE, NULL, hSCE->element_brate, nb_bits_metadata[sce_id], input_frame, 0, old_inp_12k8[sce_id][0], old_inp_16k[sce_id][0], &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], -#ifdef NONBE_1211_DTX_BR_SWITCHING fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate ); -#else - fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, ISM_FORMAT, 0, st_ivas->hEncoderConfig->ivas_total_brate ); -#endif if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index df1d804f34d12fcb08ed7e9f2724d5d67fe2f940..b00af95ed3d93bd3c663177f94d4931c9df610f7 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -188,11 +188,7 @@ ivas_error ivas_sce_enc( &ener[0], &relE[0], A[0], Aw[0], epsP[0], lsp_new[0], lsp_mid[0], &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, -#ifdef NONBE_1211_DTX_BR_SWITCHING st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->ivas_total_brate ); -#else - st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, ivas_format, 0, st_ivas->hEncoderConfig->ivas_total_brate ); -#endif if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index 49430f2d1fb8a4740eb1d9dee00326084c5f8a80..5357306eae2f4ede79e8ca1f9fe9ff7ab7230649 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -95,11 +95,7 @@ void stereo_dft_enc_sid_calc_coh( for ( k = hStereoDft->band_limits[b]; k < hStereoDft->band_limits[b + 1]; k++ ) { coh_weight = hStereoDft->DFT[0][2 * k] * hStereoDft->DFT[0][2 * k] + hStereoDft->DFT[0][2 * k + 1] * hStereoDft->DFT[0][2 * k + 1]; -#ifdef NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX cohBand[b] += coh_weight * ( ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ) ); -#else - cohBand[b] += coh_weight * ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ); -#endif coh_weight_sum += coh_weight; } if ( coh_weight_sum > 0 ) diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 7db0c9c43392989cd3008eb556b1cfe37391b480..cbe403c08adc2bea22392aab33b7fda7a9ef4d6a 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -253,11 +253,7 @@ void pre_proc( * Select SID or FRAME_NO_DATA frame if DTX enabled *-----------------------------------------------------------------*/ -#ifdef NONBE_1211_DTX_BR_SWITCHING dtx( st, -1, -1, vad_flag_dtx, inp_12k8 ); -#else - dtx( st, -1, vad_flag_dtx, inp_12k8 ); -#endif /*----------------------------------------------------------------* * Adjust FD-CNG Noise Estimator diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index cd734f659d00fa3548407ec5942a7747090646b6..486a75f47089568a53a53530a0e6552c0e570c61 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -260,14 +260,9 @@ void TDREND_firfilt( /* Handle memory */ p_signal = buffer + filterlength - 1; - mvr2r( mem, buffer, filterlength - 1 ); /* Insert memory */ -#ifdef NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR + mvr2r( mem, buffer, filterlength - 1 ); /* Insert memory */ mvr2r( signal, p_signal, subframe_length ); /* Insert current frame */ mvr2r( p_signal + subframe_length - filterlength + 1, mem, filterlength - 1 ); /* Update memory for next frame */ -#else - mvr2r( signal, buffer + filterlength - 1, subframe_length ); /* Insert current frame */ - mvr2r( signal + subframe_length - filterlength + 1, mem, filterlength - 1 ); /* Update memory for next frame */ -#endif /* Convolution */ for ( i = 0; i < subframe_length; i++ ) diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 6b0f36c49c092ee34659642ed9988928aaae0bc2..856dbd9f38a29127724abbfd25fd229fab497351 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -202,11 +202,7 @@ static ivas_error check_hrtf_binary_header( /* Check the sampling frequency */ if ( ( hrtf_header->frequency != 48000 ) && ( hrtf_header->frequency != 32000 ) && ( hrtf_header->frequency != 16000 ) ) { -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Header of HRTF binary file not compliant (sampling frequency)" ); -#else - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Header of HRTF binary file not compliant (sampling frequency)" ); -#endif } return IVAS_ERR_OK; @@ -803,7 +799,6 @@ static ivas_error load_reverb_from_binary( return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE else { if ( hrtf_header.frequency != sampleRate ) @@ -811,7 +806,6 @@ static ivas_error load_reverb_from_binary( return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; } } -#endif } free( hrtf_data ); @@ -888,10 +882,8 @@ ivas_error load_reverb_binary( --------------------------------------------------------------------*/ static ivas_error TDREND_MIX_LoadHRTF( - FILE *f_hrtf, /* i/o: File pointer to HRTF file */ -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE - const int32_t sampleRate, /* i : sample rate */ -#endif + FILE *f_hrtf, /* i/o: File pointer to HRTF file */ + const int32_t sampleRate, /* i : sample rate */ IVAS_DEC_HRTF_HANDLE HrFiltSet_p /* o : Loaded HR filter set */ ) { @@ -969,7 +961,6 @@ static ivas_error TDREND_MIX_LoadHRTF( return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } } -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE else { if ( hrtf_header.frequency != sampleRate ) @@ -977,7 +968,6 @@ static ivas_error TDREND_MIX_LoadHRTF( return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; } } -#endif } free( hrtf_data ); @@ -1015,15 +1005,9 @@ static ivas_error TDREND_MIX_LoadHRTF( * Load HRTF binary data into the HRTF handle for TD renderer *---------------------------------------------------------------------*/ -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE ivas_error load_TDrend_HRTF_binary( -#else -ivas_error load_HRTF_binary( -#endif - IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE - const int32_t sampleRate, /* i : sample rate */ -#endif + IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ + const int32_t sampleRate, /* i : sample rate */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ) { @@ -1034,11 +1018,7 @@ ivas_error load_HRTF_binary( fseek( hrtfReader->file, 0, SEEK_SET ); -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE return TDREND_MIX_LoadHRTF( hrtfReader->file, sampleRate, hHrtf ); -#else - return TDREND_MIX_LoadHRTF( hrtfReader->file, hHrtf ); -#endif } @@ -1768,13 +1748,11 @@ ivas_error load_fastconv_HRTF_from_binary( if ( load ) { -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( hrtf_header.frequency != 48000 ) /* note: Parametric renderer data are always stored at 48 kHz */ { return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; } -#endif if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { free( hrtf_data ); @@ -1867,13 +1845,11 @@ ivas_error load_parambin_HRTF_from_binary( if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) /* Parametric binauralizer data is represented as single entity */ { -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( hrtf_header.frequency != 48000 ) /* note: Parametric renderer data are always stored at 48 kHz */ { return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; } -#endif if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { free( hrtf_data ); @@ -1986,26 +1962,17 @@ ivas_error load_Crend_HRTF_from_binary( if ( load ) { -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE if ( hrtf_header.frequency != sampleRate ) { return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; } -#endif if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } -#ifndef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE - if ( hrtf_header.frequency != output_Fs ) - { - return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA; - } - -#endif if ( ( create_Crend_HRTF_from_rawdata( &hHrtfCrend, hrtf_data ) ) != IVAS_ERR_OK ) { free( hrtf_data ); diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index 5a8680638018c28ecd0e6b3611e85f21eabd5b0e..8f421ce503630a906eb30e06703c9a9bbd1f37a6 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -98,15 +98,9 @@ void hrtfFileReader_close( * Load TD renderer HRTF binary data into the HRTF handle *---------------------------------------------------------------------*/ -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE ivas_error load_TDrend_HRTF_binary( -#else -ivas_error load_HRTF_binary( -#endif - IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ -#ifdef FIX_1228_SAMPLING_RATE_MISMATCH_IN_HRTF_FILE - const int32_t sampleRate, /* i : sample rate */ -#endif + IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */ + const int32_t sampleRate, /* i : sample rate */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ );