Commit b6b21539 authored by Jonas Svedberg's avatar Jonas Svedberg
Browse files

prot.h updates

parent 55a18714
Loading
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -8076,6 +8076,7 @@ void msvq_dec(
    Word16 *uq_ind                /* o  : quantized vector (fixed point)                       */
);


void dec_FDCNG_MSVQ_stage1(
    int16_t j_full,            /* i:   index full range           */
    int16_t n,                 /* i:   dimension to generate      */
@@ -8112,6 +8113,41 @@ void extend_dctN_input(
    const int16_t n_cols,   /* i: number of columns ==  truncation length */
    DCTTYPE dcttype );      /* i: matrix  type    */

int16_t msvq_stage1_dct_search( /* o  : (p_max , best candidate sofar )                                  */
    const float *u,  /* i  : target                                   */
    const int16_t N, /* i  : target length and  IDCT synthesis length */
    const int16_t maxC_st1, /* i  : number of final stage 1 candidates to provide */
    const DCTTYPE dcttype,       /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */
    const int16_t max_dct_trunc, /* i:  maximum of truncation lenghts */
    float *invTrfMatrix,         /* i : IDCT synthesis matrix for dim N          */
    const float *midQ_truncQ,                 /* i: midQ  vector */
    const float *dct_invScaleF,               /* i: global inv scale factors*/
    const float *dct_scaleF,                  /* i: global scale factors*/
    const Word16 n_segm,                      /* i: number of segments  */
    const Word16 *cols_per_segment,           /* i: remaining length per segment  */
    const Word16 *trunc_dct_cols_per_segment, /* i: trunc length per segment   */
    const Word16 *entries_per_segment,        /* i: number of rows per segment */
    const Word16 *cum_entries_per_segment,    /* i: number of cumulative entries  */
    const Word8 *const W8Qx_dct_sections[], /*i: Word8(byte) segment  table ptrs  */
    const Word16 *col_syn_shift[],          /*i: columnwise  syn shift tables  */
    const Word8 *segm_neighbour_fwd,        /*i: circular neighbour list fwd */
    const Word8 *segm_neighbour_rev,        /*i: circular neighbour list reverse */
    const Word16 npost_check,               /*i: number of neigbours to check , should be even */
    float *st1_mse_ptr,         /*i: dynRAM buffer for MSEs  */
    int16_t *indices_st1_local, /*o:  selected cand indices */
    float *st1_syn_vec_ptr,     /*i/o:  buffer for IDCT24 synthesis  */
    float *dist1_ptr            /*o:  resulting stage 1 MSEs in DCT-N domain */
);

int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb(
    /* o  : (updated p_max)                */
    const float *st1_syn_vec_ptr, /* i  : IDCT24 synthesis vectors       */
    const float *u,               /* i  : target   signal                */
    const int16_t maxC_st1,       /* i  : number of candidates in stage1 */
    float *dist_ptr               /* i/o: updated  MSE vector for stage1 */
);


void PulseResynchronization(
    const float *src_exc,       /* i  : Input excitation buffer                 */
    float *dst_exc,             /* o  : output excitation buffer                */
+44 −46
Original line number Diff line number Diff line
@@ -50,12 +50,14 @@


#include "ivas_prot.h"
void dctT2_N_apply_matrix( const float *input, float *output, const int16_t dct_dim, int16_t fdcngvq_dim, const float *idctT2_24_X_matrixQ16, const int16_t matrix_1st_dim, DCTTYPE dcttype );

//void dctT2_N_apply_matrix( const float *input, float *output, const int16_t dct_dim, int16_t fdcngvq_dim, const float *idctT2_24_X_matrixQ16, const int16_t matrix_1st_dim, DCTTYPE dcttype );

#ifdef ERI_FDCNGVQ_LOW_ROM
#ifdef ERI_MSVQ_CLEANUP

int16_t msvq_stage1_dct_search(                  /* o  : (p_max , best candidate sofar )                                  */
int16_t msvq_stage1_dct_search(
    /* o  : (p_max , best candidate sofar )                          */
    const float *u,  /* i  : target                                   */
    const int16_t N, /* i  : target length and  IDCT synthesis length */

@@ -86,7 +88,6 @@ int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate
    float *st1_syn_vec_ptr,     /*i/o:  buffer for IDCT24 synthesis  */
    float *dist1_ptr            /*o:  resulting stage 1 MSEs in DCT-N domain */
)

{ /* stage1 search in a segmentwise  truncated dct N  domain without  weights  */

    float dct_target[FDCNG_VQ_DCT_MAXTRUNC];
@@ -122,21 +123,18 @@ int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate

    dctT2_N_apply_matrix( (const float *) u_mr_scaled, dct_target, min( max_dct_trunc, n_ana ), n_ana, invTrfMatrix, max_dct_trunc, dcttype );

    mse = 0;
    /* init search state  ptr's  at the top */
    set_f( dist1_ptr, FLT_MAX, maxC_st1 );
    st1_mse_pair = &( dist1_ptr[0] );         /* req. ptr init +=2 */
    st1_idx_pair = &( indices_st1_local[0] ); /* req. ptr init +=2 */

    set_f(mse_trunc_segm,0.0f,n_segm);
    for ( segm = 0; segm < n_segm; segm++ )
    {
        /*  point to a  new paired location for each segment  */
        st1_mse_pair += 2; /* req. ptr init +=2  */
        st1_idx_pair += 2; /* req.  ptr init     +=2 */
    {   /*  point to a  new paired location for each segment  */
        st1_mse_pair += 2; /* req. ptr init  */
        st1_idx_pair += 2; /* req.  ptr init */
        p_max = 0;         /* req. to point to one of 1 or 0, this init  can potentially be omitted here as p_max is always 1 or 0 */

        /* compute segment common trunction error in dctN domain */  
        mse_trunc_segm[segm] = 0;
        mse_trunc_segm[segm] += sum2_f( (const float *) ( &( dct_target[cols_per_segment[segm]] ) ), trunc_dct_cols_per_segment[segm] );

        cbpW8 = W8Qx_dct_sections[segm]; /* Word8 column variable Qx storage , table ptr init */
@@ -260,7 +258,7 @@ int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate
    /* always extract full length signal(e.g. 24) to be able to update WB(e.g.  N_in==21) candidate MSE values */
    /* in the case that only a part of the IDCT N  vector is in final use    */

    /* synthesis not yet fully parameterized/generalized for other IDCT lengths */
    /* note: synthesis not yet fully parameterized/generalized for other IDCT lengths */
    assert( N == 24 );
    {
        for ( c = 0; c < maxC_st1; c++ )
@@ -270,7 +268,7 @@ int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate
    }

    return p_max; /*ptr to worst performing candidate */
};
}


/* recalc MSE for fdcng WB(0..20) coeffs ,
@@ -303,7 +301,7 @@ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb(
    p_max_local = maximum( dist_ptr, maxC_st1, NULL );

    return p_max_local;
};
}
#endif

#endif