Commit b511c258 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

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

Merge branch 'main' of forge.3gpp.org:ivas-codec-pc/ivas-codec into 935-msan-error-in-sba-decoding-to-binaural_room_reverb
parents 8592280d 15499265
Loading
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ variables:
  BUILD_OUTPUT: "build_output.txt"
  EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test"
  EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec"
  SANITIZER_TESTS: "CLANG1 CLANG2"
  SANITIZER_TESTS: "CLANG1 CLANG2 CLANG3"
  OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4"
  OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3"
  OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB"
@@ -325,11 +325,12 @@ build-codec-instrumented-linux:
  extends:
    - .build-job-linux
    - .rules-basis
  timeout: "6 minutes"
  timeout: "7 minutes"
  script:
    - *print-common-info
    - *activate-Werror-linux
    - bash ci/build_codec_instrumented_linux.sh
    - ./scripts/prepare_instrumentation.sh
    - make -j -C scripts/c-code_instrument

# make sure that the codec builds with msan, asan and usan
build-codec-sanitizers-linux:
@@ -751,7 +752,7 @@ ivas-pytest-on-merge-request:
    - .rules-merge-request
  stage: compare
  needs: ["build-codec-linux-cmake", "codec-smoke-test"]
  timeout: "10 minutes"
  timeout: "14 minutes"
  script:
    - *print-common-info
    - *get-commits-behind-count
@@ -1267,10 +1268,11 @@ test-long-self-test:
    - ivas-linux-fast
  artifacts:
    name: "$CI_JOB_NAME--main--sha-$CI_COMMIT_SHORT_SHA"
    expire_in: 1 week
    expire_in: 2 weeks
    when: always
    paths:
      - ep_015.g192
      - dly_profile.dat
      - ./LOGS_PLC
      - ./LOGS_noPLC

+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

### Bug description

Clang (msan/asan?) sanitizer test in pipeline found an error:
Clang (m,a,u)san sanitizer test in pipeline found an error:

