Commit 13edf320 authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2583-harmonize-open_decoder_lpd' into 'main'

Resolve "Harmonize open_decoder_LPD"

Closes #2583

See merge request !3026
parents 94e4e1b7 b747062b
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -23,7 +23,9 @@
#include "prot_fx.h"
#include <assert.h>

#ifndef HARMONIZE_2583_open_decoder_LPD
#define STATE_BUFFER_SIZE ( 9 + 16 )
#endif

#define CLDFB_NO_POLY       ( 5 )
#define SYN_FILTER_HEADROOM ( 1 )
@@ -1438,7 +1440,7 @@ static Word16 CLDFB_getNumChannels(
    return ( nChannels );
}


#ifndef HARMONIZE_2583_open_decoder_LPD
/*-------------------------------------------------------------------*
 * cldfb_get_memory_length()
 *
@@ -1457,6 +1459,7 @@ static Word16 cldfb_get_memory_length(
        return ( i_mult( hs->no_channels, ( 9 * 2 ) ) );
    }
}
#endif


/*-------------------------------------------------------------------*
+55 −0
Original line number Diff line number Diff line
@@ -1766,6 +1766,26 @@ static void cldfb_init_proto_and_twiddles(
    return;
}

#ifdef HARMONIZE_2583_open_decoder_LPD
/*-------------------------------------------------------------------*
 * cldfb_get_memory_length()
 *
 * Return length of filter state for recovery
 *--------------------------------------------------------------------*/

Word16 cldfb_get_memory_length(
    HANDLE_CLDFB_FILTER_BANK hs )
{
    IF( EQ_16( hs->type, CLDFB_ANALYSIS ) )
    {
        return ( i_mult( hs->no_channels, STATE_BUFFER_SIZE ) );
    }
    ELSE
    {
        return ( i_mult( hs->no_channels, ( 9 * 2 ) ) );
    }
}
#endif

/*-------------------------------------------------------------------*
 * cldfb_save_memory_ivas()
@@ -1864,6 +1884,7 @@ void cldfb_reset_memory_fx(
    Word16 memory_length;
    UWord16 offset = sub( hs->p_filter_length, hs->no_channels );

#ifndef HARMONIZE_2583_open_decoder_LPD
    IF( hs->type == CLDFB_ANALYSIS )
    {
        memory_length = offset;
@@ -1883,4 +1904,38 @@ void cldfb_reset_memory_fx(
    move16();

    return;
#else  /*HARMONIZE_2583_open_decoder_LPD*/

    IF( hs->FilterStates )
    {
        /*EVS part*/
        memory_length = cldfb_get_memory_length( hs );
        set16_fx( hs->FilterStates, 0, memory_length );
        set16_fx( hs->FilterStates_e, 0, sizeof( hs->FilterStates_e ) / sizeof( hs->FilterStates_e[0] ) );
        hs->FilterStates_eg = 0;
        move16();
    }
    ELSE
    {
        /*IVAS part*/
        IF( hs->type == CLDFB_ANALYSIS )
        {
            memory_length = offset;
            move16();
        }
        ELSE
        {
            memory_length = hs->p_filter_length;
            move16();
        }

        hs->cldfb_state_length = memory_length;
        move16();
        /* save the memory */
        set32_fx( hs->cldfb_state_fx, 0, memory_length );
        hs->Q_cldfb_state = Q11;
        move16();
    }
    return;
#endif /*HARMONIZE_2583_open_decoder_LPD*/
}
+3 −0
Original line number Diff line number Diff line
@@ -2610,6 +2610,9 @@ typedef enum SIGNAL_CLASSIFER_MODE
#define SCALE_CLDFB_SYN_40                      ( SCALE_MODULATION + SCALE_GAIN_SYN )
#define SCALE_CLDFB_SYN_60                      ( SCALE_MODULATION + SCALE_GAIN_SYN )
#define SCALE_CLDFB_SYN_30                      ( SCALE_MODULATION + SCALE_GAIN_SYN )
#ifdef HARMONIZE_2583_open_decoder_LPD
#define STATE_BUFFER_SIZE                       ( 9 + 16 )
#endif


