Commit 848ef56b authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into ci/add-sanity-check-for-ext-output

parents 7828f576 9f58d491
Loading
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
__copyright__ = """
(C) 2022-2024 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
import argparse

# Enter tag of testcases to remove here WITHOUT the leading //
TESTCASES = [
    "OMASA 2Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, EXT out",
    "OSBA planar FOA 2ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL out",
    "4 ISM with extended metadata at 128 kbps, 48 kHz in, 48 kHz out, BINAURAL_ROOM_REVERB out, combined render config, directivity configuration with identifiers",
    "OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out",
    "Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 10%, bandwidth switching",
    "OSBA FOA 4ISM at bitrate switching 13.2 to 512 kbps, 48kHz in, 48kHz out, BINAURAL out, FER at 5%, bandwidth switching",
    "OSBA FOA 2ISM at 64 kbps, 48kHz in, 48kHz out, HOA3 out, bandwidth switching",
    "OMASA 2Dir2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, EXT out",
    "OSBA planar FOA 2ISM at 512 kbps, 48 kHz in, 48 kHz out, BINAURAL out",
    "OSBA planar FOA 1ISM at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out",
    "SBA 3OA at 128 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB combined renderer configuration with selected acoustic environment",
    "OSBA FOA 4ISM at bitrate switching 13.2 to 512 kbps, 48kHz in, 16kHz out, BINAURAL out (Model from file), FER at 5%, bandwidth switching",
    "stereo bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, EXT out",
    "SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, EXT out",
    "SBA 2OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, EXT out",
    "SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, random FER at 5%, EXT out",
    "Multi-channel 5_1 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, EXT out",
    "Multi-channel 5_1_2 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, EXT out",
    "Multi-channel 5_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 32kHz out, EXT out",
    "Multi-channel 7_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 16kHz out, EXT out",
    "Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, EXT out",
]


def remove_testcases(cfg: Path, testcases: list):
    """
    Go through file line by line and copy all testcases except the given ones
    """
    with open(cfg, "r") as f:
        content_in = f.readlines()

    content_out = list()
    copy_flag = True
    for line in content_in:
        if any([tc in line for tc in testcases]):
            copy_flag = False

        if copy_flag:
            content_out.append(line)
        elif line == "\n":
            copy_flag = True

    with open(cfg, "w") as f:
        f.write("".join(content_out))


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("cfg_files", nargs="+", type=Path)
    args = parser.parse_args()

    for f in args.cfg_files:
        remove_testcases(f, TESTCASES)
+6 −0
Original line number Diff line number Diff line
@@ -157,10 +157,16 @@
#define SPLIT_REND_WITH_HEAD_ROT                        /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define ISAR_BITSTREAM_UPDATE_LC3PLUS                   /* FhG: Multiple improvements to the ISAR bitstream when LC3plus is used. See MR 1456 for details. */
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#define LC3PLUS_LEA_COMPAT_BITRATES_48_6                /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel)  */
#endif
#define SPLIT_REND_POSE_CORRECTION_UNUSED_BITS
#define FIX_1081_BINAURAL_SPLIT_PCM_SANITY_CHECK        /* VA: issue 1081: correct error print-out when BINAURAL_SPLIT_PCM is requested */
#endif

//#define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT          /* Orange issue 1031 : new fix point hrtf binary file format */
//#define FIX_CREND_SIMPLIFY_CODE                         /* Ora : simplify line code in crend */
#define FLOAT_FIX_POINT_HRTF_FILE_FORMAT                /* allows reading floation or fix point hrtf binary file format */
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define CONF_DISTATT                                    /* Eri: Make distance attenuation configurable */
#define FIX_1082_INSTRUM_FAILED_LC3PLUS                 /* VoiceAge: issue 1082: fix ambiguous syntax in LC3Plus code leading to fails of instrumented builds */
+8 −0
Original line number Diff line number Diff line
@@ -317,6 +317,14 @@ int32_t isar_get_lc3plus_bitrate(
    const int16_t split_prerender_frame_size_ms );
#endif

#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6
int32_t isar_get_lc3plus_bitrate(
    const int32_t SplitRendBitRate,
    const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode,
    const int32_t nChannels,
    const int32_t codecFrameDurationUs );
#endif

ivas_error isar_split_rend_validate_config(
    const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
    const int16_t pcm_out_flag );
+15 −0
Original line number Diff line number Diff line
@@ -1969,7 +1969,11 @@ ivas_error split_renderer_open_lc3plus(

    if ( ( error = ISAR_LC3PLUS_ENC_Open( config,
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6
                                          isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, config.channels, config.lc3plus_frame_duration_us ),
#else
                                          isar_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode ),
#endif
#else
                                          isar_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, (int16_t) ( config.isar_frame_duration_us / 1000 ) ),
#endif
@@ -2229,7 +2233,18 @@ ivas_error isar_renderMultiTDBinToSplitBinaural(
        {
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#ifdef ISAR_BITSTREAM_UPDATE_LC3PLUS
#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6
            if ( pBits->pose_correction == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE )
            {
                available_bits = isar_get_lc3plus_bitrate( SplitRendBitRate, hSplitBin->multiBinPoseData.poseCorrectionMode, hSplitBin->hLc3plusEnc->config.channels, hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us ) / FRAMES_PER_SEC;
            }
            else
            {
                available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written;
            }
#else
            available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written;
#endif
            if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, available_bits, in ) ) != IVAS_ERR_OK )
#else
            available_bits = ( SplitRendBitRate / FRAMES_PER_SEC ) - pBits->bits_written;
+24 −0
Original line number Diff line number Diff line
@@ -563,6 +563,30 @@ int32_t isar_get_lcld_bitrate(
    return -1;
}

#ifdef LC3PLUS_LEA_COMPAT_BITRATES_48_6
/*-------------------------------------------------------------------------
 * Function isar_get_lc3plus_bitrate()
 *
 *
 *------------------------------------------------------------------------*/

int32_t isar_get_lc3plus_bitrate(
    const int32_t SplitRendBitRate,
    const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode,
    const int32_t nChannels,
    const int32_t codecFrameDurationUs )
{
    int32_t bitrate;
    bitrate = isar_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode );
    /* Check for LC3plus LEA 48_6 LC3 compatibility mode signalling */
    if ( ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE == poseCorrectionMode && bitrate == 256000 && nChannels == 2 && codecFrameDurationUs == 10000 )
    {
        bitrate = 2 * 126000;
    }
    return bitrate;
}
#endif


#ifndef ISAR_BITSTREAM_UPDATE_LC3PLUS
/*-------------------------------------------------------------------------
Loading