Commit 109c1d8b authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '1591_ref_port_fl1374' into 'float-pc'

Port float MR 1374 to float-pc

See merge request !1597
parents c9ac3eae a8df9142
Loading
Loading
Loading
Loading
+0 −70
Original line number Diff line number Diff line
@@ -197,10 +197,8 @@ 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;
@@ -728,16 +726,12 @@ 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 )
@@ -774,16 +768,8 @@ int main(
                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 )
@@ -792,16 +778,6 @@ int main(
                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 )
        {
@@ -809,7 +785,6 @@ int main(
            goto cleanup;
        }

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_OLD_BINARY_FORMAT
@@ -846,26 +821,14 @@ int main(
            }
#endif
        }
#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 )
@@ -878,26 +841,14 @@ int main(
                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 )
@@ -910,13 +861,6 @@ int main(
                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
    }

    /*------------------------------------------------------------------------------------------*
@@ -993,30 +937,16 @@ 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
        if ( hHrtfTD != NULL )
        {
            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 );
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        if ( hSetOfHRTF != NULL )
        {
            destroy_SetOfHRTF( hSetOfHRTF );
        }
#else
        destroy_SetOfHRTF( hSetOfHRTF );
#endif
    }

    IVAS_DEC_Close( &hIvasDec );
+0 −25
Original line number Diff line number Diff line
@@ -672,12 +672,10 @@ 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;
@@ -819,16 +817,6 @@ int main(
        }
    }

#ifndef 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 );
        }
    }
#endif

    if ( !isEmptyString( args.renderConfigFilePath ) )
    {
@@ -916,17 +904,12 @@ int main(
    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 )
@@ -1072,7 +1055,6 @@ int main(

        hrtfFileReader_close( &hrtfFileReader );
    }
#endif

    fprintf( stdout, "Input audio file:       %s\n", args.inputFilePath );
    fprintf( stdout, "Output audio file:      %s\n\n", args.outputFilePath );
@@ -2114,9 +2096,7 @@ int main(
    free( outInt16Buffer );
    free( outFloatBuffer );

#ifdef NONBE_FIX_BINARY_BINAURAL_READING
cleanup:
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( bitsBufferData != NULL )
@@ -2151,10 +2131,6 @@ cleanup:
    RotationFileReader_close( &referenceRotReader );

    Vector3PairFileReader_close( &referenceVectorReader );
#ifndef NONBE_FIX_BINARY_BINAURAL_READING
    hrtfFileReader_close( &hrtfFileReader );
#endif
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    if ( hSetOfHRTF != NULL && *hSetOfHRTF != NULL )
    {
        destroy_SetOfHRTF( hSetOfHRTF );
@@ -2163,7 +2139,6 @@ cleanup:
    {
        destroy_td_hrtf( hHrtfTD );
    }
#endif
    IVAS_REND_Close( &hIvasRend );
    IsmPositionProvider_close( positionProvider );
    RenderConfigReader_close( &renderConfigReader );
+0 −3
Original line number Diff line number Diff line
@@ -1536,9 +1536,6 @@ typedef enum
#define MAX_ANGULAR_STEP_INV                    ( 1.0f / MAX_ANGULAR_STEP )
#define MAX_INTERPOLATION_STEPS                 12

#ifndef NONBE_FIX_BINARY_BINAURAL_READING
#define LR_IAC_LENGTH_NR_FC                     ( RV_LENGTH_NR_FC )
#endif

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

+0 −4
Original line number Diff line number Diff line
@@ -78,9 +78,7 @@ typedef enum
    IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
    IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED,
    IVAS_ERR_INVALID_HRTF,
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
    IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA,
#endif
    IVAS_ERR_INVALID_INPUT_FORMAT,
    IVAS_ERR_INVALID_INDEX,
    IVAS_ERR_NOT_SUPPORTED_OPTION,
@@ -266,10 +264,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
            return "Acoustic environment not supported";
        case IVAS_ERR_INVALID_HRTF:
            return "Unsupported HRTF filter set";
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA:
            return "Renderer data missing in HRTF binary file";
#endif
        case IVAS_ERR_INVALID_INPUT_FORMAT:
            return "Invalid input format";
        case IVAS_ERR_INVALID_INDEX:
+0 −4
Original line number Diff line number Diff line
@@ -5492,11 +5492,7 @@ void ivas_mono_dmx_renderer_close(
    MONO_DOWNMIX_RENDERER_HANDLE *hMonoDmxRenderer              /* i/ i/o: Mono downmix structure                       */
);

#ifdef NONBE_FIX_967_ISM_MONO_DMX
void ivas_ism_mono_dmx(
#else
void ivas_mono_downmix_render_passive(
#endif
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                */
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/mono output */
    const int16_t output_frame                                  /* i  : output frame length                                   */
Loading