Loading tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +99 −113 Original line number Diff line number Diff line __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, Loading Loading @@ -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. """ Loading @@ -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): Loading @@ -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, Loading @@ -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" Loading @@ -119,7 +109,7 @@ def test_bypass_enc( sba_enc( dut_encoder_frontend, test_vector_path, ref_encoder_frontend, ref_encoder_path, reference_path, dut_base_path, None, Loading @@ -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, Loading @@ -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, Loading @@ -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: if SID == 1: if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': pytest.skip() if ivas_br == "13200" or ivas_br == "16400": if dtx == "1" and gain_flag == 0 and fs != "16": SID = 1 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" Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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": 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}" Loading @@ -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 Loading @@ -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, Loading Loading @@ -584,7 +569,7 @@ 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) Loading @@ -598,11 +583,9 @@ def sba_enc( 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, Loading @@ -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] Loading @@ -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}" Loading @@ -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, Loading Loading
tests/codec_be_on_mr_nonselection/test_sba_bs_enc.py +99 −113 Original line number Diff line number Diff line __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, Loading Loading @@ -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. """ Loading @@ -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): Loading @@ -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, Loading @@ -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" Loading @@ -119,7 +109,7 @@ def test_bypass_enc( sba_enc( dut_encoder_frontend, test_vector_path, ref_encoder_frontend, ref_encoder_path, reference_path, dut_base_path, None, Loading @@ -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, Loading @@ -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, Loading @@ -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: if SID == 1: if ivas_br not in ['13200','16400','64000'] or fs == '16' or gain_flag == 1 or dtx == '0': pytest.skip() if ivas_br == "13200" or ivas_br == "16400": if dtx == "1" and gain_flag == 0 and fs != "16": SID = 1 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" Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading Loading @@ -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, Loading @@ -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" Loading @@ -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, Loading @@ -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, Loading @@ -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, Loading @@ -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" Loading @@ -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": 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}" Loading @@ -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 Loading @@ -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, Loading Loading @@ -584,7 +569,7 @@ 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) Loading @@ -598,11 +583,9 @@ def sba_enc( 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, Loading @@ -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] Loading @@ -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}" Loading @@ -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, Loading