Commit 22a30e47 authored by multrus's avatar multrus
Browse files

[cleanup] accept NONBE_FIX_GSC_BSTR

parent fab61ad7
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -542,9 +542,7 @@ 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    */
@@ -778,13 +776,9 @@ ivas_error config_acelp1(
        }

        /* gain Q bit-budget - part 1: 'Es_pred' of memory-less gain Q */
#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;
@@ -877,11 +871,7 @@ 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;
        }
@@ -1065,13 +1055,9 @@ 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++ )
@@ -1119,13 +1105,9 @@ 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++ )
            {
@@ -1212,12 +1194,8 @@ 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++ )
            {
@@ -1252,13 +1230,9 @@ 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;
@@ -1351,12 +1325,8 @@ 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;
        }
+0 −9
Original line number Diff line number Diff line
@@ -63,13 +63,8 @@ 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                     */
@@ -110,11 +105,7 @@ 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 );
+0 −1
Original line number Diff line number Diff line
@@ -169,7 +169,6 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_GSC_BSTR                              /* VA: issue 1264: Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */
#define NONBE_1273_ISM_METADATA_COUNTER                 /* VA: issue 1273: fix counter overflow in ISM metadata encoder */
#define NONBE_1279_COUNTER_OVERFLOW                     /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
+0 −7
Original line number Diff line number Diff line
@@ -3568,13 +3568,8 @@ 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                             */
@@ -9109,9 +9104,7 @@ 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)              */
    int16_t *nBits_es_Pred,             /* o  : number of bits for Es_pred Q        */
+0 −8
Original line number Diff line number Diff line
@@ -332,11 +332,7 @@ void FEC_exc_estim(
     * Replicate the last spectrum in case the last good frame was coded by GSC
     *-----------------------------------------------------------------*/

#ifdef NONBE_FIX_GSC_BSTR
    if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB )
#else
    if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB )
#endif
    {
        /* Replication of the last spectrum, with a slight downscaling of its dynamic */
        st->GSC_noisy_speech = st->Last_GSC_noisy_speech_flag;
@@ -409,11 +405,7 @@ void FEC_exc_estim(
     * Total excitation
     *-----------------------------------------------------------------*/

#ifdef NONBE_FIX_GSC_BSTR
    if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB )
#else
    if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB )
#endif
    {
        /* For GSC - the excitation is already computed */
        mvr2r( exc, exc2, st->L_frame );
Loading