Unverified Commit 8ee8334f authored by norvell's avatar norvell
Browse files

Add FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN to correct TD renderer gain range

parent a6b0e09b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@

#define FIX_BASOP_2451_HQ_FEC_SELECTOR                  /* Eri: Resolve basop issue 2451, wrong condition on env_stab_plc_fx */
#define FIX_2398_PRECISSION_ORIENTATION_TRACKING        /* FhG: use refinement of Sqrt32 within certain functions*/

#define FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN            /* Eri: Basop issue 2469: TD renderer gain has wrong Q and does not support the object editing gain range */

/* ##################### End NON-BE switches ########################### */

+4 −0
Original line number Diff line number Diff line
@@ -177,7 +177,11 @@ ivas_error TDREND_MIX_Init_fx(
)
{
    ivas_error error;
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    hBinRendererTd->Gain_fx = ONE_IN_Q29;
#else
    hBinRendererTd->Gain_fx = ONE_IN_Q14;
#endif
    move16();
    /* Init source list */
    /* Spatial settings */
+31 −3
Original line number Diff line number Diff line
@@ -278,7 +278,11 @@ void TDREND_firfilt_fx(
    Word32 *mem_fx,                /* i/o: filter memory                    Qx */
    const Word16 subframe_length,  /* i  : Length of signal                 Q0 */
    const Word16 filterlength,     /* i  : Filter length                    Q0 */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    const Word32 Gain_fx, /* i  : Gain                            Q29 */
#else
    const Word32 Gain_fx, /* i  : Gain                            Q30 */
#endif
    const Word32 prevGain_fx /* i  : Previous gain                   Q30 */
)
{
@@ -289,15 +293,29 @@ void TDREND_firfilt_fx(
    Word32 *p_filter_fx;                                                      // exp(filter_e)
    Word16 i, j;
    Word32 tmp_fx;
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    Word32 step_fx /* Q29 */, gain_tmp_fx /* Q29 */, gain_delta_fx /* Q29 */;
#else
    Word32 step_fx /* Q31 */, gain_tmp_fx /* Q31 */, gain_delta_fx /* Q30 */;
#endif
    Word16 tmp_e;
    Word64 tmp64_fx;
    Word16 shift = sub( filter_e, 32 );
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    gain_delta_fx = L_sub( Gain_fx, prevGain_fx ); // Q29
#else
    gain_delta_fx = L_sub( Gain_fx, prevGain_fx ); // Q30
#endif
    step_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( gain_delta_fx, subframe_length, &tmp_e ) ); // exp(tmp_e)
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    tmp_e = sub( tmp_e, Q31 );
    step_fx = L_shl_sat( step_fx, tmp_e ); // Q29
    gain_tmp_fx = prevGain_fx;             // Q29
#else
    tmp_e = sub( tmp_e, Q30 );
    step_fx = L_shl_sat( step_fx, tmp_e );     // Q31
    gain_tmp_fx = L_shl_sat( prevGain_fx, 1 ); // Q31
#endif

    /* Handle memory */
    p_signal_fx = buffer_fx + sub( filterlength, 1 );                                                                                          // Qx
@@ -325,8 +343,13 @@ void TDREND_firfilt_fx(
        tmp_fx = W_shl_sat_l( tmp64_fx, shift ); // Qx

        /* Apply linear gain interpolation in case of abrupt gain changes */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
        gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx );             /* Saturating values which just exceeds 4, Q29*/
        signal_fx[i] = L_shl( Mpy_32_32( tmp_fx, gain_tmp_fx ), 2 ); // Qx
#else
        gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx ); /* Saturating values which just exceeds 1, Q31*/
        signal_fx[i] = Mpy_32_32( tmp_fx, gain_tmp_fx ); // Qx
#endif
        move32();
        v_add_fx( filter_fx, filter_delta_fx, filter_fx, filterlength ); // exp(filter_e)
    }
@@ -349,8 +372,13 @@ void TDREND_firfilt_fx(
        tmp_fx = W_shl_sat_l( tmp64_fx, shift ); // Qx

        /* Apply linear gain interpolation in case of abrupt gain changes */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
        gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx );             /* Saturating values which just exceeds 4, Q29*/
        signal_fx[i] = L_shl( Mpy_32_32( tmp_fx, gain_tmp_fx ), 2 ); // Qx
