diff --git a/.gitignore b/.gitignore index de9e357339c5e1b336f2e9cc0c9e58a8da5d4199..9de6ea6bb4c54a975fb5c7da0db0815389669ac0 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,10 @@ tests/**/[c|d]ut tests/**/ref tests/*/testv scripts/testv/*_cut*.pcm +scripts/testv/stvOMASA_*.met +scripts/testv/stvOMASA_*.csv +scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav +scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav # default reference binary name IVAS_cod_ref IVAS_dec_ref diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 833c3a795c755fa72e05b0ee6fdf5b59b31e9f5c..0b874f79548b7019d773f2bf956258a9cf35e6ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -811,6 +811,8 @@ check-first-frame-is-sid: script: - *print-common-info - *update-ltv-repo + # Temporary fix to test only SID start config files in this job + - rm scripts/config/ci_linux_ltv.json scripts/config/ci_linux.json - *check-for-testvectors - cmake . - make -j diff --git a/ci/smoke_test.sh b/ci/smoke_test.sh index 2bbf06bcd3c009cc20d2a480127105f4facc7114..96e661238d98f6550f2fc669fb335e6d500b0f5d 100755 --- a/ci/smoke_test.sh +++ b/ci/smoke_test.sh @@ -75,10 +75,14 @@ if [ $BUILD -eq 1 ];then fi +# prepare combined format test signals +echo "\n======================= 0. preparing combined format test inputs =======================\n\n" +./scripts/prepare_combined_format_inputs.py + # run all modes vanilla-fashion # treat ISM modes separately because passing the metadata files to MASA modes causes crashes -ism_modes=$(./scripts/runIvasCodec.py -l | grep ISM) -non_ism_modes=$(./scripts/runIvasCodec.py -l | grep -v ISM) +ism_modes=$(./scripts/runIvasCodec.py -l | grep ^ISM) +non_ism_modes=$(./scripts/runIvasCodec.py -l | grep -v ^ISM) echo "\n======================= 1. non-ism modes no FEC =======================\n\n" ./scripts/runIvasCodec.py -m $non_ism_modes -p $cfg $duration_arg $WORKERS | tee smoke_test_output.txt echo "\n======================= 2. ism modes no FEC =======================\n\n" @@ -88,8 +92,9 @@ echo "\n======================= 3. all modes with FEC =======================\n\ ./scripts/runIvasCodec.py -p $cfg $duration_arg $WORKERS -D="-fec 15" --decoder_only | tee smoke_test_output_plc.txt # run JBM modes - EXT is excluded as not supported yet -modes_with_no_ext_out=$(./scripts/runIvasCodec.py -l | grep -v MASA | grep -v ISM) -modes_with_ext_out=$(./scripts/runIvasCodec.py -l | grep 'MASA\|ISM' | grep -v ISM+) +# OMASA disabled for now +modes_with_no_ext_out=$(./scripts/runIvasCodec.py -l | grep -v ^MASA | grep -v ^ISM | grep -v OMASA) +modes_with_ext_out=$(./scripts/runIvasCodec.py -l | grep 'MASA\|ISM' | grep -v ^ISM+ | grep -v OMASA) echo "\n======================= 4. JBM, modes with no EXT =======================\n\n" ./scripts/runIvasCodec.py -m $modes_with_no_ext_out -p $cfg $duration_arg $WORKERS --decoder_only --jbm_file $dly_profile | tee smoke_test_output_jbm_noEXT.txt echo "\n======================= 5. JBM, modes with EXT =======================\n\n" diff --git a/scripts/config/ci_linux.json b/scripts/config/ci_linux.json index 1cb11417522c52ac297ddd41afe57f113efc8beb..f7d6c4ec4b2059561672f53262a3ad49585efb28 100644 --- a/scripts/config/ci_linux.json +++ b/scripts/config/ci_linux.json @@ -20,6 +20,22 @@ "ISM1": "/usr/local/testv/stv1ISM48s.wav", "ISM2": "/usr/local/testv/stv2ISM48s.wav", "ISM3": "/usr/local/testv/stv3ISM48s.wav", - "ISM4": "/usr/local/testv/stv4ISM48s.wav" + "ISM4": "/usr/local/testv/stv4ISM48s.wav", + "OMASA_ISM1_1TC1DIR": "/usr/local/testv/stvOMASA_1ISM_1MASA1TC48c.wav", + "OMASA_ISM1_1TC2DIR": "/usr/local/testv/stvOMASA_1ISM_2MASA1TC48c.wav", + "OMASA_ISM1_2TC1DIR": "/usr/local/testv/stvOMASA_1ISM_1MASA2TC48c.wav", + "OMASA_ISM1_2TC2DIR": "/usr/local/testv/stvOMASA_1ISM_2MASA2TC48c.wav", + "OMASA_ISM2_1TC1DIR": "/usr/local/testv/stvOMASA_2ISM_1MASA1TC48c.wav", + "OMASA_ISM2_1TC2DIR": "/usr/local/testv/stvOMASA_2ISM_2MASA1TC48c.wav", + "OMASA_ISM2_2TC1DIR": "/usr/local/testv/stvOMASA_2ISM_1MASA2TC48c.wav", + "OMASA_ISM2_2TC2DIR": "/usr/local/testv/stvOMASA_2ISM_2MASA2TC48c.wav", + "OMASA_ISM3_1TC1DIR": "/usr/local/testv/stvOMASA_3ISM_1MASA1TC48c.wav", + "OMASA_ISM3_1TC2DIR": "/usr/local/testv/stvOMASA_3ISM_2MASA1TC48c.wav", + "OMASA_ISM3_2TC1DIR": "/usr/local/testv/stvOMASA_3ISM_1MASA2TC48c.wav", + "OMASA_ISM3_2TC2DIR": "/usr/local/testv/stvOMASA_3ISM_2MASA2TC48c.wav", + "OMASA_ISM4_1TC1DIR": "/usr/local/testv/stvOMASA_4ISM_1MASA1TC48c.wav", + "OMASA_ISM4_1TC2DIR": "/usr/local/testv/stvOMASA_4ISM_2MASA1TC48c.wav", + "OMASA_ISM4_2TC1DIR": "/usr/local/testv/stvOMASA_4ISM_1MASA2TC48c.wav", + "OMASA_ISM4_2TC2DIR": "/usr/local/testv/stvOMASA_4ISM_2MASA2TC48c.wav" } } diff --git a/scripts/config/ivas_modes.json b/scripts/config/ivas_modes.json index 97bfb263f80c27dd935d1ce9894378f4dd9357f2..a5d2cd6bdc846d5fc25ee97387c91e45816211dc 100644 --- a/scripts/config/ivas_modes.json +++ b/scripts/config/ivas_modes.json @@ -3802,5 +3802,863 @@ } } } + }, + + "OMASA": { + "OMASA_ISM1_2TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "1", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM1_2TC1DIR", + "table_name": "OMASA ISM1 2TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "OMASA_ISM1_2TC_2DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism_masa", + "1", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM1_2TC2DIR", + "table_name": "OMASA ISM1 2TC 2DIR@{table_bitrate} RS {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + } + } + }, + "OMASA_ISM1_1TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "1", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM1_1TC1DIR", + "table_name": "OMASA ISM1 1TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 13200, + 32000, + 80000, + 192000, + 512000 + ], + "swb": [ + 16400, + 48000, + 96000, + 256000 + ], + "fb": [ + 24400, + 64000, + 128000, + 384000 + ] + } + }, + "OMASA_ISM1_1TC_2DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "1", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM1_1TC2DIR", + "table_name": "OMASA ISM1 1TC 2DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 16400, + 48000, + 96000, + 256000 + ], + "swb": [ + 24400, + 64000, + 128000, + 384000 + ], + "fb": [ + 13200, + 32000, + 80000, + 192000, + 512000 + ] + } + }, + + + "OMASA_ISM2_2TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "2", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM2_2TC1DIR", + "table_name": "OMASA ISM2 2TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "OMASA_ISM2_2TC_2DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism_masa", + "2", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM2_2TC2DIR", + "table_name": "OMASA ISM2 2TC 2DIR@{table_bitrate} RS {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + } + } + }, + "OMASA_ISM2_1TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "2", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM2_1TC1DIR", + "table_name": "OMASA ISM2 1TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 80000, + 192000, + 512000 + ], + "swb": [ + 48000, + 96000, + 160000, + 256000 + ], + "fb": [ + 64000, + 128000, + 384000 + ] + } + }, + "OMASA_ISM2_1TC_2DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "2", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM2_1TC2DIR", + "table_name": "OMASA ISM2 1TC 2DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 16400, + 48000, + 96000, + 160000, + 256000 + ], + "swb": [ + 24400, + 64000, + 128000, + 384000 + ], + "fb": [ + 13200, + 32000, + 80000, + 192000, + 512000 + ] + } + }, + + + "OMASA_ISM3_2TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "3", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM3_2TC1DIR", + "table_name": "OMASA ISM3 2TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "OMASA_ISM3_2TC_2DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism_masa", + "3", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM3_2TC2DIR", + "table_name": "OMASA ISM3 2TC 2DIR@{table_bitrate} RS {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k_2fr_start_24k4_omasatechs_3ism.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k_2fr_start_48k_omasatechs_3ism.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k_2fr_start_160k_omasatechs_3ism.bin" + } + } + }, + "OMASA_ISM3_1TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "3", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM3_1TC1DIR", + "table_name": "OMASA ISM3 1TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 192000, + 512000 + ], + "swb": [ + 96000, + 160000, + 256000 + ], + "fb": [ + 128000, + 384000 + ] + } + }, + "OMASA_ISM3_1TC_2DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "3", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM3_1TC2DIR", + "table_name": "OMASA ISM3 1TC 2DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 16400, + 48000, + 96000, + 160000, + 256000 + ], + "swb": [ + 24400, + 64000, + 128000, + 384000 + ], + "fb": [ + 13200, + 32000, + 80000, + 192000, + 512000 + ] + } + }, + + + "OMASA_ISM4_2TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "4", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM4_2TC1DIR", + "table_name": "OMASA ISM4 2TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 5, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}_ISM4.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "OMASA_ISM4_2TC_2DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism_masa", + "4", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM4_2TC2DIR", + "table_name": "OMASA ISM4 2TC 2DIR@{table_bitrate} RS {bandwidth}", + "nummetadata": 5, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}_ISM4.csv", + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k_2fr_start_32k_omasatechs_4ism.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + } + } + }, + "OMASA_ISM4_1TC_1DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "4", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "OMASA_ISM4_1TC1DIR", + "table_name": "OMASA ISM4 1TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 5, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}_ISM4.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 192000, + 512000 + ], + "swb": [ + 160000, + 256000 + ], + "fb": [ + 128000, + 384000 + ] + } + }, + "OMASA_ISM4_1TC_2DIR_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism_masa", + "4", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [] + }, + "in_config": "OMASA_ISM4_1TC2DIR", + "table_name": "OMASA ISM4 1TC 2DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 5, + "metadatafilenames": [ + "{item}_ISM1.csv", + "{item}_ISM2.csv", + "{item}_ISM3.csv", + "{item}_ISM4.csv", + "{item}.met" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 16400, + 48000, + 96000, + 256000 + ], + "swb": [ + 24400, + 64000, + 128000, + 384000 + ], + "fb": [ + 13200, + 32000, + 80000, + 192000, + 512000 + ] + } + } } } diff --git a/scripts/prepare_combined_format_inputs.py b/scripts/prepare_combined_format_inputs.py new file mode 100755 index 0000000000000000000000000000000000000000..b8ad68557986fea358918580dd886e118749c990 --- /dev/null +++ b/scripts/prepare_combined_format_inputs.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 + +__license__ = \ +""" + (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, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of 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, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + 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 os +import shutil + +import numpy as np + +from pyaudio3dtools import audiofile, audioarray + + +# scripts/testv/ path +input_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv') +if 'TESTV_DIR' in os.environ: + output_dir = os.environ['TESTV_DIR'] +else: + output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv') + +print(f'Writing new files into {output_dir}') + +# # prepare combined input for OMASA tests +force_overwrite = False # overwrite existing files + +# define MASA test item files +masa_alts = ({'masa_meta_file': 'stv2MASA2TC48c.met', + 'masa_audio_file': 'stv2MASA2TC48c.wav', + 'masa_tag': '2MASA2TC'}, + {'masa_meta_file': 'stv2MASA1TC48c.met', + 'masa_audio_file': 'stv2MASA1TC48c.wav', + 'masa_tag': '2MASA1TC'}, + {'masa_meta_file': 'stv1MASA2TC48c.met', + 'masa_audio_file': 'stv1MASA2TC48c.wav', + 'masa_tag': '1MASA2TC'}, + {'masa_meta_file': 'stv1MASA1TC48c.met', + 'masa_audio_file': 'stv1MASA1TC48c.wav', + 'masa_tag': '1MASA1TC'}) + +# files containing 1-4 ISMs as channels +ism_files = ('stv1ISM48s.wav', 'stv2ISM48s.wav', 'stv3ISM48s.wav', 'stv4ISM48s.wav') +# per-object metadata +ism_meta_files = ('stvISM1.csv', 'stvISM2.csv', 'stvISM3.csv', 'stvISM4.csv') + +wrote_files = [] +for enum_idx, (ism_audio_file, ism_meta_file) in enumerate(zip(ism_files, ism_meta_files)): + n_isms = enum_idx + 1 + ism_audio, ism_fs = audiofile.readfile(filename=os.path.join(input_dir, ism_audio_file)) + + for masa_item in masa_alts: + masa_tag = masa_item['masa_tag'] + + omasa_file_body = f'stvOMASA_{n_isms}ISM_{masa_tag}48c' + omasa_file = os.path.join(output_dir, f'{omasa_file_body}.wav') + + if not os.path.exists(omasa_file) or force_overwrite: + audiofile.combinefiles(in_filenames=[os.path.join(input_dir, ism_audio_file), + os.path.join(input_dir, masa_item['masa_audio_file'])], + out_file=omasa_file) + wrote_files.append(omasa_file) + + # copy ISM metadata files under names matching the combined file + for ism_idx in range(n_isms): + ism_file_name = os.path.join(output_dir, f'{omasa_file_body}_ISM{ism_idx+1}{os.path.splitext(ism_meta_file)[1]}') + if not os.path.exists(ism_file_name) or force_overwrite: + shutil.copyfile(os.path.join(input_dir, ism_meta_file), ism_file_name) + wrote_files.append(ism_file_name) + + # copy MASA metadata file under a matching name + masa_meta_name = os.path.join(output_dir, f'{omasa_file_body}{os.path.splitext(masa_item["masa_meta_file"])[1]}') + + if not os.path.exists(masa_meta_name) or force_overwrite: + shutil.copyfile(os.path.join(input_dir, masa_item['masa_meta_file']), masa_meta_name) + wrote_files.append(masa_meta_name) + +# info print. helps setting up .gitignore +if len(wrote_files) > 0: + print('New files written: {}'.format('\n'.join(wrote_files)))