Commit ee01877a authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

add eid-xor to SBA PLC test

parent d06ded27
Loading
Loading
Loading
Loading
+25 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ Pytest customization (configuration and fixtures) for the IVAS codec test suite.
import logging
from pathlib import Path
import platform
from subprocess import run, TimeoutExpired
from subprocess import run, TimeoutExpired, CalledProcessError, STDOUT
import textwrap
from typing import Optional, Union
import os
@@ -403,7 +403,30 @@ class DecoderFrontend:
            command.extend(["-q"])

        if plc_file is not None:
            command.extend(["-fec", str(plc_file)])
            # command.extend(["-fec", str(plc_file)])
            
            system = platform.system()

            if system == "Windows":
                eid_path = "./scripts/tools/Windows/eid-xor.exe"
            elif system in ["Darwin", "Linux"]:
                eid_path = "./scripts/tools/Linux/eid-xor"
            else:
                raise ValueError(f'Wrong system "{system}"!')
                
            if not os.path.isfile(eid_path):
                raise FileNotFoundError(f"eid-xor binary {eid_path} not found!\n!")
        
            eid_command = f"{eid_path} -fer -vbr -bs g192 -ep g192".split()
            eid_command += [str(input_bitstream_path), str(plc_file), str(input_bitstream_path + ".fer")]

            try:
                result = run(eid_command, check=True, stderr=STDOUT)
            except CalledProcessError as e:
                print(result.stdout)
                pytest.fail(f"eid-xor operation failed!")
                
            os.rename(input_bitstream_path + ".fer", input_bitstream_path)

        if add_option_list is not None:
            command.extend(add_option_list)