From e2272fffadc5af223600640dbadc545e4e9c6bd0 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Wed, 11 Jan 2023 12:29:04 +0530 Subject: [PATCH 1/2] Added test case for SBA BR switching with DTX --- scripts/config/self_test.prm | 3 +++ tests/test_param_file.py | 30 +++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a998eefe2c..8c75fc2893 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -599,6 +599,9 @@ ../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.pcm bit ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.pcm_sw_48-48_7_1_4.tst +// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out,DTX on, BINAURAL out +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.pcm bit +../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.pcm_sw_32-32_DTX_BINAURAL.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit diff --git a/tests/test_param_file.py b/tests/test_param_file.py index 4031fd36bf..a0d7036668 100644 --- a/tests/test_param_file.py +++ b/tests/test_param_file.py @@ -39,6 +39,7 @@ import errno import platform from subprocess import run import pytest +from cut_pcm import cut_samples from cmp_custom import cmp_custom from conftest import EncoderFrontend, DecoderFrontend from testconfig import PARAM_FILE @@ -148,9 +149,16 @@ def test_param_file_tests( bitstream_file = enc_split.pop() testv_file = enc_split.pop() - sampling_rate = int(enc_split.pop()) + fs = enc_split.pop() + sampling_rate = int(fs) bitrate = enc_split.pop() - + + sba_br_switching_dtx = 0 + if bitrate.startswith("../") and "-dtx" in enc_opts.split() and "-sba" in enc_opts.split(): + sba_br_switching_dtx = 1 + cut_file = pre_proc_input(testv_file,fs) + testv_file = cut_file + # bitrate can be a filename: remove leading "../" if bitrate.startswith("../"): bitrate = bitrate[3:] @@ -176,7 +184,10 @@ def test_param_file_tests( enc_split, update_ref, ) - + if sba_br_switching_dtx == 1: + isExist = os.path.exists(cut_file) + if isExist: + os.remove(cut_file) # check for networkSimulator_g192 command line if sim_opts != "": sim_split = sim_opts.split() @@ -334,6 +345,19 @@ def encode( add_option_list=enc_opts_list, ) +def pre_proc_input(testv_file,fs): + CUT_FROM = "0.0" + CUT_LEN = "5.0" + cut_gain = "0.004" + if "stvFOA" in testv_file: + num_channel = '4' + elif "stv2OA" in testv_file: + num_channel = '9' + elif "stv3OA" in testv_file: + num_channel = '16' + cut_file = testv_file.replace(".pcm",num_channel + "chn_"+ cut_gain + ".pcm") + cut_samples(testv_file, cut_file, num_channel, fs + "000", CUT_FROM, CUT_LEN, cut_gain) + return(cut_file) def simulate( reference_path, -- GitLab From 87ae301e3705b7229adbc79c0b09e5da8b7eb764 Mon Sep 17 00:00:00 2001 From: Vidhya V P <100825@ittiam.com> Date: Mon, 16 Jan 2023 13:23:33 +0530 Subject: [PATCH 2/2] Address review comments --- tests/test_param_file.py | 52 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/tests/test_param_file.py b/tests/test_param_file.py index a0d7036668..8f28d2f6d6 100644 --- a/tests/test_param_file.py +++ b/tests/test_param_file.py @@ -152,13 +152,17 @@ def test_param_file_tests( fs = enc_split.pop() sampling_rate = int(fs) bitrate = enc_split.pop() - - sba_br_switching_dtx = 0 - if bitrate.startswith("../") and "-dtx" in enc_opts.split() and "-sba" in enc_opts.split(): - sba_br_switching_dtx = 1 - cut_file = pre_proc_input(testv_file,fs) - testv_file = cut_file - + + sba_br_switching_dtx = 0 + if ( + not bitrate.isdigit() + and "-dtx" in enc_opts.split() + and "-sba" in enc_opts.split() + ): + sba_br_switching_dtx = 1 + cut_file = pre_proc_input(testv_file, fs) + testv_file = cut_file + # bitrate can be a filename: remove leading "../" if bitrate.startswith("../"): bitrate = bitrate[3:] @@ -185,8 +189,8 @@ def test_param_file_tests( update_ref, ) if sba_br_switching_dtx == 1: - isExist = os.path.exists(cut_file) - if isExist: + is_exist = os.path.exists(cut_file) + if is_exist: os.remove(cut_file) # check for networkSimulator_g192 command line if sim_opts != "": @@ -345,19 +349,23 @@ def encode( add_option_list=enc_opts_list, ) -def pre_proc_input(testv_file,fs): - CUT_FROM = "0.0" - CUT_LEN = "5.0" - cut_gain = "0.004" - if "stvFOA" in testv_file: - num_channel = '4' - elif "stv2OA" in testv_file: - num_channel = '9' - elif "stv3OA" in testv_file: - num_channel = '16' - cut_file = testv_file.replace(".pcm",num_channel + "chn_"+ cut_gain + ".pcm") - cut_samples(testv_file, cut_file, num_channel, fs + "000", CUT_FROM, CUT_LEN, cut_gain) - return(cut_file) + +def pre_proc_input(testv_file, fs): + cut_from = "0.0" + cut_len = "5.0" + cut_gain = "0.004" + if "stvFOA" in testv_file: + num_channel = "4" + elif "stv2OA" in testv_file: + num_channel = "9" + elif "stv3OA" in testv_file: + num_channel = "16" + cut_file = testv_file.replace(".pcm", num_channel + "chn_" + cut_gain + ".pcm") + cut_samples( + testv_file, cut_file, num_channel, fs + "000", cut_from, cut_len, cut_gain + ) + return cut_file + def simulate( reference_path, -- GitLab