Commit 9fb5214d authored by emerit's avatar emerit
Browse files

bug fix

parent 7632fb03
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -918,15 +918,21 @@ cleanup:
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        if ( hHrtfTD != NULL )
        {
            dealloc_HRTF_binary( *hHrtfTD );
        }
#ifdef FIX_BINARY_BINAURAL_READING
        IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        if ( hSetOfHRTF != NULL )
        {
            destroy_SetOfHRTF( *hSetOfHRTF );
        }
    }

    IVAS_DEC_Close( &hIvasDec );
    CustomLsReader_close( &hLsCustomReader );
+33 −1
Original line number Diff line number Diff line
@@ -809,17 +809,28 @@ static ivas_error ivas_rend_initCrend(

            if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
            {
#ifdef FIX_BINARY_BINAURAL_READING
                if ( hSetOfHRTF->hHRTF_brir_combined == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Invalid command wrong output format" );
                }
#endif
                hHrtf->latency_s = hSetOfHRTF->hHRTF_brir_combined->latency_s;
                hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_brir_combined->max_num_iterations;
                hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_brir_combined->index_frequency_max_diffuse;
            }
            else
            {
#ifdef FIX_BINARY_BINAURAL_READING
                if ( hSetOfHRTF->hHRTF_hrir_combined == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Invalid command wrong output format" );
                }
#endif
                hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_combined->latency_s;
                hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_combined->max_num_iterations;
                hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_combined->index_frequency_max_diffuse;
            }

            for ( j = 0; j < BINAURAL_CHANNELS; j++ )
            {
                if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
@@ -903,6 +914,13 @@ static ivas_error ivas_rend_initCrend(
        {
            if ( inConfig == IVAS_AUDIO_CONFIG_HOA3 )
            {
#ifdef FIX_BINARY_BINAURAL_READING
                if ( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Invalid command wrong output format" );
                }
#endif

                hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s;
                hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa3->max_num_iterations;
                hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa3->index_frequency_max_diffuse;
@@ -934,6 +952,13 @@ static ivas_error ivas_rend_initCrend(
            }
            else if ( inConfig == IVAS_AUDIO_CONFIG_HOA2 )
            {
#ifdef FIX_BINARY_BINAURAL_READING
                if ( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Invalid command wrong output format" );
                }
#endif

                hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s;
                hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa2->max_num_iterations;
                hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa2->index_frequency_max_diffuse;
@@ -965,6 +990,13 @@ static ivas_error ivas_rend_initCrend(
            }
            else if ( inConfig == IVAS_AUDIO_CONFIG_FOA )
            {
#ifdef FIX_BINARY_BINAURAL_READING
                if ( hSetOfHRTF->hHRTF_hrir_foa == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Invalid command wrong output format" );
                }
#endif

                hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_foa->latency_s;
                hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_foa->max_num_iterations;
                hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_foa->index_frequency_max_diffuse;
+4 −0
Original line number Diff line number Diff line
@@ -66,7 +66,11 @@
#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS )
#endif

#ifdef FIX_BINARY_BINAURAL_READING
#define MAX_BIN_DELAY_SAMPLES 150 /* Maximum supported rendering latency for binaural IRs */
#else
#define MAX_BIN_DELAY_SAMPLES 50 /* Maximum supported rendering latency for binaural IRs */
#endif

/* Frame size required when rendering to binaural */
#define BINAURAL_RENDERING_FRAME_SIZE_MS 5