Commit d6d6812b authored by Jan Kiene's avatar Jan Kiene
Browse files

fix out_config->nchannels parsing

parent b08c69a3
Loading
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5,15 +5,24 @@ THIS_PATH = os.path.join(os.getcwd(), __file__)
sys.path.append(os.path.join(os.path.dirname(THIS_PATH), "../scripts"))

import pyaudio3dtools
import pyivastest


def cmp_pcm(file1, file2, nchannels, fs) -> (int, str):
def cmp_pcm(file1, file2, oc, fs) -> (int, str):
    """
    Compare 2 PCM files for bitexactness
    """
    print("Cmp PCM Report")
    print("=====================")

    oc = "MONO" if oc == "" else oc
    if oc.upper() not in pyivastest.constants.OC_TO_NCHANNELS:
        oc_in_file_names = os.path.splitext(os.path.basename(oc))[0]
        nchannels = pyivastest.IvasScriptsCommon.IvasScript.get_n_channels_from_ls_layout(oc)
    else:
        oc_in_file_names = oc
        nchannels = pyivastest.constants.OC_TO_NCHANNELS[oc.upper()]

    s1, _ = pyaudio3dtools.audiofile.readfile(file1, nchannels, fs)
    s2, _ = pyaudio3dtools.audiofile.readfile(file2, nchannels, fs)

+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ from subprocess import run
import pytest
from cmp_pcm import cmp_pcm
from conftest import EncoderFrontend, DecoderFrontend
from testconfig import PARAM_FILE, OC_TO_NCHANNELS
from testconfig import PARAM_FILE


VALID_DEC_OUTPUT_CONF = [
@@ -275,7 +275,7 @@ def test_param_file_tests(
        dut_file = f"{dut_base_path}/param_file/dec/{output_file}"
        ref_file = f"{reference_path}/param_file/dec/{output_file}"
        fs = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(dut_file, ref_file, OC_TO_NCHANNELS[output_config], fs)
        cmp_result, reason = cmp_pcm(dut_file, ref_file, output_config, fs)
        assert cmp_result == 0, reason

        # remove DUT output files when test result is OK (to save disk space)
+1 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import pytest

from cmp_pcm import cmp_pcm
from conftest import DecoderFrontend
from testconfig import OC_TO_NCHANNELS

# params
tag_list = ['stvFOA']
@@ -177,7 +176,7 @@ def sba_dec_plc(

        # --------------  compare cmd  --------------
        fs = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, OC_TO_NCHANNELS[output_config], fs)
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, output_config, fs)

        # report compare result
        assert cmp_result == 0, reason
+1 −2
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import pytest
from cmp_pcm import cmp_pcm
from cut_pcm import cut_samples
from conftest import EncoderFrontend, DecoderFrontend
from testconfig import OC_TO_NCHANNELS

# params
tag_list = ['stvFOA']
@@ -595,7 +594,7 @@ def sba_dec(
        )

        fs = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, OC_TO_NCHANNELS[output_config], fs)
        cmp_result, reason = cmp_pcm(dut_out_raw, ref_out_raw, output_config, fs)

        # report compare result
        assert cmp_result == 0, reason
+0 −21
Original line number Diff line number Diff line
@@ -35,24 +35,3 @@ To configure test modules.
"""

PARAM_FILE = "scripts/config/self_test.prm"
OC_TO_NCHANNELS = {
    "MONO": 1,
    "STEREO": 2,
    "BINAURAL": 2,
    "BINAURAL_ROOM": 2,
    "5_1": 6,
    "7_1": 8,
    "5_1_2": 8,
    "5_1_4": 10,
    "7_1_4": 12,
    "FOA": 4,
    "HOA2": 9,
    "HOA3": 16,
    "EXT": 1,
    "ISM1": 1,
    "ISM2": 2,
    "ISM3": 3,
    "ISM4": 4,
    "MASA1TC": 1,
    "MASA2TC": 2,
}