Commit 2b644726 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fixed point conversion of sba_dirac_stereo_dec_fx.c

parent 74388cb0
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@
    <ClCompile Include="..\lib_dec\ivas_rom_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_sba_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_sba_dirac_stereo_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_sba_dirac_stereo_dec_fx.c" />
    <ClCompile Include="..\lib_dec\ivas_sba_rendering_internal.c" />
    <ClCompile Include="..\lib_dec\ivas_sce_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_sce_dec_fx.c" />
@@ -331,7 +332,9 @@
    <ClCompile Include="..\lib_dec\ivas_stereo_cng_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_dft_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_dft_dec_dmx.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_dft_dec_fx.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_dft_plc.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_dft_plc_fx.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_eclvq_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_esf_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_stereo_ica_dec.c" />
+33 −0
Original line number Diff line number Diff line
@@ -516,6 +516,10 @@ Word32 Sqrt32( /*!< output mantissa */
{
  Word16 preShift, e;

  if (mantissa < 0)
  {
    mantissa = mantissa;
  }
  assert(mantissa >= 0);

  /* normalize */
@@ -1237,6 +1241,35 @@ Word16 getCosWord16(Word16 theta)
  return result;
}

Word16 getSinWord16(Word16 theta)
{
  Word16 sine;
  Word32 theta_new  = L_sub(EVS_PI_BY_2_FX, theta);
  Word16 l_theta;
  IF(GT_32(theta_new, EVS_PI_FX))
  {
    l_theta = extract_l(L_sub(L_sub(theta_new, EVS_PI_FX), EVS_PI_FX ));
  }
  ELSE IF(LT_32(theta_new, -EVS_PI_FX))
  {
    l_theta = extract_l(L_add(L_add(theta_new, EVS_PI_FX), EVS_PI_FX));
  }
  ELSE
  {
    l_theta = extract_l(theta_new);
  }
  sine = getCosWord16(l_theta);
  IF (EQ_16(sine, ONE_IN_Q14))
  {
    sine = MAX_16;
  }
  ELSE
  {
    sine = shl(sine, 1);
  }
  return sine;
}

Word16 getCosWord16R2(
    Word16 theta )
{
+1 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ Word32 L_mult0_3216(Word32 x, /*!< : Multiplier */

/* Calculate sin/cos. Angle in 2Q13 format, result has exponent = 1 */
Word16 getCosWord16(Word16 theta);
Word16 getSinWord16(Word16 theta);
Word32 getCosWord32(Word32 theta);
/**
 * \brief calculate cosine of angle. Tuned for ISF domain.
+17 −0
Original line number Diff line number Diff line
@@ -211,6 +211,9 @@ enum{
#define INV_LOG_2                       1.442695040888963f /* 1/log(2)  */
#define INV_SQRT_2                      0.70710676908493f  /* 1/sqrt(2) */
#define INV_SQRT_2_Q15                  23170  /* 1/sqrt(2) in Q15 */
#ifdef IVAS_FLOAT_FIXED
#define INV_SQRT_2_FX                   (Word16)(0x5A82)  /* 1/sqrt(2) */
#endif

#define MAX_V_MULT_MAT                  100             /* maximum array length for the function v_mult_mat() */

@@ -546,6 +549,10 @@ enum
 *----------------------------------------------------------------------------------*/

#define FRAMES_PER_SEC                      50
#ifdef IVAS_FLOAT_FIXED
#define ONE_BY_FRAMES_PER_SEC               ((Word32)(0x028F5C29))
#define FRAMES_PER_SEC_BY_2                 (FRAMES_PER_SEC >> 1)
#endif
#define INV_FRAME_PER_SEC_Q15               656
#define INV_FR_P_S_MX_PRM_SPL_SBFR_Q15      164
#define FRAME_SIZE_NS                       20000000L
@@ -1669,6 +1676,10 @@ enum

#define OUTMAX_INV                          0.000030517578125f            /* 1/2^15 */
#define OUTMAX_INV_FX                       65536                         /* 1/2^15 (Q31) */
#ifdef IVAS_FLOAT_FIXED
#define ONE_BY_NS2A_8K_ST_DFT32MS_OVL_NS    (Word16)(0x051E)
#define OUTMAX_INV_FX_16                    (Word16)(0x0001)            /* 1/2^15 */
#endif
#define OUTMAX_SQ                           1073741824.f                  /* 2^30 */
#define OUTMAX_SQ_INV                       0.00000000093132257461547852f /* 1/2^30 */

@@ -1970,6 +1981,9 @@ typedef enum _DCTTYPE

#define EPSILON                             0.000000000000001f
#define EPSILON_FX                          0
#ifdef IVAS_FLOAT_FIXED
#define  EPSILON_FIX (1)
#endif

#define MAX_SEGMENT_LENGTH                  480
#define NUM_TIME_SWITCHING_BLOCKS           4
@@ -2928,6 +2942,9 @@ enum

#define EVS_PI                               3.14159265358979323846264338327950288f
#define EVS_PI_FX                            25736    /* pi in Q13 */
#define EVS_2PI_FX                           51472    /* 2 * pi in Q13 */
#define EVS_PI_BY_2_FX                            (Word16)(0x3244)
//#define EVS_PI_FX                            (Word16)(0x6488)

#define LG10                                 24660    /*  10*log10(2)  in Q13 */

+22 −0
Original line number Diff line number Diff line
@@ -1213,6 +1213,28 @@ Word32 rand_gauss_fx(
    return temp;
}
#endif
#ifdef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------
 * rand_gauss_fix()
 *
 * Random generator with Gaussian distribution with mean 0 and std 1
 *-------------------------------------------------------------------*/

Word16 rand_gauss_fix(
    Word16 *x,
    Word16 *seed )
{
    Word32 temp;

    temp = shr(own_random( seed ), Q2);
    temp = L_add(temp, shr(own_random( seed ), Q2));
    temp = L_add(temp, shr(own_random( seed ), Q2));

    *x = (Word16)temp;

    return (Word16)temp;
}
#endif

/*-------------------------------------------------------------------
 * lpc_from_spectrum_flt()
Loading