Commit eab61087 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'update-float-pc-with-ivas-float-update' into 'float-pc'

[non-BE] Update float-pc with ivas-float-update

See merge request !1177
parents 198e0843 e6f7828d
Loading
Loading
Loading
Loading
+52 −11
Original line number Diff line number Diff line
@@ -542,6 +542,9 @@ ivas_error config_acelp1(
    ACELP_config *acelp_cfg,        /* i  : ACELP bit-allocation            */
    const int16_t signaling_bits,   /* i  : number of signaling bits        */
    const int16_t coder_type,       /* i  : coder type                      */
#ifdef NONBE_FIX_GSC_BSTR
    const int16_t inactive_coder_type_flag, /* i  : AVQ (0) or GSC (1) IC flag      */
#endif
    const int16_t tc_subfr,             /* i  : TC subfr ID                     */
    const int16_t tc_call,              /* i  : TC call number (0,1,2,3,5(DEC)) */
    int16_t *nBits_es_Pred,             /* o  : number of bits for Es_pred Q    */
@@ -775,7 +778,13 @@ ivas_error config_acelp1(
        }

        /* gain Q bit-budget - part 1 */
#ifdef NONBE_FIX_GSC_BSTR
        if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ ||
             ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */
        )
#else
        if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) || ( coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE ) )
#endif
        {
            *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX( core_brate, coder_type, -1, -1 )];
            bits -= *nBits_es_Pred;
@@ -868,7 +877,11 @@ ivas_error config_acelp1(
    }
    else if ( core_brate >= ACELP_11k60 && ( coder_type != AUDIO && !( coder_type == INACTIVE && L_frame == L_FRAME ) ) )
    {
#ifdef NONBE_FIX_GSC_BSTR
        if ( coder_type == INACTIVE && L_frame == L_FRAME16k && inactive_coder_type_flag ) /* GSC Inactive @16kHz */
#else
        if ( coder_type == INACTIVE && L_frame == L_FRAME16k && total_brate <= MAX_GSC_INACTIVE_BRATE ) /* GSC Inactive @16kHz */
#endif
        {
            acelp_cfg->ltf_mode = FULL_BAND;
        }
@@ -1052,7 +1065,13 @@ ivas_error config_acelp1(
        acelp_cfg->fixed_cdk_index[2] = -1;
        acelp_cfg->fixed_cdk_index[3] = -1;
    }
#ifdef NONBE_FIX_GSC_BSTR
    else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) ||           /* @12.8kHz core except of GSC */
              ( nb_subfr == NB_SUBFR16k && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */
              || core == HQ_CORE /* ACELP -> HQ switching in EVS */ )
#else
    else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || ( nb_subfr == NB_SUBFR16k && ( total_brate > MAX_GSC_INACTIVE_BRATE || coder_type != INACTIVE ) ) || core == HQ_CORE )
#endif
    {
        /* pitch Q & gain Q bit-budget - part 2*/
        for ( i = 0; i < nb_subfr; i++ )
@@ -1100,7 +1119,13 @@ ivas_error config_acelp1(
        }

        /* algebraic codebook bit-budget */
#ifdef NONBE_FIX_GSC_BSTR
        if ( flag_hardcoded || /* EVS */
             ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ ||
             ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ )
#else
        if ( flag_hardcoded || ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) )
#endif
        {
            for ( i = 0; i < nb_subfr; i++ )
            {
@@ -1187,7 +1212,12 @@ ivas_error config_acelp1(
        }

        /* AVQ codebook */
#ifdef NONBE_FIX_GSC_BSTR
        if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ ||
             ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ )
#else
        if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) )
#endif
        {
            for ( i = 0; i < nb_subfr; i++ )
            {
@@ -1222,7 +1252,13 @@ ivas_error config_acelp1(
            }
        }
    }
#ifdef NONBE_FIX_GSC_BSTR
    else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) /* LBR secondary channel in TD stereo */ ||
              ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) /* GSC @12.8kHz */ ||
              ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ )
#else
    else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) || ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) || ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) )
