Commit c7bac706 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Float code cleanup changes for lib_dec, stere_dft_enc_itd.c

parent 6c9a691d
Loading
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -5886,11 +5886,18 @@ void ivas_spar_get_cldfb_gains(
);

/*! r: 1 if prediction residual channel */
#ifndef IVAS_FLOAT_FIXED
int16_t ivas_is_res_channel(
    const int16_t ch,                                           /* i  : ch index in WYZX ordering               */
    const int16_t nchan_transport                               /* i  : number of transport channels (1-4)      */
);

#else
Word16 ivas_is_res_channel(
    const Word16 ch,                                           /* i  : ch index in WYZX ordering               */
    const Word16 nchan_transport                               /* i  : number of transport channels (1-4)      */
);
#endif
void ivas_spar_dec_agc_pca(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    float *output[],                                            /* i/o: input/output audio channels             */
@@ -6758,6 +6765,14 @@ void ivas_map_prior_coeffs_quant(
    const int16_t nB
);

#ifdef IVAS_FLOAT_FIXED
void ivas_copy_band_coeffs_idx_to_arr(
    ivas_band_coeffs_ind_t *pBands_idx,
    const Word16 nB,
    Word16 *pSymbol_re,
    ivas_cell_dim_t *pCell_dims,
    const ivas_coeffs_type_t coeff_type);
#else
void ivas_copy_band_coeffs_idx_to_arr( 
    ivas_band_coeffs_ind_t *pBands_idx, 
    const int16_t nB, 
@@ -6765,6 +6780,7 @@ void ivas_copy_band_coeffs_idx_to_arr(
    ivas_cell_dim_t *pCell_dims, 
    const ivas_coeffs_type_t coeff_type
);
#endif

void ivas_clear_band_coeffs( 
    ivas_band_coeffs_t *pband_coeffs,
+49 −0
Original line number Diff line number Diff line
@@ -485,6 +485,54 @@ void ivas_spar_quant_dtx_init_fx(
 * Copy pred band coeffs to arr
 *-----------------------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void ivas_copy_band_coeffs_idx_to_arr(
    ivas_band_coeffs_ind_t *pBands_idx,
    const Word16 nB,
    Word16 *pSymbol_re,
    ivas_cell_dim_t *pCell_dims,
    const ivas_coeffs_type_t coeff_type )
{
    Word16 i, len;
    Word16 *pPtr_idx = NULL;

    FOR( i = 0; i < nB; i++ )
    {
        SWITCH( coeff_type )
        {
            case PRED_COEFF:
            {
                pPtr_idx = pBands_idx[i].pred_index_re;
                BREAK;
            }
            case DRCT_COEFF:
            {
                pPtr_idx = pBands_idx[i].drct_index_re;
                BREAK;
            }
            case DECD_COEFF:
            {
                pPtr_idx = pBands_idx[i].decd_index_re;
                BREAK;
            }
            case DECX_COEFF:
            {
                BREAK;
            }
        }
        len = imult1616( pCell_dims[i].dim1, pCell_dims[i].dim2 );
        IF( NE_16( coeff_type, DECX_COEFF ) )
        {
            Copy( pPtr_idx, pSymbol_re, len );
            pSymbol_re += len;
        }
    }


    return;
}

#else
void ivas_copy_band_coeffs_idx_to_arr(
    ivas_band_coeffs_ind_t *pBands_idx,
    const int16_t nB,
@@ -530,6 +578,7 @@ void ivas_copy_band_coeffs_idx_to_arr(

    return;
}
#endif


/*-----------------------------------------------------------------------------------------*
+3 −1
Original line number Diff line number Diff line
@@ -7807,6 +7807,7 @@ int16_t ari_done_cbr_encoding_14bits(
    int32_t bits,
    Tastat *s );
#ifndef IVAS_FLOAT_FIXED
int16_t ari_decode_14bits_pow_ivas(
    const int16_t *ptr,
    int16_t bp,
@@ -7821,6 +7822,7 @@ int16_t ari_decode_14bits_sign_ivas(
    int16_t bits,
    uint16_t *res,
    Tastat *s );
#endif // !IVAS_FLOAT_FIXED
void tcx_arith_encode_envelope(
    float spectrum[],            /* i/o: MDCT coefficients             */
@@ -7863,7 +7865,7 @@ void tcx_arith_decode_envelope_ivas_fx(
    Word16 L_spec,              /* i  : length w/o BW limitation      */
    const Word16 A_ind[],       /* i  : quantised LPC coefficients    */
    const Word16 target_bits,   /* i  : number of available bits      */
    const Word16 prm[],         /* i  : bitstream parameters          */
    Word16 prm[],               /* i  : bitstream parameters          */
    const Word16 use_hm,        /* i  : use HM in current frame?      */
    const Word16 prm_hm[],      /* i  : HM parameter area             */
    Word16 tcxltp_pitch,        /* i  : TCX LTP pitch in FD, -1 if n/a*/
+13 −0
Original line number Diff line number Diff line
@@ -10182,4 +10182,17 @@ void hq_generic_hf_encoding_fx(
    Encoder_State *st_fx,           /* i/o: encoder state structure                  */
    Word16 *hq_generic_exc_clas,    /* o  : bwe excitation class                     */
    Word16 length );
Word16 ari_decode_14bits_pow_ivas(
    Word16 *ptr,
    Word16 bp,
    Word16 bits,
    Word16 *res,
    Tastat *s,
    UWord16 base );
Word16 ari_decode_14bits_sign_ivas(
    Word16 *ptr,
    Word16 bp,
    Word16 bits,
    Word16 *res,
    Tastat *s );
#endif
+14 −4
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(
        ii[1] = 0;
        move16();
        p1 = p2 = 0; /* to avoid compilation warnings */
        move16();
        move16();

        get_next_coeff = get_next_coeff_mapped;
        move16();
@@ -153,7 +155,6 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(

        /* Get context */
        ctx = &c[s_or( p1, p2 )];
        move16();

        t = add( *ctx, rateFlag );
        IF( GT_16( idx, nt_half ) )
@@ -163,7 +164,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(

        test();
        /* BER detection: Check max value of context t leading to out-of-bound access to ari_lookup_s17_LC[]*/
        IF( GE_16( t, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ) || LE_16( lsbs_bit_pos, 0 ) )
        IF( GE_16( t, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ) || lsbs_bit_pos <= 0 )
        {
            st->BER_detect = 1;
            move16();
@@ -368,13 +369,13 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(

    /*Decode number of ntuples*/
    start_bit_pos = st->next_bit_pos;
    move16();
    lsbs_bit_pos = add( start_bit_pos, sub( nbbits, 1 ) );
    n = 0;
    move16();
    k = 1;
    move16();
    nt_half = shr( nt, 1 );
    move16();
    WHILE( LT_16( k, nt_half ) )
    {
        n = add( n, 1 );
@@ -409,6 +410,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
        IF( GT_16( nbbits, 400 ) )
        {
            rateFlag = 2 << NBITS_CONTEXT;
            move16();
        }
        ELSE
        {
@@ -424,6 +426,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
        numPeakIndicesOrig = hm_cfg->numPeakIndices;
        move16();
        hm_cfg->numPeakIndices = s_min( hm_cfg->numPeakIndices, lastnz );
        move16();
        numHoleIndices = sub( lastnz, hm_cfg->numPeakIndices );

        /* Mark hole indices beyond lastnz as pruned */
@@ -472,6 +475,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
            IF( ( GE_16( t, ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ) ) ) || ( lsbs_bit_pos <= 0 ) )
            {
                st->BER_detect = 1;
                move16();
                return 0;
            }

@@ -483,6 +487,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
            {
                esc_nb = s_min( lev, 3 );
                pki = ari_lookup_s17_LC[add( t, Tab_esc_nb[esc_nb] )];
                move16();
                r = rc_uni_dec_read_symbol_fastS_fx( &rc_st_dec, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 17, 14 ); /*Alphabet size = 17 (2^4 = 16 MSB symbols + 1 ESC symbol) */
                                                                                                                                             /* r is the symbol read, the possible values are {0,1,....alphabet_size - 1}  */

@@ -522,6 +527,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(

            /* Update bitstream pointer */
            st->next_bit_pos = add( start_bit_pos, add( bits_tups, rc_uni_dec_virtual_finish_fx( &rc_st_dec ) ) );
            move16();

            /* Confirm that there is no overflow */
#ifdef DEBUGGING
@@ -549,6 +555,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
                }

                *ctx = add( shl( s_and( *ctx, 0xf ), 4 ), t );
                move16();
            }
            ELSE
            {
@@ -561,7 +568,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
                    move16();
                }

                IF( idx2 & 1 )
                IF( s_and( idx2, 1 ) )
                {
                    /* update second context */
                    c[p2] = update_mixed_context( c[p2], b );
@@ -629,6 +636,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(

            a = b = 0;
            move16();
            move16();
            esc_nb = 0;
            move16();
            r = 0;
@@ -638,6 +646,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
            {
                esc_nb = s_min( lev, 3 );
                pki = ari_lookup_s17_LC[add( t, add( shl( ( rateQ ), NBITS_CONTEXT ), Tab_esc_nb[esc_nb] ) )];
                move16();
                r = rc_uni_dec_read_symbol_fastS_fx( &rc_st_dec, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 17, 14 ); /*Alphabet size = 17 (2^4 = 16 MSB symbols + 1 ESC symbol) */
                                                                                                                                             /* r is the symbol read, the possible values are {0,1,....alphabet_size - 1}  */

@@ -677,6 +686,7 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(

            /* Update bitstream pointer */
            st->next_bit_pos = add( start_bit_pos, add( bits_tups, rc_uni_dec_virtual_finish_fx( &rc_st_dec ) ) );
            move16();

            /* Confirm that there is no overflow */
#ifdef DEBUGGING
Loading