Commit a7ca565b authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_ITD

parent de951741
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1391,7 +1391,6 @@ typedef enum
#define SFX_SPAT_BIN_MAX_FILTER_LENGTH          256

#define SPAT_BIN_MAX_INPUT_CHANNELS             1                           /* Max number of input channels per source/object. Mono for now, but stereo objects may be considered. */
#ifdef FIX_ITD
#define MAX_ITD                                 50
#define SFX_SPAT_BIN_SINC_M                     5
#define SFX_SPAT_BIN_NUM_SUBSAMPLES             64
@@ -1401,9 +1400,6 @@ typedef enum
#define MAX_ANGULAR_STEP_INV                    ( 1.0f / MAX_ANGULAR_STEP )
#define MAX_INTERPOLATION_STEPS                 12
#define BINAURAL_TD_LATENCY_S                   0.0f                        /* ITD fix removes TD renderer delay -- should be cleaned out */
#else
#define BINAURAL_TD_LATENCY_S                   0.00675f                    /* Binaural TD renderer latency in second == 324 samples in between 333 and 315 */
#endif

/* ----- Enums - TD Renderer ----- */

+0 −54
Original line number Diff line number Diff line
@@ -5021,13 +5021,9 @@ void GetFilterFromAngle(
    TDREND_HRFILT_FiltSet_t *HrFiltSet_p,                       /* i/o: HR filter set structure                 */
    const float Elev,                                           /* i  : Elevation, degrees                      */
    float Azim,                                                 /* i  : Azimuth, degrees                        */
#ifdef FIX_ITD
    float *LeftFilter,                                          /* o  : Left HR filter                          */
    float *RightFilter,                                         /* o  : Right HR filter                         */
    int16_t *itd                                                /* o  : ITD value                               */
#else
    SFX_SpatBin_Params_t *SfxSpatBinParams_p                    /* i/o: Currently used HR filter                */
#endif
);

void HRTF_model_precalc(
@@ -5052,22 +5048,11 @@ void TDREND_HRFILT_SetFiltSet(

ivas_error TDREND_REND_RenderSourceHRFilt(
    TDREND_SRC_t *Src_p,                                        /* i/o: The source to be rendered               */
#ifdef FIX_ITD
    const float *hrf_left_delta,                                /*   i: Left filter interpolation delta         */
    const float *hrf_right_delta,                               /*   i: Right filter interpolation delta        */
    const int16_t intp_count,                                   /*   i: Interpolation count                     */        
#else
#ifdef TDREND_HRTF_TABLE_METHODS
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd,          /* i/o: TD renderer handle                      */
#endif
#endif
    float output_buf[][L_SPATIAL_SUBFR_48k],                    /* o  : Output buffer                           */
#ifdef FIX_ITD
    const int16_t subframe_length                               /* i  : Subframe length in use                  */
#else
    const int16_t subframe_length,                              /* i  : Subframe length in use                  */
    const int32_t output_Fs                                     /* i  : Output sample rate                      */
#endif
);

/* ----- Object renderer - sources ----- */
@@ -5100,7 +5085,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd,          /* i/o: TD renderer handle                      */
    TDREND_SRC_REND_t *SrcRend_p,                               /* i/o: Source object                           */
    TDREND_SRC_SPATIAL_t *SrcSpatial_p,                         /* i  : Spatial aspects of source               */
#ifdef FIX_ITD
    float *hrf_left_prev,                                       /*   o: Left filter                             */
    float *hrf_right_prev,                                      /*   o: Right filter                            */
    float *hrf_left_delta,                                      /*   o: Left filter interpolation delta         */
@@ -5111,9 +5095,6 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    float *Gain,                                                /*   o: Gain value                              */
    TDREND_SRC_t *Src_p,
    const int16_t subframe_idx                                  /* i  : Subframe index to 5 ms subframe         */
#else
    const int32_t output_Fs                                     /* i  : Output sample rate                      */
#endif
);

ivas_error TDREND_SRC_Alloc(
@@ -5126,12 +5107,7 @@ void TDREND_SRC_Dealloc(

void TDREND_SRC_Init(
    TDREND_SRC_t *Src_p,                                        /* i/o: Source to initialize                    */ 
#ifdef FIX_ITD
    const TDREND_PosType_t PosType                              /* i  : Position type specifier                 */
#else
    const TDREND_PosType_t PosType,                             /* i  : Position type specifier                 */
    const int32_t output_Fs                                     /* i  : Output sampling rate                    */
#endif
);

/* ----- Object renderer - vec ----- */
@@ -5176,12 +5152,7 @@ int16_t TDREND_SPATIAL_EvalOrthonormOrient(
ivas_error TDREND_MIX_AddSrc(
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd,          /* i/o: TD renderer handle                      */
    int16_t *SrcInd,                                            /* o  : Source index                            */
#ifdef FIX_ITD
    const TDREND_PosType_t PosType                              /* i  : Position type (absolute/relative)       */
#else
    const TDREND_PosType_t PosType,                             /* i  : Position type (absolute/relative)       */
    const int32_t output_Fs                                     /* i  : Output sampling rate                    */
#endif
);

ivas_error TDREND_MIX_SetDistAttenModel(
@@ -5212,31 +5183,7 @@ ivas_error TDREND_MIX_Init(
);

 /* ----- Object renderer - sfx ----- */
#ifndef FIX_ITD
ivas_error TDREND_SFX_SpatBin_Initialize(
    SFX_SpatBin_t *SfxSpatBin_p,                                /* i/o: Spatial parameters handle               */
    const int32_t output_Fs                                     /* i  : Output sampling rate                    */
);

void TDREND_SFX_SpatBin_SetParams(
    SFX_SpatBin_t *SfxSpatBin_p,                                /* i/o: Spatial parameters struct to be updated */
    const SFX_SpatBin_Params_t *NewParam_p,                     /* i  : New parameters struct                   */
    const int32_t output_Fs                                     /* i  : Output sample rate                      */
);

void TDREND_SFX_SpatBin_Execute_Main(
    SFX_SpatBin_t *SfxSpatBin_p,                                /* i/o: Spatial parameters handle                  */
    const float *InBuffer_p,                                    /* i  : Input buffer                               */
    const int16_t subframe_length,                              /* i  : subframe length                            */
    float *LeftOutBuffer_p,                                     /* o  : Rendered left channel                      */
    float *RightOutBuffer_p,                                    /* o  : Rendered right channel                     */
    int16_t *NoOfUsedInputSamples_p,                            /* o  : Number of input samples actually used      */
    int16_t *NoOfDeliveredOutputSamples_p,                      /* o  : Number of output samples actually rendered */
    const int32_t output_Fs                                     /* i  : Output sample rate                         */
);
#endif

#ifdef FIX_ITD
void TDREND_Apply_ITD(
    float *input,                                               /*  i: Input SCE subframe to be time adjusted   */
    float *out_left,                                            /*  o: Output left channels with ITD applied    */
@@ -5256,7 +5203,6 @@ void TDREND_firfilt(
    const int16_t subframe_length,                              /* i  : Length of signal                        */
    const int16_t filterlength                                  /* i  : Filter length                           */
);
#endif
/*----------------------------------------------------------------------------------*
 * Filter-bank (FB) Mixer
 *----------------------------------------------------------------------------------*/
+0 −1
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define SBA_BR_SWITCHING_2                              /* Issue 114: Changes for sba bit rate switching with reconfigurations*/
#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/
#define FIX_ITD                                         /* Contribution 16: TD renderer ITD improvement and code cleanup */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */
#define FIX_ISM_DECODER_PRINTOUT                        /* Issue 229: fix ISM decoder printout */
#define FIX_150                                         /* Issue 150: Crash in EVS mono, HQ_HARMONIC mode, related to BASOP_NOGLOB */
+0 −71
Original line number Diff line number Diff line
@@ -1323,71 +1323,6 @@ typedef struct ivas_binaural_head_track_struct
 * TD ISm Object Renderer structure
 *----------------------------------------------------------------------------------*/

#ifndef FIX_ITD
// VE2AT: move to ivas_rom_rend.h ?
typedef struct
{
    SFX_OpMode_t OpMode;      /* Operating mode. This effect can only be TRANSIENT or OFF. */
    int16_t TurningOffEffect; /* Flag showing if the effect is being turned off. */
    int16_t TurningOnEffect;  /* Flag showing if the effect is being turned on. */
    int16_t InitializeParams; /* Flag showing if parameters should be initialized the next SetParam call. */
    int16_t FirstUpdate;      /* Flag showing if it SetParams has only been called once (TRUE) or more (FALSE). */

    int32_t TotNoOfOutputSamples; /* The total number of output samples produced since last SetParam call. */
    int32_t MaxTargetTime;        /* The maximum allowed target time. Also used for turning the effect on or off. */
    int32_t MaxBlockLength;       /* The maximum block length */

    int16_t TargetTime;                                                                                    /* Time left until the parameters should have reached the new parameters values. */
    float ItdIncrForResampling;                                                                            /* Resampling factor for adjusting the ITD. */
    float *LeftOldBuffer;                                                                                  /* Buffer with old samples for the Resampling function */
    int16_t NoOfLeftOldBufferSamples;                                                                      /* Number of samples in LeftOldBuffer                  */
    float Left_Tf;                                                                                         /* The left fractional delay. */
    float *RightOldBuffer;                                                                                 /* Buffer with old samples for the Resampling function */
    int16_t NoOfRightOldBufferSamples;                                                                     /* Number of samples in RightOldBuffer                  */
    float ResampledBufferLeft[SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES + SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; /* Buffers getting the resampled output and having the old samples used for HR-filtering */
    float ResampledBufferRight[SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES + SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1];
    int16_t TransientTime; /* Transient time when turning off the effect */

    int16_t FilterLength; /* HR-filter length */

    /* HR-filters */
    float *LeftFilter_p;      /* Pointer to left filter */
    float *LeftFilterIncr_p;  /* Left filter adjustment step */
    float *RightFilter_p;     /* Pointer to right filter */
    float *RightFilterIncr_p; /* Right filter adjustment step */

#ifdef TDREND_HRTF_TABLE_METHODS
    int16_t HrFilterInterpOn;                                /* Indicates whether to interpolate filter from previous frame */
    float LeftFilterStored[SFX_SPAT_BIN_MAX_FILTER_LENGTH];  /* Stored previous filter for interpolation */
    float RightFilterStored[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; /* Stored previous filter for interpolation */
#endif

} SFX_SpatBin_t;

/* Container struct for setting new parameters in SFX_SpatBin */
typedef struct
{
    int16_t TurnOn;
    int16_t Reset;
    /* Rendering parameters */
    float Itd;
    int16_t FilterLength;
    float *LeftFilter_p;
    float *RightFilter_p;
    float LeftVolume;
    float RightVolume;

} SFX_SpatBin_Params_t;

typedef struct TDREND_LIST_Item_s
{
    int16_t Ind;                       /* Index number of item */
    void *Data_p;                      /* Pointer to the item data struct */
    struct TDREND_LIST_Item_s *Prev_p; /* Pointer to the prev item */
    struct TDREND_LIST_Item_s *Next_p; /* Pointer to the next item */

} TDREND_LIST_Item_t;
#endif

typedef struct
{
@@ -1580,10 +1515,6 @@ typedef struct TDREND_SRC_REND_s
    float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS];
    float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS];
    float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS];
#ifndef FIX_ITD
    /* HR filtering parameters */
    SFX_SpatBin_t *SfxSpatBin_p;
#endif
} TDREND_SRC_REND_t;


@@ -1606,7 +1537,6 @@ typedef struct
    float *InputFrame_p; /* Input frame pointer */
    TDREND_SRC_SPATIAL_t *SrcSpatial_p;
    TDREND_SRC_REND_t *SrcRend_p;
#ifdef FIX_ITD
    int16_t itd;
    int16_t previtd;
    int16_t filterlength;
@@ -1618,7 +1548,6 @@ typedef struct
    float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1];
    float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1];
    float Gain;
#endif
} TDREND_SRC_t;

/* Top level TD binaural renderer handle */
+0 −3
Original line number Diff line number Diff line
@@ -108,9 +108,6 @@ ivas_error ivas_rend_TDObjRenderFrame(
    const IVAS_REND_HeadRotData *headRotData,        /* i  : Input head positions              */
    const IVAS_REND_AudioObjectPosition *currentPos, /* i  : Object position                   */
    const int16_t output_frame,                      /* i  : output frame length               */
#ifndef FIX_ITD
    const int32_t output_Fs, /* i  : output sampling rate              */
#endif
    float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */
);

Loading