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

Merge branch 'ivas_core_coder_enc_stereo_dft_fxd' into 'main'

Core coder and stereo DFT functions conversion/integration

See merge request !594
parents 62aa4070 0c287810
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2251,8 +2251,11 @@ typedef enum _DCTTYPE
#define HVQ_NSUB_24k                        7                       /* HVQ Classifier number of subbands */

#define HQ_CREST_THRESHOLD 7.0f                                     /* HQ harmonic high band classifier, crest threshold */
#define HQ_CREST_THRESHOLD_FX 1879048192 //7.0f in Q28                                   /* HQ harmonic high band classifier, crest threshold */
#define HQ_CREST_MOD_THRESHOLD 2.128f                               /* HQ harmonic high band classifier, modified crest threshold */
#define HQ_CREST_MOD_THRESHOLD_FX 1142461301 //2.128f in Q29                               /* HQ harmonic high band classifier, modified crest threshold */
#define HQ_CREST_FAC_SM 0.97f                                       /* HQ harmonic high band classifier, smoothing factor */
#define HQ_CREST_FAC_SM_FX 2083059139 //0.97f in Q31                                      /* HQ harmonic high band classifier, smoothing factor */

#define HVQ_BWE_NOISE_BANDS                 2                       /* Number of BWE noise bands */
#define HVQ_BWE_WEIGHT1                     0.95f
+0 −1
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ move16();

return;
}

void hq_bit_allocation_fx(
    const Word32 core_brate,   /* i  : Core bit-rate                    Q0  */
    const Word16 length,       /* i  : Frame length                     Q0  */
+85 −0
Original line number Diff line number Diff line
@@ -212,6 +212,91 @@ void interleave_spectrum_fx(

    return;
}

void interleave_spectrum_ivas_fx(
    Word32 *coefs,      /* i/o: input and output coefficients   Q12  */
    const Word16 length /* i  : length of spectrum              Q0   */
)
{
    Word16 i, j, k;
    Word32 *p1, *p2, *p3, *p4;
    Word32 *p_out;
    Word32 coefs_out[L_FRAME48k];
    Word16 sublen[3] = { 240, 160, 80 };
    move16();
    move16();
    move16();
    Word16 grps;
    const Word16 *bw;
    const Word16 *cnt;

    /* Common inits */
    p1 = coefs;
    p_out = coefs_out;

    IF( EQ_16( length, L_SPEC48k ) )
    {
        bw = intl_bw_48;
        cnt = intl_cnt_48;
        grps = N_INTL_GRP_48;
        move16();
        p2 = p1 + sublen[0];
        p3 = p2 + sublen[0];
        p4 = p3 + sublen[0];
    }
    ELSE IF( EQ_16( length, L_SPEC32k ) )
    {
        bw = intl_bw_32;
        cnt = intl_cnt_32;
        grps = N_INTL_GRP_32;
        move16();
        p2 = p1 + sublen[1];
        p3 = p2 + sublen[1];
        p4 = p3 + sublen[1];
    }
    ELSE /* length == L_SPEC16k */
    {
        bw = intl_bw_16;
        cnt = intl_cnt_16;
        grps = N_INTL_GRP_16;
        move16();
        p2 = p1 + sublen[2];
        p3 = p2 + sublen[2];
        p4 = p3 + sublen[2];
    }

    FOR( i = 0; i < grps; i++ )
    {
        FOR( j = 0; j < cnt[i]; j++ )
        {
            FOR( k = 0; k < bw[i]; k++ )
            {
                *p_out++ = *p1++;
                move32();
            }
            FOR( k = 0; k < bw[i]; k++ )
            {
                *p_out++ = *p2++;
                move32();
            }
            FOR( k = 0; k < bw[i]; k++ )
            {
                *p_out++ = *p3++;
                move32();
            }
            FOR( k = 0; k < bw[i]; k++ )
            {
                *p_out++ = *p4++;
                move32();
            }
        }
    }

    /* For FB the interleaved spectrum is 800 samples */
    Copy32( coefs_out, coefs, (Word16) ( p_out - coefs_out ) );

    return;
}
#endif

/*--------------------------------------------------------------------------*
+8 −0
Original line number Diff line number Diff line
@@ -1760,12 +1760,14 @@ float stereo_dft_enc_synthesize(
    const int16_t L_frame                                       /* i  : frame length at internal Fs         */
);

#ifndef IVAS_FLOAT_FIXED
void stereo_dft_enc_process(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure               */
    const int16_t vad_flag_dtx[],                               /* i  : VAD dtx flags                       */
    const int16_t vad_hover_flag[],                             /* i  : VAD hangover flags                  */
    const int16_t input_frame                                   /* i  : input frame length                  */
);
#endif

void stereo_dft_enc_res(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: encoder DFT stereo handle           */
@@ -2640,9 +2642,15 @@ void stereo_classifier_features(
    const int16_t clas                                          /* i  : signal class                                    */
);

#ifdef IVAS_FLOAT_FIXED
void unclr_classifier_dft_fx(
    CPE_ENC_HANDLE hCPE                                         /* i/o: CPE encoder structure                           */
);
#else
void unclr_classifier_dft(
    CPE_ENC_HANDLE hCPE                                         /* i/o: CPE encoder structure                           */
);
#endif

void unclr_classifier_td(
    CPE_ENC_HANDLE hCPE                                         /* i/o: CPE encoder structure                           */
+9 −0
Original line number Diff line number Diff line
@@ -2692,3 +2692,12 @@ void rc_uni_enc_encode_bits(
    const UWord16 value,         /* i  : Value to encode                     */
    const Word16 bits            /* i  : Number of bits                      */
);

#ifdef IVAS_FLOAT_FIXED
void stereo_dft_enc_process_fx(
    CPE_ENC_HANDLE hCPE,           /* i/o: CPE encoder structure       */
    const Word16 vad_flag_dtx[],   /* i  : VAD dtx flags               */
    const Word16 vad_hover_flag[], /* i  : VAD hangover flags          */
    const Word16 input_frame       /* i  : input frame length          */
);
#endif
Loading