Commit 4c288405 authored by Jan Kiene's avatar Jan Kiene
Browse files

introduce new function for reconfiguration - BE

parent 34c6b03f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@
#define FIX_155_HP20_ISSUE                              /* Issue 155: apply hp20 on all input channels instead of just 2 channels */
#define EFAP_FIX_POLY                                   /* Issue 167: fix bug in EFAP polygon selection */
#define SBA_HOA_HBR_IMPROV                              /* issue 91: Improvements to SBA high bitrate HOA3 coding */

#define FIX_TCX_DEC_RECONF_BF

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+44 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@
 *-------------------------------------------------------------*/

static void dec_prm_tcx( Decoder_State *st, int16_t param[], int16_t param_lpc[], int16_t *total_nbbits, int16_t *bitsRead );
#ifdef FIX_TCX_DEC_RECONF_BFI
static void stereo_tcx_dec_mode_switch_reconf( Decoder_State *st, const int16_t is_mct, const int16_t last_element_mode );
#endif


/*-------------------------------------------------------------*
@@ -66,7 +69,9 @@ void stereo_tcx_init_dec(
    const int16_t last_element_mode /* i  : element mode of previous frame */
)
{
#ifndef FIX_TCX_DEC_RECONF_BFI
    int16_t frame_size_index;
#endif
    TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec;
    TCX_DEC_HANDLE hTcxDec = st->hTcxDec;

@@ -128,6 +133,9 @@ void stereo_tcx_init_dec(
    if ( ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ) )
    {
        /*re-initialization*/
#ifdef FIX_TCX_DEC_RECONF_BFI
        stereo_tcx_dec_mode_switch_reconf( st, is_mct, last_element_mode );
#else
        st->rate_switching_init = 1;

        /* Identify frame type - TCX Reconfiguration */
@@ -151,6 +159,7 @@ void stereo_tcx_init_dec(

        /* Reconfigure Core */
        mode_switch_decoder_LPD( st, st->bwidth, st->bits_frame_nominal * FRAMES_PER_SEC, st->last_bits_frame_nominal * FRAMES_PER_SEC, frame_size_index, is_mct, last_element_mode );
#endif
    }

    return;
@@ -923,3 +932,38 @@ static void dec_prm_tcx(

    return;
}

#ifdef FIX_TCX_DEC_RECONF_BFI
static void stereo_tcx_dec_mode_switch_reconf(
    DecoderState *st,
    const int16_t is_mct,
    const int16_t last_element_mode
)
{
    int16_t frame_size_index;

    st->rate_switching_init = 1;

    /* Identify frame type - TCX Reconfiguration */
    for ( frame_size_index = 0; frame_size_index < FRAME_SIZE_NB; frame_size_index++ )
    {
        if ( frame_size_index < FRAME_SIZE_NB - 1 )
        {
            if ( ( FrameSizeConfig[frame_size_index].frame_bits <= st->bits_frame_nominal ) && ( FrameSizeConfig[frame_size_index + 1].frame_bits > st->bits_frame_nominal ) )
            {
                break;
            }
        }
        else
        {
            if ( FrameSizeConfig[frame_size_index].frame_bits <= st->bits_frame_nominal )
            {
                break;
            }
        }
    }

    /* Reconfigure Core */
    mode_switch_decoder_LPD( st, st->bwidth, st->bits_frame_nominal * FRAMES_PER_SEC, st->last_bits_frame_nominal * FRAMES_PER_SEC, frame_size_index, is_mct, last_element_mode );
}
#endif