/*----------------------------------------------------------------------------------*
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
#define BE_FIX_BASOP_2543_MISMATCH_REND_OPEN_FX_FL      /* FhG: Aligns implementation of split rendering init loops in IVAS_REND_Open between float and BASOP */
#define FIX_2402_REPL_EVS_ARI_CODEC_DEC                 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder, except functions in igf_scf_dec_fx.c */
#define FIX_2402_SIGNED_VERSION                         /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */
#define HARMONIZE_2583_open_decoder_LPD                 /* FhG: harmonize open_decoder_LPD between EVS and IVAS versions */

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

+31 −9
Original line number Diff line number Diff line
@@ -7050,14 +7050,20 @@ ivas_error ppp_quarter_decoder_fx(
    DTFS_STRUCTURE PREV_CW_D_FX,      /* i  : Previous DTFS                                            */
    Decoder_State *st_fx );

#ifndef HARMONIZE_2583_open_decoder_LPD
void open_decoder_LPD_fx(
    Decoder_State *st,
    const Word32 total_brate, /* Q0 */
    const Word16 bwidth,      /* Q0 */
    const Word16 is_init      /* i  : indicate call during initialization    */
);
#endif

#ifdef HARMONIZE_2583_open_decoder_LPD
void open_decoder_LPD_fx(
#else
void open_decoder_LPD_ivas_fx(
#endif
    Decoder_State *st,              /* i/o: decoder state structure                     */
    const Word32 total_brate,       /* i  : total bitrate                             Q0*/
    const Word32 last_total_brate,  /* i  : last total bitrate                        Q0*/
@@ -7065,14 +7071,20 @@ void open_decoder_LPD_ivas_fx(
    const Word16 MCT_flag,          /* i  : hMCT handle allocated (1) or not (0)      Q0*/
    const Word16 last_element_mode, /* i  : last element mode                         Q0*/
    const Word16 is_init,           /* i  : indicate call from init_decoder() to avoid double TC initialization Q0*/
    Word16 *Q_syn_Overl_TDAC,
    Word16 *Q_fer_samples,
    Word16 *Q_syn_Overl_TDAC,       /*EVS:0 */
    Word16 *Q_fer_samples,          /*EVS:0 */
#ifndef HARMONIZE_2583_open_decoder_LPD
    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
    Word16 *Q_syn_Overl_TDACFB, /*EVS:0 */
    Word16 *Q_syn_OverlFB,      /*EVS:0 */
    Word16 *Q_old_out,          /*EVS:0 */
    Word16 *Q_old_outLB         /*EVS:0 */
#ifndef HARMONIZE_2583_open_decoder_LPD
    ,
    Word16 *Q_old_Aq_12_8 /*EVS:0 */
#endif
);

void reset_tcx_overl_buf_fx(
    TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */
@@ -7357,12 +7369,18 @@ void mode_switch_decoder_LPD_ivas_fx(
    const Word16 last_element_mode, /* i  : last element mode                       Q0*/
    Word16 *Q_syn_Overl_TDAC,
    Word16 *Q_fer_samples,
#ifndef HARMONIZE_2583_open_decoder_LPD
    Word16 *Q_syn_Overl,
#endif
    Word16 *Q_syn_Overl_TDACFB,
    Word16 *Q_syn_OverlFB,
    Word16 *Q_old_out,
    Word16 *Q_old_outLB,
    Word16 *Q_old_Aq_12_8 );
    Word16 *Q_old_outLB
#ifndef HARMONIZE_2583_open_decoder_LPD
    ,
    Word16 *Q_old_Aq_12_8
#endif
);

Word16 DecodeIndex(
    Decoder_State *st,
@@ -10059,4 +10077,8 @@ ivas_error IGF_Reconfig(
    const Word16 rf_mode              /* i  : flag to signal the RF mode      */
);

#ifdef HARMONIZE_2583_open_decoder_LPD
Word16 cldfb_get_memory_length( HANDLE_CLDFB_FILTER_BANK hs );
#endif

#endif
Loading