#endif
    {
        int32_t Local_BR, Pitch_BR;
        int16_t Pitch_CT;
@@ -1315,7 +1351,12 @@ ivas_error config_acelp1(
    /* sanity check */
    if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || nb_subfr == NB_SUBFR16k )
    {
#ifdef NONBE_FIX_GSC_BSTR
        if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ ||
             ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* IVAS GSC @16kHz */
#else
        if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) || ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* GSC Inactive @16kHz */
#endif
        {
            acelp_cfg->ubits = 0;
        }
+15 −6
Original line number Diff line number Diff line
@@ -63,8 +63,13 @@ void inact_switch_ematch(
    float dct_exc_tmp[],      /* i  : GSC excitation in DCT domain        */
    float lt_ener_per_band[], /* i/o: Long term energy per band           */
    const int16_t coder_type, /* i  : Coder type                          */
#ifdef NONBE_FIX_GSC_BSTR
    const int16_t inactive_coder_type_flag, /* i  : AVQ (0) or GSC (1) IC flag   */
#endif
    const int16_t L_frame, /* i  : Frame length                        */
#ifndef NONBE_FIX_GSC_BSTR
    const int32_t total_brate, /* i  : Total bitrate                       */
#endif
    const int16_t bfi,               /* i  : frame lost indicator                */
    const int16_t last_core,         /* i  : Last core used                      */
    const int16_t last_codec_mode,   /* i  : Last codec mode                     */
@@ -105,7 +110,11 @@ void inact_switch_ematch(
            lt_ener_per_band[i] = Ener_per_bd[i];
        }
    }
#ifdef NONBE_FIX_GSC_BSTR
    else if ( coder_type == INACTIVE && inactive_coder_type_flag )
#else
    else if ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE )
