Commit d00cc04d authored by vaclav's avatar vaclav
Browse files

comments

parent 4595b00c
Loading
Loading
Loading
Loading
+136 −81
Original line number Diff line number Diff line
@@ -66,7 +66,12 @@ static Word16 divide_16_16_fx( Word16 y, Word16 x, Word16 *rem );
static Word16 decode_indexes_ivas_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, const Word16 prediction_flag, Word16 *x_lvq, const Word16 mode_glb, Word16 *scales_mslvq );
#endif

/* used in CNG-LP coding */

/*-----------------------------------------------------------------*
 * permute()
 * used in CNG-LP coding
 *-----------------------------------------------------------------*/

void permute_fx(
    Word16 *pTmp1,     /* i/o: vector whose components are to be permuted */
    const Word16 *perm /* i  : permutation info (indexes that should be interchanged), max two perms */
@@ -193,6 +198,11 @@ void init_lvq_fx(
}


/*-----------------------------------------------------------------*
 * make_offset_scale()
 *
 *-----------------------------------------------------------------*/

/* make_offset_scale_fx() - calculates scale offset values for a particular MSLVQ structure  */
static void make_offset_scale_fx(
    Word16 j,                                /* i  : MSLVQ structure index */
@@ -271,6 +281,12 @@ void init_offset_fx(
    return;
}


/*-----------------------------------------------------------------*
 * decode_indexes()
 *
 *-----------------------------------------------------------------*/

/* Unified decode_indexes function under compilation switch */
#ifdef FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES
Word16 decode_indexes_fx(
@@ -333,10 +349,11 @@ Word16 decode_indexes_fx(
        }
    }


    /* Safety check for bit errors (common) */
    FOR (i = 0; i < 3; i++) {
        IF (index[i] < 0 ) {
    FOR( i = 0; i < 3; i++ )
    {
        IF( index[i] < 0 )
        {
            set16_fx( x_lvq, 0, shl( LATTICE_DIM, 1 ) );
            scales_mslvq[0] = 0;
            move16();
@@ -413,7 +430,8 @@ Word16 decode_indexes_fx(
    }

    /* Second subvector (common structure, offset logic differs) */
    IF (index2 == 0) {
    IF( index2 == 0 )
    {
        FOR( i = LATTICE_DIM; i < shl( LATTICE_DIM, 1 ); i++ )
        {
            x_lvq[i] = 0;
@@ -438,14 +456,19 @@ Word16 decode_indexes_fx(
        /* Find leader (common) */
        i = 1;
        move16();
        IF (use_ivas_mode) {
            WHILE (GE_32(index2, (Word32)table_no_cv[i])) {
        IF( use_ivas_mode )
        {
            WHILE( GE_32( index2, (Word32) table_no_cv[i] ) )
            {
                i++;
            }
            decode_comb_fx( (Word32) ( index2 - table_no_cv[i - 1] ), &x_lvq[LATTICE_DIM], i - 1 );
            scales_mslvq[1] = p_scales[mode_glb * len_scales + MAX_NO_SCALES + idx_scale];
        } ELSE {
            WHILE (GE_32(index2, table_no_cv_fx[i])) {
        }
        ELSE
        {
            WHILE( GE_32( index2, table_no_cv_fx[i] ) )
            {
                i = add( i, 1 );
            }
            im1 = sub( i, 1 );
@@ -763,6 +786,12 @@ static Word16 decode_indexes_ivas_fx(
}
#endif


/*-----------------------------------------------------------------*
 * deindex_lvq()
 *
 *-----------------------------------------------------------------*/

Word16 deindex_lvq_fx(
    Word16 *index,           /* i  : index to be decoded, as an array of 3 Word16             */
    Word16 *x_lvq,           /* o  : decoded codevector                             Q(x2.56)  */
@@ -913,7 +942,8 @@ Word16 deindex_lvq_ivas_fx(
    ber_flag = decode_indexes_fx( index, no_bits, p_scales, NULL,
                                  NULL, NULL,
                                  x_lvq, mode_glb, scales_mslvq,
                                 1, 1 - sf_flag); /* use_ivas_mode=1 */ /* x_lvq is here Q1 */
                                  1, 1 - sf_flag );
        /* use_ivas_mode=1 */ /* x_lvq is here Q1 */
#else
    ber_flag = decode_indexes_ivas_fx( index, no_bits, p_scales, 1 - sf_flag, x_lvq, mode_glb, scales_mslvq ); /* x_lvq is here Q1 */
#endif
@@ -1103,6 +1133,13 @@ Word16 deindex_lvq_cng_ivas_fx(
    return ber_flag;
}


/*-----------------------------------------------------------------*
 * idx2c()
 *
 * decode index of binomial combinations, find the positions of k components out of n total components
 *-----------------------------------------------------------------*/

/* combinatorial indexing */
static void idx2c_fx(
    Word16 n,  /* i  : total number of positions (components)*/
@@ -1212,6 +1249,12 @@ void decode_sign_pc1_fx(
}


/*-----------------------------------------------------------------*
 * decode_leaders()
 *
 * decode index of a codevector from the leader class idx_lead
 *-----------------------------------------------------------------*/

static void decode_leaders_fx(
    Word16 index,    /* i  : index to be decoded    */
    Word16 idx_lead, /* i  : leader class index     */
@@ -1451,6 +1494,13 @@ static void divide_64_32_fx(
    return;
}


/*-----------------------------------------------------------------*
 * put_value()
 *
 * inserts no_new_val values of val in the codevector cv at the positions given by the array p
 *-----------------------------------------------------------------*/

static void put_value_fx(
    Word16 *cv,       /* i/o: input codevector              Q1*/
    Word16 *p,        /* i  : array with positions            */
@@ -1596,6 +1646,12 @@ void sort_desc_ind_32_fx(
}


/*-----------------------------------------------------------------*
 * deindex_lvq_SHB()
 *
 *
 *-----------------------------------------------------------------*/

void deindex_lvq_SHB_fx(
    UWord32 index,
    Word16 *out,
@@ -1620,7 +1676,6 @@ void deindex_lvq_SHB_fx(
        p_scales = &scales_BWE_3b_fx[i_mult( sub( nbits, mslvq_SHB_min_bits[1] ), 3 )];
    }


    IF( index == 0 )
    {
        set16_fx( out, 0, LATTICE_DIM );