Commit 40edcbc0 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

add self test cases for MASA JBM and OMASA JBM. add smoke tests for OMASA. add...

add self test cases for MASA JBM and OMASA JBM. add smoke tests for OMASA. add a script for generating smoke test inputs for combined formats. add MASA and ISM metadata files files used by self test with the full item name.
parent e6777207
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ fi
if [ -z "$1" ] || [ "$1" == "test" ]; then
    WORKERS=""
    BUILD=1
    BUILD=0
elif [ "$1" == "coverage" ]; then
    WORKERS="-t 1"
    BUILD=0
@@ -75,10 +76,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,15 +93,16 @@ 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"
./scripts/runIvasCodec.py -m $modes_with_ext_out -p $cfg $duration_arg $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM_IR mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt

# run all modes with binaural output using external files
modes_with_bin_out="SBA PlanarSBA MASA MC ISM1 ISM2 ISM3 ISM4"
modes_with_bin_out="SBA PlanarSBA MASA MC ISM1 ISM2 ISM3 ISM4 OMASA"
bin_out_modes="BINAURAL BINAURAL_ROOM_IR"

echo "\n======================= 6. binaural out with HRTF files - WB =======================\n\n"
+36 −20
Original line number Diff line number Diff line
{
    "afspPath": "not_needed",
    "utilPath": "/tools",
    "utilPath": "//home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/tools/Linux/",
    "inpaths": {
        "MONO": "/usr/local/testv/stv48c.wav",
        "STEREO": "/usr/local/testv/stvST48c.wav",
        "FOA": "/usr/local/testv/stvFOA48c.wav",
        "HOA2": "/usr/local/testv/stv2OA48c.wav",
        "HOA3": "/usr/local/testv/stv3OA48c.wav",
        "SBA": "/usr/local/testv/stv3OA48c.wav",
        "MASA1TC1DIR": "/usr/local/testv/stv1MASA1TC48c.wav",
        "MASA1TC2DIR": "/usr/local/testv/stv2MASA1TC48c.wav",
        "MASA2TC1DIR": "/usr/local/testv/stv1MASA2TC48c.wav",
        "MASA2TC2DIR": "/usr/local/testv/stv2MASA2TC48c.wav",
        "5_1": "/usr/local/testv/stv51MC48c.wav",
        "5_1_2": "/usr/local/testv/stv512MC48c.wav",
        "5_1_4": "/usr/local/testv/stv514MC48c.wav",
        "7_1": "/usr/local/testv/stv71MC48c.wav",
        "7_1_4": "/usr/local/testv/stv714MC48c.wav",
        "ISM1": "/usr/local/testv/stv1ISM48s.wav",
        "ISM2": "/usr/local/testv/stv2ISM48s.wav",
        "ISM3": "/usr/local/testv/stv3ISM48s.wav",
        "ISM4": "/usr/local/testv/stv4ISM48s.wav"
        "MONO": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv48c.wav",
        "STEREO": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvST48c.wav",
        "FOA": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvFOA48c.wav",
        "HOA2": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv2OA48c.wav",
        "HOA3": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv3OA48c.wav",
        "SBA": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv3OA48c.wav",
        "MASA1TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv1MASA1TC48c.wav",
        "MASA1TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv2MASA1TC48c.wav",
        "MASA2TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv1MASA2TC48c.wav",
        "MASA2TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv2MASA2TC48c.wav",
        "5_1": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv51MC48c.wav",
        "5_1_2": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv512MC48c.wav",
        "5_1_4": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv514MC48c.wav",
        "7_1": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv71MC48c.wav",
        "7_1_4": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv714MC48c.wav",
        "ISM1": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv1ISM48s.wav",
        "ISM2": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv2ISM48s.wav",
        "ISM3": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv3ISM48s.wav",
        "ISM4": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stv4ISM48s.wav",
        "OMASA_ISM1_1TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_1ISM_1MASA1TC48c.wav",
        "OMASA_ISM1_1TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_1ISM_2MASA1TC48c.wav",
        "OMASA_ISM1_2TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_1ISM_1MASA2TC48c.wav",
        "OMASA_ISM1_2TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_1ISM_2MASA2TC48c.wav",
        "OMASA_ISM2_1TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav",
        "OMASA_ISM2_1TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_2ISM_2MASA1TC48c.wav",
        "OMASA_ISM2_2TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_2ISM_1MASA2TC48c.wav",
        "OMASA_ISM2_2TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_2ISM_2MASA2TC48c.wav",
        "OMASA_ISM3_1TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav",
        "OMASA_ISM3_1TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_3ISM_2MASA1TC48c.wav",
        "OMASA_ISM3_2TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_3ISM_1MASA2TC48c.wav",
        "OMASA_ISM3_2TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_3ISM_2MASA2TC48c.wav",
        "OMASA_ISM4_1TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_4ISM_1MASA1TC48c.wav",
        "OMASA_ISM4_1TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_4ISM_2MASA1TC48c.wav",
        "OMASA_ISM4_2TC1DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_4ISM_1MASA2TC48c.wav",
        "OMASA_ISM4_2TC2DIR": "/home/jpaulus/IVAS/ivas_public/ivas-codec/scripts/testv/stvOMASA_4ISM_2MASA2TC48c.wav"
    }
}
+857 −0

File changed.

Preview size limit exceeded, changes collapsed.

+53 −29

File changed.

Preview size limit exceeded, changes collapsed.

+95 −0
Original line number Diff line number Diff line
#!/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')
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testv')

# # 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')

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)

        # 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}{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)

        # 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)
    
Loading