<!--- Copy sanitizer traceback from command line here -->
```
@@ -20,7 +20,7 @@ Using the [scripts](https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/wikis/
<!--- check correct sanitizer type -->
<!--- add error pattern if needed -->
```
python3 scripts/IvasBuildAndRunChecks.py --checks CLANGX -m MODE -p /path/to/my/local/ci_linux_ltv_local.json
python3 scripts/IvasBuildAndRunChecks.py --checks CLANGX -m MODE -p /path/to/my/local/ci_linux_ltv_local.json --usan_supp_file scripts/ubsan.supp
```
or directly:

+121 −4
Original line number Diff line number Diff line
@@ -196,6 +196,10 @@ int main(
    RenderConfigReader *renderConfigReader = NULL;
    int16_t *pcmBuf = NULL;
    IVAS_RENDER_FRAMESIZE asked_frame_size;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
#endif
#ifdef DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -708,58 +712,142 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;

#endif
        if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                destroy_td_hrtf( hHrtfTD );
            }
        }
#else
        if ( ( error = load_HRTF_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
        }
#else
        if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif
#endif

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName );
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                destroy_SetOfHRTF( hSetOfHRTF );
            }
        }
#endif

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
#else
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                destroy_fastconv_hrtf( hHrtfFastConv );
            }
        }
#else
        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
#else
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
#endif
        if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
            }
            else
            {
                destroy_parambin_hrtf( hHrtfParambin );
            }
        }
#else
        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -836,10 +924,19 @@ cleanup:
#endif
    if ( arg.hrtfReaderEnabled )
    {
#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        destroy_td_hrtf( hHrtfTD );
#else
        dealloc_HRTF_binary( hHrtfTD );
#endif

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
    }
@@ -1492,7 +1589,27 @@ static bool parseCmdlIVAS_dec(
     * Mandatory input arguments
     *-----------------------------------------------------------------*/

#ifdef FIX_956_DECODER_COMMAND_LINE_FIX
    if ( i < argc - 4 )
    {
        for ( i = 1; i < argc; i++ )
        {
            if ( argv[i][0] == '-' )
            {
                fprintf( stderr, "Error: Wrong order of command-line arguments (optional arguments are first)\n\n" );
                usage_dec();
                return false;
            }
        }

        fprintf( stderr, "Error: Too many mandatory command-line arguments\n\n" );
        usage_dec();
        return false;
    }
    else if ( i < argc - 3 )
#else
    if ( i < argc - 3 )
#endif
    {
        arg->outputConfig = cmdline2config( argv[i] );
        if ( arg->outputConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM )
+134 −3
Original line number Diff line number Diff line
@@ -743,6 +743,12 @@ int main(
#endif
    Vector3PairFileReader *referenceVectorReader = NULL;
    hrtfFileReader *hrtfFileReader = NULL;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
    IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
#endif
    IsmPositionProvider *positionProvider;
    LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS];
    RenderConfigReader *renderConfigReader = NULL;
@@ -762,7 +768,7 @@ int main(
    int16_t *outInt16Buffer;
    float *outFloatBuffer;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    uint8_t *bitsBufferData;
    uint8_t *bitsBufferData = NULL;
#endif
    IVAS_REND_AudioBuffer inBuffer;
    IVAS_REND_AudioBuffer outBuffer;
@@ -795,6 +801,10 @@ int main(

#ifdef SPLIT_REND_WITH_HEAD_ROT
    hSplitRendFileReadWrite = NULL;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    CLDFBframeSize_smpls = 0;
    cldfb_in_flag = 0;
#endif
#endif
    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
@@ -868,6 +878,7 @@ int main(
        }
    }

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
    if ( !isEmptyString( args.customHrtfFilePath ) )
    {
        if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK )
@@ -876,6 +887,7 @@ int main(
            exit( -1 );
        }
    }
#endif

    if ( !isEmptyString( args.renderConfigFilePath ) )
    {
@@ -1001,24 +1013,132 @@ int main(
#endif
    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
    }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    if ( !isEmptyString( args.customHrtfFilePath ) )
    {
        if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath );
            exit( -1 );
        }

        if ( hrtfFileReader != NULL )
        {
            if ( ( error = IVAS_REND_GetHrtfHandle( hIvasRend, &hHrtfTD ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_REND_GetHrtfHandle failed: %s\n\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
                }
                else
                {
                    destroy_td_hrtf( hHrtfTD );
                }
            }

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
            if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
                }
            }
#endif

            if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hSetOfHRTF ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
                }
                else
                {
                    destroy_SetOfHRTF( hSetOfHRTF );
                }
            }

            if ( ( error = IVAS_REND_GetHrtfFastConvHandle( hIvasRend, &hHrtfFastConv ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_REND_GetHrtfFastConvHandle failed: %s\n\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
                }
                else
                {
                    destroy_fastconv_hrtf( hHrtfFastConv );
                }
            }

            if ( ( error = IVAS_REND_GetHrtfParamBinHandle( hIvasRend, &hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", ivas_error_to_string( error ) );
                goto cleanup;
            }

            if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
                }
                else
                {
                    destroy_parambin_hrtf( hHrtfParambin );
                }
            }
        }

        hrtfFileReader_close( &hrtfFileReader );
    }
#endif

    /* === Configure === */
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Error in Renderer Config Init\n" );
        fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
    }

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
#ifdef SPLIT_REND_WITH_HEAD_ROT
    CLDFBframeSize_smpls = 0;
    cldfb_in_flag = 0;
#endif

#endif
    if ( args.renderConfigFilePath[0] != '\0' )
    {
        IVAS_RENDER_CONFIG_DATA renderConfig;
@@ -2079,6 +2199,11 @@ int main(
    free( inFloatBuffer );
    free( outInt16Buffer );
    free( outFloatBuffer );

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
cleanup:
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( bitsBufferData != NULL )
    {
@@ -2110,7 +2235,13 @@ int main(
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &referenceRotReader );
    Vector3PairFileReader_close( &referenceVectorReader );
#ifndef NONBE_FIX_BINARY_BINAURAL_READING
    hrtfFileReader_close( &hrtfFileReader );
#endif
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    destroy_td_hrtf( hHrtfTD );
    destroy_SetOfHRTF( hSetOfHRTF );
#endif
    IVAS_REND_Close( &hIvasRend );
    IsmPositionProvider_close( positionProvider );
    RenderConfigReader_close( &renderConfigReader );
+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))
Loading