Commit 29d0421d authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2650-review-bits_frame_core-calculation-in-dec_prm_tcx_ivas_fx' into 'main'

Resolve "Review bits_frame_core calculation in dec_prm_tcx_ivas_fx()"

Closes #2650

See merge request !3096
parents 22bc0eb0 89edc5c2
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define HARMONIZE_2502_GENERATE_COMFORT_NOISE_DEC       /* FhG: harmonize generate_comfort_noise_dec_fx() and generate_comfort_noise_dec_ivas_fx() */
#define FIX_BASOP_2650_DEC_PRM_TCX                      /* FhG: Simplify calculation of st->bits_frame_core in dec_prm_tcx(), align function name to float */

/* #################### End BE switches ################################## */

+36 −18
Original line number Diff line number Diff line
@@ -43,8 +43,12 @@
 * Local prototypes
 *-------------------------------------------------------------*/

#ifdef FIX_BASOP_2650_DEC_PRM_TCX
static void dec_prm_tcx_fx( Decoder_State *st, Word16 param[], Word16 param_lpc[], Word16 *total_nbbits, const Word16 last_element_mode, Word16 *bitsRead );
#else
static void dec_prm_tcx_ivas_fx( Decoder_State *st, Word16 param[], Word16 param_lpc[], Word16 *total_nbbits, const Word16 last_element_mode, Word16 *bitsRead );
static void stereo_tcx_dec_mode_switch_reconf_ivas_fx( Decoder_State *st, const Word16 MCT_flag, const Word16 last_element_mode, Word16 *Q_syn_Overl_TDAC, Word16 *Q_fer_samples, Word16 *Q_syn_Overl, Word16 *Q_syn_Overl_TDACFB, Word16 *Q_syn_OverlFB, Word16 *Q_old_out, Word16 *Q_old_outLB, Word16 *Q_old_Aq_12_8 );
#endif
static void stereo_tcx_dec_mode_switch_reconf_fx( Decoder_State *st, const Word16 MCT_flag, const Word16 last_element_mode, Word16 *Q_syn_Overl_TDAC, Word16 *Q_fer_samples, Word16 *Q_syn_Overl, Word16 *Q_syn_Overl_TDACFB, Word16 *Q_syn_OverlFB, Word16 *Q_old_out, Word16 *Q_old_outLB, Word16 *Q_old_Aq_12_8 );


/*-------------------------------------------------------------*
@@ -167,7 +171,7 @@ void stereo_tcx_init_dec_fx(

        Word16 Q_old_Aq_12_8 = 12;
        move16();
        stereo_tcx_dec_mode_switch_reconf_ivas_fx( st, MCT_flag, last_element_mode,
        stereo_tcx_dec_mode_switch_reconf_fx( st, MCT_flag, last_element_mode,
                                              &st->hTcxDec->Q_syn_Overl_TDAC,
                                              &st->hHQ_core->Q_fer_samples,
                                              &st->hTcxDec->Q_syn_Overl,
@@ -311,7 +315,11 @@ void stereo_tcx_core_dec_fx(
        move16();

        move16();
#ifdef FIX_BASOP_2650_DEC_PRM_TCX
        dec_prm_tcx_fx( st, param, param_lpc, &total_nbbits, last_element_mode, &bitsRead );
#else
        dec_prm_tcx_ivas_fx( st, param, param_lpc, &total_nbbits, last_element_mode, &bitsRead );
#endif
    }
    ELSE
    {
@@ -893,7 +901,7 @@ void stereo_tcx_core_dec_fx(
}


static void stereo_tcx_dec_mode_switch_reconf_ivas_fx(
static void stereo_tcx_dec_mode_switch_reconf_fx(
    Decoder_State *st,              /* i/o: decoder state structure                   */
    const Word16 MCT_flag,          /* i  : hMCT handle allocated (1) or not (0)    Q0*/
    const Word16 last_element_mode, /* i  : element mode of previous frame          Q0*/
@@ -936,7 +944,12 @@ static void stereo_tcx_dec_mode_switch_reconf_ivas_fx(

    return;
}

#ifdef FIX_BASOP_2650_DEC_PRM_TCX
static void dec_prm_tcx_fx(
#else
static void dec_prm_tcx_ivas_fx(
#endif
    Decoder_State *st,              /* i/o: decoder memory state                */
    Word16 param[],                 /* o  : decoded parameters                Q0*/
    Word16 param_lpc[],             /* o  : LPC parameters                    Q0*/
@@ -958,8 +971,13 @@ static void dec_prm_tcx_ivas_fx(
    hm_cfg.indexBuffer = indexBuffer;
    IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
    {
#ifdef FIX_BASOP_2650_DEC_PRM_TCX
        st->bits_frame_core = extract_l( L_sub( Mpy_32_32_r( st->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ), st->next_bit_pos ) ); /* Q0 */
        assert( st->bits_frame_core == (int16_t) ( ( st->total_brate / FRAMES_PER_SEC ) - st->next_bit_pos ) );
#else
        // The value of 1/ FRAMES_PER_SEC shifted left by 19 because taking Q as 15 led to precision loss
        st->bits_frame_core = extract_l( L_sub( L_shr( Mpy_32_16_1( st->total_brate, 10486 ), 4 ), st->next_bit_pos ) ); /* Q0 */
#endif
        move16();
    }
    start_bit_pos = st->next_bit_pos; /* Q0 */
@@ -1004,7 +1022,7 @@ static void dec_prm_tcx_ivas_fx(
        {
            Word16 Q_old_Aq_12_8 = Q12;
            move16();
            stereo_tcx_dec_mode_switch_reconf_ivas_fx( st, 0, last_element_mode, &st->hTcxDec->Q_syn_Overl_TDAC,
            stereo_tcx_dec_mode_switch_reconf_fx( st, 0, last_element_mode, &st->hTcxDec->Q_syn_Overl_TDAC,
                                                  &st->hHQ_core->Q_fer_samples,
                                                  &st->hTcxDec->Q_syn_Overl,
                                                  &st->hTcxDec->Q_syn_Overl_TDACFB,