Commit 4fd32473 authored by vaclav's avatar vaclav
Browse files

address remaining todos

parent 922ef1b8
Loading
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -171,8 +171,8 @@ typedef struct
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF;
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;

    ISAR_SPLIT_REND_RENDERER_SELECTION binaural_renderer;
    ISAR_SPLIT_REND_RENDERER_SELECTION binaural_renderer_old;
    IVAS_BIN_RENDERER_TYPE binaural_renderer;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_old;

    IVAS_AUDIO_CONFIG intern_audio_config;
    int16_t room_reverb_flag;
@@ -768,7 +768,7 @@ int main(
#ifdef FIX_HRTF_LOAD
        hHrtfBinary.hrtfReader = hrtfReader;
        hHrtfBinary.hrtfFileName = arg.hrtfFileName;
        hHrtfBinary.binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_NONE;
        hHrtfBinary.binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
        hHrtfBinary.room_reverb_flag = 0;
        hHrtfBinary.intern_audio_config = IVAS_AUDIO_CONFIG_INVALID;
#else
@@ -3860,7 +3860,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
    const int32_t output_Fs )
{
    ivas_error error;
    ISAR_SPLIT_REND_RENDERER_SELECTION binaural_renderer;
    IVAS_BIN_RENDERER_TYPE binaural_renderer;

    if ( hHrtfBinary == NULL || hIvasDec == NULL )
    {
@@ -3869,18 +3869,18 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(

    binaural_renderer = hHrtfBinary->binaural_renderer;

    if ( ( binaural_renderer != hHrtfBinary->binaural_renderer_old ) || ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
    if ( ( binaural_renderer != hHrtfBinary->binaural_renderer_old ) || ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
    {
        /*------------------------------------------------------------------------------------------*
         * Release HRTF binary data
         *------------------------------------------------------------------------------------------*/

        if ( !( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_TDREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
            destroy_td_hrtf( hHrtfBinary->hHrtfTD );
        }

        if ( !( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_CREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
            destroy_SetOfHRTF( hHrtfBinary->hSetOfHRTF );
        }
@@ -3899,7 +3899,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
            return error;
        }

        if ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_TDREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT )
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK )
            {
@@ -3921,7 +3921,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
            }
        }

        if ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_CREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT )
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hHrtfBinary->hSetOfHRTF ) ) != IVAS_ERR_OK )
            {
@@ -3943,7 +3943,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
            }
        }

        if ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT )
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
            if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
@@ -3966,7 +3966,7 @@ static ivas_error IVAS_DEC_LoadHrtfFromFile(
            }
        }

        if ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_PARAMBIN || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT )
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {
            IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
            if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK )
