Commit 77652ed9 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ivas_core_dec_fxd_conv' into 'main'

Few functions in ivas_core_dec converted to fixed point.

See merge request !62
parents 56078410 ae7628b3
Loading
Loading
Loading
Loading
Loading
+8 −45
Original line number Diff line number Diff line
@@ -477,6 +477,14 @@ Word16 getMdctWindowLength_fx(
 *
 *
 *-------------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
Word16 sr2fscale_fx(
    const Word32 sr_core /* i  : internal sampling rate    */
)
{
    return (Word16) ( ( FSCALE_DENOM * sr_core ) / 12800 );
}
#endif

int16_t sr2fscale(
    const int32_t sr_core /* i  : internal sampling rate    */
@@ -486,51 +494,6 @@ int16_t sr2fscale(
    return (int16_t) ( ( FSCALE_DENOM * sr_core ) / 12800 );
}

Word16 sr2fscale_fx(
    const Word32 sr_core /* i  : internal sampling rate    */
)
{
    Word16 fscale;

    SWITCH( sr_core )
    {
        case 8000:
            fscale = ( FSCALE_DENOM * 8000 ) / 12800;
            move16();
            BREAK;

        case 12800:
            fscale = FSCALE_DENOM;
            move16();
            BREAK;

        case 16000:
            fscale = ( FSCALE_DENOM * 16000 ) / 12800;
            move16();
            BREAK;

        case 25600:
            fscale = ( FSCALE_DENOM * 25600 ) / 12800;
            move16();
            BREAK;

        case 32000:
            fscale = ( FSCALE_DENOM * 32000 ) / 12800;
            move16();
            BREAK;

        case 48000:
            fscale = ( FSCALE_DENOM * 48000 ) / 12800;
            move16();
            BREAK;

        default:
            assert( 0 );
            fscale = 0; /* just to avoid compiler warning */
            BREAK;
    }
    return fscale;
}
/*-------------------------------------------------------------------*
 * getCoreSamplerateMode2_flt()
 *
+29 −0
Original line number Diff line number Diff line
@@ -489,4 +489,33 @@ void ivas_ism_metadata_sid_dec_fx(
    ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles        */
    Word16 nb_bits_metadata[]      /* o  : number of metadata bits     */
);

void td_stereo_param_updt_fx(
    const Word16 lsp_old_PCh[],        /* i  : primary channel old LSPs                */
    const Word16 lsf_old_PCh[],        /* i  : primary channel old LSFs                */
    const Word16 pitch_buf_PCh[],      /* i  : primary channel pitch buffer            */
    Word16 tdm_lspQ_PCh[],             /* o  : Q LSPs for primary channel              */
    Word16 tdm_lsfQ_PCh[],             /* o  : Q LSFs for primary channel              */
    Word16 tdm_Pri_pitch_buf[],        /* o  : pitch values for primary channel        */
    const Word16 flag_ACELP16k,        /* i  : ACELP@16kHz flag                        */
    const Word16 tdm_use_IAWB_Ave_lpc, /* i  : flag to indicate the usage of mean inactive LP coefficients */
    Word16 Q_var );

void updateBuffersForDmxMdctStereo_fx(
    CPE_DEC_HANDLE hCPE,                      /* i/o: CPE handle                              */
    const Word16 output_frame,                /* i  : output frame length                     */
    Word32 output0_fx[],                      /* i/o: decoder output                          */
    Word32 output1_fx[],                      /* i/o: decoder output                          */
    Word16 synth_fx[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis                       */
);

void stereo_cng_compute_PScorr_fx(
    Word32 output_fx0[], /*  i  : Output signal                          */
    Word32 output_fx1[], /*  i  : Output signal                          */
    Word16 output_Q,
    Word32 *c_PS_LT_fx, /* i/o: Correlation                             */
    Word16 Q_c_PS_LT_fx,
    const Word16 L_frame_0, /* i  : L_frame channel 0                       */
    const Word16 L_frame_1  /* i  : L_frame channel 1                       */
);
#endif
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ Word16 ivas_sba_get_order_fx(
    }
    ELSE
    {
        sba_order = sub( Sqrt16( nb_channels, &exp ), ONE_IN_Q15 ); // 15 - exp
        sba_order = sub( Sqrt16( nb_channels, &exp ), MAX16B); // 15 - exp
        assert( ( EQ_16( mult( add( sba_order, 1 ), add( sba_order, 1 ) ), nb_channels ) ) && "Number of channels not supported in SBA!" );
    }

+54 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@
#include "ivas_cnst.h"
#include "prot.h"
#include "wmc_auto.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx2.h"
#endif


/*-------------------------------------------------------------------*
@@ -484,7 +487,58 @@ void td_stereo_param_updt(
    return;
}

#ifdef IVAS_FLOAT_FIXED

void td_stereo_param_updt_fx(
    const Word16 lsp_old_PCh_fx[],     /* i  : primary channel old LSPs         Q15*/
    const Word16 lsf_old_PCh_fx[],     /* i  : primary channel old LSFs      Qx2.56*/
    const Word16 pitch_buf_PCh_fx[],   /* i  : primary channel pitch buffer   Q_var*/
    Word16 tdm_lspQ_PCh_fx[],          /* o  : Q LSPs for primary channel       Q15*/
    Word16 tdm_lsfQ_PCh_fx[],          /* o  : Q LSFs for primary channel    Qx2.56*/
    Word16 tdm_Pri_pitch_buf_fx[],     /* o  : pitch values for primary channel    Q_var */
    const Word16 flag_ACELP16k,        /* i  : ACELP@16kHz flag                    */
    const Word16 tdm_use_IAWB_Ave_lpc, /* i  : flag to indicate the usage of mean inactive LP coefficients */
    Word16 Q_var )
{
    Word16 i;
    /* Copy some primary channel information into the secondary channel structure for later usage */
    IF( tdm_use_IAWB_Ave_lpc == 1 )
    {
        /*not being assert*/
        Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M );
        lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
    }
    ELSE IF( flag_ACELP16k == 1 )
    {
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M );
        lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
        lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
    }
    ELSE
    {
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M );
        Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M );
    }

    /* This is only to keep the buffer up-to-date */
    Word16 mult_factor = float_to_fix16( 0.8f, 15 );

    IF( flag_ACELP16k == 1 )
    {
        FOR( i = 0; i < NB_SUBFR; i++ )
        {
            tdm_Pri_pitch_buf_fx[i] = mult( pitch_buf_PCh_fx[i], mult_factor );
            tdm_Pri_pitch_buf_fx[i] = max( tdm_Pri_pitch_buf_fx[i], float_to_fix16( PIT_MIN, Q_var ) );
        }
    }
    ELSE
    {
        Copy( pitch_buf_PCh_fx, tdm_Pri_pitch_buf_fx, NB_SUBFR );
    }

    return;
}
#endif
/*-------------------------------------------------------------------*
 * tdm_SCh_LSF_intra_pred_zero_bits()
 *
+6 −2
Original line number Diff line number Diff line
@@ -9752,11 +9752,15 @@ int16_t getRestrictedMode(

int16_t getMdctWindowLength(
    const int16_t fscale );

#ifdef IVAS_FLOAT_FIXED
Word16 sr2fscale(
    const Word32 sr_core /* i  : internal sampling rate        */
);
#else
int16_t sr2fscale(
    const int32_t sr_core /* i  : internal sampling rate        */
);

#endif
int32_t getCoreSamplerateMode2_flt(
    const int16_t element_mode,     /* i  : IVAS element mode              */
    const int32_t total_brate,      /* i  : total bitrate                  */
Loading