diff --git a/apps/decoder.c b/apps/decoder.c index ce04fa923eba35a7fa6f640407d08b6ebc8579c0..9f657b5a8c731c3a6df4daa7dc49aa4b2f236d1e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1999,7 +1999,6 @@ static ivas_error initOnFirstGoodFrame( if ( numInitialBadFrames > 0 ) { /* Duplicate good first frame metadata to fill the beginning of stream. */ -#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM int16_t fullDelayNumSamplesLocal[3]; int32_t delayTimeScaleLocal; float delayMs; @@ -2012,9 +2011,6 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal ); -#else - IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { @@ -2024,9 +2020,6 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { -#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM - float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); -#endif if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); diff --git a/ci/basop-pages/create_summary_page.py b/ci/basop-pages/create_summary_page.py index 1f146c4cbbb5bfacf57bb908958ee935b3051d3e..f8ddb00ae8fb23f38bc55315e1dae05fd7d6e024 100644 --- a/ci/basop-pages/create_summary_page.py +++ b/ci/basop-pages/create_summary_page.py @@ -2,7 +2,7 @@ import argparse from create_report_pages import SUBPAGE_TMPL_CSS, FORMATS -MEASURES = ["MLD","DIFF","SSNR","ODG"] +MEASURES = ["MLD","DIFF","SSNR","ODG","DELTA_ODG"] SUMMARY_PAGE_TMPL_HTML = """ diff --git a/lib_com/options.h b/lib_com/options.h index 754937c540e986ed56ce1dad969e20055463b056..959eecf6ab9d47d933e2a896e56ec169d8120f0b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,12 +170,8 @@ /* all switches in this category should start with "NONBE_" */ #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_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ #define NONBE_FIX_1262_OSBA_STEREO /* FhG: issue 1262: Fix missing scaling factor for OSBA stereo output */ -#define NONBE_FIX_1189_GSC_IVAS_OMASA /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */ -#define NONBE_1214_PLC_LSF_MEMORY /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */ -#define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 0bba174b7c86a50d36add26f440d896ea88ba5b3..b83c105064ada3e5e7e27f7885ad29ceccdcabd4 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -483,11 +483,7 @@ ivas_error acelp_core_dec( if ( st->element_mode > EVS_MONO && st->idchan == 0 && !( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && !tdm_low_rate_mode ) { -#ifdef NONBE_FIX_1189_GSC_IVAS_OMASA if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) ) -#else - if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->total_brate <= MAX_GSC_INACTIVE_BRATE ) ) -#endif { st->GSC_IVAS_mode = get_next_indice( st, 2 ); } diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 686e5926db5f82aa617ebd2899cb95431335e927..dba82a0dcb1c4687a12875246f2ed796789886c9 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -263,14 +263,9 @@ ivas_error core_switching_pre_dec( st->uv_count = 0; } -#ifdef NONBE_1214_PLC_LSF_MEMORY if ( ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && st->last_core == HQ_CORE ) /* EVS and HQ -> ACELP */ || ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT ) ) && nchan_out == 2 && st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA && ( last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40 ) ) || ( st->core == ACELP_CORE && st->last_L_frame > L_FRAME16k ) /* TCX @ 25.6/32 kHz -> ACELP */ ) -#else - if ( ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && st->last_core == HQ_CORE ) || ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT ) ) && nchan_out == 2 && - st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA && ( last_core_brate_st0 == FRAME_NO_DATA || last_core_brate_st0 == SID_2k40 ) ) ) -#endif { if ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) { diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 8b8f467d382191ab1927157734c57519f9f88aa6..0c85220ad51d949e1f0d3126c78d31a03838cb9a 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -811,15 +811,11 @@ 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 } } } @@ -835,15 +831,11 @@ 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_enc/core_switching_enc.c b/lib_enc/core_switching_enc.c index c4a8f8bd52514f2b160df3e0109c2e8ded59fe03..c588173d3febf13458703ba7758d1f767cf19203 100644 --- a/lib_enc/core_switching_enc.c +++ b/lib_enc/core_switching_enc.c @@ -171,13 +171,9 @@ void core_switching_pre_enc( st->uv_count = 0; } -#ifdef NONBE_1214_PLC_LSF_MEMORY if ( ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && st->last_core == HQ_CORE ) /* EVS and HQ -> ACELP */ || ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT ) ) && active_cnt == 1 ) || ( st->core == ACELP_CORE && st->last_L_frame > L_FRAME16k ) /* TCX @ 25.6/32 kHz -> ACELP */ ) -#else - if ( ( ( st->core == ACELP_CORE || st->core == AMR_WB_CORE ) && st->last_core == HQ_CORE ) || ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD || ( st->element_mode == IVAS_CPE_MDCT && last_element_mode == IVAS_CPE_DFT ) ) && active_cnt == 1 ) ) -#endif { /* Reset the ACELP core in case of HQ->ACELP core switching */ diff --git a/scripts/create_histogram_summary.py b/scripts/create_histogram_summary.py index 0b10b76b8d2ba3c2aebcabd9927276b4e7245c3c..af9a11de2ab48e10f897301da566b826ca06c0c7 100644 --- a/scripts/create_histogram_summary.py +++ b/scripts/create_histogram_summary.py @@ -75,6 +75,7 @@ if __name__ == "__main__": "DIFF": ("MAXIMUM ABS DIFF", None), "SSNR": ("MIN_SSNR", None), "ODG": ("MIN_ODG", None), + "DELTA_ODG": ("DELTA_ODG", None), } else: limits_per_measure = { @@ -82,6 +83,7 @@ if __name__ == "__main__": "DIFF": ("MAXIMUM ABS DIFF", [0, 16, 256, 1024, 2048, 4096, 8192, 16384, 32769]), "SSNR": ("MIN_SSNR", [-math.inf, 0, 10, 20, 30, 40, 40, 50, 60, 100]), "ODG": ("MIN_ODG", [-5, -2, -1, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.5]), + "DELTA_ODG": ("DELTA_ODG", [-5, -2, -1, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.5]), } (measure_label, limits) = limits_per_measure[measure] diff --git a/scripts/create_mode_force.py b/scripts/create_mode_force.py index fe87f7fdce821ecc0806938b771b666289247471..6a0a6f76e33541e5cf4d8a5a88a5b5988e00782f 100644 --- a/scripts/create_mode_force.py +++ b/scripts/create_mode_force.py @@ -35,8 +35,8 @@ import struct MODES = { 0: "1 ACELP\n", - 1: "1 TCX\n", - 2: "1 TCX\n", # Current -force option does not distinguish between TCX10 and TCX20 + 1: "1 TCX20\n", + 2: "1 TCX10\n", 3: "1 HQ\n", } SR = [16, 32, 48] diff --git a/scripts/parse_xml_report.py b/scripts/parse_xml_report.py index d68637c64977f7538957ce1b0cb3d6c47c311e13..1f2157ca8f5b6dc30cdd53e9bf080b9a0e8afba3 100644 --- a/scripts/parse_xml_report.py +++ b/scripts/parse_xml_report.py @@ -72,6 +72,11 @@ if __name__ == "__main__": action="store_true", help="Extract clipping information. Available if encoder has been run with DEBUGGING active.", ) + parser.add_argument( + "--delta_odg", + action="store_true", + help="Extract Delta ODG information.", + ) parser.add_argument( "--skip_formats", action="store_true", @@ -90,6 +95,8 @@ if __name__ == "__main__": CATEGORIES = IVAS_CATEGORIES if args.clipping: PROPERTIES += ["ENC_CORE_OVL","MAX_OVL","MIN_OVL"] + if args.delta_odg: + PROPERTIES += ["DELTA_ODG"] if args.skip_formats: FORMATS = NO_FORMATS CATEGORIES = NO_CATEGORIES diff --git a/tests/cmp_pcm.py b/tests/cmp_pcm.py index c19bf6a6d9a85d9f7464c84e7e5aec12a4951545..cb779ff51765cbdfa91e4eb75005b99513dac29c 100755 --- a/tests/cmp_pcm.py +++ b/tests/cmp_pcm.py @@ -34,6 +34,7 @@ def cmp_pcm( abs_tol=0, get_ssnr=False, get_odg=False, + get_odg_bin=False, odg_input=None, odg_test=None, odg_ref=None, @@ -133,6 +134,16 @@ def cmp_pcm( reason += msg + " - " if get_odg: + for n in range(nchannels): + pqeval_output = pqevalaudio_wrapper(s1[:, n], s2[:, n], fs) + + match_odg = re.search(ODG_PATTERN_PQEVALAUDIO, pqeval_output) + odg = float(match_odg.groups()[0]) + msg = f"Channel {n} ODG: {odg}" + reason += " - " + msg + print(msg) + + if get_odg_bin: odg_files = {} for f in [odg_input, odg_test, odg_ref]: # Load PEAQ test files and ensure 48 kHz sampling rate @@ -165,7 +176,7 @@ def cmp_pcm( odg = odg_test - odg_ref # Todo: store both rather than difference? - msg = f"ODG: {odg}" + msg = f"Delta-ODG: {odg}" reason += " - " + msg print(msg, file=output_target) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 98c54b7cdb9d25c54256cfe9e2f66490bb57a5b9..e760edd4702fd68859a1c309d31a543a21737d70 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -217,6 +217,7 @@ def test_param_file_tests( get_ssnr, get_enc_stats, get_odg, + get_odg_bin, compare_to_input, compare_enc_dmx, ): @@ -248,6 +249,7 @@ def test_param_file_tests( get_ssnr, get_enc_stats, get_odg, + get_odg_bin, compare_to_input, compare_enc_dmx, ) @@ -279,6 +281,7 @@ def run_test( get_ssnr, get_enc_stats, get_odg, + get_odg_bin, compare_to_input, compare_enc_dmx, ): @@ -526,7 +529,7 @@ def run_test( odg_input = None odg_test = None odg_ref = None - if get_odg: + if get_odg_bin: # Find input format in_fmt = [(a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts)][0][1] @@ -595,6 +598,7 @@ def run_test( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, diff --git a/tests/codec_be_on_mr_nonselection/test_sba.py b/tests/codec_be_on_mr_nonselection/test_sba.py index a0c72b64f020ba9f4da4cac630035b496a86a886..55c7dcf3fe884712edd4ed47078833fd3713b3f2 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba.py +++ b/tests/codec_be_on_mr_nonselection/test_sba.py @@ -112,6 +112,7 @@ def test_pca_enc( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -195,6 +196,7 @@ def test_pca_enc( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -231,6 +233,7 @@ def test_sba_enc_system( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -372,6 +375,7 @@ def test_sba_enc_system( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -400,6 +404,7 @@ def test_spar_hoa2_enc_system( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -516,6 +521,7 @@ def test_spar_hoa2_enc_system( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -544,6 +550,7 @@ def test_spar_hoa3_enc_system( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -654,6 +661,7 @@ def test_spar_hoa3_enc_system( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -686,6 +694,7 @@ def test_sba_enc_BWforce_system( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -812,6 +821,7 @@ def test_sba_enc_BWforce_system( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -848,6 +858,7 @@ def test_sba_plc_system( abs_tol, get_ssnr, get_odg, + get_odg_bin, get_enc_stats, compare_to_input, compare_enc_dmx, @@ -951,6 +962,7 @@ def test_sba_plc_system( abs_tol=abs_tol, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, compare_to_input=compare_to_input, ) @@ -1126,6 +1138,7 @@ def sba_dec( abs_tol=0, get_ssnr=False, get_odg=False, + get_odg_bin=False, compare_to_input=False, ): dut_pkt_dir = f"{dut_base_path}/sba_bs/pkt" @@ -1198,7 +1211,7 @@ def sba_dec( odg_input = None odg_test = None odg_ref = None - if get_odg: + if get_odg_bin: enc_opts = "" dec_opts = "" input_file = f"{test_vector_path}/{tag}.wav" @@ -1249,6 +1262,7 @@ def sba_dec( allow_differing_lengths=allow_differing_lengths, get_ssnr=get_ssnr, get_odg=get_odg, + get_odg_bin=get_odg_bin, odg_input=odg_input, odg_test=odg_test, odg_ref=odg_ref, diff --git a/tests/conftest.py b/tests/conftest.py index 1fd548641756c62ec2caca1954059152ebc95f2f..07cd5be183e74086d996f5ac8b298cfad5d98bc5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -59,10 +59,12 @@ from .constants import ( SSNR_PATTERN, ENC_AUX_FILES, ODG_PATTERN, + DELTA_ODG_PATTERN, MLD, MAX_ABS_DIFF, SSNR, ODG, + DELTA_ODG, MAX_ENC_DIFF, MAX_ENC_DIFF_PATTERN, ENC_CORE_OVL, @@ -222,6 +224,12 @@ def pytest_addoption(parser): help="Get Objective Difference Grade for both conditions during comparison and report difference", ) + parser.addoption( + "--odg_bin", + action="store_true", + help="Get Objective Difference Grade for both conditions during comparison and report Delta ODG for binauralized signals", + ) + parser.addoption( "--create_ref", action="store_true", @@ -350,6 +358,13 @@ def get_odg(request): """ return request.config.option.odg +@pytest.fixture(scope="session", autouse=True) +def get_odg_bin(request): + """ + Return indication to compute Delta PEAQ ODG during ref/dut comparison. Uses binauralization of input and output signals. + """ + return request.config.option.odg_bin + @pytest.fixture(scope="session") def abs_tol(request) -> int: @@ -409,9 +424,13 @@ def dut_encoder_path(request) -> str: # fixture returns test information, enabling per-testcase SNR -@pytest.fixture +@pytest.fixture(scope="function") def test_info(request): - return request + yield request + + # Check for errors during teardown to report error instead of failure + if hasattr(request, "error"): + pytest.fail(request.error) class EncoderFrontend: @@ -1110,7 +1129,7 @@ def pytest_configure(config): @pytest.fixture(scope="session") def props_to_record( - request, get_mld, get_ssnr, get_odg, get_enc_stats, encoder_only + request, get_mld, get_ssnr, get_odg, get_odg_bin, get_enc_stats, encoder_only ) -> str: props = [] @@ -1125,6 +1144,8 @@ def props_to_record( props.append(SSNR) if get_odg: props.append(ODG) + if get_odg_bin: + props.append(DELTA_ODG) return props @@ -1170,6 +1191,10 @@ def parse_properties(text_to_parse: str, output_differs: bool, props_to_record: max_enc_diff_param_name, _, max_enc_diff_ratio = search_result.groups(0) props[MAX_ENC_DIFF] = float(max_enc_diff_ratio) props[MAX_ENC_DIFF_PARAM_NAME] = max_enc_diff_param_name + elif prop == DELTA_ODG: + delta_odg = re.search(DELTA_ODG_PATTERN, text_to_parse) + if delta_odg: + props["DELTA_ODG"] = delta_odg.groups(1)[0] return props diff --git a/tests/constants.py b/tests/constants.py index 865a7061a7fdab6d2e21eb14f0e317ad58fd1cd8..9990db37cc690d2a52eb983df927740eacf5b46b 100644 --- a/tests/constants.py +++ b/tests/constants.py @@ -11,6 +11,7 @@ MLD = "MLD" MAX_ABS_DIFF = "MAXIMUM ABS DIFF" SSNR = "SSNR" ODG = "ODG" +DELTA_ODG = "Delta-ODG" MAX_ENC_DIFF = "MAXIMUM ENC DIFF" MAX_ENC_DIFF_PARAM_NAME = "MAXIMUM ENC DIFF PARAM" ENC_CORE_OVL = "ENC_CORE_OVL" @@ -24,7 +25,8 @@ DMX_SSNR = "DMX_SSNR" MLD_PATTERN = r"MLD: ([\d\.]*)" MAX_DIFF_PATTERN = r"MAXIMUM ABS DIFF: (\d*)" ODG_PATTERN_PQEVALAUDIO = r"Objective Difference Grade: (-*\d*\.\d*)" -ODG_PATTERN = r"ODG: (-*\d*\.\d*)" +ODG_PATTERN = r"(?