Commit 7e84a542 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

remove run_test_bin_latencys.py from repository root

parent 734142ae
Loading
Loading
Loading
Loading
Loading

run_test_bin_latencys.py

deleted100644 → 0
+0 −204
Original line number Diff line number Diff line


import os
import subprocess
import errno
import tempfile as tf
import sys
from scipy.io.wavfile import read, write
import numpy as np

ivas_path = 'D:/DEV/ivas-3gpp/'

trunk_path = ivas_path + 'ivas-codec/'
script_path = trunk_path + 'scripts/'
inpath = script_path + 'testv/'
outpath = script_path + 'testv/out/'
trajpath = script_path + 'trajectories/'

if sys.platform.startswith('win32'):
    unit_test_exe = trunk_path + 'build/IVAS_crend_unit_test.exe'
    ivas_cod_exe = trunk_path + 'build/IVAS_cod.exe'
    ivas_dec_exe = trunk_path + 'build/IVAS_dec.exe'

file_name_7_1_root = 'test_8ch_'

file_name_7_1_4_root = 'dirac_12ch_'

sampleRates = ['48', '16', '32']
# sampleRates = ['48']

for sr in sampleRates:
    file_name_7_1_4 = inpath + file_name_7_1_4_root + sr + 'k'
    inFileName_7_1_4 = file_name_7_1_4 + '.wav'

    file_name_7_1 = inpath + file_name_7_1_root + sr + 'k'
    inFileName_7_1 = file_name_7_1 + '.wav'

    # encode 7.1.4 512kb
    cmd = [ivas_cod_exe, '-MC', '7_1_4', '-max_band', 'FB', '512000', sr,
           file_name_7_1_4 + '.wav',   file_name_7_1_4 + '_512kb.ptk']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # encode 7.1 512kb
    cmd = [ivas_cod_exe, '-MC', '7_1', '-max_band', 'FB', '512000', sr,
           file_name_7_1 + '.wav',   file_name_7_1 + '_512kb.ptk']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # encode 7.1.4 128kb PARAMMC
    cmd = [ivas_cod_exe, '-MC', '7_1_4', '-max_band', 'FB', '128000', sr,
           file_name_7_1_4 + '.wav',   file_name_7_1_4 + '_128kb.ptk']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # encode 7.1 64kb PARAMMC
    cmd = [ivas_cod_exe, '-MC', '7_1', '-max_band', 'FB', '64000', sr,
           file_name_7_1 + '.wav',   file_name_7_1 + '_64kb.ptk']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode 7_1_4
    cmd = [ivas_dec_exe, '7_1_4', sr,  file_name_7_1_4 +
           '_512kb.ptk',  file_name_7_1_4 + '_enc_dec.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode 7_1
    cmd = [ivas_dec_exe, '7_1', sr, file_name_7_1 +
           '_512kb.ptk',   file_name_7_1 + '_enc_dec.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

# -render_config testv/config_renderer.cfg
#     # decode binaural crend 7.1.4
#     cmd = [ivas_dec_exe, '-render_config', 'script/testv/config_renderer_fastconv.cfg', 'BINAURAL', sr,  file_name_7_1_4 +
#            '_512kb.ptk',   file_name_7_1_4 + '-hrir.wav']

#     print(' '.join(cmd))
#     subprocess.call(cmd, shell=False)

#     # decode binaural room crend 7.1.4
#     cmd = [ivas_dec_exe, 'BINAURAL_ROOM', sr,
#            file_name_7_1_4 + '_128kb.ptk',  file_name_7_1_4 + '-parammc_brir.wav']

#     print(' '.join(cmd))
#     subprocess.call(cmd, shell=False)

    # decode binaural crend 7.1.4
    cmd = [ivas_dec_exe, 'BINAURAL', sr,  file_name_7_1_4 +
           '_512kb.ptk',   file_name_7_1_4 + '-hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural room crend 7.1.4
    cmd = [ivas_dec_exe, 'BINAURAL_ROOM', sr,
           file_name_7_1_4 + '_128kb.ptk',  file_name_7_1_4 + '-parammc_brir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural crend 7.1.4
    cmd = [ivas_dec_exe, 'BINAURAL', sr,  file_name_7_1_4 +
           '_128kb.ptk',   file_name_7_1_4 + '-parammc_hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural room crend 7.1.4
    cmd = [ivas_dec_exe, 'BINAURAL_ROOM', sr,
           file_name_7_1_4 + '_512kb.ptk',  file_name_7_1_4 + '-brir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)
    # decode binaural crend 7.1
    cmd = [ivas_dec_exe, 'BINAURAL', sr,  file_name_7_1 +
           '_512kb.ptk',  file_name_7_1 + '-hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural room crend 7.1
    cmd = [ivas_dec_exe, 'BINAURAL_ROOM', sr,  file_name_7_1 +
           '_512kb.ptk',  file_name_7_1 + '-brir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural fastconv 7.1
    cmd = [ivas_dec_exe, 'BINAURAL', sr,  file_name_7_1 +
           '_64kb.ptk',  file_name_7_1 + '-parammc-hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural room fastconv 7.1
    cmd = [ivas_dec_exe, 'BINAURAL_ROOM', sr,  file_name_7_1 +
           '_64kb.ptk',  file_name_7_1 + '-parammc-brir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural TD 7.1.4
    cmd = [ivas_dec_exe, '-T', trajpath + '/const000.csv', 'BINAURAL', sr,
           file_name_7_1_4 + '_512kb.ptk',  file_name_7_1_4 + '-td-hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    # decode binaural TD 7.1
    cmd = [ivas_dec_exe, '-T', trajpath + '/const000.csv', 'BINAURAL', sr,
           file_name_7_1 + '_512kb.ptk',  file_name_7_1 + '-td-hrir.wav']

    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

# render CICP19 to binaural
sampleRates = ['16', '32', '48']
# option = ['-limiter', '-lp_lfe']
option = ['-lp_lfe']

for sr in sampleRates:
    file_name_7_1_4 = inpath + file_name_7_1_4_root + sr + 'k'
    inFileName_7_1_4 = file_name_7_1_4 + '.wav'

    file_name_7_1 = inpath + file_name_7_1_root + sr + 'k'
    inFileName_7_1 = file_name_7_1 + '.wav'

    cmd = [unit_test_exe, '-test', '1', '-sr', sr, '-ifmt', '7', '-ofmt', '2',  '-i',
           inFileName_7_1_4, '-o',  file_name_7_1_4 + '-hrir-crend-u.wav']
    cmd = cmd + option
    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    cmd = [unit_test_exe, '-test', '1', '-sr', sr, '-ifmt', '7', '-ofmt', '2', '-BRIR',
           '-i', inFileName_7_1_4, '-o',  file_name_7_1_4 + '-brir-crend-u.wav']
    cmd = cmd + option
    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    cmd = [unit_test_exe, '-test', '2', '-sr', sr, '-ifmt', '7', '-ofmt', '2',  '-i',
           inFileName_7_1_4, '-o',  file_name_7_1_4 + '-hrir-fastconv-u.wav']
    cmd = cmd + option
    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    cmd = [unit_test_exe, '-test', '2', '-sr', sr, '-ifmt', '7', '-ofmt', '2', '-BRIR',
           '-i', inFileName_7_1_4, '-o', file_name_7_1_4 + '-brir-fastconv-u.wav']
    cmd = cmd + option
    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)

    cmd = [unit_test_exe, '-test', '4', '-sr', sr, '-ifmt', '7', '-ofmt', '2',
           '-i', inFileName_7_1_4, '-o',  file_name_7_1_4 + '-hrir-td-u.wav']
    cmd = cmd + option
    print(' '.join(cmd))
    subprocess.call(cmd, shell=False)