Commit 9754b5ff authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ivas_mc_param_dec_digest_tc_fxd' into 'main'

Few subfunctions for ivas_mc_param_dec_digest_tc converted to fxd.

See merge request !181
parents 2a5cda70 ff49dec6
Loading
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -4384,6 +4384,21 @@ Word16 matrix_product_fx(
    Word32 *Z_fx                                                    /* o  : resulting matrix after the matrix multiplication                                       */
);

Word16 matrix_product_mant_exp(
  const Word32 *X_fx,    /* i  : left hand matrix                                                                       */
  const Word16 *X_e,     /* i  : left hand matrix                                                                       */
  const Word16 rowsX,   /* i  : number of rows of the left hand matrix                                                 */
  const Word16 colsX,   /* i  : number of columns of the left hand matrix                                              */
  const Word16 transpX, /* i  : flag indicating the transposition of the left hand matrix prior to the multiplication  */
  const Word32 *Y_fx,    /* i  : right hand matrix                                                                      */
  const Word16 *Y_e,     /* i  : right hand matrix                                                                      */
  const Word16 rowsY,   /* i  : number of rows of the right hand matrix                                                */
  const Word16 colsY,   /* i  : number of columns of the right hand matrix                                             */
  const Word16 transpY, /* i  : flag indicating the transposition of the right hand matrix prior to the multiplication */
  Word32 *Z_fx,          /* o  : resulting matrix after the matrix multiplication                                       */
  Word16 *Z_e            /* o  : resulting matrix after the matrix multiplication                                       */
);

void mat2svdMat_fx(
    const Word32 *mat,                                       /* i  : matrix as column ordered vector */
    Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o  : matrix as two-dimensional arry  */
+15 −0
Original line number Diff line number Diff line
@@ -1509,4 +1509,19 @@ void synchro_synthesis_fixed_clean(
  const Word16 output_frame,         /* i  : Number of samples                   */
  const Word16 sba_dirac_stereo_flag /* i  : signal stereo output for SBA DirAC  */
);

//ivas_dirac_output_synthesis_cov
void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx(
  Word32 *RealBuffer_fx,                                                                                        /* i  : input channel filter bank samples (real part)         */
  Word16 RealBuffer_e,                                                                                          /* i  : exponent input channel filter bank samples (real part)*/
  Word32 *ImagBuffer_fx,                                                                                        /* i  : input channel filter bank samples (imaginary part     */
  Word16 ImagBuffer_e,                                                                                          /* i  : exponent input channel filter bank samples (real part)*/
  Word32 cx_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS],      /* o  : accumulated input covariance (real part)              */
  Word16 *cx_e,                                                                                                 /* i  : exponent for accumulated input covariance (real part) */
  Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o  : accumulated input covariance (imaginary part)         */
  Word16 *cx_imag_e,                                                                                            /* i : exponent accumulated input covariance (imag part)      */
  PARAM_MC_DEC_HANDLE hParamMC,                                                                                 /* i  : handle to Parametric MC state                         */
  const Word16 nchan_in                                                                                         /* i  : number of input channels                              */
);

