Commit 103af260 authored by vaclav's avatar vaclav Committed by emerit
Browse files

issue 1227: for Crend binaural renderer in decoder, load only HTRT coefficient...

issue 1227: for Crend binaural renderer in decoder, load only HTRT coefficient set that is needed; under FIX_1227_Crend_HRTF_LOADING_OPTIM
parent fcb057c8
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -173,6 +173,8 @@ typedef struct
#else
    IVAS_AUDIO_CONFIG intern_audio_config;
    int16_t room_reverb_flag;
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG hrtf_set_audio_cfg;
#endif

} IVAS_DEC_HRTF_BINARY_WRAPPER;
@@ -734,6 +736,8 @@ int main(
#else
        hHrtfBinary.room_reverb_flag = 0;
        hHrtfBinary.intern_audio_config = IVAS_AUDIO_CONFIG_INVALID;
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
#endif
    }

@@ -813,7 +817,9 @@ cleanup:
    if ( arg.hrtfReaderEnabled )
    {
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
#ifndef FIX_1227_Crend_HRTF_LOADING_OPTIM
        destroy_SetOfHRTF( hHrtfBinary.hSetOfHRTF );
#endif
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
    }

@@ -2365,8 +2371,8 @@ static ivas_error decodeG192(
                /* 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;
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg, &hHrtfBinary->room_reverb_flag, &hHrtfBinary->intern_audio_config ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->room_reverb_flag, &hHrtfBinary->intern_audio_config ) ) != IVAS_ERR_OK )
#endif
@@ -3280,8 +3286,8 @@ static ivas_error decodeVoIP(
                /* 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;
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg, &hHrtf->room_reverb_flag, &hHrtf->intern_audio_config ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->room_reverb_flag, &hHrtf->intern_audio_config ) ) != IVAS_ERR_OK )
#endif
@@ -3739,11 +3745,13 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
            destroy_td_hrtf( hHrtfBinary->hHrtfTD );
        }

#ifndef FIX_1227_Crend_HRTF_LOADING_OPTIM
        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && hHrtfBinary->hSetOfHRTF != NULL )
        {
            destroy_SetOfHRTF( hHrtfBinary->hSetOfHRTF );
        }

#endif
        if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -3793,7 +3801,11 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
                return error;
            }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            if ( ( error = create_SetOfHRTF_from_binary( *hHrtfBinary->hSetOfHRTF, hHrtfBinary->hrtfReader, hHrtfBinary->hrtf_set_audio_cfg, output_Fs ) ) != IVAS_ERR_OK )
#else
            if ( ( error = create_SetOfHRTF_from_binary( *hHrtfBinary->hSetOfHRTF, hHrtfBinary->hrtfReader, output_Fs ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
+4 −0
Original line number Diff line number Diff line
@@ -926,7 +926,11 @@ int main(
                goto cleanup;
            }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, IVAS_AUDIO_CONFIG_INVALID, args.sampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
+1 −2
Original line number Diff line number Diff line
@@ -161,8 +161,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1209_SID_SIGNALING                          /* VA: issue 1209: remove dead code in IVAS SID signaling */
#define FIX_1226_FASTCONV_HRTF_LOADING_OPTIM            /* VA: issue 1226: for FastConv binaural renderer in decoder, load only HTRT coefficient set that is needed */

#define FIX_1227_Crend_HRTF_LOADING_OPTIM               /* VA: issue 1227: for Crend binaural renderer in decoder, load only HTRT coefficient set that is needed */

/* #################### End BE switches ################################## */

+21 −26
Original line number Diff line number Diff line
@@ -909,12 +909,11 @@ ivas_error IVAS_DEC_ReadFormat(
    IVAS_DEC_HANDLE hIvasDec,                      /* i/o: IVAS decoder handle              */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer,     /* o  : binaural renderer type           */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec, /* o  : secondary binaural renderer type */
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg /* o  : HRTF set audio config.                   */
#else
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg, /* o  : HRTF set audio config.           */
#endif
    int16_t *room_reverb_flag,             /* o  : room reverb flag                 */
    IVAS_AUDIO_CONFIG *intern_audio_config /* o  : internal audio configuration     */
#endif
)
{
    ivas_error error;
@@ -923,7 +922,7 @@ ivas_error IVAS_DEC_ReadFormat(
    ISM_MODE ism_mode_old;
    MC_MODE mc_mode_old;
    int16_t nchan_transport_old;
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    AUDIO_CONFIG intern_config_old, transport_config_old, output_config;
#else
    AUDIO_CONFIG intern_config_old, transport_config_old;
@@ -944,11 +943,10 @@ ivas_error IVAS_DEC_ReadFormat(
    transport_config_old = st_ivas->transport_config;
    renderer_type_old = st_ivas->renderer_type;

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    output_config = st_ivas->hDecoderConfig->output_config;

#endif

    if ( st_ivas->ivas_format == MONO_FORMAT )
    {
        return IVAS_ERR_OK;
@@ -1011,35 +1009,32 @@ ivas_error IVAS_DEC_ReadFormat(
            *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND;
        }

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
        if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV )
        if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND )
        {
            if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
            if ( st_ivas->ivas_format == ISM_FORMAT )
            {
                /* SHD HRIRs */
                *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_HOA3;

                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
                {
                    /* BRIRs */
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;
                }
            }
            else if ( st_ivas->ivas_format == MC_FORMAT )
            else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT )
            {
                /* HRIRs */
                *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
                /* BRIRs */
                *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;

                if ( ( st_ivas->hDecoderConfig->Opt_Headrotation ) &&
                     !( st_ivas->mc_mode == MC_MODE_PARAMUPMIX && output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
                {
                    /* SHD HRIRs for low complexity rotation */
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_HOA3;
                    /* HRIRs */
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL;
                }
            }
        }
#else
#endif

        *intern_audio_config = st_ivas->intern_config;
#endif

+3 −3
Original line number Diff line number Diff line
@@ -157,9 +157,9 @@ ivas_error IVAS_DEC_ReadFormat(
    IVAS_DEC_HANDLE hIvasDec,                   /* i/o: IVAS decoder handle                                                     */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer,  /* o  : binaural renderer type                                                  */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec,/* o: secondary binaural renderer type                                        */
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg       /* o  : HRTF set audio config.                                                  */
#else
#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg,      /* o  : HRTF set audio config.                                                  */
#endif
    int16_t *room_reverb_flag,                  /* o  : room reverb flag                                                        */
    IVAS_AUDIO_CONFIG *intern_audio_config      /* o  : internal audio configuration                                            */
#endif
Loading