Commit 18a3c9e1 authored by Andrea Genovese's avatar Andrea Genovese
Browse files

merged main into branch

parents a5e6e3ca 2668a005
Loading
Loading
Loading
Loading
Loading
+1 −1
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"
+128 −1
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,172 @@ 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 )
            {
#ifdef FIX_OLD_BINARY_FORMAT
                hrtfFileReader_close( &hrtfReader );
                strcat( arg.hrtfFileName, "new" );

                if ( hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                    goto cleanup;
                }

                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
                fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
                goto cleanup;
#endif
            }
            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;
        }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != 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_SetOfHRTF( hSetOfHRTF );
            }
        }
#else
        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 );
            goto cleanup;
        }
#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 +954,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 );
    }
+156 −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,154 @@ 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 )
                {
#ifdef FIX_OLD_BINARY_FORMAT
                    hrtfFileReader_close( &hrtfFileReader );
                    strcat( args.customHrtfFilePath, "new" );
                    if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, 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 );
                        }
                    }
#else
                    fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) );
                    goto cleanup;
#endif
                }
                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 +2221,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 +2257,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 );
+4 −1
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@ 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"]
SUPPORTED_TESTS = ["CLANG1", "CLANG2", "CLANG3"]
USAN_SUPP_FILE = str(SCRIPT_DIR.joinpath("ubsan.supp"))
EP_FILE = "ep_015.g192"
DLY_PROFILE_IN = SCRIPT_DIR.joinpath("dly_error_profiles/dly_error_profile_5.dat")
DLY_PROFILE_OUT = "dly_profile.dat"
@@ -145,6 +146,8 @@ def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = Tr
        "--oc",
        *out_formats,
        *md_file_command,
        "--usan_supp_file",
        USAN_SUPP_FILE,
    ]

    print(
+11 −3
Original line number Diff line number Diff line
@@ -1556,6 +1556,9 @@ typedef enum
#define MAX_SPLIT_MD_SUBFRAMES                  1
#define COMPLEX_MD_BAND_THRESH                  MAX_SPLIT_REND_MD_BANDS
#define COMPLEX_MD_BAND_THRESH_LOW              5
#ifdef SPLIT_REND_HF_TUNING
#define SPLIT_REND_RO_MD_BAND_THRESH            4
#endif

#define IVAS_SPLIT_REND_NUM_QUANT_STRATS        4
#define IVAS_SPLIT_REND_PRED_63QUANT_PNTS       63
@@ -1613,8 +1616,6 @@ typedef enum
#define MAX_ANGULAR_STEP_INV                    ( 1.0f / MAX_ANGULAR_STEP )
#define MAX_INTERPOLATION_STEPS                 12

#define LR_IAC_LENGTH_NR_FC                     ( RV_LENGTH_NR_FC )

/* ----- Enums - TD Renderer ----- */

typedef enum
@@ -1666,9 +1667,16 @@ typedef enum
#define RV_FILTER_MAX_FFT_SIZE                  ( 512 )
#define RV_FILTER_MAX_HISTORY                   ( 512 - 160 )               /* for longest history */
#define RV_LENGTH_NR_FC                         ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1

#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
#define RV_LENGTH_NR_FC_16KHZ                   ( RV_FILTER_MAX_FFT_SIZE / 4 ) + 1
#endif
#define IVAS_REVERB_DEFAULT_N_BANDS             31

#define LR_IAC_LENGTH_NR_FC                     ( RV_LENGTH_NR_FC )
#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB
#define LR_IAC_LENGTH_NR_FC_16KHZ               ( RV_LENGTH_NR_FC_16KHZ )
#endif


/*----------------------------------------------------------------------------------*
 * FB mixer constants
Loading