#endif
+166 −17
Original line number Diff line number Diff line
@@ -2041,6 +2041,16 @@ const float ivas_param_mc_ild_fac_CICP6_2tc[6] =
    0.323713613305539f,
    0.208150823035836f,
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] =
{
    12832,
    12832,
    6820,
    10607,
    10607,
    6820 
};
const float ivas_param_mc_ild_fac_CICP12_2tc[8] =
{
@@ -2053,6 +2063,18 @@ const float ivas_param_mc_ild_fac_CICP12_2tc[8] =
    0.171473949468979f,
    0.208008958987949f
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP12_2tc_fx[8] =
{
    11965,
    11965,
    6816,
    6877,
    6877,
    5619,
    5619,
    6816
};
const float ivas_param_mc_ild_fac_CICP12_3tc[8] =
{
@@ -2065,6 +2087,18 @@ const float ivas_param_mc_ild_fac_CICP12_3tc[8] =
    1.0f,
    0.25f
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP12_3tc_fx[8] =
{
    16384,
    16384,
    9502,
    9502,
    6553,
    6553,
    32767,
    8192
};
const float ivas_param_mc_ild_fac_CICP14_2tc[8] =
{
@@ -2077,6 +2111,18 @@ const float ivas_param_mc_ild_fac_CICP14_2tc[8] =
    0.24564756f,
    0.20800895f
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP14_2tc_fx[8] =
{
    11936,
    11936,
    5993,
    6945,
    6945,
    8049,
    8049,
    6816
};
const float ivas_param_mc_ild_fac_CICP14_3tc[8] =
{
@@ -2089,6 +2135,18 @@ const float ivas_param_mc_ild_fac_CICP14_3tc[8] =
    1.0f,
    0.25f
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP14_3tc_fx[8] =
{
    16291,
    16291,
    8257,
    8257,
    9666,
    9666,
    32767,
    8192
};
const float ivas_param_mc_ild_fac_CICP16_3tc[10] =
{
@@ -2103,6 +2161,20 @@ const float ivas_param_mc_ild_fac_CICP16_3tc[10] =
    1.0f,
    0.25f,
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP16_3tc_fx[10] =
{
    11141,
    11141,
    7209,
    7209,
    6553,
    6553,
    5898,
    5898,
    32767,
    8192
};
const float ivas_param_mc_ild_fac_CICP19_3tc[12] =
{
@@ -2119,6 +2191,22 @@ const float ivas_param_mc_ild_fac_CICP19_3tc[12] =
    1.0f,
    0.5f
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP19_3tc_fx[12] =
{
    9830,
    9830,
    5570,
    5570,
    3932,
    3932,
    6226,
    6226,
    6226,
    6226,
    32767,
    16384
};
const float ivas_param_mc_ild_fac_CICP19_4tc[12] =
{
@@ -2135,6 +2223,22 @@ const float ivas_param_mc_ild_fac_CICP19_4tc[12] =
    0.5f,
    0.2f,
};
//Q15
const Word16 ivas_param_mc_ild_fac_CICP19_4tc_fx[12] =
{
    11468,
    11468,
    5570,
    7209,
    6553,
    6553,
    6553,
    16384,
    16384,
    16384,
    16384,
    6553
};
const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc =
{
@@ -2335,7 +2439,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP6_2tc,
        &ivas_param_mc_icc_mapping_CICP6_2tc,
        &ivas_param_mc_dmx_fac_CICP6_2tc[0],
        &ivas_param_mc_ild_fac_CICP6_2tc[0]
        &ivas_param_mc_ild_fac_CICP6_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP6_2tc_fx[0]
#endif
    },
    /* CICP6 64000 */
    {
@@ -2346,7 +2453,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP6_2tc,
        &ivas_param_mc_icc_mapping_CICP6_2tc,
        &ivas_param_mc_dmx_fac_CICP6_2tc[0],
        &ivas_param_mc_ild_fac_CICP6_2tc[0]
        &ivas_param_mc_ild_fac_CICP6_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP6_2tc_fx[0]
#endif
    },
    /* CICP6 80000 */
    {
@@ -2357,7 +2467,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP6_2tc,
        &ivas_param_mc_icc_mapping_CICP6_2tc,
        &ivas_param_mc_dmx_fac_CICP6_2tc[0],
        &ivas_param_mc_ild_fac_CICP6_2tc[0]
        &ivas_param_mc_ild_fac_CICP6_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP6_2tc_fx[0]
#endif
    },
    /* CICP12 48000 */
    {
@@ -2368,7 +2481,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP12_2tc,
        &ivas_param_mc_icc_mapping_CICP12_2tc,
        &ivas_param_mc_dmx_fac_CICP12_2tc[0],
        &ivas_param_mc_ild_fac_CICP12_2tc[0]
        &ivas_param_mc_ild_fac_CICP12_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP12_2tc_fx[0]
#endif
    },
    /* CICP12 64000 */
    {
@@ -2379,7 +2495,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP12_2tc,
        &ivas_param_mc_icc_mapping_CICP12_2tc,
        &ivas_param_mc_dmx_fac_CICP12_2tc[0],
        &ivas_param_mc_ild_fac_CICP12_2tc[0]
        &ivas_param_mc_ild_fac_CICP12_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP12_2tc_fx[0]
#endif
    },
    /* CICP12 80000 */
    {
@@ -2390,7 +2509,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP12_2tc,
        &ivas_param_mc_icc_mapping_CICP12_2tc,
        &ivas_param_mc_dmx_fac_CICP12_2tc[0],
        &ivas_param_mc_ild_fac_CICP12_2tc[0]
        &ivas_param_mc_ild_fac_CICP12_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP12_2tc_fx[0]
#endif
    },
    /* CICP12 96000 */
    {
@@ -2401,7 +2523,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP12_3tc,
        &ivas_param_mc_icc_mapping_CICP12_3tc,
        &ivas_param_mc_dmx_fac_CICP12_3tc[0],
        &ivas_param_mc_ild_fac_CICP12_3tc[0]
        &ivas_param_mc_ild_fac_CICP12_3tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP12_3tc_fx[0]
#endif
    },
    /* CICP14 48000 */
    {
@@ -2412,7 +2537,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP14_2tc,
        &ivas_param_mc_icc_mapping_CICP14_2tc,
        &ivas_param_mc_dmx_fac_CICP14_2tc[0],
        &ivas_param_mc_ild_fac_CICP14_2tc[0]
        &ivas_param_mc_ild_fac_CICP14_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP14_2tc_fx[0]
#endif
    },
    /* CICP14 64000 */
    {
@@ -2423,7 +2551,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP14_2tc,
        &ivas_param_mc_icc_mapping_CICP14_2tc,
        &ivas_param_mc_dmx_fac_CICP14_2tc[0],
        &ivas_param_mc_ild_fac_CICP14_2tc[0]
        &ivas_param_mc_ild_fac_CICP14_2tc[0],
#ifdef IVAS_FLOAT_FIXED
		&ivas_param_mc_ild_fac_CICP14_2tc_fx[0]
#endif
    },
    /* CICP14 80000 */
    {
@@ -2434,7 +2565,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP14_2tc,
        &ivas_param_mc_icc_mapping_CICP14_2tc,
        &ivas_param_mc_dmx_fac_CICP14_2tc[0],
        &ivas_param_mc_ild_fac_CICP14_2tc[0]
        &ivas_param_mc_ild_fac_CICP14_2tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP14_2tc_fx[0]
#endif
    },
    /* CICP14 96000 */
    {
@@ -2445,7 +2579,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP14_3tc,
        &ivas_param_mc_icc_mapping_CICP14_3tc,
        &ivas_param_mc_dmx_fac_CICP14_3tc[0],
        &ivas_param_mc_ild_fac_CICP14_3tc[0]
        &ivas_param_mc_ild_fac_CICP14_3tc[0],
#ifdef IVAS_FLOAT_FIXED
		&ivas_param_mc_ild_fac_CICP14_3tc_fx[0]
#endif
    },
    /* CICP16 96000 */
    {
@@ -2456,7 +2593,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP16_3tc,
        &ivas_param_mc_icc_mapping_CICP16_3tc,
        &ivas_param_mc_dmx_fac_CICP16_3tc[0],
        &ivas_param_mc_ild_fac_CICP16_3tc[0]
        &ivas_param_mc_ild_fac_CICP16_3tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP16_3tc_fx[0]
#endif
	},
    /* CICP16 128000 */
    {
@@ -2467,7 +2607,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP16_3tc,
        &ivas_param_mc_icc_mapping_CICP16_3tc,
        &ivas_param_mc_dmx_fac_CICP16_3tc[0],
        &ivas_param_mc_ild_fac_CICP16_3tc[0]
        &ivas_param_mc_ild_fac_CICP16_3tc[0],
#ifdef IVAS_FLOAT_FIXED      
		&ivas_param_mc_ild_fac_CICP16_3tc_fx[0]
#endif
	},
    /* CICP19 128000 */
    {
@@ -2478,7 +2621,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP19_3tc,
        &ivas_param_mc_icc_mapping_CICP19_3tc,
        &ivas_param_mc_dmx_fac_CICP19_3tc[0],
        &ivas_param_mc_ild_fac_CICP19_3tc[0]
        &ivas_param_mc_ild_fac_CICP19_3tc[0],
#ifdef IVAS_FLOAT_FIXED
        &ivas_param_mc_ild_fac_CICP19_3tc_fx[0]
#endif
    },
    /* CICP19 160000 */
    {
@@ -2489,7 +2635,10 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
        &ivas_param_mc_ild_mapping_CICP19_4tc,
        &ivas_param_mc_icc_mapping_CICP19_4tc,
        &ivas_param_mc_dmx_fac_CICP19_4tc[0],
        &ivas_param_mc_ild_fac_CICP19_4tc[0]
        &ivas_param_mc_ild_fac_CICP19_4tc[0],
#ifdef IVAS_FLOAT_FIXED
		&ivas_param_mc_ild_fac_CICP19_4tc_fx[0]
#endif
    }
};
+150 −0
Original line number Diff line number Diff line
@@ -1257,6 +1257,156 @@ Word16 matrix_product_fx(

    return EXIT_SUCCESS;
}

/*takes input matrices in mantissa and exponent forms*/
Word16 matrix_product_mant_exp(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       */
    const Word16 *X_e,    /* i  : left hand matrix                                                                       */
    const Word16 rowsX,   /* i  : number of rows of the left hand matrix                                                 */
    const Word16 colsX,   /* i  : number of columns of the left hand matrix                                              */
    const Word16 transpX, /* i  : flag indicating the transposition of the left hand matrix prior to the multiplication  */
    const Word32 *Y_fx,   /* i  : right hand matrix                                                                      */
    const Word16 *Y_e,    /* i  : right hand matrix                                                                      */
    const Word16 rowsY,   /* i  : number of rows of the right hand matrix                                                */
    const Word16 colsY,   /* i  : number of columns of the right hand matrix                                             */
    const Word16 transpY, /* i  : flag indicating the transposition of the right hand matrix prior to the multiplication */
    Word32 *Z_fx,         /* o  : resulting matrix after the matrix multiplication                                       */
    Word16 *Z_e           /* o  : resulting matrix after the matrix multiplication                                       */
)
{
    Word16 i, j, k;
    Word32 *Zp = Z_fx;
    Word16 *Zp_e = Z_e;
    Word32 L_tmp;
    Word16 tmp_e;

    /* Processing */
    test();
    test();
    test();
    IF( EQ_16( transpX, 1 ) && EQ_16( transpY, 0 ) ) /* We use X transpose */
    {
        IF( NE_16( rowsX, rowsY ) )
        {
            return EXIT_FAILURE;
        }
        FOR( j = 0; j < colsY; ++j )
        {
            FOR( i = 0; i < colsX; ++i )
            {
                ( *Zp ) = 0;
                move32();
                ( *Zp_e ) = 0;
                move16();
                FOR( k = 0; k < rowsX; ++k )
                {
                    //( *Zp ) += X[k + i * rowsX] * Y[k + j * rowsY];
                    L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] );
                    tmp_e = add( X_e[k + i * rowsX], Y_e[k + j * rowsY] );

                    ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e );
                    ( *Zp_e ) = tmp_e;
                    move16();
                }
                Zp++;
                Zp_e++;
            }
        }
    }
    ELSE IF( EQ_16( transpX, 0 ) && EQ_16( transpY, 1 ) ) /* We use Y transpose */
    {
        IF( NE_16( colsX, colsY ) )
        {
            return EXIT_FAILURE;
        }
        FOR( j = 0; j < rowsY; ++j )
        {
            FOR( i = 0; i < rowsX; ++i )
            {
                ( *Zp ) = 0;
                move32();
                ( *Zp_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[j + k * rowsY];
                    L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] );
                    tmp_e = add( X_e[i + k * rowsX], Y_e[j + k * rowsY] );

                    ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e );
                    ( *Zp_e ) = tmp_e;
                    move16();
                }
                Zp++;
                Zp_e++;
            }
        }
    }
    ELSE IF( EQ_16( transpX, 1 ) && EQ_16( transpY, 1 ) ) /* We use both transpose */
    {
        IF( NE_16( rowsX, colsY ) )
        {
            return EXIT_FAILURE;
        }
        FOR( j = 0; j < rowsY; ++j )
        {
            FOR( i = 0; i < colsX; ++i )
            {
                ( *Zp ) = 0;
                move32();
                ( *Zp_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    //( *Zp ) += X_fx[k + i * rowsX] * Y_fx[j + k * rowsY];
                    L_tmp = Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] );
                    tmp_e = add( X_e[k + i * rowsX], Y_e[j + k * rowsY] );

                    ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e );
                    ( *Zp_e ) = tmp_e;
                    move16();
                }

                Zp++;
                Zp_e++;
            }
        }
    }
    ELSE /* Regular case */
    {
        IF( NE_16( colsX, rowsY ) )
        {
            return EXIT_FAILURE;
        }

        FOR( j = 0; j < colsY; ++j )
        {
            FOR( i = 0; i < rowsX; ++i )
            {
                ( *Zp ) = 0;
                move32();
                ( *Zp_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    //( *Zp ) += X_fx[i + k * rowsX] * Y_fx[k + j * rowsY];
                    L_tmp = Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] );
                    tmp_e = add( X_e[i + k * rowsX], Y_e[k + j * rowsY] );

                    ( *Zp ) = BASOP_Util_Add_Mant32Exp( *Zp, *Zp_e, L_tmp, tmp_e, &tmp_e );
                    ( *Zp_e ) = tmp_e;
                    move16();
                }
                Zp++;
                Zp_e++;
            }
        }
    }

    return EXIT_SUCCESS;
}


#endif

/*---------------------------------------------------------------------*
+11 −0
Original line number Diff line number Diff line
@@ -5417,6 +5417,17 @@ void v_add_fixed(
    const Word16 hdrm  /* i  : headroom for when subtraction result > 1 or < -1 */
);

void v_add_fixed_me(
    const Word32 x1[], /* i  : Input vector 1                                   */
    const Word16 x1_e, /* i  : Exponent for input vector 1                      */
    const Word32 x2[], /* i  : Input vector 2                                   */
    const Word16 x2_e, /* i  : Exponent for input vector 2                      */
    Word32 y[],        /* o  : Output vector that contains vector 1 - vector 2  */
    Word16 *y_e,       /* i  : Exponent for output vector                       */
    const Word16 N,    /* i  : Vector length                                    */
    const Word16 hdrm  /* i  : headroom for when subtraction result > 1 or < -1 */
);

void v_add_w64(
    const Word64 x1[], /* i  : Input vector 1                                   */
    const Word64 x2[], /* i  : Input vector 2                                   */
Loading