Commit 2c88982e authored by vaclav's avatar vaclav
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 5609487f
Loading
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -172,6 +172,9 @@ typedef struct

    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;

@@ -730,6 +733,9 @@ int main(
        hHrtfBinary.binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE;
        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
    }

    /*------------------------------------------------------------------------------------------*
@@ -808,7 +814,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 );
    }

@@ -2366,7 +2374,11 @@ 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_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
                {
                    return error;
                }
@@ -3273,7 +3285,11 @@ 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_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
                {
                    return error;
                }
@@ -3710,11 +3726,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;
@@ -3764,7 +3782,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 −1
Original line number Diff line number Diff line
@@ -163,7 +163,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_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 ################################## */

+39 −2
Original line number Diff line number Diff line
@@ -915,6 +915,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_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     */
)
@@ -925,7 +928,11 @@ ivas_error IVAS_DEC_ReadFormat(
    ISM_MODE ism_mode_old;
    MC_MODE mc_mode_old;
    int16_t nchan_transport_old;
#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;
#endif
    RENDERER_TYPE renderer_type_old;

    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
@@ -942,6 +949,10 @@ ivas_error IVAS_DEC_ReadFormat(
    transport_config_old = st_ivas->transport_config;
    renderer_type_old = st_ivas->renderer_type;

#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;
@@ -998,6 +1009,32 @@ ivas_error IVAS_DEC_ReadFormat(
            *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND;
        }

#ifdef FIX_1227_Crend_HRTF_LOADING_OPTIM
        *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
        if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND )
        {
            if ( st_ivas->ivas_format == ISM_FORMAT )
            {
                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
                {
                    /* BRIRs */
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;
                }
            }
            else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT )
            {
                /* BRIRs */
                *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;

                if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
                {
                    /* HRIRs */
                    *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_BINAURAL;
                }
            }
        }
#endif

        *intern_audio_config = st_ivas->intern_config;

        if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) ||
+3 −0
Original line number Diff line number Diff line
@@ -159,6 +159,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_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                                            */
);
Loading