Loading ci/basop-pages/create_report_pages.py +17 −5 Original line number Diff line number Diff line Loading @@ -112,11 +112,18 @@ def create_subpage( ) write_out_csv(merged_reports, merged_reports[0].keys(), csv_out) table_header_a = "".join([TH_TMPL_GLOBAL.format(c) for c in COLUMNS_GLOBAL] + [TH_TMPL_DIFFERENTIAL.format(c) for c in COLUMNS_DIFFERENTIAL]) table_header_a = "".join( [TH_TMPL_GLOBAL.format(c) for c in COLUMNS_GLOBAL] + [TH_TMPL_DIFFERENTIAL.format(c) for c in COLUMNS_DIFFERENTIAL] ) table_header_b = list() for c in COLUMNS_DIFFERENTIAL: table_header_b.append(TH_TMPL_SECOND_ROW.format(f"Previous Run<br>ID: {id_previous}")) table_header_b.append(TH_TMPL_SECOND_ROW.format(f"Current Run<br>ID: {id_current}")) table_header_b.append( TH_TMPL_SECOND_ROW.format(f"Previous Run<br>ID: {id_previous}") ) table_header_b.append( TH_TMPL_SECOND_ROW.format(f"Current Run<br>ID: {id_current}") ) table_header_b = "".join(table_header_b) table_body = "\n".join( tr_from_row(row, id_current, id_previous) for row in merged_reports Loading Loading @@ -242,8 +249,13 @@ def merge_and_cleanup_mld_reports( return diff other_col_pairs = [(f"{col}-{id_previous}", f"{col}-{id_current}") for col in COLUMNS_DIFFERENTIAL_NOT_MLD] merged = sorted(merged, key=partial(sort_func, other_col_pairs=other_col_pairs), reverse=True) other_col_pairs = [ (f"{col}-{id_previous}", f"{col}-{id_current}") for col in COLUMNS_DIFFERENTIAL_NOT_MLD ] merged = sorted( merged, key=partial(sort_func, other_col_pairs=other_col_pairs), reverse=True ) # remove the unecessary whole path from the testcase names for row in merged: Loading scripts/pyaudio3dtools/audioarray.py +45 −31 Original line number Diff line number Diff line Loading @@ -342,8 +342,14 @@ def compare( for i in range(nchannels): tmpfile_ref = Path(tmpdir).joinpath(f"ref_ch{i+1}.wav") tmpfile_test = Path(tmpdir).joinpath(f"test_ch{i+1}.wav") r48 = np.clip( resample(ref[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) # Convert to float for resample, then to int16 for wavfile.write t48 = np.clip( resample(test[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) r48 = np.clip( resample(ref[:, i].astype(float), fs, 48000), -32768, 32767 ).astype( np.int16 ) # Convert to float for resample, then to int16 for wavfile.write t48 = np.clip( resample(test[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_ref), 48000, r48) wavfile.write(str(tmpfile_test), 48000, t48) out = subprocess.check_output([mld, tmpfile_ref, tmpfile_test]) Loading @@ -355,7 +361,13 @@ def compare( # length of segment is always 20ms len_seg = int(0.02 * fs) print(len_seg, ref.shape, test.shape) result["SSNR"] = ssnr(ref, test, len_seg, thresh_low=ssnr_thresh_low, thresh_high=ssnr_thresh_high) result["SSNR"] = ssnr( ref, test, len_seg, thresh_low=ssnr_thresh_low, thresh_high=ssnr_thresh_high, ) return result Loading Loading @@ -575,7 +587,9 @@ def ssnr( # for that channel and the division here would trigger a warning. We supress the warning and later # set the SSNR for those channels to -inf manually instead (overwriting later is simply easier than adding ifs here) with warnings.catch_warnings(): ssnr = np.round(10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2) ssnr = np.round( 10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2 ) ssnr[segment_counter == 0] = -np.inf return ssnr scripts/ssnr.py +10 −4 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ def main(args): len_seg = int(20 * fs_ref / 1000) print(len_seg, ref_sig.shape, test_sig.shape) ssnr = audioarray.ssnr(ref_sig, test_sig, len_seg, args.thresh_low, args.thresh_high) ssnr = audioarray.ssnr( ref_sig, test_sig, len_seg, args.thresh_low, args.thresh_high ) for i, s in enumerate(ssnr, start=1): print(f"Channel {i}: {s}") Loading @@ -29,10 +31,14 @@ if __name__ == "__main__": "test_file", type=pathlib.Path, help="Signal under test wav file" ) parser.add_argument( "--thresh_low", type=float, default="-inf", "--thresh_low", type=float, default="-inf", ) parser.add_argument( "--thresh_high", type=float, default="inf", "--thresh_high", type=float, default="inf", ) args = parser.parse_args() Loading tests/cmp_pcm.py +12 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,12 @@ def cmp_pcm( else: nchannels = pyivastest.constants.OC_TO_NCHANNELS[out_config.upper()] s1, _ = pyaudio3dtools.audiofile.readfile(ref_file, nchannels, fs, outdtype=np.int16) s2, _ = pyaudio3dtools.audiofile.readfile(cmp_file, nchannels, fs, outdtype=np.int16) s1, _ = pyaudio3dtools.audiofile.readfile( ref_file, nchannels, fs, outdtype=np.int16 ) s2, _ = pyaudio3dtools.audiofile.readfile( cmp_file, nchannels, fs, outdtype=np.int16 ) # In case of wav input, override the nchannels with the one from the wav header nchannels = s1.shape[1] Loading @@ -63,7 +67,12 @@ def cmp_pcm( return 1, reason cmp_result = pyaudio3dtools.audioarray.compare( s1, s2, fs, per_frame=False, get_mld=get_mld, get_ssnr=get_ssnr, s1, s2, fs, per_frame=False, get_mld=get_mld, get_ssnr=get_ssnr, ) output_differs = 0 Loading tests/conftest.py +10 −2 Original line number Diff line number Diff line Loading @@ -366,7 +366,11 @@ class EncoderFrontend: try: result = run( command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir, ) except TimeoutExpired: pytest.fail(f"{self._type} encoder run timed out after {self.timeout}s.") Loading Loading @@ -565,7 +569,11 @@ class DecoderFrontend: try: result = run( command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir, ) except TimeoutExpired: pytest.fail(f"{self._type} decoder run timed out after {self.timeout}s.") Loading Loading
ci/basop-pages/create_report_pages.py +17 −5 Original line number Diff line number Diff line Loading @@ -112,11 +112,18 @@ def create_subpage( ) write_out_csv(merged_reports, merged_reports[0].keys(), csv_out) table_header_a = "".join([TH_TMPL_GLOBAL.format(c) for c in COLUMNS_GLOBAL] + [TH_TMPL_DIFFERENTIAL.format(c) for c in COLUMNS_DIFFERENTIAL]) table_header_a = "".join( [TH_TMPL_GLOBAL.format(c) for c in COLUMNS_GLOBAL] + [TH_TMPL_DIFFERENTIAL.format(c) for c in COLUMNS_DIFFERENTIAL] ) table_header_b = list() for c in COLUMNS_DIFFERENTIAL: table_header_b.append(TH_TMPL_SECOND_ROW.format(f"Previous Run<br>ID: {id_previous}")) table_header_b.append(TH_TMPL_SECOND_ROW.format(f"Current Run<br>ID: {id_current}")) table_header_b.append( TH_TMPL_SECOND_ROW.format(f"Previous Run<br>ID: {id_previous}") ) table_header_b.append( TH_TMPL_SECOND_ROW.format(f"Current Run<br>ID: {id_current}") ) table_header_b = "".join(table_header_b) table_body = "\n".join( tr_from_row(row, id_current, id_previous) for row in merged_reports Loading Loading @@ -242,8 +249,13 @@ def merge_and_cleanup_mld_reports( return diff other_col_pairs = [(f"{col}-{id_previous}", f"{col}-{id_current}") for col in COLUMNS_DIFFERENTIAL_NOT_MLD] merged = sorted(merged, key=partial(sort_func, other_col_pairs=other_col_pairs), reverse=True) other_col_pairs = [ (f"{col}-{id_previous}", f"{col}-{id_current}") for col in COLUMNS_DIFFERENTIAL_NOT_MLD ] merged = sorted( merged, key=partial(sort_func, other_col_pairs=other_col_pairs), reverse=True ) # remove the unecessary whole path from the testcase names for row in merged: Loading
scripts/pyaudio3dtools/audioarray.py +45 −31 Original line number Diff line number Diff line Loading @@ -342,8 +342,14 @@ def compare( for i in range(nchannels): tmpfile_ref = Path(tmpdir).joinpath(f"ref_ch{i+1}.wav") tmpfile_test = Path(tmpdir).joinpath(f"test_ch{i+1}.wav") r48 = np.clip( resample(ref[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) # Convert to float for resample, then to int16 for wavfile.write t48 = np.clip( resample(test[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) r48 = np.clip( resample(ref[:, i].astype(float), fs, 48000), -32768, 32767 ).astype( np.int16 ) # Convert to float for resample, then to int16 for wavfile.write t48 = np.clip( resample(test[:, i].astype(float), fs, 48000), -32768, 32767 ).astype(np.int16) wavfile.write(str(tmpfile_ref), 48000, r48) wavfile.write(str(tmpfile_test), 48000, t48) out = subprocess.check_output([mld, tmpfile_ref, tmpfile_test]) Loading @@ -355,7 +361,13 @@ def compare( # length of segment is always 20ms len_seg = int(0.02 * fs) print(len_seg, ref.shape, test.shape) result["SSNR"] = ssnr(ref, test, len_seg, thresh_low=ssnr_thresh_low, thresh_high=ssnr_thresh_high) result["SSNR"] = ssnr( ref, test, len_seg, thresh_low=ssnr_thresh_low, thresh_high=ssnr_thresh_high, ) return result Loading Loading @@ -575,7 +587,9 @@ def ssnr( # for that channel and the division here would trigger a warning. We supress the warning and later # set the SSNR for those channels to -inf manually instead (overwriting later is simply easier than adding ifs here) with warnings.catch_warnings(): ssnr = np.round(10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2) ssnr = np.round( 10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2 ) ssnr[segment_counter == 0] = -np.inf return ssnr
scripts/ssnr.py +10 −4 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ def main(args): len_seg = int(20 * fs_ref / 1000) print(len_seg, ref_sig.shape, test_sig.shape) ssnr = audioarray.ssnr(ref_sig, test_sig, len_seg, args.thresh_low, args.thresh_high) ssnr = audioarray.ssnr( ref_sig, test_sig, len_seg, args.thresh_low, args.thresh_high ) for i, s in enumerate(ssnr, start=1): print(f"Channel {i}: {s}") Loading @@ -29,10 +31,14 @@ if __name__ == "__main__": "test_file", type=pathlib.Path, help="Signal under test wav file" ) parser.add_argument( "--thresh_low", type=float, default="-inf", "--thresh_low", type=float, default="-inf", ) parser.add_argument( "--thresh_high", type=float, default="inf", "--thresh_high", type=float, default="inf", ) args = parser.parse_args() Loading
tests/cmp_pcm.py +12 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,12 @@ def cmp_pcm( else: nchannels = pyivastest.constants.OC_TO_NCHANNELS[out_config.upper()] s1, _ = pyaudio3dtools.audiofile.readfile(ref_file, nchannels, fs, outdtype=np.int16) s2, _ = pyaudio3dtools.audiofile.readfile(cmp_file, nchannels, fs, outdtype=np.int16) s1, _ = pyaudio3dtools.audiofile.readfile( ref_file, nchannels, fs, outdtype=np.int16 ) s2, _ = pyaudio3dtools.audiofile.readfile( cmp_file, nchannels, fs, outdtype=np.int16 ) # In case of wav input, override the nchannels with the one from the wav header nchannels = s1.shape[1] Loading @@ -63,7 +67,12 @@ def cmp_pcm( return 1, reason cmp_result = pyaudio3dtools.audioarray.compare( s1, s2, fs, per_frame=False, get_mld=get_mld, get_ssnr=get_ssnr, s1, s2, fs, per_frame=False, get_mld=get_mld, get_ssnr=get_ssnr, ) output_differs = 0 Loading
tests/conftest.py +10 −2 Original line number Diff line number Diff line Loading @@ -366,7 +366,11 @@ class EncoderFrontend: try: result = run( command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir, ) except TimeoutExpired: pytest.fail(f"{self._type} encoder run timed out after {self.timeout}s.") Loading Loading @@ -565,7 +569,11 @@ class DecoderFrontend: try: result = run( command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir command, capture_output=True, check=False, timeout=self.timeout, cwd=run_dir, ) except TimeoutExpired: pytest.fail(f"{self._type} decoder run timed out after {self.timeout}s.") Loading