Commit 4ce25cba authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'main' of forge.3gpp.org:ivas-codec-pc/ivas-codec into split_rend_fixes_mc_ism

parents eec4f05d a2f7b206
Loading
Loading
Loading
Loading
Loading
+70 −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 argparse
import numpy as np


ERR_MAGIC_NUM_DLY_PROF = -1
ERR_MAGIC_NUM_G192 = 27424


def combine_error_profiles(genpatt_file, jbm_dly_profile, output_file):
    ep = np.fromfile(genpatt_file, dtype="int16")
    with open(jbm_dly_profile) as f:
        dly = np.asarray([int(l.strip()) for l in f.readlines()])

    # if one wants to differently-sized files, add wraparound/shorten logic here
    # in ci, file lengths will match
    assert len(ep) == len(dly)

    # remove lost frames already in the dly profile
    # replace with no delay (not there in the profile files, except the all-zero one)
    err_idx = np.where(dly == ERR_MAGIC_NUM_DLY_PROF)[0]
    dly[err_idx] = 0

    # insert lost frames based on .g192 file
    err_idx = np.where(ep == ERR_MAGIC_NUM_G192)[0]
    dly[err_idx] = -1
    
    with open(output_file, "w") as f:
        for d in dly:
            f.write(f"{int(d)}\n")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("genpatt_file")
    parser.add_argument("jbm_dly_profile")
    parser.add_argument("output_file")
    args = parser.parse_args()

    combine_error_profiles(**vars(args))
+9 −6
Original line number Diff line number Diff line
@@ -40,19 +40,21 @@ from collect_artifacts import (
    find_failed_files_for_sanitizer_test,
    collect_for_sanitizer_test,
)
from combine_genpatt_and_jbm_profile import combine_error_profiles


SCRIPT_DIR = pathlib.Path("./scripts").resolve()
DURATION = "120"
CFG = "ci_linux_ltv.json"
SUPPORTED_TESTS = ["CLANG1", "CLANG2", "CLANG3", "VALGRIND"]
EP_FILE = "ep_015.g192"
GENPATT_CMD = f"gen-patt -tailstat -fer -g192 -gamma 0 -rate 0.15 -tol 0.001 -reset -n {int(DURATION) * 50} {EP_FILE}"
EIDXOR_CMD = "eid-xor -vbr -fer {bitstream} {ep_file} {out_file}"
DLY_PROFILE_IN = SCRIPT_DIR.joinpath("dly_error_profiles/dly_error_profile_5.dat")
DLY_PROFILE_OUT = "dly_profile.dat"
N_FRAMES_DLY_PROFILE = 7500
GENPATT_CMD = f"gen-patt -tailstat -fer -g192 -gamma 0 -rate 0.15 -tol 0.001 -reset -n {N_FRAMES_DLY_PROFILE} {EP_FILE}"
MC_MODES = ["5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"]
AMBISONICS_MODES = ["HOA3", "HOA2", "FOA", "PlanarHOA3", "PlanarHOA2", "PlanarFOA"]

SCRIPT_DIR = pathlib.Path("./scripts").resolve()

CONSOLE_OUT_FILE = "output_san.txt"


@@ -186,6 +188,7 @@ def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = Tr

    # generate error pattern
    subprocess.call(GENPATT_CMD.split())
    combine_error_profiles(EP_FILE, DLY_PROFILE_IN, DLY_PROFILE_OUT)

    # cleanup to avoid script errors
    # we want "logs" and "dec" subfolders to be empty -> delete "dec" and rename "log"
@@ -203,10 +206,10 @@ def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = Tr
            # need empty log folder to avoid crashes
            path.mkdir()

    cmd_fec = cmd_no_fec + ["--decoder_only", "-f", EP_FILE]
    cmd_fec = cmd_no_fec + ["--decoder_only", "-J", DLY_PROFILE_OUT]
    print(
        "======== Script command line WITH plc: ========\n{}".format(
            " ".join(cmd_no_fec)
            " ".join(cmd_fec)
        )
    )

+2 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#define FIX_954_OTR_REF_VEC                             /* FhG: Fix forward vector direction for OTR REF VEC mode */


/* #################### End BE switches ################################## */
@@ -160,6 +161,7 @@

#define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER                    /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/
#define NONBE_FIX_944_FEC_OMASA_1SEP_OBJ_MASA                 /* Nokia: issue 944: fix FEC error in OMASA */
#define NONBE_FIX_949_MC_5MS_FRAMING                          /* Dlb: issue 949: fix for issue 949, distorted output in MC mode with 5ms framing*/

#ifdef SPLIT_REND_WITH_HEAD_ROT
#define SPLIT_REND_HF_TUNING                                  /* Dlb: issue 950: split rendering MD tuning change at high frequencies*/
+6 −0
Original line number Diff line number Diff line
@@ -1260,6 +1260,12 @@ ivas_error ivas_jbm_dec_render(
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
#ifdef NONBE_FIX_949_MC_5MS_FRAMING
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        {
            p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered];
        }
#endif
        if ( st_ivas->mc_mode == MC_MODE_MCT )
        {
            int16_t crendInPlaceRotation = FALSE;
+12 −0
Original line number Diff line number Diff line
@@ -545,7 +545,11 @@ ivas_error ivas_orient_trk_SetReferenceVector(
        case IVAS_HEAD_ORIENT_TRK_REF:
        case IVAS_HEAD_ORIENT_TRK_AVG:
        case IVAS_HEAD_ORIENT_TRK_REF_VEC:
#ifdef FIX_954_OTR_REF_VEC
            acousticFrontVector = VectorSubtract( refPos, listenerPos );
#else
            acousticFrontVector = VectorSubtract( listenerPos, refPos );
#endif
            break;
        case IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV:
            /* ignore the height difference between listener position and reference position */
@@ -554,7 +558,11 @@ ivas_error ivas_orient_trk_SetReferenceVector(
            listenerPosLevel.y = listenerPos.y;
            refPosLevel.x = refPos.x;
            refPosLevel.y = refPos.y;
#ifdef FIX_954_OTR_REF_VEC
            acousticFrontVector = VectorSubtract( refPosLevel, listenerPosLevel );
#else
            acousticFrontVector = VectorSubtract( listenerPosLevel, refPosLevel );
#endif
            break;
        default:
            return IVAS_ERR_WRONG_PARAMS;
@@ -568,7 +576,11 @@ ivas_error ivas_orient_trk_SetReferenceVector(
        return IVAS_ERR_WRONG_PARAMS;
    }

#ifdef FIX_954_OTR_REF_VEC
    ivasForwardVector.x = 1.0f;
#else
    ivasForwardVector.x = -1.0f;
#endif
    ivasForwardVector.y = 0.0f;
    ivasForwardVector.z = 0.0f;
    VectorRotationToQuaternion( ivasForwardVector, acousticFrontVector, &pOTR->refRot );
Loading