Commit 85522174 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

remove input file writing from sba pytests

parent b01c431c
Loading
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import re
import platform
from pathlib import Path
from subprocess import run
import tempfile
from tempfile import TemporaryDirectory
import pytest

from tests.cmp_pcm import cmp_pcm
@@ -173,7 +173,7 @@ def test_param_file_tests(
        and Path(testv_file).name.startswith("stv")
    ):
        sba_br_switching_dtx = 1
        cut_file, cut_file_pre_exist = pre_proc_input(testv_file, fs)
        cut_file = pre_proc_input(testv_file, fs)
        testv_file = cut_file

    # bitrate can be a filename: remove leading "../"
@@ -202,10 +202,6 @@ def test_param_file_tests(
            enc_split,
            update_ref,
        )
    if sba_br_switching_dtx == 1 and not keep_files:
        is_exist = os.path.exists(cut_file)
        if is_exist and cut_file_pre_exist == 0:
            os.remove(cut_file)

    # check for networkSimulator_g192 command line
    if sim_opts != "":
@@ -452,25 +448,9 @@ def encode(


def pre_proc_input(testv_file, fs):
    cut_from = "0.0"
    cut_len = "5.0"
    cut_gain = ".004"
    if "stvFOA" in testv_file:
        num_channel = "4"
    elif "stv2OA" in testv_file:
        num_channel = "9"
    elif "stv3OA" in testv_file:
        num_channel = "16"
    cut_file = testv_file.replace(".wav", "_cut_" + cut_gain + ".wav")
    cut_file_pre_exist = 1;
    if not os.path.exists(cut_file):
        tmpf = tempfile.TemporaryFile()
        cut_file = tmpf.name
        cut_file += "_cut_" + cut_gain + ".wav"
        cut_file_pre_exist = 0;
    
    cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain)
    return cut_file, cut_file_pre_exist
    return cut_file


def simulate(
+1 −19
Original line number Diff line number Diff line
@@ -36,14 +36,12 @@ __doc__ = """
import errno
import os
import re
import tempfile

import pytest
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
@@ -586,23 +584,7 @@ def sba_enc(
            cut_file = f"{test_vector_path}/{tag_in}_cut{in_extension}"
        else:
            cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}"
        if not os.path.exists(cut_file):
            tmpf = tempfile.TemporaryFile()
            cut_file = tmpf.name
            if cut_gain == "1.0":
                cut_file += f"{tag_in}_cut{in_extension}"
            else:
                cut_file += f"{tag_in}_cut_{cut_gain}{in_extension}"          

            cut_samples(
                input_path,
                cut_file,
                num_channels,
                cut_from,
                cut_len,
                cut_gain,
                sample_rate=sampling_rate + "000",
            )
        input_path = cut_file

    if ref_encoder_frontend: