From b49c8f8e83558bdf46f54227ad71e99276a39078 Mon Sep 17 00:00:00 2001 From: azmill Date: Fri, 29 Sep 2023 15:05:23 +1000 Subject: [PATCH 1/8] Readded the test cases for SBA SID and SBA JBM conditions. --- .../test_sba_bs_enc.py | 212 ++++++++---------- 1 file changed, 99 insertions(+), 113 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index d175e1583d..3c36b8257d 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -1,4 +1,5 @@ -__copyright__ = """ +__copyright__ = \ + """ (C) 2022-2023 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, @@ -28,7 +29,8 @@ __copyright__ = """ the United Nations Convention on Contracts on the International Sales of Goods. """ -__doc__ = """ +__doc__ = \ + """ Test file to run C encoder and decoder code. The outputs are compared with C generated references. """ @@ -41,40 +43,28 @@ from tests.cmp_pcm import cmp_pcm from tests.cut_pcm import cut_samples from tests.conftest import EncoderFrontend, DecoderFrontend from cut_bs import cut_from_start - # params -tag_list = ["stvFOA"] -tag_list_HOA2 = ["stv2OA"] -tag_list_HOA3 = ["stv3OA"] - -tag_list_bw_force = ["stvFOA"] -dtx_set = ["0", "1"] -dict_fsample_bw = {"48": "3", "32": "2", "16": "1"} -dict_bw_idx = {"FB": "3", "SWB": "2", "WB": "1"} -dict_bw_tag = {"SWB": "_ForceSWB", "WB": "_ForceWB"} -ivas_br_FOA = [ - "13200", - "16400", - "32000", - "64000", - "96000", - "160000", - "256000", - "384000", - "512000", - "sw_24k4_256k.bin", -] -ivas_br_HOA2 = ["256000", "384000", "512000"] -ivas_br_HOA3 = ["256000", "384000", "512000"] - -sample_rate_list = ["48", "32", "16"] +tag_list = ['stvFOA'] +tag_list_HOA2 = ['stv2OA'] +tag_list_HOA3 = ['stv3OA'] + +tag_list_bw_force = ['stvFOA'] +dtx_set = ['0', '1'] +dict_fsample_bw = {'48': '3', '32': '2', '16': '1'} +dict_bw_idx = {'FB': '3', 'SWB': '2', 'WB': '1'} +dict_bw_tag = {'SWB': '_ForceSWB', 'WB': '_ForceWB'} +ivas_br_FOA = ['13200','16400','32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin'] +ivas_br_HOA2 = ['256000', '384000', '512000'] +ivas_br_HOA3 = ['256000', '384000', '512000'] +SID_list = [0, 1] +sample_rate_list = ['48', '32', '16'] bypass_list = [1, 2] gain_list = [0, 1] -sample_rate_bw_idx_list = [("48", "SWB"), ("48", "WB"), ("32", "WB")] +sample_rate_bw_idx_list = [('48', 'SWB'), ('48', 'WB'), ('32', 'WB')] -AbsTol = "0" +AbsTol = '0' def check_and_makedir(dir_path): @@ -96,8 +86,8 @@ def test_bypass_enc( test_vector_path, reference_path, dut_base_path, - ref_encoder_frontend, - ref_decoder_frontend, + ref_encoder_path, + ref_decoder_path, update_ref, keep_files, tag, @@ -107,9 +97,9 @@ def test_bypass_enc( if update_ref == 1 and bypass == 1: pytest.skip() - tag = tag + fs + "c" - ivas_br = "256000" - dtx = "0" + tag = tag + fs + 'c' + ivas_br = '256000' + dtx = '0' max_bw = "FB" gain_flag = -1 sba_order = "+1" @@ -119,10 +109,10 @@ def test_bypass_enc( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, - None, + None, tag, fs, ivas_br, @@ -133,13 +123,13 @@ def test_bypass_enc( sba_order, update_ref, gain_flag, - cut_testv=True, + cut_testv=True ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -162,14 +152,15 @@ def test_bypass_enc( @pytest.mark.parametrize("tag", tag_list) @pytest.mark.parametrize("fs", sample_rate_list) @pytest.mark.parametrize("gain_flag", gain_list) +@pytest.mark.parametrize("SID", SID_list) def test_sba_enc_system( dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend, test_vector_path, reference_path, dut_base_path, - ref_encoder_frontend, - ref_decoder_frontend, + ref_encoder_path, + ref_decoder_path, br_switch_file_path, update_ref, keep_files, @@ -178,28 +169,30 @@ def test_sba_enc_system( tag, fs, gain_flag, + SID, ): - SID = 0 - if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]: + + if dtx == '1' and ivas_br not in ['13200','16400','24400','32000','64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1: - pytest.skip() - if ivas_br == "13200" or ivas_br == "16400": - if dtx == "1" and gain_flag == 0 and fs != "16": - SID = 1 - else: + if SID == 1: + if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': + pytest.skip() + else: + if ivas_br in ['13200','16400']: pytest.skip() - if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]: + if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1: pytest.skip() - tag = tag + fs + "c" + if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']: + pytest.skip() + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 sba_order = "+1" output_config = "FOA" if gain_flag == 1: cut_gain = "16.0" - elif dtx == "1": + elif dtx == '1': cut_gain = ".004" else: cut_gain = "1.0" @@ -207,7 +200,7 @@ def test_sba_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, br_switch_file_path, @@ -223,13 +216,13 @@ def test_sba_enc_system( gain_flag, cut_gain=cut_gain, create_dutenc=True, - cut_testv=True, + cut_testv=True ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -255,18 +248,18 @@ def test_spar_hoa2_enc_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_frontend, - ref_decoder_frontend, + ref_encoder_path, + ref_decoder_path, update_ref, keep_files, ivas_br, tag, ): - fs = "48" - dtx = "0" + fs = '48' + dtx = '0' gain_flag = -1 - tag = tag + fs + "c" + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 sba_order = "+2" @@ -276,7 +269,7 @@ def test_spar_hoa2_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, None, @@ -295,7 +288,7 @@ def test_spar_hoa2_enc_system( # dec sba_dec( dut_decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -321,18 +314,18 @@ def test_spar_hoa3_enc_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_frontend, - ref_decoder_frontend, + ref_encoder_path, + ref_decoder_path, update_ref, keep_files, ivas_br, tag, ): - fs = "48" - dtx = "0" + fs = '48' + dtx = '0' gain_flag = -1 - tag = tag + fs + "c" + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 sba_order = "+3" @@ -342,7 +335,7 @@ def test_spar_hoa3_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, None, @@ -361,7 +354,7 @@ def test_spar_hoa3_enc_system( # dec sba_dec( dut_decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -389,8 +382,8 @@ def test_sba_enc_BWforce_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_frontend, - ref_decoder_frontend, + ref_encoder_path, + ref_decoder_path, update_ref, keep_files, ivas_br, @@ -398,16 +391,16 @@ def test_sba_enc_BWforce_system( tag, sample_rate_bw_idx, ): - if dtx == "1" and ivas_br not in ["32000", "64000"]: + if dtx == '1' and ivas_br not in ['32000','64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - if ivas_br == "13200" or ivas_br == "16400": + if ivas_br == '13200' or ivas_br == '16400': pytest.skip() - if ivas_br == "sw_24k4_256k.bin": + if ivas_br == 'sw_24k4_256k.bin': pytest.skip() fs = sample_rate_bw_idx[0] bw = sample_rate_bw_idx[1] - tag = tag + fs + "c" + tag = tag + fs + 'c' bypass = -1 gain_flag = -1 sba_order = "+1" @@ -417,7 +410,7 @@ def test_sba_enc_BWforce_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, None, @@ -431,13 +424,13 @@ def test_sba_enc_BWforce_system( sba_order, update_ref, gain_flag, - cut_testv=True, + cut_testv=True ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -459,7 +452,7 @@ def test_sba_enc_BWforce_system( def sba_enc( encoder_frontend, test_vector_path, - ref_encoder_frontend, + ref_encoder_path, reference_path, dut_base_path, br_switch_file_path, @@ -473,10 +466,11 @@ def sba_enc( sba_order, update_ref, gain_flag, - cut_gain="1.0", + cut_gain='1.0', create_dutenc=False, - cut_testv=False, + cut_testv=False ): + # ------------ run cmd ------------ dut_out_dir = f"{dut_base_path}/sba_bs/pkt" ref_out_dir = f"{reference_path}/sba_bs/pkt" @@ -493,13 +487,13 @@ def sba_enc( tag = tag + dict_bw_tag[ivas_max_bw] tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}" - if ivas_br == "sw_24k4_256k.bin": - ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" + if ivas_br == 'sw_24k4_256k.bin': + ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" short_tag_ext = "" if gain_flag == 1: - short_tag_ext += f"_Gain{gain_flag}" + short_tag_ext += f'_Gain{gain_flag}' if SID == 1: - short_tag_ext += f"_SID" + short_tag_ext += f'_SID' # we update only bypass = 0/2 (bypass 1 is the same as the baseline) if bypass in [0, 2]: short_tag_ext += f"_pca{bypass}" @@ -516,12 +510,10 @@ def sba_enc( if SID == 1: dut_pkt_file_cut = f"{dut_out_dir}/{tag_out}{long_tag_ext}_cut.pkt" ref_pkt_file_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_cut.pkt" - ref_pkt_file_dutenc_cut = ( - f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt" - ) + ref_pkt_file_dutenc_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt" input_path = f"{test_vector_path}/{tag_in}{in_extension}" bypass_mode = bypass if bypass >= 0 else None - dtx_mode = dtx == "1" + dtx_mode = dtx == '1' if cut_testv: # use shortened and potentially gain adjusted input PCM file - create if not present @@ -534,20 +526,13 @@ def sba_enc( else: cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}" if not os.path.exists(cut_file): - cut_samples( - input_path, - cut_file, - num_channels, - sampling_rate + "000", - cut_from, - cut_len, - cut_gain, - ) + cut_samples(input_path, cut_file, num_channels, sampling_rate + "000", cut_from, cut_len, cut_gain) input_path = cut_file - if ref_encoder_frontend: + if ref_encoder_path: + ref_encoder = EncoderFrontend(ref_encoder_path, "REF") # call REF encoder - ref_encoder_frontend.run( + ref_encoder.run( ivas_br, sampling_rate, input_path, @@ -584,10 +569,10 @@ def sba_enc( ) if SID == 1: - if ref_encoder_frontend: + if ref_encoder_path: with open(ref_pkt_file, "rb") as fp_in: - with open(ref_pkt_file_cut, "wb") as fp_out: - fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) + with open(ref_pkt_file_cut, "wb") as fp_out: + fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) with open(ref_pkt_file_dutenc, "rb") as fp_in: with open(ref_pkt_file_dutenc_cut, "wb") as fp_out: fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) @@ -595,14 +580,12 @@ def sba_enc( os.remove(ref_pkt_file_dutenc) if update_ref == 0: with open(dut_pkt_file, "rb") as fp_in: - with open(dut_pkt_file_cut, "wb") as fp_out: - fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) - os.remove(dut_pkt_file) - - + with open(dut_pkt_file_cut, "wb") as fp_out: + fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) + os.remove(dut_pkt_file) def sba_dec( decoder_frontend, - ref_decoder_frontend, + ref_decoder_path, reference_path, dut_base_path, tag, @@ -617,6 +600,7 @@ def sba_dec( gain_flag, keep_files, ): + # -------- run cmd ------------ # sampling rate to BW mapping bw_idx = dict_fsample_bw[sampling_rate] @@ -627,12 +611,12 @@ def sba_dec( short_tag_ext = "" if gain_flag == 1: - short_tag_ext += f"_Gain{gain_flag}" + short_tag_ext += f'_Gain{gain_flag}' # we update only bypass = 0/2 (bypass 1 is the same as the baseline) if bypass in [0, 2]: short_tag_ext += f"_pca{bypass}" if SID == 1: - short_tag_ext += f"_SID_cut" + short_tag_ext += f'_SID_cut' # to avoid conflicting names in case of parallel test execution, differentiate all cases if gain_flag == 1: long_tag_ext = f"_Gain{gain_flag}" @@ -652,9 +636,11 @@ def sba_dec( check_and_makedir(dut_out_dir) check_and_makedir(ref_out_dir) - if ref_decoder_frontend: + if ref_decoder_path: + ref_decoder = DecoderFrontend(ref_decoder_path, "REF") + # call REF decoder - ref_decoder_frontend.run( + ref_decoder.run( output_config, sampling_rate, ref_in_pkt, -- GitLab From 154fd6c1fd58cce98946a3a36d4b083d597471e9 Mon Sep 17 00:00:00 2001 From: azmill Date: Fri, 29 Sep 2023 15:09:01 +1000 Subject: [PATCH 2/8] Bad update --- .../test_sba_bs_enc.py | 212 ++++++++++-------- 1 file changed, 113 insertions(+), 99 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index 3c36b8257d..d175e1583d 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -1,5 +1,4 @@ -__copyright__ = \ - """ +__copyright__ = """ (C) 2022-2023 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, @@ -29,8 +28,7 @@ __copyright__ = \ the United Nations Convention on Contracts on the International Sales of Goods. """ -__doc__ = \ - """ +__doc__ = """ Test file to run C encoder and decoder code. The outputs are compared with C generated references. """ @@ -43,28 +41,40 @@ from tests.cmp_pcm import cmp_pcm from tests.cut_pcm import cut_samples from tests.conftest import EncoderFrontend, DecoderFrontend from cut_bs import cut_from_start + # params -tag_list = ['stvFOA'] -tag_list_HOA2 = ['stv2OA'] -tag_list_HOA3 = ['stv3OA'] - -tag_list_bw_force = ['stvFOA'] -dtx_set = ['0', '1'] -dict_fsample_bw = {'48': '3', '32': '2', '16': '1'} -dict_bw_idx = {'FB': '3', 'SWB': '2', 'WB': '1'} -dict_bw_tag = {'SWB': '_ForceSWB', 'WB': '_ForceWB'} -ivas_br_FOA = ['13200','16400','32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin'] -ivas_br_HOA2 = ['256000', '384000', '512000'] -ivas_br_HOA3 = ['256000', '384000', '512000'] -SID_list = [0, 1] -sample_rate_list = ['48', '32', '16'] +tag_list = ["stvFOA"] +tag_list_HOA2 = ["stv2OA"] +tag_list_HOA3 = ["stv3OA"] + +tag_list_bw_force = ["stvFOA"] +dtx_set = ["0", "1"] +dict_fsample_bw = {"48": "3", "32": "2", "16": "1"} +dict_bw_idx = {"FB": "3", "SWB": "2", "WB": "1"} +dict_bw_tag = {"SWB": "_ForceSWB", "WB": "_ForceWB"} +ivas_br_FOA = [ + "13200", + "16400", + "32000", + "64000", + "96000", + "160000", + "256000", + "384000", + "512000", + "sw_24k4_256k.bin", +] +ivas_br_HOA2 = ["256000", "384000", "512000"] +ivas_br_HOA3 = ["256000", "384000", "512000"] + +sample_rate_list = ["48", "32", "16"] bypass_list = [1, 2] gain_list = [0, 1] -sample_rate_bw_idx_list = [('48', 'SWB'), ('48', 'WB'), ('32', 'WB')] +sample_rate_bw_idx_list = [("48", "SWB"), ("48", "WB"), ("32", "WB")] -AbsTol = '0' +AbsTol = "0" def check_and_makedir(dir_path): @@ -86,8 +96,8 @@ def test_bypass_enc( test_vector_path, reference_path, dut_base_path, - ref_encoder_path, - ref_decoder_path, + ref_encoder_frontend, + ref_decoder_frontend, update_ref, keep_files, tag, @@ -97,9 +107,9 @@ def test_bypass_enc( if update_ref == 1 and bypass == 1: pytest.skip() - tag = tag + fs + 'c' - ivas_br = '256000' - dtx = '0' + tag = tag + fs + "c" + ivas_br = "256000" + dtx = "0" max_bw = "FB" gain_flag = -1 sba_order = "+1" @@ -109,10 +119,10 @@ def test_bypass_enc( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, - None, + None, tag, fs, ivas_br, @@ -123,13 +133,13 @@ def test_bypass_enc( sba_order, update_ref, gain_flag, - cut_testv=True + cut_testv=True, ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -152,15 +162,14 @@ def test_bypass_enc( @pytest.mark.parametrize("tag", tag_list) @pytest.mark.parametrize("fs", sample_rate_list) @pytest.mark.parametrize("gain_flag", gain_list) -@pytest.mark.parametrize("SID", SID_list) def test_sba_enc_system( dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend, test_vector_path, reference_path, dut_base_path, - ref_encoder_path, - ref_decoder_path, + ref_encoder_frontend, + ref_decoder_frontend, br_switch_file_path, update_ref, keep_files, @@ -169,30 +178,28 @@ def test_sba_enc_system( tag, fs, gain_flag, - SID, ): - - if dtx == '1' and ivas_br not in ['13200','16400','24400','32000','64000']: + SID = 0 + if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - if SID == 1: - if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': - pytest.skip() - else: - if ivas_br in ['13200','16400']: - pytest.skip() - if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1: + if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1: pytest.skip() - if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']: + if ivas_br == "13200" or ivas_br == "16400": + if dtx == "1" and gain_flag == 0 and fs != "16": + SID = 1 + else: + pytest.skip() + if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]: pytest.skip() - tag = tag + fs + 'c' + tag = tag + fs + "c" max_bw = "FB" bypass = -1 sba_order = "+1" output_config = "FOA" if gain_flag == 1: cut_gain = "16.0" - elif dtx == '1': + elif dtx == "1": cut_gain = ".004" else: cut_gain = "1.0" @@ -200,7 +207,7 @@ def test_sba_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, br_switch_file_path, @@ -216,13 +223,13 @@ def test_sba_enc_system( gain_flag, cut_gain=cut_gain, create_dutenc=True, - cut_testv=True + cut_testv=True, ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -248,18 +255,18 @@ def test_spar_hoa2_enc_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_path, - ref_decoder_path, + ref_encoder_frontend, + ref_decoder_frontend, update_ref, keep_files, ivas_br, tag, ): - fs = '48' - dtx = '0' + fs = "48" + dtx = "0" gain_flag = -1 - tag = tag + fs + 'c' + tag = tag + fs + "c" max_bw = "FB" bypass = -1 sba_order = "+2" @@ -269,7 +276,7 @@ def test_spar_hoa2_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, None, @@ -288,7 +295,7 @@ def test_spar_hoa2_enc_system( # dec sba_dec( dut_decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -314,18 +321,18 @@ def test_spar_hoa3_enc_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_path, - ref_decoder_path, + ref_encoder_frontend, + ref_decoder_frontend, update_ref, keep_files, ivas_br, tag, ): - fs = '48' - dtx = '0' + fs = "48" + dtx = "0" gain_flag = -1 - tag = tag + fs + 'c' + tag = tag + fs + "c" max_bw = "FB" bypass = -1 sba_order = "+3" @@ -335,7 +342,7 @@ def test_spar_hoa3_enc_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, None, @@ -354,7 +361,7 @@ def test_spar_hoa3_enc_system( # dec sba_dec( dut_decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -382,8 +389,8 @@ def test_sba_enc_BWforce_system( test_vector_path, reference_path, dut_base_path, - ref_encoder_path, - ref_decoder_path, + ref_encoder_frontend, + ref_decoder_frontend, update_ref, keep_files, ivas_br, @@ -391,16 +398,16 @@ def test_sba_enc_BWforce_system( tag, sample_rate_bw_idx, ): - if dtx == '1' and ivas_br not in ['32000','64000']: + if dtx == "1" and ivas_br not in ["32000", "64000"]: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - if ivas_br == '13200' or ivas_br == '16400': + if ivas_br == "13200" or ivas_br == "16400": pytest.skip() - if ivas_br == 'sw_24k4_256k.bin': + if ivas_br == "sw_24k4_256k.bin": pytest.skip() fs = sample_rate_bw_idx[0] bw = sample_rate_bw_idx[1] - tag = tag + fs + 'c' + tag = tag + fs + "c" bypass = -1 gain_flag = -1 sba_order = "+1" @@ -410,7 +417,7 @@ def test_sba_enc_BWforce_system( sba_enc( dut_encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, None, @@ -424,13 +431,13 @@ def test_sba_enc_BWforce_system( sba_order, update_ref, gain_flag, - cut_testv=True + cut_testv=True, ) # dec sba_dec( dut_decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -452,7 +459,7 @@ def test_sba_enc_BWforce_system( def sba_enc( encoder_frontend, test_vector_path, - ref_encoder_path, + ref_encoder_frontend, reference_path, dut_base_path, br_switch_file_path, @@ -466,11 +473,10 @@ def sba_enc( sba_order, update_ref, gain_flag, - cut_gain='1.0', + cut_gain="1.0", create_dutenc=False, - cut_testv=False + cut_testv=False, ): - # ------------ run cmd ------------ dut_out_dir = f"{dut_base_path}/sba_bs/pkt" ref_out_dir = f"{reference_path}/sba_bs/pkt" @@ -487,13 +493,13 @@ def sba_enc( tag = tag + dict_bw_tag[ivas_max_bw] tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}" - if ivas_br == 'sw_24k4_256k.bin': - ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" + if ivas_br == "sw_24k4_256k.bin": + ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" short_tag_ext = "" if gain_flag == 1: - short_tag_ext += f'_Gain{gain_flag}' + short_tag_ext += f"_Gain{gain_flag}" if SID == 1: - short_tag_ext += f'_SID' + short_tag_ext += f"_SID" # we update only bypass = 0/2 (bypass 1 is the same as the baseline) if bypass in [0, 2]: short_tag_ext += f"_pca{bypass}" @@ -510,10 +516,12 @@ def sba_enc( if SID == 1: dut_pkt_file_cut = f"{dut_out_dir}/{tag_out}{long_tag_ext}_cut.pkt" ref_pkt_file_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_cut.pkt" - ref_pkt_file_dutenc_cut = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt" + ref_pkt_file_dutenc_cut = ( + f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc_cut.pkt" + ) input_path = f"{test_vector_path}/{tag_in}{in_extension}" bypass_mode = bypass if bypass >= 0 else None - dtx_mode = dtx == '1' + dtx_mode = dtx == "1" if cut_testv: # use shortened and potentially gain adjusted input PCM file - create if not present @@ -526,13 +534,20 @@ def sba_enc( else: cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}" if not os.path.exists(cut_file): - cut_samples(input_path, cut_file, num_channels, sampling_rate + "000", cut_from, cut_len, cut_gain) + cut_samples( + input_path, + cut_file, + num_channels, + sampling_rate + "000", + cut_from, + cut_len, + cut_gain, + ) input_path = cut_file - if ref_encoder_path: - ref_encoder = EncoderFrontend(ref_encoder_path, "REF") + if ref_encoder_frontend: # call REF encoder - ref_encoder.run( + ref_encoder_frontend.run( ivas_br, sampling_rate, input_path, @@ -569,10 +584,10 @@ def sba_enc( ) if SID == 1: - if ref_encoder_path: + if ref_encoder_frontend: with open(ref_pkt_file, "rb") as fp_in: - with open(ref_pkt_file_cut, "wb") as fp_out: - fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) + with open(ref_pkt_file_cut, "wb") as fp_out: + fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) with open(ref_pkt_file_dutenc, "rb") as fp_in: with open(ref_pkt_file_dutenc_cut, "wb") as fp_out: fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) @@ -580,12 +595,14 @@ def sba_enc( os.remove(ref_pkt_file_dutenc) if update_ref == 0: with open(dut_pkt_file, "rb") as fp_in: - with open(dut_pkt_file_cut, "wb") as fp_out: - fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) - os.remove(dut_pkt_file) + with open(dut_pkt_file_cut, "wb") as fp_out: + fr_cnt, cut_cnt = cut_from_start(fp_in, fp_out, 0, True) + os.remove(dut_pkt_file) + + def sba_dec( decoder_frontend, - ref_decoder_path, + ref_decoder_frontend, reference_path, dut_base_path, tag, @@ -600,7 +617,6 @@ def sba_dec( gain_flag, keep_files, ): - # -------- run cmd ------------ # sampling rate to BW mapping bw_idx = dict_fsample_bw[sampling_rate] @@ -611,12 +627,12 @@ def sba_dec( short_tag_ext = "" if gain_flag == 1: - short_tag_ext += f'_Gain{gain_flag}' + short_tag_ext += f"_Gain{gain_flag}" # we update only bypass = 0/2 (bypass 1 is the same as the baseline) if bypass in [0, 2]: short_tag_ext += f"_pca{bypass}" if SID == 1: - short_tag_ext += f'_SID_cut' + short_tag_ext += f"_SID_cut" # to avoid conflicting names in case of parallel test execution, differentiate all cases if gain_flag == 1: long_tag_ext = f"_Gain{gain_flag}" @@ -636,11 +652,9 @@ def sba_dec( check_and_makedir(dut_out_dir) check_and_makedir(ref_out_dir) - if ref_decoder_path: - ref_decoder = DecoderFrontend(ref_decoder_path, "REF") - + if ref_decoder_frontend: # call REF decoder - ref_decoder.run( + ref_decoder_frontend.run( output_config, sampling_rate, ref_in_pkt, -- GitLab From 9780dacc7c23e4b460ab7a1b0333fb1b5c005f42 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Thu, 21 Sep 2023 10:44:36 +0530 Subject: [PATCH 3/8] Readded the test cases for SBA SID and SBA JBM conditions. --- scripts/config/self_test.prm | 5 +++++ .../test_sba_bs_enc.py | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 62a3cd044b..dbe2abf131 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1254,6 +1254,11 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP HOA3 32 netsimoutput testv/stv3OA32c.wav_SBA_80000_32-32_HOA3_JBM5.tst +// SBA at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out, JBM Prof 5 +../IVAS_cod -sba 1 13200 48 testv/stvFOA48c.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/stvFOA32c.wav_SBA_13200_48-48_BINAURAL_JBM5.tst + // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 ../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index d175e1583d..6efa7e81ff 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -67,7 +67,7 @@ ivas_br_FOA = [ ] ivas_br_HOA2 = ["256000", "384000", "512000"] ivas_br_HOA3 = ["256000", "384000", "512000"] - +SID_list = [0, 1] sample_rate_list = ["48", "32", "16"] bypass_list = [1, 2] gain_list = [0, 1] @@ -162,6 +162,7 @@ def test_bypass_enc( @pytest.mark.parametrize("tag", tag_list) @pytest.mark.parametrize("fs", sample_rate_list) @pytest.mark.parametrize("gain_flag", gain_list) +@pytest.mark.parametrize("SID", SID_list) def test_sba_enc_system( dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend, @@ -178,19 +179,21 @@ def test_sba_enc_system( tag, fs, gain_flag, + SID, ): - SID = 0 + if dtx == "1" and ivas_br not in ["13200", "16400", "24400", "32000", "64000"]: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1: - pytest.skip() - if ivas_br == "13200" or ivas_br == "16400": - if dtx == "1" and gain_flag == 0 and fs != "16": - SID = 1 - else: + if SID == 1: + if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': pytest.skip() - if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]: + else: + if ivas_br in ['13200','16400']: + pytest.skip() + if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1: + pytest.skip() + if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']: pytest.skip() tag = tag + fs + "c" max_bw = "FB" -- GitLab From fba79c036141f22e5eba9b1dddf34cbdb6ec2259 Mon Sep 17 00:00:00 2001 From: azmill Date: Fri, 29 Sep 2023 15:20:41 +1000 Subject: [PATCH 4/8] Fixing python quotes --- tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index 6efa7e81ff..618b22649a 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -186,14 +186,14 @@ def test_sba_enc_system( # skip high bitrates for DTX until DTX issue is resolved pytest.skip() if SID == 1: - if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': + if ivas_br not in ["13200","16400","64000"] or fs == "16" or gain_flag == 1 or dtx == "0": pytest.skip() else: - if ivas_br in ['13200','16400']: + if ivas_br in ["13200","16400"]: pytest.skip() - if ivas_br == 'sw_24k4_256k.bin' and gain_flag != 1: + if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1: pytest.skip() - if gain_flag == 1 and ivas_br not in ['13200','16400','24400','32000']: + if gain_flag == 1 and ivas_br not in ["13200","16400","24400","32000"]: pytest.skip() tag = tag + fs + "c" max_bw = "FB" -- GitLab From a872bd75acd3cb3ac324770e15cf07b562c645e4 Mon Sep 17 00:00:00 2001 From: azmill Date: Fri, 29 Sep 2023 15:22:34 +1000 Subject: [PATCH 5/8] Fixing spacing --- tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py index 618b22649a..a02865410e 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py @@ -186,14 +186,14 @@ def test_sba_enc_system( # skip high bitrates for DTX until DTX issue is resolved pytest.skip() if SID == 1: - if ivas_br not in ["13200","16400","64000"] or fs == "16" or gain_flag == 1 or dtx == "0": + if ivas_br not in ["13200", "16400", "64000"] or fs == "16" or gain_flag == 1 or dtx == "0": pytest.skip() else: if ivas_br in ["13200","16400"]: pytest.skip() if ivas_br == "sw_24k4_256k.bin" and gain_flag != 1: pytest.skip() - if gain_flag == 1 and ivas_br not in ["13200","16400","24400","32000"]: + if gain_flag == 1 and ivas_br not in ["13200", "16400", "24400", "32000"]: pytest.skip() tag = tag + fs + "c" max_bw = "FB" -- GitLab From 09bba6f42e004f9b08b109f060e4fdb31538ab03 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Tue, 3 Oct 2023 11:57:52 +0530 Subject: [PATCH 6/8] Resolving MSAN and USAN errors for the added test case --- lib_com/options.h | 2 +- lib_dec/ivas_masa_dec.c | 4 ++++ lib_dec/jbm_jb4_jmf.c | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0d417a8f84..7a1a75dc7f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,7 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif #define REMOVE_UNUSED_FUNCTION /* Dlb: Remove functions that are unhit/unused */ - +#define FIX_MSAN_USAN_ERROR_JBM /* Dlb: Resolve MSAN and USAN errors in the SBA-JBM test case added*/ #define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ #define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 37cff3347e..25d20bf53f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1587,7 +1587,11 @@ void ivas_spar_param_to_masa_param_mapping( for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++ ) { sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; +#ifndef FIX_MSAN_USAN_ERROR_JBM if ( subframe < SPAR_META_DELAY_SUBFRAMES ) +#else + if ( ( subframe < SPAR_META_DELAY_SUBFRAMES ) && ( sf < 2 ) ) +#endif { mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 85e9980e6e..4e43650904 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -205,8 +205,11 @@ int16_t JB4_JMF_PushPacket( h->lastRtpTimeStamp = rtpTimeStamp; return 0; } - +#ifndef FIX_MSAN_USAN_ERROR_JBM rtpTimeDiff = rtpTimeStamp - h->lastRtpTimeStamp; +#else + rtpTimeDiff = (int32_t) ( rtpTimeStamp - h->lastRtpTimeStamp ); +#endif sysTimeDiff = sysTime - h->lastSysTime; offset = sysTime - rtpTimeStamp; -- GitLab From 28c2bf11db5fd8da68450e41981439d49480fba3 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 4 Oct 2023 11:32:00 +0530 Subject: [PATCH 7/8] Addressing review comment. --- lib_dec/ivas_masa_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 25d20bf53f..783bea30f6 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1590,7 +1590,7 @@ void ivas_spar_param_to_masa_param_mapping( #ifndef FIX_MSAN_USAN_ERROR_JBM if ( subframe < SPAR_META_DELAY_SUBFRAMES ) #else - if ( ( subframe < SPAR_META_DELAY_SUBFRAMES ) && ( sf < 2 ) ) + if ( ( sf < SPAR_META_DELAY_SUBFRAMES ) ) #endif { mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; -- GitLab From 726c1cd313458262901eb9eb2fe30f9d8565f688 Mon Sep 17 00:00:00 2001 From: azmill Date: Thu, 5 Oct 2023 17:34:13 +1100 Subject: [PATCH 8/8] Fixing bad merge of options.h --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index c886eb063e..84c1d3cbd7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif #define REMOVE_UNUSED_FUNCTION /* Dlb: Remove functions that are unhit/unused */ +#define FIX_MSAN_USAN_ERROR_JBM /* Dlb: Resolve MSAN and USAN errors in the SBA-JBM test case added*/ #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ -- GitLab