Commit b3c889a2 authored by Anika Treffehn's avatar Anika Treffehn
Browse files

added files for bitstream processing

parent 33dfec0f
Loading
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
#!/usr/bin/env python3
import copy
import logging
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Optional, Tuple, Union
from warnings import warn

import numpy as np

from ivas_processing_scripts.audiotools import audio, convert
from ivas_processing_scripts.audiotools.audiofile import write
from ivas_processing_scripts.audiotools.wrappers.filter import resample_itu
from ivas_processing_scripts.utils import find_binary, get_devnull, run

#
#  (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
@@ -43,6 +30,19 @@ from ivas_processing_scripts.utils import find_binary, get_devnull, run
#  the United Nations Convention on Contracts on the International Sales of Goods.
#

import copy
import logging
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Optional, Tuple, Union
from warnings import warn

import numpy as np

from ivas_processing_scripts.audiotools import audio, convert
from ivas_processing_scripts.audiotools.audiofile import write
from ivas_processing_scripts.audiotools.wrappers.filter import resample_itu
from ivas_processing_scripts.utils import find_binary, get_devnull, run

logger = logging.getLogger("__main__")
logger.setLevel(logging.DEBUG)
@@ -271,7 +271,6 @@ def scale_files(

    for folder, meta_folder in zip(file_list, in_meta):
        for file, meta in zip(folder, meta_folder):

            # create audio object
            if meta_bool:
                audio_obj = audio.fromfile(fmt, file, fs, meta)
+56 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3

#
#  (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.
#

from pathlib import Path
from typing import Union

from ivas_processing_scripts.utils import find_binary, run


def eid_xor(
    error_pattern: Union[str, Path],
):
    # TODO
    binary = find_binary("eid-xor")

    # check for valid inputs

    # set up command line

    # run command
    # result = run(cmd)

    return


def apply_error_pattern():
    return
+62 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3

#
#  (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 warnings
from pathlib import Path
from ivas_processing_scripts.utils import find_binary, run


LIST_FER = [3, 5, 6, 10]


def gen_patt():
    # TODO: call binary
    binary = find_binary("eid-xor")

    # run command
    # result = run(cmd)
    return


def create_error_pattern(
    frame_error_rate: float,
    preamble: int,
):
    # TODO: copy sta files to cwd and call gen_patt
    # TODO: start after preamble (if preamble is int multiple of frame length)
    if frame_error_rate in LIST_FER:
        # copy sta file
        pass
    else:
        warnings.warn(f"Frame error rate {frame_error_rate}% is not a default rate. Error pattern is random and not deterministic.")

    return
+9 −0
Original line number Diff line number Diff line
EID
BER           = 0.030000
GAMMA         = 0.000000
RAN-seed      = 0xab5d4825
Current State = G
GOOD->GOOD    = 0.940000
GOOD->BAD     = 1.000000
BAD ->GOOD    = 0.940000
BAD ->BAD     = 1.000000
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
EID
BER           = 0.050000
GAMMA         = 0.000000
RAN-seed      = 0x6d30b654
Current State = G
GOOD->GOOD    = 0.900000
GOOD->BAD     = 1.000000
BAD ->GOOD    = 0.900000
BAD ->BAD     = 1.000000
Loading