diff --git a/ci/complexity_measurements/mergeNewsletterRam.py b/ci/complexity_measurements/mergeNewsletterRam.py index 40b5f75c59a3f6af23f155d1177463d3b99d0e1d..d578b51c56f8b7a4cf6dee50c87f0d94d7c64422 100755 --- a/ci/complexity_measurements/mergeNewsletterRam.py +++ b/ci/complexity_measurements/mergeNewsletterRam.py @@ -29,7 +29,6 @@ # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. import csv -import re import sys newsletterFilename = "" diff --git a/ci/complexity_measurements/mergeNewsletterRom.py b/ci/complexity_measurements/mergeNewsletterRom.py index 0e75f26f5867341f3c3a37ee292698d04ba9dbd0..b46e6c55709ee8c401cec78554218f8cff283bf7 100755 --- a/ci/complexity_measurements/mergeNewsletterRom.py +++ b/ci/complexity_measurements/mergeNewsletterRom.py @@ -29,7 +29,6 @@ # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. import csv -import re import sys newsletterFilename = "" diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 62d3f730bc5b225f5e2f1bab6bac7b5c3f359c34..a191d1bf3967a79ca83e585388ea631f4cec20cd 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1095,11 +1095,13 @@ void ivas_param_ism_dec_close( const AUDIO_CONFIG output_config /* i : output audio configuration */ ); +#ifndef FIX_1022_REMOVE_PARAMISM_DEC void ivas_param_ism_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#endif void ivas_ism_dec_digest_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -3867,11 +3869,13 @@ void ivas_param_mc_dec_render( float *output_f[] /* o : rendered time signal */ ); +#ifndef FIX_1023_REMOVE_PARAMMC_DEC void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#endif /*! r: number of cldfb synthesis instances */ int16_t param_mc_get_num_cldfb_syntheses( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ @@ -5214,6 +5218,9 @@ void ivas_ism_renderer_close( void ivas_ism_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + const RENDERER_TYPE renderer_type, /* i : active renderer type */ +#endif float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t n_samples_to_render /* i : output frame length per channel */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 52357d6c25210c34323435d170e21d6ace5d3190..7b6179c5c6652986470e948fdf476fa595bf98f9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,6 +157,9 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ +#define FIX_1024_REMOVE_PARAMMC_MIXING_MAT /* VA: issue 1024: remove unused function ivas_param_mc_get_mono_stereo_mixing_matrices() */ +#define FIX_1023_REMOVE_PARAMMC_DEC /* VA: issue 1023: remove unused function ivas_param_mc_dec() */ +#define FIX_1022_REMOVE_PARAMISM_DEC /* VA: issue 1022: remove unused function ivas_param_ism_dec() */ /* #################### End BE switches ################################## */ @@ -164,6 +167,7 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ +#define NONBE_FIX_1021_ISM_BRIR_RS_FLUSH /* FhG: issue #1021: fix ISM with JBM and RS renderer flushing*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 9d1e179c8b6fdb2c12f247094d0dd2498e063fba..9337ccb08a0a1313e7a5fbb9474ad1226874d0c6 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -324,7 +324,7 @@ static void ivas_param_ism_render_slot( return; } - +#ifndef FIX_1022_REMOVE_PARAMISM_DEC static void ivas_param_ism_rendering( PARAM_ISM_DEC_HANDLE hParamIsmDec, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, @@ -361,7 +361,7 @@ static void ivas_param_ism_rendering( return; } - +#endif static ivas_error ivas_param_ism_rendering_init( PARAM_ISM_RENDERING_HANDLE hParamIsmRendering, @@ -729,7 +729,7 @@ void ivas_param_ism_dec_close( return; } - +#ifndef FIX_1022_REMOVE_PARAMISM_DEC /*-------------------------------------------------------------------------* * ivas_param_ism_dec() * @@ -973,7 +973,7 @@ void ivas_param_ism_dec( return; } - +#endif /*-------------------------------------------------------------------------* * ivas_ism_dec_digest_tc() @@ -1121,7 +1121,7 @@ void ivas_param_ism_dec_digest_tc( nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; } - push_wmops( "ivas_param_ism_dec" ); + push_wmops( "ivas_param_ism_dec_digest_tc" ); /* general setup */ ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator ); @@ -1533,8 +1533,10 @@ void ivas_param_ism_params_to_masa_param_mapping( st_ivas->hISMDTX.dtx_flag = 1; } +#ifndef FIX_1022_REMOVE_PARAMISM_DEC if ( st_ivas->nchan_ism > 1 ) { +#endif if ( st_ivas->hISMDTX.dtx_flag ) { float energy_ratio; @@ -1598,6 +1600,7 @@ void ivas_param_ism_params_to_masa_param_mapping( } } } +#ifndef FIX_1022_REMOVE_PARAMISM_DEC } else { @@ -1617,6 +1620,7 @@ void ivas_param_ism_params_to_masa_param_mapping( } } } +#endif return; } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 7b321c523b80740d052f2ef276032d04cd8085b4..33e05a0e6a99c67be570a43642640a1e520fa0af 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -140,7 +140,10 @@ void ivas_ism_renderer_close( *-------------------------------------------------------------------------*/ void ivas_ism_render_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + const RENDERER_TYPE renderer_type, /* i : active renderer type */ +#endif float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t n_samples_to_render /* i : output frame length per channel */ ) @@ -172,12 +175,15 @@ void ivas_ism_render_sf( assert( slots_to_render == 0 ); assert( last_sf <= st_ivas->hTcBuffer->nb_subframes ); #endif - +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + num_objects = st_ivas->nchan_ism; +#else num_objects = st_ivas->nchan_transport; if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { num_objects = st_ivas->nchan_ism; } +#endif nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; @@ -282,7 +288,11 @@ void ivas_ism_render_sf( n_samples_rendered_loop += n_samples_in_subframe; /* update rendered subframe and slots info for all cases apart from a following crend call, the update will then happen in the crend call*/ +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + if ( renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) +#else if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) +#endif { st_ivas->hTcBuffer->subframes_rendered += 1; st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index c7ad64a60afbba35711ec1cc73babb9a64489e9f..1c550fa68f77e49e5bbbdaad70db6bcdfdbe2d80 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1093,7 +1093,11 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output, *nSamplesRendered ); +#else ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); +#endif } else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { @@ -1231,7 +1235,11 @@ ivas_error ivas_jbm_dec_render( } /* render objects */ +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output, *nSamplesRendered ); +#else ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); +#endif /* add already rendered SBA part */ for ( n = 0; n < nchan_out; n++ ) @@ -1628,7 +1636,11 @@ ivas_error ivas_jbm_dec_flush_renderer( /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ set_f( st_ivas->hIsmRendererData->interpolator, 1.0f, hTcBuffer->n_samples_granularity ); +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + ivas_ism_render_sf( st_ivas, renderer_type_old, p_output, hTcBuffer->n_samples_granularity ); +#else ivas_ism_render_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ); +#endif #if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 70f01eb927619225ace8f1522b0415eae1629ce6..21bdcfb85685db3d9740dc9444db27b046d734e2 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -88,8 +88,10 @@ static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); +#ifndef FIX_1024_REMOVE_PARAMMC_MIXING_MAT static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); +#endif static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); @@ -1454,15 +1456,19 @@ void ivas_param_mc_dec_digest_tc( } +#ifndef FIX_1024_REMOVE_PARAMMC_MIXING_MAT if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); } else { +#endif /* generate mixing matrices */ ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); +#ifndef FIX_1024_REMOVE_PARAMMC_MIXING_MAT } +#endif pop_wmops(); @@ -1471,9 +1477,9 @@ void ivas_param_mc_dec_digest_tc( /*------------------------------------------------------------------------- - * ivas_param_mc_dec() + * ivas_param_mc_dec_render() * - * Parametric MC decoding process + * Parametric MC rendering process *------------------------------------------------------------------------*/ void ivas_param_mc_dec_render( @@ -1809,6 +1815,8 @@ void ivas_param_mc_dec_render( return; } + +#ifndef FIX_1023_REMOVE_PARAMMC_DEC /*------------------------------------------------------------------------- * ivas_param_mc_dec() * @@ -1848,6 +1856,7 @@ void ivas_param_mc_dec( pop_wmops(); return; } +#endif /*------------------------------------------------------------------------- * param_mc_dec_init() @@ -2445,7 +2454,7 @@ static void ivas_param_mc_get_mixing_matrices( return; } - +#ifndef FIX_1024_REMOVE_PARAMMC_MIXING_MAT /*------------------------------------------------------------------------- * ivas_param_mc_get_mono_stereo_mixing_matrices() * @@ -2566,7 +2575,7 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( return; } - +#endif /*------------------------------------------------------------------------- * param_mc_update_mixing_matrices() diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 6585db587e12be2c683a5c4edafeb23bdd76f3d0..65e05f78be7ca22ed2063d4196bba570bddb9241 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -284,7 +284,11 @@ ivas_error ivas_osba_render_sf( if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef NONBE_FIX_1021_ISM_BRIR_RS_FLUSH + ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output_ism, *nSamplesRendered ); +#else ivas_ism_render_sf( st_ivas, p_output_ism, *nSamplesRendered ); +#endif } for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 75015f7aeb06f4ef8006039cf22af78862d5e076..b66e02e1eeb4b6a09c8eb2d0679a623507c36f80 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -973,7 +973,11 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); set_zero( target_ch_ener, MAX_OUTPUT_CHANNELS ); +#ifdef FIX_1024_REMOVE_PARAMMC_MIXING_MAT + /* Step 1.2, get target channel energies for the transported format, Nrqq calculation */ +#else /* Step 1.2, get target channel energies for the transported format as in ivas_param_mc_get_mono_stereo_mixing_matrices(), Nrqq calculation */ +#endif ild_q = hParamMC->icld_q + bandIdx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe; for ( chInIdx = 0; chInIdx < nchan_transport_format; chInIdx++ ) @@ -991,7 +995,11 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( Nrqq[hParamMC->hMetadataPMC->ild_mapping_conf->ild_index[chInIdx]] = powf( 10.0f, ild_q[chInIdx] / 10.0f ) * hParamMC->hMetadataPMC->ild_factors[chInIdx] * ref_ener; } +#ifdef FIX_1024_REMOVE_PARAMMC_MIXING_MAT + /* Step 1.3 get target Cy (with dmx matrix from CICPX to MONO/STEREO saved in hParamMC) */ +#else /* Step 1.3 get target Cy like in ivas_param_mc_get_mono_stereo_mixing_matrices() (with dmx matrix from CICPX to MONO/STEREO saved in hParamMC) */ +#endif for ( chOutIdx = 0; chOutIdx < nchan_out; chOutIdx++ ) { for ( i = 0; i < nchan_transport_format; i++ ) diff --git a/scripts/batch_comp_audio.py b/scripts/batch_comp_audio.py index 6854f41f30fb9e39b9cab8efc121f65d01840bc0..ce1f380c568c4bd1073686371490d7714722cf29 100755 --- a/scripts/batch_comp_audio.py +++ b/scripts/batch_comp_audio.py @@ -33,7 +33,6 @@ import argparse import concurrent.futures import os -import pathlib import re import shutil import subprocess @@ -132,7 +131,7 @@ def main(args): if num_files_diff > 0: print(f"{num_files_diff} files differ/don't exist") else: - print(f"All files are bitexact") + print("All files are bitexact") def compare_files(f, fol1, fol2, outputs_dict, tool): diff --git a/scripts/mem_analysis.py b/scripts/mem_analysis.py index e3f3d8afe40d1e83b06e1a9e32ce254a0529b5a7..18d1e3a554c2819bce237f2c5dedb9a9b4ab02d5 100644 --- a/scripts/mem_analysis.py +++ b/scripts/mem_analysis.py @@ -1,10 +1,7 @@ #!/usr/bin/env python3 import argparse -import csv import os -import struct -import sys import matplotlib.pyplot as plt import numpy as np diff --git a/scripts/parse_mld.py b/scripts/parse_mld.py deleted file mode 100644 index b999e839032a3204e2b068a38f364779b46def94..0000000000000000000000000000000000000000 --- a/scripts/parse_mld.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import re - -# Main routine -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Parse HTML report to extract MLD values" - ) - parser.add_argument( - "html_report", type=str, help="HTML report input file, e.g. report.html" - ) - parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. output.csv") - args = parser.parse_args() - html_report = args.html_report - csv_file = args.csv_file - - mld = {} - - with open(html_report, "r") as infile: - for line in infile.readlines(): - if "col-name" in line: - test_name = re.search("\[(.*)\]", line).group(1) - mld[test_name] = 0.0 - if "MLD" in line: - mld_val = float(line.split()[1]) - mld[test_name] = mld_val - - with open(csv_file, "w") as outfile: - for test_name in mld: - outfile.write(test_name + ";" + str(mld[test_name]) + "\n") diff --git a/scripts/parse_mld_xml.py b/scripts/parse_mld_xml.py index fb1dc8e73ab38e7a73582aa00d051ca2241eaf3e..84acf4fbba7df736869137058ba935f4dd8e3fba 100644 --- a/scripts/parse_mld_xml.py +++ b/scripts/parse_mld_xml.py @@ -4,9 +4,12 @@ import argparse from xml.etree import ElementTree """ -Parse a junit report and create a MLD summary report. +Parse a junit report and create an MLD summary report. """ +PROPERTIES = ["MLD", "MAXIMUM ABS DIFF"] + + # Main routine if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -30,22 +33,32 @@ if __name__ == "__main__": ) testcases = tree.findall(".//testcase") + + results_unsorted = {} + + for testcase in testcases: + if testcase.find(".//skipped") is None: + if testcase.get("file") is None: + fulltestname = ( + testcase.get("classname").replace(".", "/") + + ".py::" + + testcase.get("name") + ) + else: + fulltestname = testcase.get("file") + "::" + testcase.get("name") + + properties_found = { + p.get("name"): p.get("value") + for p in testcase.findall(".//property") + } + properties_values = [str(properties_found.get(p)) for p in PROPERTIES] + outline = ";".join([fulltestname] + properties_values) + "\n" + results_unsorted[fulltestname] = outline + + results_sorted = dict(sorted(results_unsorted.items())) with open(csv_file, "w") as outfile: - for testcase in testcases: - if testcase.find(".//skipped") == None: - if testcase.get("file") == None: - fulltestname = ( - testcase.get("classname").replace(".", "/") - + ".py::" - + testcase.get("name") - ) - else: - fulltestname = testcase.get("file") + "::" + testcase.get("name") - if testcase.find(".//property") == None: - mld_val = None - else: - mld_val = testcase.find(".//property").get( - "value" - ) # Currently MLD is the only set property. If more are added updates are needed here. - outfile.write(fulltestname + ";" + str(mld_val) + "\n") + headerline = ";".join(["testcase"] + PROPERTIES) + "\n" + outfile.write(headerline) + for test in results_sorted: + outfile.write(results_sorted[test]) diff --git a/scripts/prepare_combined_format_inputs.py b/scripts/prepare_combined_format_inputs.py index c081b75bb10c64989837b0d60011221e209b3df2..bb406a30b642d4b5497a045d70f74d2301933230 100755 --- a/scripts/prepare_combined_format_inputs.py +++ b/scripts/prepare_combined_format_inputs.py @@ -33,8 +33,7 @@ __license__ = """ import os import shutil -import numpy as np -from pyaudio3dtools import audioarray, audiofile +from pyaudio3dtools import audiofile def main(): diff --git a/scripts/pyaudio3dtools/__init__.py b/scripts/pyaudio3dtools/__init__.py index ccf53c51e1867d876f81f3642641c04d54793cd1..3df489f58206a0dac25e92b46dc773bde45fc40b 100644 --- a/scripts/pyaudio3dtools/__init__.py +++ b/scripts/pyaudio3dtools/__init__.py @@ -40,4 +40,3 @@ Imports functions class """ -from . import audioarray, audiofile, spatialaudioformat diff --git a/scripts/pyaudio3dtools/audio3dtools.py b/scripts/pyaudio3dtools/audio3dtools.py index 0fec5c6ce977fa6dafdb61dbfef3c98b61128621..22c26e28e8759a18a9de33da276d61250d78aac2 100755 --- a/scripts/pyaudio3dtools/audio3dtools.py +++ b/scripts/pyaudio3dtools/audio3dtools.py @@ -30,11 +30,8 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ -import argparse import logging -import os -from pyaudio3dtools import audiofile, spatialaudioformat main_logger = logging.getLogger("__main__") logger = main_logger.getChild(__name__) @@ -43,7 +40,7 @@ logger.setLevel(logging.DEBUG) def main(): print( - f"These scripts have been deprecated! Please check out and use the latest version from https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts.git" + "These scripts have been deprecated! Please check out and use the latest version from https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts.git" ) diff --git a/scripts/pyaudio3dtools/audiofile.py b/scripts/pyaudio3dtools/audiofile.py index d3153e21db5caa82f12eb95177176d38761811fc..e614bfbd49fa3a72209ef10cb6f4791c52ba8204 100644 --- a/scripts/pyaudio3dtools/audiofile.py +++ b/scripts/pyaudio3dtools/audiofile.py @@ -36,7 +36,6 @@ import shutil import struct import subprocess as sp import warnings -from importlib import import_module from tempfile import TemporaryDirectory from typing import Optional, Tuple @@ -662,37 +661,6 @@ def loudnessinfo( return measured_loudness, scale_factor -def print_plot_play(x: np.ndarray, fs: int, text: Optional[str] = "") -> None: - """1. Prints information about an audio signal, 2. plots the waveform, and 3. Creates player - - Parameters - ---------- - x: np array - Input signal - fs: int - Input sampling rate - text: Optional[str] = '' - text to print - Returns - ------- - None - - """ - - plt = import_module("matplotlib.pyplot") - ipd = import_module("IPython.display") - - print("%s fs = %d, x.shape = %s, x.dtype = %s" % (text, fs, x.shape, x.dtype)) - plt.figure(figsize=(8, 2)) - plt.plot(x, color="gray") - plt.xlim([0, x.shape[0]]) - plt.xlabel("Time (samples)") - plt.ylabel("Amplitude") - plt.tight_layout() - plt.show() - ipd.display(ipd.Audio(data=x, rate=fs)) - - def get_wav_file_info(filename: str) -> dict: """ Get the format information from a WAV file. diff --git a/scripts/pyivastest/IvasBaseClass.py b/scripts/pyivastest/IvasBaseClass.py index bad578f75357b1d6431f54a9316bba84a0a0ea7d..c7c734c5c9733dc64da7b89bc891175d9d384462 100644 --- a/scripts/pyivastest/IvasBaseClass.py +++ b/scripts/pyivastest/IvasBaseClass.py @@ -30,7 +30,6 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ -import filecmp import json import logging import logging.handlers diff --git a/scripts/pyivastest/IvasModeCollector.py b/scripts/pyivastest/IvasModeCollector.py index 3255dc3a8ac527521f862d4198d9e0dfa5a3d5f4..90274544dcd38a809839eabdcb6f374b888d8263 100644 --- a/scripts/pyivastest/IvasModeCollector.py +++ b/scripts/pyivastest/IvasModeCollector.py @@ -34,8 +34,6 @@ import json import logging import os import os.path -import platform -import re from copy import deepcopy from pyivastest import IvasBaseClass, constants diff --git a/scripts/pyivastest/IvasModeRunner.py b/scripts/pyivastest/IvasModeRunner.py index 27f013ee8dc9844d24f4d71265b6e6eb903117d7..41dd4d20ab0f296d72b204c6482a50c955e689ed 100644 --- a/scripts/pyivastest/IvasModeRunner.py +++ b/scripts/pyivastest/IvasModeRunner.py @@ -35,8 +35,6 @@ import json import logging import logging.handlers import os -import platform -import re import subprocess import threading import time diff --git a/scripts/self_test.py b/scripts/self_test.py index c41e19993901b4b9a9802b117331a8c8903f49fb..714366bcf1cd6a426c74428a951e4c45743bafeb 100755 --- a/scripts/self_test.py +++ b/scripts/self_test.py @@ -32,8 +32,6 @@ import errno -import multiprocessing -import operator import os import platform import re diff --git a/tests/cmp_pcm.py b/tests/cmp_pcm.py index 13a1c1ba5ab9180d05ca5adb2ac2e18fb045feb9..c7df4b800d8f47db19131ef43b216c57adb43180 100755 --- a/tests/cmp_pcm.py +++ b/tests/cmp_pcm.py @@ -49,21 +49,30 @@ def cmp_pcm(file1, file2, out_config, fs, get_mld=False, mld_lim=0) -> (int, str s1, s2, fs, per_frame=False, get_mld=get_mld ) - if cmp_result["bitexact"]: - return 0, "SUCCESS: Files are bitexact" - else: + output_differs = 0 + reason = "SUCCESS: Files are bitexact" + + if not cmp_result["bitexact"]: diff_msg = f"MAXIMUM ABS DIFF ==> {cmp_result['max_abs_diff']} at sample num {cmp_result['max_abs_diff_pos_sample']} (assuming {nchannels} channels)" first_msg = f"First diff found at sample num {cmp_result['first_diff_pos_sample']} in channel {cmp_result['first_diff_pos_channel']}, frame {cmp_result['first_diff_pos_frame']} (assuming {nchannels} channels, {fs} sampling rate)" print(diff_msg) print(first_msg) - if get_mld: - mld_msg = f"MLD: {cmp_result['MLD']}" - print(mld_msg) - if cmp_result["MLD"] <= mld_lim: - return 0, f"MLD: {cmp_result['MLD']} <= {mld_lim}" - else: - return 1, f"MLD: {cmp_result['MLD']} > {mld_lim}" - return 1, "Non-BE" + + reason = f"Non-BE - MAXIMUM ABS DIFF: {cmp_result['max_abs_diff']}" + output_differs = 1 + + if get_mld: + mld_msg = f"MLD: {cmp_result['MLD']}" + reason += " - " + mld_msg + print(mld_msg) + + if cmp_result["MLD"] <= mld_lim: + output_differs = 0 + reason += f" <= {mld_lim}" + else: + reason += f" > {mld_lim}" + + return output_differs, reason if __name__ == "__main__": diff --git a/tests/codec_be_on_mr_nonselection/__init__.py b/tests/codec_be_on_mr_nonselection/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..aba85788e77b1889a019b49dc761a76b04fa8ac4 100644 --- a/tests/codec_be_on_mr_nonselection/__init__.py +++ b/tests/codec_be_on_mr_nonselection/__init__.py @@ -0,0 +1,2 @@ +MLD_PATTERN = r"MLD: ([\d\.]*)" +MAX_DIFF_PATTERN = r"MAXIMUM ABS DIFF: (\d*)" diff --git a/tests/codec_be_on_mr_nonselection/test_masa_enc_dec.py b/tests/codec_be_on_mr_nonselection/test_masa_enc_dec.py index 75b01db3829d1e1786a2c9bd421f1c8007829713..9dc8ce9e6dbcae08effdb32ddf9f92a1fe4ef514 100644 --- a/tests/codec_be_on_mr_nonselection/test_masa_enc_dec.py +++ b/tests/codec_be_on_mr_nonselection/test_masa_enc_dec.py @@ -35,6 +35,7 @@ __doc__ = """ import errno import os +import re from filecmp import cmp from typing import Optional @@ -43,6 +44,8 @@ import pytest from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend +from . import MLD_PATTERN, MAX_DIFF_PATTERN + # params # output_mode_list = ['MONO', 'STEREO', '5_1', '7_1', '5_1_2', '5_1_4', '7_1_4', 'FOA', 'HOA2', 'HOA3', 'BINAURAL', 'BINAURAL_ROOM', 'EXT'] output_mode_list = ["BINAURAL", "EXT"] @@ -216,11 +219,15 @@ def test_masa_enc_dec( mld_lim=get_mld_lim, ) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + max_diff = 0 + if pcmcmp_res: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + if get_mld and get_mld_lim > 0: if pcmcmp_res != 0: pytest.fail(reason) @@ -248,10 +255,15 @@ def test_masa_enc_dec( mld_lim=get_mld_lim, ) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + + max_diff = 0 + if pcmcmp_res: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + # Report compare result if cmp_result != 0: pytest.fail(reason) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 459964a1861ce9447c73c10356ac896e5ea37ddd..890d530f825561e6a9e89e16ee8bdcff427b2ee1 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -35,6 +35,7 @@ Execute tests specified via a parameter file. import errno import filecmp import os +import re import platform from pathlib import Path from subprocess import run @@ -45,6 +46,7 @@ from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend from tests.cut_pcm import cut_samples from tests.testconfig import PARAM_FILE +from . import MLD_PATTERN, MAX_DIFF_PATTERN VALID_DEC_OUTPUT_CONF = [ "MONO", @@ -342,11 +344,15 @@ def test_param_file_tests( md_out_files = get_expected_md_files(ref_output_file, enc_split, output_config) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + max_diff =0 + if output_differs: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + metadata_differs = False for md_file in md_out_files: dut_metadata_file = Path(f"{dut_base_path}/param_file/dec/{md_file}") @@ -357,9 +363,9 @@ def test_param_file_tests( metadata_differs = True except FileNotFoundError: if not dut_metadata_file.exists(): - print(f"DUT output metadata missing for expected file: " + md_file) + print("DUT output metadata missing for expected file: " + md_file) if not ref_metadata_file.exists(): - print(f"REF output metadata missing for expected file: " + md_file) + print("REF output metadata missing for expected file: " + md_file) metadata_differs = True if get_mld and get_mld_lim > 0: diff --git a/tests/codec_be_on_mr_nonselection/test_sba_bs_dec_plc.py b/tests/codec_be_on_mr_nonselection/test_sba_bs_dec_plc.py index 11a8aeca04baf683bfdc67ee5f25f278e77f2b6b..5b52b9bd2f1c4f42bfd96b49a90b6a415f8ce784 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba_bs_dec_plc.py +++ b/tests/codec_be_on_mr_nonselection/test_sba_bs_dec_plc.py @@ -34,11 +34,13 @@ __doc__ = """ import errno import os +import re import pytest from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend +from . import MLD_PATTERN, MAX_DIFF_PATTERN # params tag_list = ["stvFOA"] @@ -209,11 +211,15 @@ def sba_dec_plc( mld_lim=get_mld_lim, ) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + max_diff = 0 + if cmp_result: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + # report compare result if cmp_result != 0: pytest.fail(reason) 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 4f4c1a3271ae86d8703bcafb2975dbab749d218c..0a07a0d1d7a6348b898111815c8293e3a1303195 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 @@ -35,6 +35,7 @@ __doc__ = """ import errno import os +import re import pytest from cut_bs import cut_from_start @@ -42,6 +43,7 @@ from cut_bs import cut_from_start from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend from tests.cut_pcm import cut_samples +from . import MLD_PATTERN, MAX_DIFF_PATTERN # params @@ -542,15 +544,15 @@ def sba_enc( if gain_flag != -1: short_tag_ext += f"_Gain{gain_flag}" if SID == 1: - short_tag_ext += f"_SID" + short_tag_ext += "_SID" if pca: - short_tag_ext += f"_pca" + short_tag_ext += "_pca" # to avoid conflicting names in case of parallel test execution, differentiate all cases long_tag_ext = "" if gain_flag != -1: long_tag_ext += f"_Gain{gain_flag}" if SID == 1: - long_tag_ext += f"_SID" + long_tag_ext += "_SID" dut_pkt_file = f"{dut_out_dir}/{tag_out}{long_tag_ext}.192" ref_pkt_file = f"{ref_out_dir}/{tag_out}{short_tag_ext}.192" ref_pkt_file_dutenc = f"{ref_out_dir}/{tag_out}{short_tag_ext}_dutenc.192" @@ -727,11 +729,15 @@ def sba_dec( mld_lim=get_mld_lim, ) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + max_diff = 0 + if cmp_result: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + # report compare result if cmp_result != 0: pytest.fail(reason) diff --git a/tests/codec_be_on_mr_selection/__init__.py b/tests/codec_be_on_mr_selection/__init__.py index 2ee63a30a5d04c539adf972895ac4db59a00e4b0..bf530e5ebcdb4ec62124cfdf960b4bc86c9174a6 100644 --- a/tests/codec_be_on_mr_selection/__init__.py +++ b/tests/codec_be_on_mr_selection/__init__.py @@ -174,7 +174,7 @@ def run_check( if not is_ref_creation: if compare_bitstream: if not is_be_to_ref(dut_bitstream): - pytest.fail(f"Bitstream file differs from reference") + pytest.fail("Bitstream file differs from reference") dut_bitstream_to_decoder = dut_bitstream if error_pattern is not None: diff --git a/tests/conftest.py b/tests/conftest.py index 37b528140336ab5f65872e8e9c94c5e59eb344e3..07004cad091aac0851115c9854bc99a64c1e1f80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -37,10 +37,9 @@ import os from tests import testconfig import pytest import platform -import tempfile import textwrap from pathlib import Path -from subprocess import STDOUT, CalledProcessError, TimeoutExpired, run +from subprocess import TimeoutExpired, run from typing import Optional, Union logger = logging.getLogger(__name__) diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index d80a328c14ff8b85dd5946c598796efc333f164d..e51f018f451ced981a72fa502103026a3b5543e4 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -67,7 +67,7 @@ def collect_files(file_ids): for f in TEST_VECTOR_DIR.iterdir() if f.suffix == ".wav" and any([id in f.name for id in file_ids]) - and not "_cut" in f.name + and "_cut" not in f.name ] return files diff --git a/tests/cut_pcm.py b/tests/cut_pcm.py index 644a2ba1bcddf774441a94b1ebe1f8b80974eaff..2abc86b624ff698cb4f216b6943cce067211c7b5 100755 --- a/tests/cut_pcm.py +++ b/tests/cut_pcm.py @@ -47,7 +47,6 @@ import platform import sys from pathlib import Path -import numpy as np HERE = Path(__file__).parent.resolve() SCRIPTS_DIR = str(HERE.joinpath("../scripts").resolve()) @@ -81,7 +80,7 @@ def cut_samples( ) if sample_rate is None and not str(in_file).endswith(".wav"): - raise ValueError(f"For non-wav files, samplerate must be explicitly given") + raise ValueError("For non-wav files, samplerate must be explicitly given") elif sample_rate is None: # set to default of pyaudio3dtools.audiofile.readfile -> for wav files it will be ignored anyway sample_rate = 48000 diff --git a/tests/hrtf_binary_loading/utils.py b/tests/hrtf_binary_loading/utils.py index 85d55a34d3702a935f709af3ad70b51925279fe6..c1b34c57cd14daf9ba57940c2e7cde5d7c8a2690 100644 --- a/tests/hrtf_binary_loading/utils.py +++ b/tests/hrtf_binary_loading/utils.py @@ -33,11 +33,10 @@ import os import sys import uuid -from typing import Dict, Optional +from typing import Optional import pytest -from tests.renderer.compare_audio import compare_audio_arrays from tests.renderer.utils import check_BE, run_cmd, run_renderer, test_info from .constants import * diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 52d1ccf19ec1288a7e81d65457dcc877e5fd2c35..a538df7ee83c6a771fbf992e0aad18c2ef0bdfc4 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -55,7 +55,6 @@ def test_info(request): def run_cmd(cmd, env=None): logging.info(f"\nRunning command\n{' '.join(cmd)}\n") - cmdJoin = " ".join(cmd) try: sp.run(cmd, check=True, capture_output=True, text=True, env=env) except sp.CalledProcessError as e: diff --git a/tests/scale_pcm.py b/tests/scale_pcm.py index 614e8cef3f65cbaa0839b36b96fc796a00bbf43c..356cdd90e12b95e818bf0f2fa58600fe48d96efc 100755 --- a/tests/scale_pcm.py +++ b/tests/scale_pcm.py @@ -10,9 +10,7 @@ sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../scripts")) import concurrent.futures -import numpy as np import pyaudio3dtools -import pyivastest def scale_folder(folder, factor): diff --git a/tests/test_26444.py b/tests/test_26444.py index 3bcef2567a6a1e8c36f87a4f7e91a7ee1848b6f5..c413be81e48a9ba9f2b988e3351c46dcce9dfb63 100644 --- a/tests/test_26444.py +++ b/tests/test_26444.py @@ -35,7 +35,6 @@ Execute tests specified via a parameter file. import filecmp import os import subprocess -from pathlib import Path import pytest diff --git a/tests/test_param_file_ltv.py b/tests/test_param_file_ltv.py index 44c6a388f807633e1970877abdc2ced4c0002184..a2341e93506313ad1403fcd59ab383d1dc49a3e4 100644 --- a/tests/test_param_file_ltv.py +++ b/tests/test_param_file_ltv.py @@ -35,6 +35,7 @@ Execute tests specified via a parameter file. import errno import filecmp import os +import re import platform from pathlib import Path from subprocess import run @@ -44,6 +45,7 @@ import pytest from tests.cmp_pcm import cmp_pcm from tests.conftest import DecoderFrontend, EncoderFrontend from tests.cut_pcm import cut_samples +from .codec_be_on_mr_nonselection import MLD_PATTERN, MAX_DIFF_PATTERN # from tests.testconfig import PARAM_FILE @@ -340,11 +342,15 @@ def test_param_file_tests( md_out_files = get_expected_md_files(ref_output_file, enc_split, output_config) if get_mld: - mld = 0 - if "MLD" in reason: - mld = float(reason.split(":")[1].split()[0]) + mld = re.search(MLD_PATTERN, reason).groups(1)[0] record_property("MLD", mld) + max_diff = 0 + if output_differs: + search_result = re.search(MAX_DIFF_PATTERN, reason) + max_diff = search_result.groups(1)[0] + record_property("MAXIMUM ABS DIFF", max_diff) + metadata_differs = False for md_file in md_out_files: dut_metadata_file = Path(f"{dut_base_path}/param_file/dec/{md_file}") @@ -355,9 +361,9 @@ def test_param_file_tests( metadata_differs = True except FileNotFoundError: if not dut_metadata_file.exists(): - print(f"DUT output metadata missing for expected file: " + md_file) + print("DUT output metadata missing for expected file: " + md_file) if not ref_metadata_file.exists(): - print(f"REF output metadata missing for expected file: " + md_file) + print("REF output metadata missing for expected file: " + md_file) metadata_differs = True if output_differs or metadata_differs: