Commit 81129c2c authored by norvell's avatar norvell
Browse files

Add interpolation of distance/direction gain in 6DoF under FIX_379_GAININTP

parent e3860752
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@
#define SBA2MONO                                        /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */
#define FIX_379_EXT_METADATA                            /* Eri: Extended metadata issues */
#define FIX_379_ANGLE                                   /* Eri: Extended metadata issues related to angle structure */

#define FIX_379_GAININTP                                /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+8 −0
Original line number Diff line number Diff line
@@ -69,13 +69,21 @@ ivas_error TDREND_REND_RenderSourceHRFilt(
{
    float LeftOutputFrame[L_SPATIAL_SUBFR_48k];
    float RightOutputFrame[L_SPATIAL_SUBFR_48k];
#ifndef FIX_379_GAININTP
    float Gain;

    Gain = ( *Src_p->SrcRend_p->DirGain_p ) * ( *Src_p->SrcRend_p->DistGain_p );
#endif

    TDREND_Apply_ITD( Src_p->InputFrame_p, LeftOutputFrame, RightOutputFrame, &Src_p->previtd, Src_p->itd, Src_p->mem_itd, subframe_length );
#ifdef FIX_379_GAININTP
    TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Src_p->Gain, Src_p->prevGain );
    TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Src_p->Gain, Src_p->prevGain );
    Src_p->prevGain = Src_p->Gain;
#else
    TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Gain );
    TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Gain );
#endif

    /* Copy to accumulative output frame */
    v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length );
+29 −1
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@
#include "ivas_rom_rend.h"
#include "prot.h"
#include "wmc_auto.h"
#ifdef FIX_379_GAININTP
#include "ivas_rom_com.h"
#endif


/*---------------------------------------------------------------------*
@@ -236,7 +239,12 @@ void TDREND_firfilt(
    float *mem,                    /* i/o: filter memory                  */
    const int16_t subframe_length, /* i  : Length of signal               */
    const int16_t filterlength,    /* i  : Filter length                  */
#ifdef FIX_379_GAININTP
    const float Gain,    /* i  : Gain                           */
    const float prevGain /* i  : Previous gain                  */
#else
    const float Gain /* i  : Gain                           */
#endif
)
{
    float buffer[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 + L_SUBFRAME5MS_48k];
@@ -245,6 +253,18 @@ void TDREND_firfilt(
    float *p_filter;
    float tmp;
    int16_t i, j;
#ifdef FIX_379_GAININTP
    float gain_tmp, gain_delta;
    const float *pcos;
    int16_t step;
    float cos_tmp;

    /* Setup pointer for cosine gain transition curve */
    gain_delta = Gain - prevGain;
    pcos = ivas_mdft_coeff_cos_twid_960; /* ivas_mdft_coeff_cos_twid_960 */
    step = 960 / subframe_length;
    gain_tmp = prevGain;
#endif

    /* Handle memory */
    p_signal = buffer + filterlength - 1;
@@ -262,7 +282,15 @@ void TDREND_firfilt(
        {
            tmp += ( *p_filter++ ) * ( *p_tmp-- );
        }
#ifdef FIX_379_GAININTP
        /* Apply cosine gain curve in case of abrupt gain changes */
        cos_tmp = *pcos;
        pcos += step;
        gain_tmp = prevGain + gain_delta * ( 1 - cos_tmp * cos_tmp );
        signal[i] = tmp * gain_tmp;
#else
        signal[i] = tmp * Gain;
#endif

        if ( i < intp_count )
        {
+5 −0
Original line number Diff line number Diff line
@@ -462,7 +462,12 @@ void TDREND_firfilt(
    float *mem,                                                 /* i/o: filter memory                           */
    const int16_t subframe_length,                              /* i  : Length of signal                        */
    const int16_t filterlength,                                 /* i  : Filter length                           */
#ifdef FIX_379_GAININTP 
    const float Gain,                                           /* i  : Gain                                    */
    const float prevGain                                        /* i  : Previous gain                           */
#else
    const float Gain                                            /* i  : Gain                                    */
#endif
);


+3 −0
Original line number Diff line number Diff line
@@ -600,6 +600,9 @@ 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;
#ifdef FIX_379_GAININTP
    float prevGain;
#endif
} TDREND_SRC_t;

/* Top level TD binaural renderer handle */