Commit 1e3574dc authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'main' into 978-tdrend-mc-with-head-tracking-has-no-reverb

parents fc967b43 2b11d68e
Loading
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
@@ -198,9 +198,7 @@ int main(
    IVAS_RENDER_FRAMESIZE asked_frame_size;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
#endif
#ifdef DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -457,9 +455,14 @@ int main(
     *------------------------------------------------------------------------------------------*/

#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef SPLIT_REND_LCLD_5MS
    asked_frame_size = arg.renderFramesize;
#endif
    if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
#ifndef SPLIT_REND_LCLD_5MS
        asked_frame_size = arg.renderFramesize;
#endif
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -472,11 +475,12 @@ int main(
            goto cleanup;
        }

#ifndef SPLIT_REND_LCLD_5MS
        if ( arg.renderFramesize != asked_frame_size )
        {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for split rendering!\n" );
        }

#endif
        arg.enableHeadRotation = true;
    }
#endif
@@ -630,6 +634,7 @@ int main(
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifndef SPLIT_REND_LCLD_5MS
        if ( arg.renderFramesize == IVAS_RENDER_FRAMESIZE_5MS && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
                                                                   renderConfig.split_rend_config.dof == 0 ) )
        {
@@ -647,7 +652,7 @@ int main(
        }

#endif

#endif
        if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
@@ -660,6 +665,30 @@ int main(
            goto cleanup;
        }

#ifdef SPLIT_REND_LCLD_5MS
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
                                                                 renderConfig.split_rend_config.dof == 0 ) )
        {
            arg.renderFramesize = asked_frame_size;
        }
        else
        {
            arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
        }

        if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        if ( arg.renderFramesize != asked_frame_size )
        {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
        }
#endif
#endif

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
@@ -732,16 +761,6 @@ int main(
            }
        }

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

        if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK )
        {
@@ -802,7 +821,6 @@ int main(
            }
        }

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -820,7 +838,6 @@ int main(
                destroy_hrtf_statistics( hHrtfStatistics );
            }
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -903,10 +920,8 @@ cleanup:
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
        destroy_hrtf_statistics( hHrtfStatistics );
#endif
    }

    IVAS_DEC_Close( &hIvasDec );
+23 −17
Original line number Diff line number Diff line
@@ -747,9 +747,7 @@ int main(
    IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
#endif
    IsmPositionProvider *positionProvider;
    LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS];
    RenderConfigReader *renderConfigReader = NULL;
@@ -1037,16 +1035,6 @@ int main(
                }
            }

#ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            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 )
            {
@@ -1105,7 +1093,6 @@ int main(
                }
            }

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            if ( ( error = IVAS_REND_GetHrtfStatisticsHandle( hIvasRend, &hHrtfStatistics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_REND_GetHrtfStatisticsHandle failed\n\n" );
@@ -1123,7 +1110,6 @@ int main(
                    destroy_hrtf_statistics( hHrtfStatistics );
                }
            }
#endif
        }

        hrtfFileReader_close( &hrtfFileReader );
@@ -1903,7 +1889,8 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
            if ( splitBinNeedsNewFrame )
#ifdef SPLIT_REND_LCLD_5MS
            if ( numSamplesRead > 0 )
            {
                if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK )
                {
@@ -1917,7 +1904,24 @@ int main(
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
            }
#endif
            if ( splitBinNeedsNewFrame )
            {
#ifndef SPLIT_REND_LCLD_5MS
                if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
                IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.binBuses[i].inputChannelIndex, numChannels );

                if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, splitBinIds[i], tmpBuffer ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
#endif
                if ( ( error = IVAS_REND_FeedSplitBinauralBitstream( hIvasRend, splitBinIds[i], &bitsBuffer ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
@@ -2217,6 +2221,9 @@ cleanup:
    }

    split_rend_reader_writer_close( &hSplitRendFileReadWrite );
#ifdef SPLIT_REND_LCLD_5MS
    SplitRendBFIFileReader_close( &splitRendBFIReader );
#endif
#endif

    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
@@ -2229,12 +2236,11 @@ cleanup:
    RotationFileReader_close( &headRotReader );
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &referenceRotReader );

    Vector3PairFileReader_close( &referenceVectorReader );
    destroy_td_hrtf( hHrtfTD );
    destroy_SetOfHRTF( hSetOfHRTF );
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    destroy_hrtf_statistics( hHrtfStatistics );
#endif
    IVAS_REND_Close( &hIvasRend );
    IsmPositionProvider_close( positionProvider );
    RenderConfigReader_close( &renderConfigReader );
+1 −15
Original line number Diff line number Diff line
@@ -273,8 +273,7 @@ void tcx_hm_modify_envelope(
)
{
#ifdef FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI
    int16_t h, x;
    int32_t k;
    int32_t h, x, k;
#else
    int16_t k, h, x;
#endif
@@ -295,25 +294,12 @@ void tcx_hm_modify_envelope(

    while ( k <= L_frame + kTcxHmParabolaHalfWidth - 1 )
    {
#ifdef FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI
        int32_t tmp;
#endif

#ifdef FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI
        for ( x = (int16_t) max( 0, k - kTcxHmParabolaHalfWidth ); x <= (int16_t) min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x )
#else
        for ( x = max( 0, k - kTcxHmParabolaHalfWidth ); x <= min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x )
#endif
        {
            env[x] = Mpy_32_16( env[x], inv_shape[x - k + kTcxHmParabolaHalfWidth] );
        }
        ++h;
#ifdef FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI
        tmp = ( h * lag );
        k = tmp >> fract_res;
#else
        k = ( h * lag ) >> fract_res;
#endif
    }

    return;
+0 −2
Original line number Diff line number Diff line
@@ -163,9 +163,7 @@ typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;
typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
typedef struct ivas_hrtfs_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE;
#endif
typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE;

typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE;
+1 −6
Original line number Diff line number Diff line
@@ -445,13 +445,8 @@ ivas_error ivas_dirac_sba_config(
    else
    {
        hQMetaData->useLowerBandRes = 0;
#ifndef NONBE_FIX_973_HODIRAC_BAND_GROUPING
        if ( hodirac_flag == 0 )
#endif
        {
        nbands_coded = nbands - 1; /* always combine the last two bands */
    }
    }

    {
        int16_t no_dirs = 1;
Loading