+4 −0
Original line number Diff line number Diff line
@@ -615,7 +615,11 @@ static int16_t get_cldfb_in_flag(
    int16_t cldfb_in_flag;

    cldfb_in_flag = 0;
#ifdef FIX_HRTF_LOAD
    if ( renderConfig->split_rend_config.rendererSelection == IVAS_BIN_RENDERER_TYPE_FASTCONV )
#else
    if ( renderConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
#endif
    {
#ifdef DEBUGGING
        cldfb_in_flag = 1;
+18 −3
Original line number Diff line number Diff line
@@ -213,6 +213,18 @@ typedef struct _IVAS_JBM_TRACE_DATA

} IVAS_JBM_TRACE_DATA;

#ifdef FIX_HRTF_LOAD
typedef enum _ivas_binaural_renderer_type
{
    IVAS_BIN_RENDERER_TYPE_NONE,
    IVAS_BIN_RENDERER_TYPE_CREND,
    IVAS_BIN_RENDERER_TYPE_FASTCONV,
    IVAS_BIN_RENDERER_TYPE_PARAMBIN,
    IVAS_BIN_RENDERER_TYPE_TDREND,
    IVAS_BIN_RENDERER_TYPE_DEFAULT,

} IVAS_BIN_RENDERER_TYPE;
#endif

/*----------------------------------------------------------------------------------*
 * Split rendering API constants, structures, and enums
@@ -251,11 +263,9 @@ typedef enum

} ISAR_SPLIT_REND_CODEC;

#ifndef FIX_HRTF_LOAD
typedef enum
{
#ifdef FIX_HRTF_LOAD // VE: rename the enum -> IVAS_RENDERER_xx
    ISAR_SPLIT_REND_RENDERER_SELECTION_NONE,
#endif
    ISAR_SPLIT_REND_RENDERER_SELECTION_CREND,
    ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV,
    ISAR_SPLIT_REND_RENDERER_SELECTION_PARAMBIN,
@@ -263,6 +273,7 @@ typedef enum
    ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT,

} ISAR_SPLIT_REND_RENDERER_SELECTION;
#endif

typedef struct _ISAR_SPLIT_REND_BITS_DATA
{
@@ -294,7 +305,11 @@ typedef struct _ISAR_SPLIT_REND_CONFIG
    int16_t codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
    ISAR_SPLIT_REND_CODEC codec;
#ifdef FIX_HRTF_LOAD
    IVAS_BIN_RENDERER_TYPE rendererSelection;
#else
    ISAR_SPLIT_REND_RENDERER_SELECTION rendererSelection;
#endif
    int16_t lc3plus_highres;

} ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE;
+2 −5
Original line number Diff line number Diff line
@@ -1153,15 +1153,12 @@ ivas_error ivas_init_decoder_front(
        }
    }

#ifndef FIX_HRTF_LOAD
    /*-------------------------------------------------------------------*
     * Allocate HRTF binary handle
     *--------------------------------------------------------------------*/

#ifdef FIX_HRTF_LOAD // VE: TODO - JBM decoder path to be addressed
    if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && st_ivas->hDecoderConfig->Opt_tsm )
#else
    if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
#endif
    {
        if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
        {
@@ -1187,7 +1184,7 @@ ivas_error ivas_init_decoder_front(
            return error;
        }
    }

#endif
    /*-------------------------------------------------------------------*
     * Allocate and initialize Binaural Renderer configuration handle
     *--------------------------------------------------------------------*/
+26 −26
Original line number Diff line number Diff line
@@ -1064,7 +1064,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial(

ivas_error IVAS_DEC_ReadFormat(
    IVAS_DEC_HANDLE hIvasDec,                  /* i/o: IVAS decoder handle          */
    ISAR_SPLIT_REND_RENDERER_SELECTION *binaural_renderer, /* o  : binaural renderer type       */
    IVAS_BIN_RENDERER_TYPE *binaural_renderer, /* o  : binaural renderer type       */
    int16_t *room_reverb_flag,                 /* o  : room reverb flag             */
    IVAS_AUDIO_CONFIG *intern_audio_config     /* o  : internal audio configuration */
)
@@ -1113,14 +1113,14 @@ ivas_error IVAS_DEC_ReadFormat(
        switch ( st_ivas->renderer_type )
        {
            case RENDERER_BINAURAL_OBJECTS_TD:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_TDREND;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_TDREND;
                break;
            case RENDERER_BINAURAL_MIXER_CONV:
            case RENDERER_BINAURAL_MIXER_CONV_ROOM:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_CREND;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_CREND;
                break;
            case RENDERER_BINAURAL_FASTCONV:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;

                if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
                {
@@ -1129,21 +1129,20 @@ ivas_error IVAS_DEC_ReadFormat(

                break;
            case RENDERER_BINAURAL_FASTCONV_ROOM:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;
                *room_reverb_flag = 1;
                break;
            case RENDERER_BINAURAL_PARAMETRIC:
            case RENDERER_BINAURAL_PARAMETRIC_ROOM:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_PARAMBIN;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_PARAMBIN;
                break;
            default:
                *binaural_renderer = ISAR_SPLIT_REND_RENDERER_SELECTION_NONE;
                *binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
                break;
        }

        *intern_audio_config = st_ivas->intern_config;

#ifdef FIX_HRTF_LOAD
        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 ) )
        {
@@ -1166,7 +1165,6 @@ ivas_error IVAS_DEC_ReadFormat(
                }
            }
        }
#endif
    }

    st_ivas->ism_mode = ism_mode_old;
@@ -3023,7 +3021,7 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle(

ivas_error IVAS_DEC_HRTF_binary_open(
    IVAS_DEC_HANDLE hIvasDec,                      /* i/o: IVAS decoder handle      */
    const ISAR_SPLIT_REND_RENDERER_SELECTION binaural_renderer /* i  : binaural renderer type   */
    const IVAS_BIN_RENDERER_TYPE binaural_renderer /* i  : binaural renderer type   */
)
{
    ivas_error error;
@@ -3038,7 +3036,8 @@ ivas_error IVAS_DEC_HRTF_binary_open(

    if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
    {
        if ( ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_TDREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) && st_ivas->hHrtfTD == NULL )
        /* TD binaural renderer */
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && st_ivas->hHrtfTD == NULL )
        {
            if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
            {
@@ -3046,7 +3045,8 @@ ivas_error IVAS_DEC_HRTF_binary_open(
            }
        }

        if ( ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_CREND || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) && st_ivas->hSetOfHRTF == NULL )
        /* Crend binaural renderer */
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && st_ivas->hSetOfHRTF == NULL )
        {
            if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK )
            {
@@ -3054,7 +3054,8 @@ ivas_error IVAS_DEC_HRTF_binary_open(
            }
        }

        if ( ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) && st_ivas->hHrtfFastConv == NULL )
        /* FastConv binaural renderer */
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && st_ivas->hHrtfFastConv == NULL )
        {
            if ( ( error = ivas_HRTF_fastconv_binary_open( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK )
            {
@@ -3062,7 +3063,8 @@ ivas_error IVAS_DEC_HRTF_binary_open(
            }
        }

        if ( ( binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_PARAMBIN || binaural_renderer == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) && st_ivas->hHrtfParambin == NULL )
        /* Parametric binaural renderer */
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && st_ivas->hHrtfParambin == NULL )
        {
            if ( ( error = ivas_HRTF_parambin_binary_open( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
            {
@@ -3091,7 +3093,7 @@ ivas_error IVAS_DEC_HRTF_binary_open(

ivas_error IVAS_DEC_HRTF_binary_close(
    IVAS_DEC_HANDLE hIvasDec,                          /* i/o: IVAS decoder handle              */
    const ISAR_SPLIT_REND_RENDERER_SELECTION binaural_renderer_old /* i  : previous binaural renderer type  */
    const IVAS_BIN_RENDERER_TYPE binaural_renderer_old /* i  : previous binaural renderer type  */
)
{
    Decoder_Struct *st_ivas;
@@ -3105,20 +3107,18 @@ ivas_error IVAS_DEC_HRTF_binary_close(

    if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
    {
#if 0
        if ( !( binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_TDREND || binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
            ivas_HRTF_binary_close( &st_ivas->hHrtfTD );
        }

        if ( !( binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_CREND || binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {
            /* CRend binaural renderer handle */
            ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF );
        }
#endif

        if ( !( binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV || binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {

            /* Fastconv HRTF memories */
@@ -3128,7 +3128,7 @@ ivas_error IVAS_DEC_HRTF_binary_close(
            ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv );
        }

        if ( !( binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_PARAMBIN || binaural_renderer_old == ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT ) )
        if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
        {

            /* Parametric binauralizer HRTF filters */
Loading