Commit e051afd7 authored by gaoyuy's avatar gaoyuy
Browse files

Fixed issue-84

parent bacb1e53
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -536,6 +536,9 @@ ivas_error config_acelp1(
    const int16_t tdm_lp_reuse_flag,    /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const int16_t tdm_low_rate_mode,    /* i  : secondary channel low rate mode flag */
    const int16_t idchan,               /* i  : stereo channel ID               */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
    const int16_t active_cnt,           /* i  :active counts*/
#endif
    const int16_t tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag*/
    const int16_t tdm_LRTD_flag,        /* i  : LRTD stereo mode flag           */
    const int16_t GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
@@ -754,7 +757,11 @@ ivas_error config_acelp1(
            bits -= acelp_cfg->mid_lsf_bits;
        }
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
        else if ( tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1)
#else
        else if ( tdm_lp_reuse_flag == 1 && idchan == 1 )
#endif
        {
            bits -= TDM_IC_LSF_PRED_BITS;
        }
+6 −1
Original line number Diff line number Diff line
@@ -136,7 +136,12 @@

#define LSF_RE_USE_SECONDARY_CHANNEL                    /* TD stereo Secondary channel LSF Q improvement */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL
/*#define LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE */     /* switch to isolate the reuse mode case */
#define LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE      /* switch to isolate the reuse mode case */

#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE
#define LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX  /* lsf reuse mode bug fix */
#endif

#endif
#define DISABLE_ADAP_RES_COD_TMP                        /* temporary fix for IVAS-403, disables adaptive residual coding */
/*#define ITD_WINNER_GAIN_MODIFY */                     /* ITD optimization - WORK IN PROGRESS */
+5 −0
Original line number Diff line number Diff line
@@ -2327,7 +2327,9 @@ ivas_error acelp_core_enc(
    float pitch_buf[NB_SUBFR16k],        /* o  : floating pitch for each subframe        */
    int16_t *unbits,                     /* o  : number of unused bits                   */
    STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle                */
#ifndef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
    const float tdm_lspQ_PCh[M],         /* i  : Q LSPs for primary channel              */
#endif
    const float tdm_lsfQ_PCh[M]          /* i  : Q LSFs for primary channel              */
);

@@ -8984,6 +8986,9 @@ ivas_error config_acelp1(
    const int16_t tdm_lp_reuse_flag,    /* i  : LPC reuse flag (can be 1 only with secondary channel*/
    const int16_t tdm_low_rate_mode,    /* i  : secondary channel low rate mode flag*/
    const int16_t idchan,               /* i  : channel id                          */
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
    const int16_t active_cnt,           /* i  :active counts*/
#endif
    const int16_t tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag    */
    const int16_t tdm_LRTD_flag,        /* i  : LRTD stereo mode flag               */
    const int16_t GSC_IVAS_mode         /* i  : GSC IVAS mode                       */
+23 −0
Original line number Diff line number Diff line
@@ -614,11 +614,19 @@ ivas_error acelp_core_dec(
                    nb_bits = -1;
                }

#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
                config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
#else
                config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
#endif

                if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) /*  ISfm: why is this called again after above */
                {
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
                    config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
#else
                    config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
#endif
                }
            }

@@ -661,10 +669,25 @@ ivas_error acelp_core_dec(
            {
                const float *pt_interp_2;
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE
#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
                if ( st->active_cnt != 1 )
                {
                    int16_t beta_index[1];

                    beta_index[0] = get_next_indice( st, TDM_IC_LSF_PRED_BITS );
                    tdm_SCh_lsf_reuse( DEC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, NULL, beta_index );
                }
                else
                {
                    mvr2r( tdm_lspQ_PCh, lsp_new, M );
                    mvr2r( tdm_lsfQ_PCh, lsf_new, M );
                }
#else
                int16_t beta_index[1];

                beta_index[0] = get_next_indice( st, TDM_IC_LSF_PRED_BITS );
                tdm_SCh_lsf_reuse( DEC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, NULL, beta_index );
#endif
#else
                mvr2r( tdm_lspQ_PCh, lsp_new, M );
                mvr2r( tdm_lsfQ_PCh, lsf_new, M );
+4 −0
Original line number Diff line number Diff line
@@ -158,7 +158,11 @@ ivas_error acelp_core_switch_dec(
         * Excitation decoding
         *----------------------------------------------------------------*/

#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE_BUGFIX
        config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ );
#else
        config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, 0, 0, 0 /*st->GSC_IVAS_mode*/ );
#endif

        decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate );

Loading