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

Merge branch 'ism_mix_mat_fxd_funcs' into 'main'

Changes for fixed path for ivas_param_ism_compute_mixing_matrix_fx and computeMixingMatricesISM_fx.

See merge request !358
parents 37468e78 dd731d66
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2016,6 +2016,8 @@ typedef enum _DCTTYPE
#define EPSILON_FX_SMALL                         1
#define  EPSILON_FIX (1)
#define  EPSILON_FX (Word32)1
#define EPSILON_FX_M                         1208925819
#define EPSILON_FX_E                         -49


#define MAX_SEGMENT_LENGTH                  480
+48 −3
Original line number Diff line number Diff line
@@ -1333,7 +1333,7 @@ void ivas_ism_dec_digest_tc(
);

#ifdef IVAS_FLOAT_FIXED
void ivas_param_ism_dec_digest_tc(
void ivas_param_ism_dec_digest_tc_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const UWord16 nCldfbSlots,                                  /* i  : number of CLFBS slots in the transport channels         */
    Word32 *transport_channels_f[]                              /* i  : synthesized core-coder transport channels/DirAC output  */
@@ -3436,6 +3436,15 @@ void v_min(
    const int16_t N                                             /* i  : Vector length                                    */
);

#ifdef IVAS_FLOAT_FIXED
void v_sqrt_fx(
    const Word32 x[], /* i  : Input vector                                     */
    Word16 exp[],
    Word32 y[],       /* o  : Output vector that contains sqrt(x)              */
    const Word16 N    /* i  : Vector length                                    */
);
#endif

void v_sqrt(
    const float x[],                                            /* i  : Input vector                                     */
    float y[],                                                  /* o  : Output vector that contains sqrt(x)              */
@@ -4807,6 +4816,21 @@ int16_t matrix_product(
);

#ifdef IVAS_FLOAT_FIXED
Word16 matrix_product_mant_exp_fx(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       */
    const Word16 X_fx_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_fx_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_fx_e        /* o  : resulting matrix after the matrix multiplication                                       */
);

Word16 matrix_product_fx(
    const Word32 *X_fx,                                             /* i  : left hand matrix                                                                       */
    const Word16 rowsX,                                        /* i  : number of rows of the left hand matrix                                                 */
@@ -5114,6 +5138,26 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx(
);
#endif

#ifdef IVAS_FLOAT_FIXED
Word16 computeMixingMatricesISM_fx(
    const Word16 num_inputs,
    const Word16 num_responses,
    const Word16 num_outputs,
    const Word32 *responses_fx,
    const Word16 responses_e,
    const Word32 *ener_fx,
    const Word16 ener_e,
    const Word32 *Cx_diag_fx,
    const Word16 Cx_diag_e,
    const Word32 *Cy_diag_fx,
    const Word16 Cy_diag_e,
    const Word16 *Q_16fx, //Q15
    const Word16 energy_compensation_flag,
    const Word32 reg_Sx_fx,
    const Word32 reg_ghat_fx,
    Word32 *mixing_matrix_fx,
    Word16 *mixing_matrix_e);
#else
int16_t computeMixingMatricesISM(
    const int16_t num_inputs,
    const int16_t num_responses,
@@ -5128,6 +5172,7 @@ int16_t computeMixingMatricesISM(
    const float reg_ghat,
    float *mixing_matrix 
);
#endif

void FdCngEncodeDiracMDCTStereoSID(
    CPE_ENC_HANDLE hCPE                                         /* i/o: CPE encoder state structure             */
+171 −0
Original line number Diff line number Diff line
@@ -778,6 +778,24 @@ void v_min(
 *
 * square root of vector
 *-------------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
void v_sqrt_fx(
    const Word32 x[], /* i  : Input vector                                     */
    Word16 exp[],
    Word32 y[],    /* o  : Output vector that contains sqrt(x)              */
    const Word16 N /* i  : Vector length                                    */
)
{
    Word16 i;

    FOR( i = 0; i < N; i++ )
    {
        y[i] = Sqrt32( x[i], &exp[i] );
    }

    return;
}
#endif

void v_sqrt(
    const float x[], /* i  : Input vector                                     */
@@ -1275,6 +1293,159 @@ int16_t matrix_product(
}

#ifdef IVAS_FLOAT_FIXED
Word16 matrix_product_mant_exp_fx(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       */
    const Word16 X_fx_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_fx_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_fx_e        /* o  : resulting matrix after the matrix multiplication                                       */
)
{
    Word16 i, j, k;
    Word32 *Zp_fx = Z_fx;
    Word16 out_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS];
    Word16 *Zp_fx_e = out_e;
    Word16 row, col;

    /* 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_fx ) = 0;
                move32();
                ( *Zp_fx_e ) = 0;
                move16();
                FOR( k = 0; k < rowsX; ++k )
                {
                    ( *Zp_fx ) = BASOP_Util_Add_Mant32Exp( *Zp_fx, *Zp_fx_e, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[k + j * rowsY] ), add( X_fx_e, Y_fx_e ), Zp_fx_e );
                }
                Zp_fx++;
                Zp_fx_e++;
            }
        }
        row = colsY;
        col = colsX;
    }
    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_fx ) = 0;
                move32();
                ( *Zp_fx_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    ( *Zp_fx ) = BASOP_Util_Add_Mant32Exp( *Zp_fx, *Zp_fx_e, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[j + k * rowsY] ), add( X_fx_e, Y_fx_e ), Zp_fx_e );
                }
                Zp_fx++;
                Zp_fx_e++;
            }
        }
        row = rowsY;
        col = rowsX;
    }
    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_fx ) = 0;
                move32();
                ( *Zp_fx_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    ( *Zp_fx ) = BASOP_Util_Add_Mant32Exp( *Zp_fx, *Zp_fx_e, Mpy_32_32( X_fx[k + i * rowsX], Y_fx[j + k * rowsY] ), add( X_fx_e, Y_fx_e ), Zp_fx_e );
                }

                Zp_fx++;
                Zp_fx_e++;
            }
        }
        row = rowsY;
        col = colsX;
    }
    ELSE /* Regular case */
    {
        IF( NE_16( colsX, rowsY ) )
        {
            return EXIT_FAILURE;
        }

        FOR( j = 0; j < colsY; ++j )
        {
            FOR( i = 0; i < rowsX; ++i )
            {
                ( *Zp_fx ) = 0;
                move32();
                ( *Zp_fx_e ) = 0;
                move16();
                FOR( k = 0; k < colsX; ++k )
                {
                    ( *Zp_fx ) = BASOP_Util_Add_Mant32Exp( *Zp_fx, *Zp_fx_e, Mpy_32_32( X_fx[i + k * rowsX], Y_fx[k + j * rowsY] ), add( X_fx_e, Y_fx_e ), Zp_fx_e );
                }
                Zp_fx++;
                Zp_fx_e++;
            }
        }
        row = colsY;
        col = rowsX;
    }
    Zp_fx = Z_fx;
    Zp_fx_e = out_e;
    Word16 max_exp = -31;
    FOR( j = 0; j < row; ++j )
    {
        FOR( i = 0; i < col; ++i )
        {
            max_exp = s_max( max_exp, *Zp_fx_e );
            Zp_fx_e++;
        }
    }
    Zp_fx_e = out_e;
    *Z_fx_e = max_exp;
    FOR( j = 0; j < row; ++j )
    {
        FOR( i = 0; i < col; ++i )
        {
            *Zp_fx = L_shr_r( *Zp_fx, sub( *Z_fx_e, *Zp_fx_e ) );
            Zp_fx++;
            Zp_fx_e++;
        }
    }

    return EXIT_SUCCESS;
}

Word16 matrix_product_fx(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       */
    const Word16 rowsX,   /* i  : number of rows of the left hand matrix                                                 */
+182 −231

File changed.

Preview size limit exceeded, changes collapsed.

+167 −94

File changed.

Preview size limit exceeded, changes collapsed.

Loading