Commit 82d05b52 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

Merge remote-tracking branch 'origin/ivas-float-update' into 1680_ref-porting-mr-234-object-editing

parents 8a143193 6ded5dc7
Loading
Loading
Loading
Loading
+336 −12
Original line number Diff line number Diff line
@@ -163,6 +163,25 @@ typedef struct

} DecArguments;

#ifdef FIX_CREND_SIMPLIFY_CODE
typedef struct
{
    hrtfFileReader *hrtfReader;
    char *hrtfFileName;

    IVAS_DEC_HRTF_HANDLE *hHrtfTD;

    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;

    IVAS_BIN_RENDERER_TYPE binaural_renderer;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_old;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec_old;

    IVAS_AUDIO_CONFIG hrtf_set_audio_cfg;

} IVAS_DEC_HRTF_BINARY_WRAPPER;
#endif

/*------------------------------------------------------------------------------------------*
 * Local functions prototypes
@@ -170,9 +189,14 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef FIX_CREND_SIMPLIFY_CODE
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );

#endif
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed );
@@ -207,9 +231,13 @@ int main(
    RenderConfigReader *renderConfigReader = NULL;
    int16_t *pcmBuf = NULL;
    IVAS_RENDER_FRAMESIZE asked_frame_size;
#ifdef FIX_CREND_SIMPLIFY_CODE
    IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary;
#else
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
#endif
#ifdef DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -226,6 +254,11 @@ int main(
    reset_mem( USE_BYTES );
#endif

#ifdef FIX_CREND_SIMPLIFY_CODE
    hHrtfBinary.hHrtfTD = NULL;         /* just to avoid compilation warning */
    hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */
#endif

    splitRendBits.bits_buf = splitRendBitsBuf;

    /*------------------------------------------------------------------------------------------*
@@ -700,18 +733,29 @@ int main(
    }

    /*------------------------------------------------------------------------------------------*
     * Load HRTF binary file data
     * Initialize HRTF binary file data
     *------------------------------------------------------------------------------------------*/

    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        hHrtfBinary.hrtfReader = hrtfReader;
        hHrtfBinary.hrtfFileName = arg.hrtfFileName;
        hHrtfBinary.binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
        hHrtfBinary.binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE;
        hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
#else
        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 FIX_989_TD_REND_ROM
        if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, arg.output_Fs, hrtfReader ) ) != IVAS_ERR_OK )
#else
        if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
#endif
        {
            if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
            {
@@ -802,6 +846,7 @@ int main(
                destroy_hrtf_statistics( hHrtfStatistics );
            }
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -816,18 +861,32 @@ int main(
    }

    pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) );

#ifdef FIX_CREND_SIMPLIFY_CODE
    if ( pcmBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        goto cleanup;
    }
#endif
    /*-----------------------------------------------------------------*
     * Decoding
     *-----------------------------------------------------------------*/

    if ( arg.voipMode )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
#else
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
#endif
    }
    else
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -843,7 +902,11 @@ int main(
    }
    else
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        fprintf( stderr, "\nDecoding finished prematurely: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
#else
        fprintf( stdout, "Decoding finished prematurely\n\n" );
#endif
        goto cleanup;
    }

@@ -880,6 +943,10 @@ cleanup:
#endif
    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
#else
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        if ( hHrtfTD != NULL )
        {
@@ -892,6 +959,7 @@ cleanup:
        }
        IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
        destroy_hrtf_statistics( hHrtfStatistics );
#endif
    }

    IVAS_DEC_Close( &hIvasDec );
