Commit 825c5046 authored by vaclav's avatar vaclav
Browse files

fix issue 1226: for FastConv binaural renderer in decoder, load only HTRT...

fix issue 1226: for FastConv binaural renderer in decoder, load only HTRT coefficient set that is needed; under FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
parent d5dcab3b
Loading
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -170,8 +170,12 @@ typedef struct
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec_old;

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
    IVAS_AUDIO_CONFIG fastConv_set_cfg;
#else
    IVAS_AUDIO_CONFIG intern_audio_config;
    int16_t room_reverb_flag;
#endif

} IVAS_DEC_HRTF_BINARY_WRAPPER;

@@ -728,8 +732,12 @@ int main(
        hHrtfBinary.hrtfFileName = arg.hrtfFileName;
        hHrtfBinary.binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
        hHrtfBinary.binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE;
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
        hHrtfBinary.fastConv_set_cfg = IVAS_AUDIO_CONFIG_INVALID;
#else
        hHrtfBinary.room_reverb_flag = 0;
        hHrtfBinary.intern_audio_config = IVAS_AUDIO_CONFIG_INVALID;
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -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_1226_FASTCONV_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->fastConv_set_cfg ) ) != 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_1226_FASTCONV_HRTF_LOADING_OPTIM
                if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->fastConv_set_cfg ) ) != 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;
                }
@@ -3787,7 +3803,11 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
                return error;
            }

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hHrtfBinary->fastConv_set_cfg, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hHrtfBinary->room_reverb_flag, hHrtfBinary->intern_audio_config, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
@@ -3797,6 +3817,9 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
                else
                {
                    destroy_fastconv_hrtf( hHrtfFastConv );
#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
                    return error;
#endif
                }
            }
        }
+4 −0
Original line number Diff line number Diff line
@@ -945,7 +945,11 @@ int main(
                goto cleanup;
            }

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, IVAS_AUDIO_CONFIG_EXTERNAL, hrtfFileReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, 0, IVAS_AUDIO_CONFIG_INVALID, hrtfFileReader ) ) != 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_1226_FASTCONV_HRTF_LOADING_OPTIM            /* VA: issue 1226: for FastConv binaural renderer in decoder, load only HTRT coefficient set that is needed */

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

+42 −8
Original line number Diff line number Diff line
@@ -915,8 +915,12 @@ 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 *fastConv_set_cfg /* o  : HRTF set audio config. for FastConv rend.*/
#else
    int16_t *room_reverb_flag,             /* o  : room reverb flag                         */
    IVAS_AUDIO_CONFIG *intern_audio_config /* o  : internal audio configuration             */
#endif
)
{
    ivas_error error;
@@ -972,16 +976,18 @@ ivas_error IVAS_DEC_ReadFormat(
                break;
            case RENDERER_BINAURAL_FASTCONV:
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;

#ifndef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
                if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
                {
                    *room_reverb_flag = 1;
                }

#endif
                break;
            case RENDERER_BINAURAL_FASTCONV_ROOM:
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;
#ifndef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
                *room_reverb_flag = 1;
#endif
                break;
            case RENDERER_BINAURAL_PARAMETRIC:
            case RENDERER_BINAURAL_PARAMETRIC_ROOM:
@@ -998,7 +1004,35 @@ ivas_error IVAS_DEC_ReadFormat(
            *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND;
        }

#ifdef FIX_1226_FASTCONV_HRTF_LOADING_OPTIM
        *fastConv_set_cfg = IVAS_AUDIO_CONFIG_INVALID;
        if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV )
        {
            if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
            {
                if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL ||
                     st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
                {
                    *fastConv_set_cfg = IVAS_AUDIO_CONFIG_HOA3;
                }
                else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
                {
                    *fastConv_set_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;
                }
            }
            else if ( st_ivas->ivas_format == MC_FORMAT )
            {
                *fastConv_set_cfg = IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR;

                if ( st_ivas->hDecoderConfig->Opt_Headrotation )
                {
                    *fastConv_set_cfg = IVAS_AUDIO_CONFIG_HOA3;
                }
            }
        }
#else
        *intern_audio_config = st_ivas->intern_config;
#endif

        if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) ||
             ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) )
+4 −0
Original line number Diff line number Diff line
@@ -159,8 +159,12 @@ 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 *fastConv_set_cfg         /* o  : HRTF set audio config. for FastConv rend.                               */
#else
    int16_t *room_reverb_flag,                  /* o  : room reverb flag                                                        */
    IVAS_AUDIO_CONFIG *intern_audio_config      /* o  : internal audio configuration                                            */
#endif
);

/*! r: decoder error code */
Loading