Loading tests/create_short_testvectors.py +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import argparse import sys from pathlib import Path from cut_pcm import cut_samples from tests.cut_pcm import cut_samples HERE = Path(__file__).parent.resolve() TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() Loading @@ -50,6 +50,7 @@ from pyaudio3dtools import audiofile CUT_FROM = "0.0" GAIN = "1.0" FILE_IDS = [ "stv", "stvST", "stv51MC", "stv71MC", Loading tests/rtp/ivasrtp.py +46 −44 Original line number Diff line number Diff line Loading @@ -1446,6 +1446,7 @@ class IvasRtp: fd.write(json_output) def requestReader(self, timestamp: int) -> dict[str, any]: if self.requests is not None: tsList = sorted(self.requests.keys()) if len(tsList) > 0: lastTs = int(tsList[0]) Loading @@ -1458,6 +1459,7 @@ class IvasRtp: def piDataReader(self, startTimestamp: int, endTimestamp: int) -> list[PIDATA]: piDataList = list() if self.piData is not None: while startTimestamp < endTimestamp: ts = str(startTimestamp) if ts in self.piData.keys(): Loading tests/test_format_switching.py→tests/rtp/test_format_switching.py +40 −13 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ from tests.renderer.constants import ( FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_METADATA_FILES, ) from ivasrtp import * FORMAT_ARGUMENT_MAPPING = { "MONO": [], Loading Loading @@ -110,6 +111,16 @@ def test_format_switching ( with TemporaryDirectory() as tmp_dir: bitstreams = [] rtpdumps = [] codec=CODECS.IVAS #if key is "MONO": # codec=CODECS.EVS #else: # codec=CODECS.IVAS rtpPacker = IvasRtp(numFramesPerPacket=1, codec=codec) piData = dict() requestsData = dict() # Encode subformats for key, audioFile in FORMAT_TO_FILE_COMPARETEST.items(): Loading @@ -126,6 +137,7 @@ def test_format_switching ( encoder_args += FORMAT_TO_METADATA_FILES[key[:4]] temp_bitstream = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.bts").absolute() temp_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.rtpdump").absolute() dut_encoder_frontend.run( bitrate=bitrate, Loading @@ -140,24 +152,39 @@ def test_format_switching ( bitstreams.append(temp_bitstream) # Combine bitstreams cat_bitstream_full = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-FULL-CAT.bts").absolute() cat_bitstream_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.bts").absolute() catBsFull = bytes() cat_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-CAT.rtpdump").absolute() cat_rtpdump_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.rtpdump").absolute() catBsNoEVS = bytes() catRTP = bytes() catRTPnoEVS = bytes() for bsFile in bitstreams: with open (bsFile, mode="rb") as fd: tempRead = fd.read() catBsFull += tempRead if "MONO" not in str(bsFile): catBsNoEVS += tempRead with open (cat_bitstream_full, mode="wb") as outFile: outFile.write(catBsFull) with open (bsFile, mode="rb") as fd: catBsNoEVS += fd.read() with open (cat_bitstream_no_evs, mode="wb") as outFile: outFile.write(catBsNoEVS) # TODO: also pack EVS packets (while increasing timestamp and sequence number) # Pack to RTP packets rtpPacker.packG192File(g192File=cat_bitstream_no_evs, rtpDumpOut=cat_rtpdump_no_evs, piData=piData, requestsData=requestsData) #rtpdumps.append(temp_rtpdump) #for rtpdumpFile in rtpdumps: # with open (rtpdumpFile, mode="rb") as fd: # tempBits = fd.read() # catRTP += tempBits # if "MONO" not in str(rtpdumpFile): # catRTPnoEVS += tempBits #with open (cat_rtpdump, mode="wb") as outFile: # outFile.write(catRTP) #with open (cat_rtpdump_no_evs, mode="wb") as outFile: # outFile.write(catRTPnoEVS) # Decode the combined bitstreams cat_output_full = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-FULL-CAT.wav").absolute() cat_output_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.wav").absolute() cat_output_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}.wav").absolute() dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, Loading @@ -168,8 +195,8 @@ def test_format_switching ( dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_bitstream_full, output_path=cat_output_full, add_option_list= [] input_bitstream_path=cat_rtpdump, output_path=cat_output_rtpdump, add_option_list= ["-VOIP_HF_ONLY=1"] ) lib_com/options.h +1 −1 File changed.Contains only whitespace changes. Show changes Loading
tests/create_short_testvectors.py +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import argparse import sys from pathlib import Path from cut_pcm import cut_samples from tests.cut_pcm import cut_samples HERE = Path(__file__).parent.resolve() TEST_VECTOR_DIR = HERE.joinpath("../scripts/testv").resolve() Loading @@ -50,6 +50,7 @@ from pyaudio3dtools import audiofile CUT_FROM = "0.0" GAIN = "1.0" FILE_IDS = [ "stv", "stvST", "stv51MC", "stv71MC", Loading
tests/rtp/ivasrtp.py +46 −44 Original line number Diff line number Diff line Loading @@ -1446,6 +1446,7 @@ class IvasRtp: fd.write(json_output) def requestReader(self, timestamp: int) -> dict[str, any]: if self.requests is not None: tsList = sorted(self.requests.keys()) if len(tsList) > 0: lastTs = int(tsList[0]) Loading @@ -1458,6 +1459,7 @@ class IvasRtp: def piDataReader(self, startTimestamp: int, endTimestamp: int) -> list[PIDATA]: piDataList = list() if self.piData is not None: while startTimestamp < endTimestamp: ts = str(startTimestamp) if ts in self.piData.keys(): Loading
tests/test_format_switching.py→tests/rtp/test_format_switching.py +40 −13 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ from tests.renderer.constants import ( FORMAT_TO_FILE_COMPARETEST, FORMAT_TO_METADATA_FILES, ) from ivasrtp import * FORMAT_ARGUMENT_MAPPING = { "MONO": [], Loading Loading @@ -110,6 +111,16 @@ def test_format_switching ( with TemporaryDirectory() as tmp_dir: bitstreams = [] rtpdumps = [] codec=CODECS.IVAS #if key is "MONO": # codec=CODECS.EVS #else: # codec=CODECS.IVAS rtpPacker = IvasRtp(numFramesPerPacket=1, codec=codec) piData = dict() requestsData = dict() # Encode subformats for key, audioFile in FORMAT_TO_FILE_COMPARETEST.items(): Loading @@ -126,6 +137,7 @@ def test_format_switching ( encoder_args += FORMAT_TO_METADATA_FILES[key[:4]] temp_bitstream = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.bts").absolute() temp_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-{key}.rtpdump").absolute() dut_encoder_frontend.run( bitrate=bitrate, Loading @@ -140,24 +152,39 @@ def test_format_switching ( bitstreams.append(temp_bitstream) # Combine bitstreams cat_bitstream_full = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-FULL-CAT.bts").absolute() cat_bitstream_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.bts").absolute() catBsFull = bytes() cat_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-CAT.rtpdump").absolute() cat_rtpdump_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.rtpdump").absolute() catBsNoEVS = bytes() catRTP = bytes() catRTPnoEVS = bytes() for bsFile in bitstreams: with open (bsFile, mode="rb") as fd: tempRead = fd.read() catBsFull += tempRead if "MONO" not in str(bsFile): catBsNoEVS += tempRead with open (cat_bitstream_full, mode="wb") as outFile: outFile.write(catBsFull) with open (bsFile, mode="rb") as fd: catBsNoEVS += fd.read() with open (cat_bitstream_no_evs, mode="wb") as outFile: outFile.write(catBsNoEVS) # TODO: also pack EVS packets (while increasing timestamp and sequence number) # Pack to RTP packets rtpPacker.packG192File(g192File=cat_bitstream_no_evs, rtpDumpOut=cat_rtpdump_no_evs, piData=piData, requestsData=requestsData) #rtpdumps.append(temp_rtpdump) #for rtpdumpFile in rtpdumps: # with open (rtpdumpFile, mode="rb") as fd: # tempBits = fd.read() # catRTP += tempBits # if "MONO" not in str(rtpdumpFile): # catRTPnoEVS += tempBits #with open (cat_rtpdump, mode="wb") as outFile: # outFile.write(catRTP) #with open (cat_rtpdump_no_evs, mode="wb") as outFile: # outFile.write(catRTPnoEVS) # Decode the combined bitstreams cat_output_full = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-FULL-CAT.wav").absolute() cat_output_no_evs = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}-NO-EVS-CAT.wav").absolute() cat_output_rtpdump = Path(tmp_dir).joinpath(f"output-{bitrate}-{bandwidth}.wav").absolute() dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, Loading @@ -168,8 +195,8 @@ def test_format_switching ( dut_decoder_frontend.run( output_config=outMode, output_sampling_rate=48, input_bitstream_path=cat_bitstream_full, output_path=cat_output_full, add_option_list= [] input_bitstream_path=cat_rtpdump, output_path=cat_output_rtpdump, add_option_list= ["-VOIP_HF_ONLY=1"] )