@@ -2163,6 +2231,9 @@ static ivas_error initOnFirstGoodFrame(
static ivas_error decodeG192(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
#ifdef FIX_CREND_SIMPLIFY_CODE
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary,
#endif
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
@@ -2535,6 +2606,30 @@ static ivas_error decodeG192(
                    goto cleanup;
                }


#ifdef FIX_CREND_SIMPLIFY_CODE
                /* Read main parameters from the bitstream to set-up the decoder */
                hHrtfBinary->binaural_renderer_old = hHrtfBinary->binaural_renderer;
                hHrtfBinary->binaural_renderer_sec_old = hHrtfBinary->binaural_renderer_sec;
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                /* Placeholder for memory reallocation */
                /* ... */

                /* Load HRTF binary file data */
                if ( arg.hrtfReaderEnabled )
                {
                    if ( ( error = load_hrtf_from_file( hHrtfBinary, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nIVAS_DEC_LoadHrtfFromFile failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }
                }
#endif

#ifdef OBJ_EDITING_API
#ifdef OBJ_EDITING_EXAMPLE
                if ( arg.objEditEnabled )
@@ -3104,6 +3199,9 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer
static ivas_error decodeVoIP(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
#ifdef FIX_CREND_SIMPLIFY_CODE
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf,
#endif
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
@@ -3153,6 +3251,10 @@ static ivas_error decodeVoIP(
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
#ifdef FIX_CREND_SIMPLIFY_CODE
    bool bitstreamReadDone = false;
    uint16_t nSamplesRendered;
#endif

#ifdef OBJ_EDITING_API
    bool parameterAvailableForEditing = false;
@@ -3275,6 +3377,9 @@ static ivas_error decodeVoIP(

    while ( 1 )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        nSamplesRendered = 0;
#endif

#ifdef OBJ_EDITING_API
        nSamplesRendered = 0;
@@ -3448,14 +3553,25 @@ static ivas_error decodeVoIP(


        /* decode and get samples */

#ifdef FIX_HRTF_LOAD
        while ( nSamplesRendered < nOutSamples )
        {
#endif
#ifdef SUPPORT_JBM_TRACEFILE
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter
#ifdef FIX_CREND_SIMPLIFY_CODE
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered
#ifdef OBJ_EDITING_API
                                                    ,
                                                 &nSamplesRendered, &parameterAvailableForEditing
                                                    &parameterAvailableForEditing
#endif
        
        ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef FIX_CREND_SIMPLIFY_CODE
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms
#ifdef OBJ_EDITING_API
@@ -3463,12 +3579,42 @@ static ivas_error decodeVoIP(
                                                 &nSamplesRendered, &parameterAvailableForEditing
#endif
                                                 ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }

#ifdef FIX_CREND_SIMPLIFY_CODE
            if ( bitstreamReadDone == true )
            {
                /* Read main parameters from the bitstream to set-up the decoder */
                hHrtf->binaural_renderer_old = hHrtf->binaural_renderer;
                hHrtf->binaural_renderer_sec_old = hHrtf->binaural_renderer_sec;
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                /* Placeholder for memory reallocation */
                /* ... */

                /* Load HRTF binary file data */
                if ( arg.hrtfReaderEnabled )
                {
                    if ( ( error = load_hrtf_from_file( hHrtf, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nIVAS_DEC_LoadHrtfFromFile failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }
                }
            }
#endif
#ifdef FIX_HRTF_LOAD
        }
#endif

        /* write JBM Offset file entry */
        if ( jbmOffsetWriter != NULL )
        {
@@ -3750,7 +3896,6 @@ cleanup:
    return error;
}


#ifdef DEBUGGING

/*---------------------------------------------------------------------*
@@ -3773,6 +3918,185 @@ static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec(

    return IVAS_DEC_FORCE_REND_UNDEFINED;
}

#endif

#ifdef FIX_CREND_SIMPLIFY_CODE
/*---------------------------------------------------------------------*
 * load_hrtf_from_file()
 *
 * Load HRTF coefficients from external binary file
 *---------------------------------------------------------------------*/

static ivas_error load_hrtf_from_file(
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, /* i/o: HRTF binary wrapper handle   */
    IVAS_DEC_HANDLE hIvasDec,                  /* i/o: IVAS decoder handle          */
    const IVAS_AUDIO_CONFIG OutputConfig,      /* i  : output audio configuration   */
    const int32_t output_Fs                    /* i  : output sampling rate         */
)
{
    ivas_error error;
    IVAS_BIN_RENDERER_TYPE binaural_renderer, binaural_renderer_sec;

    if ( hHrtfBinary == NULL || hIvasDec == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    binaural_renderer = hHrtfBinary->binaural_renderer;
    binaural_renderer_sec = hHrtfBinary->binaural_renderer_sec;

    if ( ( binaural_renderer != hHrtfBinary->binaural_renderer_old ) ||
         ( binaural_renderer_sec != hHrtfBinary->binaural_renderer_sec_old ) ||
         ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
    {
        /*------------------------------------------------------------------------------------------*
         * Release HRTF binary data
         *------------------------------------------------------------------------------------------*/

        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && binaural_renderer_sec != IVAS_BIN_RENDERER_TYPE_TDREND && hHrtfBinary->hHrtfTD != NULL )
        {
            destroy_td_hrtf( hHrtfBinary->hHrtfTD );
        }

        if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /*------------------------------------------------------------------------------------------*
         * Load HRTF binary data
         *------------------------------------------------------------------------------------------*/

        if ( ( error = IVAS_DEC_HRTF_binary_open( hIvasDec, binaural_renderer ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        if ( ( error = IVAS_DEC_HRTF_binary_open( hIvasDec, binaural_renderer_sec ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_sec == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfTDrendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

#ifdef FIX_989_TD_REND_ROM
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_HRTF_binary( *hHrtfBinary->hHrtfTD, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                    fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
                    return error;
                }
                else
                {
                    destroy_td_hrtf( hHrtfBinary->hHrtfTD );
                }
            }
        }

        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend = NULL;
            if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hHrtfCrend ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

            if ( ( error = load_Crend_HRTF_from_binary( *hHrtfCrend, hHrtfBinary->hrtfReader, OutputConfig, hHrtfBinary->hrtf_set_audio_cfg, 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", hHrtfBinary->hrtfFileName );
                    return error;
                }
                else
                {
                    destroy_crend_hrtf( hHrtfCrend );
                }
            }
        }

        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
            if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, OutputConfig, hHrtfBinary->hrtf_set_audio_cfg, hHrtfBinary->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", hHrtfBinary->hrtfFileName );
                    return error;
                }
                else
                {
                    destroy_fastconv_hrtf( hHrtfFastConv );
                }
            }
        }

        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
            if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

            if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hHrtfBinary->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", hHrtfBinary->hrtfFileName );
                    return error;
                }
                else
                {
                    destroy_parambin_hrtf( hHrtfParambin );
                }
            }
        }
    }

    if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            return error;
        }

        if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->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", hHrtfBinary->hrtfFileName );
                return error;
            }
            else
            {
                destroy_hrtf_statistics( hHrtfBinary->hHrtfStatistics );
            }
        }
    }

    return IVAS_ERR_OK;
}
#endif
#undef WMC_TOOL_SKIP
Loading