Commit c581ec75 authored by vaclav's avatar vaclav
Browse files

fix external renderer

parent 2c88982e
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -927,7 +927,13 @@ int main(
            }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, IVAS_AUDIO_CONFIG_INVALID, args.sampleRate ) ) != IVAS_ERR_OK )
            IVAS_AUDIO_CONFIG hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL;
            if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
            {
                hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;
            }

            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, hrtf_set_audio_cfg, args.sampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK )
#endif
+5 −0
Original line number Diff line number Diff line
@@ -2193,8 +2193,13 @@ ivas_error ivas_init_decoder(
            }
        }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
                                            st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
                                            st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
+4 −0
Original line number Diff line number Diff line
@@ -205,7 +205,11 @@ static ivas_error ivas_ism_bitrate_switching_dec(
            ivas_omasa_data_close( &st_ivas->hMasaIsmData );

            /* Open Crend Binaural renderer */
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
+4 −0
Original line number Diff line number Diff line
@@ -1241,7 +1241,11 @@ static ivas_error ivas_mc_dec_reconfig(
            }
            else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) )
            {
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
                if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
                if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
                }
+65 −31
Original line number Diff line number Diff line
@@ -173,6 +173,9 @@ static ivas_error ivas_rend_initCrend(
    const AUDIO_CONFIG inConfig,
    const AUDIO_CONFIG outConfig,
    HRTFS_CREND_HANDLE hSetOfHRTF,
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    const int16_t ext_rend_flag,
#endif
    const int32_t output_Fs )
{
    int16_t i, j, tmp;
@@ -198,7 +201,8 @@ static ivas_error ivas_rend_initCrend(
    if ( hHrtf == NULL )
    {
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        if ( hSetOfHRTF != NULL )

        if ( hSetOfHRTF != NULL && ext_rend_flag == 0 )
        {
            /* HRTF set loaded from binary file */
            if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
@@ -209,6 +213,8 @@ static ivas_error ivas_rend_initCrend(
            {
                hHrtf = hSetOfHRTF->hHRTF_hrir_combined;
            }

            hHrtf->init_from_rom = 0;
        }
        else
        {
@@ -216,6 +222,12 @@ static ivas_error ivas_rend_initCrend(
            {
                return error;
            }

            hHrtf->init_from_rom = 1;
            if ( hSetOfHRTF != NULL )
            {
                hHrtf->init_from_rom = 0;
            }
        }
#else
        if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK )
@@ -237,6 +249,9 @@ static ivas_error ivas_rend_initCrend(
        return IVAS_ERR_INTERNAL_FATAL;
    }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    if ( hHrtf->init_from_rom )
#else
    if ( ( hSetOfHRTF == NULL ) ||
         ( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ||
         ( ( hSetOfHRTF->hHRTF_hrir_combined == NULL ) && ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL ) ) ||
@@ -244,8 +259,11 @@ static ivas_error ivas_rend_initCrend(
         ( ( hSetOfHRTF->hHRTF_hrir_foa == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_FOA ) ) ||
         ( ( hSetOfHRTF->hHRTF_hrir_hoa2 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA2 ) ) ||
         ( ( hSetOfHRTF->hHRTF_hrir_hoa3 == NULL ) && ( inConfig == IVAS_AUDIO_CONFIG_HOA3 ) ) )
#endif
    {
#ifndef FIX_1227_Crend_HRTF_LOADING_OPTIM
        hHrtf->init_from_rom = 1;
#endif
        if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
        {
            hHrtf->max_num_ir -= 1; /* subtract LFE */
@@ -727,7 +745,10 @@ static ivas_error ivas_rend_initCrend(
            hHrtf->max_num_ir -= 1; /* subtract LFE */
            hHrtf->gain_lfe = GAIN_LFE;

#ifndef FIX_1227_Crend_HRTF_LOADING_OPTIM
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            if ( ext_rend_flag == 1 )
            {
#endif
                if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
                {
                    if ( hSetOfHRTF->hHRTF_brir_combined == NULL )
@@ -766,6 +787,8 @@ static ivas_error ivas_rend_initCrend(
                        hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_im[j];
                    }
                }
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            }
#endif

            for ( i = 0; i < hHrtf->max_num_ir; i++ )
@@ -1232,7 +1255,11 @@ ivas_error ivas_rend_openMultiBinCrend(
    const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    const int32_t output_Fs )
{
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    return ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, NULL /* hHrtfStatistics */, output_Fs, 0, pMultiBinPoseData->num_poses );
#else
    return ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, NULL /* hHrtfStatistics */, output_Fs, pMultiBinPoseData->num_poses );
#endif
}


@@ -1250,6 +1277,9 @@ ivas_error ivas_rend_openCrend(
    HRTFS_CREND_HANDLE hSetOfHRTF,
    HRTFS_STATISTICS_HANDLE hHrtfStatistics,
    const int32_t output_Fs,
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    const int16_t ext_rend_flag,
#endif
    const int16_t num_poses )
{
    int16_t i, subframe_length;
@@ -1270,7 +1300,11 @@ ivas_error ivas_rend_openCrend(

    if ( ( *pCrend )->hHrtfCrend == NULL )
    {
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hSetOfHRTF, ext_rend_flag, output_Fs ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
Loading