#endif
    {
        /* Find spectrum and energy per band for inactive frames */
        edct( exc2, dct_exc_tmp, L_frame, element_mode );
+3 −0
Original line number Diff line number Diff line
@@ -1147,6 +1147,9 @@ enum
#endif
#define BITS_MASA2TOTTAL_DCT0                   6
#define STEP_M2T                                0.1f
#ifdef NONBE_1319_M2R_PRECISION_ALIGN 
#define STEP_M2T_FX                             214748365 // Q31
#endif
#define MASA_HEADER_BITS                        2
#define MASA_SUBFRAME_BITS                      1
#define MASA_LOWBITRATE_MODE_BITS               1
+30 −1
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ ivas_error pre_proc_front_ivas(
    const int16_t front_vad_dtx_flag,                           /* i  : front-VAD DTX flag to overwrite VAD decision*/
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                                */
    const int16_t MCT_flag,                                     /* i  : hMCT handle allocated (1) or not (0)       */
#ifdef NONBE_1211_DTX_BR_SWITCHING
    const int32_t last_ivas_total_brate,                        /* i  : last IVAS total bitrate                    */
#endif
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                         */
#ifdef DEBUG_MODE_INFO
	, const int16_t ch_idx
@@ -756,6 +759,32 @@ int16_t get_igf_startline(
float rand_triangular_signed(
    int16_t *seed );

#ifdef NONBE_1319_M2R_PRECISION_ALIGN
Word16 matrix_product_fx(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       Qx*/
    const Word16 rowsX,   /* i  : number of rows of the left hand matrix                                                 Q0*/
    const Word16 colsX,   /* i  : number of columns of the left hand matrix                                              Q0*/
    const Word16 transpX, /* i  : flag indicating the transposition of the left hand matrix prior to the multiplication  Q0*/
    const Word32 *Y_fx,   /* i  : right hand matrix                                                                      Qy*/
    const Word16 rowsY,   /* i  : number of rows of the right hand matrix                                                Q0*/
    const Word16 colsY,   /* i  : number of columns of the right hand matrix                                             Q0*/
    const Word16 transpY, /* i  : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/
    Word32 *Z_fx          /* o  : resulting matrix after the matrix multiplication                                       Qx + Qy - 31*/
);

Word16 matrix_product_q30_fx(
    const Word32 *X_fx,   /* i  : left hand matrix                                                                       Q31*/
    const Word16 rowsX,   /* i  : number of rows of the left hand matrix                                                 Q0*/
    const Word16 colsX,   /* i  : number of columns of the left hand matrix                                              Q0*/
    const Word16 transpX, /* i  : flag indicating the transposition of the left hand matrix prior to the multiplication  Q0*/
    const Word32 *Y_fx,   /* i  : right hand matrix                                                                      Q25*/
    const Word16 rowsY,   /* i  : number of rows of the right hand matrix                                                Q0*/
    const Word16 colsY,   /* i  : number of columns of the right hand matrix                                             Q0*/
    const Word16 transpY, /* i  : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/
    Word32 *Z_fx          /* o  : resulting matrix after the matrix multiplication                                       Q30*/
);
#endif

void dtx_read_padding_bits(
    DEC_CORE_HANDLE st,
    const int16_t num_bits 
+42 −0
Original line number Diff line number Diff line
@@ -2833,6 +2833,48 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] =
};
/* column wise DCT matrices for 4 5, and 8 dim */
#ifdef NONBE_1319_M2R_PRECISION_ALIGN  
const Word32 dct4_fx[4 * 4] = { // Q31
    1073741824, 1402951040, 1073741824, 581109056,
    1073741824, 581109056, -1073741824, -1402951040,
    1073741824, -581109056, -1073741824, 1402951040,
    1073741824, -1402951040, 1073741824, -581109056
};
const Word32 dct5_fx[5 * 5] = { // Q31
    960354688, 1291711360, 1098867328, 798219648, 419618304,
    960354688, 798219648, -419618304, -1291711360, -1098867328,
    960354688, 0, -1358283392, 0, 1358283392,
    960354688, -798219648, -419618304, 1291711360, -1098867328,
    960354688, -1291711360, 1098867328, -798219648, 419618304
};
const Word32 dct8_fx[8 * 8] = { // Q31
    759350208, 1053125952, 991922688, 892708928, 759350208, 596570944, 410813632, 209379648,
    759350208, 892708928, 410813632, -209379648, -759350208, -1053125952, -991922688, -596570944,
    759350208, 596570944, -410813632, -1053125952, -759350208, 209379648, 991922688, 892708928,
    759350208, 209379648, -991922688, -596570944, 759350208, 892708928, -410813632, -1053125952,
    759350208, -209379648, -991922688, 596570944, 759350208, -892708928, -410813632, 1053125952,
    759350208, -596570944, -410813632, 1053125952, -759350208, -209379648, 991922688, -892708928,
    759350208, -892708928, 410813632, 209379648, -759350208, 1053125952, -991922688, 596570944,
    759350208, -1053125952, 991922688, -892708928, 759350208, -596570944, 410813632, -209379648
};
const Word32 dct12_fx[12 * 12] = { // Q31
    619978560, 869301376, 846752832, 810030848, 759350208, 695569984, 619978560, 533649696, 438301408, 335436960, 226989024, 114460880,
    619978560, 810030848, 619978560, 335436960, 0, -335436960, -619978560, -810030848, -876602816, -810030848, -619978560, -335436960,
    619978560, 695569984, 226989024, -335436960, -759350208, -869301376, -619978560, -114460880, 438301408, 810030848, 846752832, 533649696,
    619978560, 533649696, -226989024, -810030848, -759350208, -114460880, 619978560, 869301376, 438301408, -335436960, -846752832, -695569984,
    619978560, 335436960, -619978560, -810030848, 0, 810030848, 619978560, -335436960, -876602816, -335436960, 619978560, 810030848, 619978560,
    114460880, -846752832, -335436960, 759350208, 533649696, -619978560, -695569984, 438301408, 810030848, -226989024, -869301376, 619978560,
    -114460880, -846752832, 335436960, 759350208, -533649696, -619978560, 695569984, 438301408, -810030848, -226989024, 869301376, 619978560,
    -335436960, -619978560, 810030848, 0, -810030848, 619978560, 335436960, -876602816, 335436960, 619978560, -810030848, 619978560, -533649696,
    -226989024, 810030848, -759350208, 114460880, 619978560, -869301376, 438301408, 335436960, -846752832, 695569984, 619978560, -695569984,
    226989024, 335436960, -759350208, 869301376, -619978560, 114460880, 438301408, -810030848, 846752832, -533649696, 619978560, -810030848,
    619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832,
    -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880
};
#endif
const float dct4[4*4] = 
{
    0.5000f,  0.6533f,  0.5000f,  0.2706f,
Loading