#else
        gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx ); /* Saturating values which just exceeds 1, Q31*/
        signal_fx[i] = Mpy_32_32( tmp_fx, gain_tmp_fx ); // Qx
#endif
        move32();
    }

+26 −0
Original line number Diff line number Diff line
@@ -403,7 +403,16 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx(
        }

        /* Update total gains */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
        {
            Word32 tmp1, tmp2;
            tmp1 = L_shl( Mpy_32_16( extract_h( *SrcRend_p->SrcGain_p_fx ), extract_l( *SrcRend_p->SrcGain_p_fx ), *SrcRend_p->DirGain_p_fx ), 1 ); /* Q29 */
            tmp2 = L_shl( Mpy_32_16( extract_h( hBinRendererTd->Gain_fx ), extract_l( hBinRendererTd->Gain_fx ), *SrcRend_p->DistGain_p_fx ), 1 );  /* Q29 */
            *Gain = L_shl( Mpy_32_32( tmp1, tmp2 ), 2 );                                                                                            /* Q29 */
        }
#else
        *Gain = L_shl( Mpy_32_32( L_shl( L_mult( *SrcRend_p->SrcGain_p_fx, *SrcRend_p->DirGain_p_fx ), 1 ), L_shl( L_mult( *SrcRend_p->DistGain_p_fx, hBinRendererTd->Gain_fx ), 1 ) ), 1 ); // Q30
#endif
        move32();

        /* Delta for interpolation, in case the angular step exceeds MAX_ANGULAR_STEP=0.01f */
@@ -692,11 +701,21 @@ static void TDREND_SRC_SPATIAL_SetDistAtten(
 --------------------------------------------------------------------*/

static void TDREND_SRC_SPATIAL_SetGain(
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    const TDREND_SRC_t *Src_p, /* i  : Source                        */
    const Word32 Gain          /* i  : Gain                      Q29 */
#else
    const TDREND_SRC_t *Src_p, /* i  : Directional attenuation specification */
    const Word32 Gain          /* i  : Front-pointing vector                 */
#endif
)
{
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    Src_p->SrcRend_p->SrcGain_p_fx[0] = Gain; /* Q29 */
    move32();
#else
    Src_p->SrcRend_p->SrcGain_p_fx[0] = shl_sat( extract_h( Gain ), Q1 ); // TODO: Check incoming Q-value and fix this
#endif

    return;
}
@@ -978,10 +997,17 @@ void TDREND_SRC_Init_fx(
    move32();
    Src_p->elev_prev_fx = 0; // Q22
    move32();
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    Src_p->Gain_fx = ONE_IN_Q29; // Q29
    move32();
    Src_p->prevGain_fx = ONE_IN_Q29; // Q29
    move32();
#else
    Src_p->Gain_fx = ONE_IN_Q30; // Q30
    move32();
    Src_p->prevGain_fx = ONE_IN_Q30; // Q30
    move32();
#endif

    return;
}
+9 −0
Original line number Diff line number Diff line
@@ -817,7 +817,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams_fx(
    Word16 *intp_count,                                         /* o  : Interpolation count                       */
    Word16 *filterlength,                                       /* o  : Length of filters                         */
    Word16 *itd,                                                /* o  : ITD value                                 */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    Word32 *Gain,                                               /* o  : Gain value                           Q29  */
#else
    Word32 *Gain,                                               /* o  : Gain value                           Q30  */
#endif
    TDREND_SRC_t *Src_p                                         /* i/o: Source pointer                            */
);

@@ -897,8 +901,13 @@ void TDREND_firfilt_fx(
    Word32 *mem_fx,                                             /* i/o: filter memory                    Qx */
    const Word16 subframe_length,                               /* i  : Length of signal                    */
    const Word16 filterlength,                                  /* i  : Filter length                       */
#ifdef FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN
    const Word32 Gain_fx,                                       /* i  : Gain                            Q29 */
    const Word32 prevGain_fx                                    /* i  : Previous gain                   Q29 */
#else
    const Word32 Gain_fx,                                       /* i  : Gain                            Q30 */
    const Word32 prevGain_fx                                    /* i  : Previous gain                   Q30 */
#endif
);


Loading