Commit 9cf7497a authored by fotopoulou's avatar fotopoulou
Browse files

Issue-24 remove LFE processing from MCT

parent de6eaffe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -833,12 +833,13 @@ static ivas_error write_indices_element(
            /* restore previous pointer position */
            pt_stream_loc = pt_stream_backup;
        }

#ifndef ISSUE_24_CLEANUP_MCT_LFE
        /* TODO implemented only for MCT for now */
        if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) )
        {
            continue;
        }
#endif
#ifdef ENABLE_BITRATE_VERIFICATION
        total_nb_bits =
#endif
+28 −6
Original line number Diff line number Diff line
@@ -249,14 +249,19 @@ int16_t getResq(
int16_t getTnsAllowed(
    const int32_t total_brate, /* i  : total bitrate               */
    const int16_t igf,         /* i  : flag indicating IGF activity*/
    const int16_t element_mode,       /* i  : IVAS element mode           */
    const int16_t element_mode /* i  : IVAS element mode           */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const MCT_CHAN_MODE mct_chan_mode /* i  : MCT channel mode            */
#endif
)
{
    int16_t tnsAllowed = 0;

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode != MCT_CHAN_MODE_LFE )
    {
#endif
        if ( igf )
        {
            if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) )
@@ -268,7 +273,9 @@ int16_t getTnsAllowed(
        {
            tnsAllowed = 1;
        }
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    }
#endif

    return tnsAllowed;
}
@@ -411,16 +418,21 @@ int16_t getIgfPresent(
    const int16_t element_mode, /* i  : IVAS element mode           */
    const int32_t total_brate,  /* i  : total bitrate               */
    const int16_t bwidth,       /* i  : audio bandwidth             */
    const int16_t rf_mode,      /* i  : flag to signal the RF mode  */
    const int16_t rf_mode       /* i  : flag to signal the RF mode  */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const int16_t mct_chan_mode /* i  : MCT channel mode            */
#endif
)
{
    int16_t igfPresent = 0;

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode == MCT_CHAN_MODE_LFE )
    {
        return igfPresent;
    }
#endif

    if ( bwidth == SWB )
    {
@@ -808,8 +820,11 @@ void init_tcx_cfg(
    const int16_t infoIGFStopFreq,
    const int16_t element_mode,
    const int16_t ini_frame,
    const int16_t MCT_flag,
    const int16_t MCT_flag
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    ,
    const MCT_CHAN_MODE mct_chan_mode /* i  : MDCT channel mode     */
#endif
)
{
    int16_t i;
@@ -840,13 +855,20 @@ void init_tcx_cfg(
    /* set number of coded lines */
    hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth );

#ifndef ISSUE_24_CLEANUP_MCT_LFE
    if ( mct_chan_mode == MCT_CHAN_MODE_LFE )
    {
        hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE;
    }
#endif
    /* TNS in TCX */
    hTcxCfg->pCurrentTnsConfig = NULL;
    hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode, mct_chan_mode );
    hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode
#ifndef ISSUE_24_CLEANUP_MCT_LFE
                                            ,
                                            mct_chan_mode
#endif
    );

    if ( hTcxCfg->fIsTNSAllowed )
    {
+10 −2
Original line number Diff line number Diff line
@@ -1277,17 +1277,25 @@ typedef enum
#define BITRATE_MCT_RATIO_RANGE                 ( 1 << NBBITS_MCT_RATIO )   /* Range of the coded bitrate distribution ratio */

#define LFE_BITS                                180

#ifndef ISSUE_24_CLEANUP_MCT_LFE
#define MCT_LFE_MAX_LINE                        24
#endif
#define MCT_NUM_BLOCK_DATA_BITS                 4

#ifndef ISSUE_24_CLEANUP_MCT_LFE
typedef enum
{
    MCT_CHAN_MODE_REGULAR,
    MCT_CHAN_MODE_LFE,
    MCT_CHAN_MODE_IGNORE
} MCT_CHAN_MODE;

#else
typedef enum
{
    MCT_CHAN_MODE_REGULAR,
    MCT_CHAN_MODE_IGNORE
} MCT_CHAN_MODE;
#endif

/*----------------------------------------------------------------------------------*
 * Parametric MC Constants
+19 −4
Original line number Diff line number Diff line
@@ -66,11 +66,13 @@ void splitAvailableBitsMCT(
    int16_t min_chan_bits[MCT_MAX_CHANNELS], min_bits_tot, remaining_bits;
    int16_t core[MCT_MAX_CHANNELS];
    MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS];
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    int16_t num_lfe;
    int16_t lfe_channel;

    num_lfe = 0;
    lfe_channel = -1;
#endif
    min_bits_tot = 0;

    for ( i = 0; i < nchan; i++ )
@@ -85,18 +87,23 @@ void splitAvailableBitsMCT(
            mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode;
            core[i] = ( (Decoder_State *) sts[i] )->core;
        }

#ifndef ISSUE_24_CLEANUP_MCT_LFE
        if ( mct_chan_mode[i] == MCT_CHAN_MODE_LFE )
        {
            num_lfe++;
            lfe_channel = i;
            assert( lfe_channel == LFE_CHANNEL );
        }
#endif
    }

    for ( i = 0; i < nchan; i++ )
    {
        if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
            mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
            mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        {
            min_chan_bits[i] = 0;

@@ -128,7 +135,11 @@ void splitAvailableBitsMCT(
            bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel;
        }

        if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
            mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
            mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
        {
            assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE );
            *bits_frame_channel = split_ratio[i] * remaining_bits / BITRATE_MCT_RATIO_RANGE + min_chan_bits[i];
@@ -162,7 +173,11 @@ void splitAvailableBitsMCT(
                bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel;
            }

            if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
            if (
#ifndef ISSUE_24_CLEANUP_MCT_LFE
                mct_chan_mode[i] != MCT_CHAN_MODE_LFE &&
#endif
                mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE )
            {
                *bits_frame_channel -= diff * split_ratio[i] / BITRATE_MCT_RATIO_RANGE;
                *bits_frame_channel = max( min_chan_bits[i], *bits_frame_channel );
+14 −0
Original line number Diff line number Diff line
@@ -2227,7 +2227,9 @@ void decoder_tcx_imdct(
    float synthFB[],
    const int16_t bfi,                                          /* i  : Bad frame indicator                     */
    const int16_t frame_cnt,                                    /* i  : frame counter in the super frame        */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    const int16_t isLFE,                                        /* i  : is LFE                                  */
#endif
    const int16_t sba_dirac_stereo_flag                         /* i  : signal stereo output for SBA DirAC      */
);

@@ -2792,7 +2794,9 @@ void ivas_mdct_core_whitening_enc(
    int16_t tnsSize[CPE_CHANNELS][NB_DIV],                      /* o  : size of TNS                             */
    int16_t p_param[CPE_CHANNELS][NB_DIV],                      /* o  : pointer to parameter array              */
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: encoder bitstream handle                */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    int16_t *LFE_off,                                           /* o  : flag if LFE has content                 */
#endif
    const int16_t mct_on,                                       /* i  : flag mct block (1) or stereo (0)        */
    const int16_t nChannels                                     /* i  : total number of coded channels          */
);
@@ -2810,7 +2814,9 @@ void ivas_mct_core_enc(

void ivas_mdct_quant_coder(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: Encoder CPE handle                      */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    const int16_t LFE_off,                                      /* i  : flag if LFE has content                 */
#endif
    int16_t tnsBits[CPE_CHANNELS][NB_DIV],                      /* i  : bits needed for TNS parameters          */
    int16_t tnsSize[CPE_CHANNELS][NB_DIV],                      /* i  : size of TNS                             */
    int16_t p_param[CPE_CHANNELS][NB_DIV],                      /* i  : pointer to parameter array              */
@@ -2861,7 +2867,9 @@ void ivas_mdct_dec_side_bits_frame_channel(
    int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW],          /* o  : lpc_parameters                          */
    int16_t p_param[CPE_CHANNELS][NB_DIV],                      /* o  : pointer to param buffer                 */
    Decoder_State *st0,                                         /* i  : pointer to bitstream handle             */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    int16_t *LFE_off,                                           /* o  : flag if LFE has content                 */
#endif
    int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV],                /* o  : number of bits for TNS                  */
    int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV],         /* i/o: parameters buffer                       */
    const int16_t MCT_flag,                                     /* i  : hMCT handle allocated (1) or not (0)    */
@@ -2881,7 +2889,9 @@ void ivas_mct_side_bits(

void ivas_mdct_core_invQ(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE handle                              */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    const int16_t LFE_off,                                      /* i  : flag if LFE content                     */
#endif 
    int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV],                /* i  : number of TNS bits                      */
    int16_t p_param[CPE_CHANNELS][NB_DIV],                      /* i  : pointer to param buffer                 */
    int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW],              /* i  : lpc parameters                          */
@@ -2899,14 +2909,18 @@ void ivas_mdct_core_reconstruct(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    float *x[][NB_DIV],                                         /* i/o: pointers to synthesis @internal_FS      */
    float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS],             /* o  : synthesis @output_FS                    */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    const int16_t LFE_off,                                      /* i  : flag if LFE content                     */
#endif
    int16_t fUseTns[CPE_CHANNELS][NB_DIV],                      /* i  : flage TNS enabled                       */
    const int16_t MCT_flag                                      /* i  : hMCT handle allocated (1) or not (0)    */
);

void ivas_mdct_core_tns_ns(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
#ifndef ISSUE_24_CLEANUP_MCT_LFE
    const int16_t LFE_off,                                      /* i  : flag if LFE has content                 */
#endif
    int16_t fUseTns[CPE_CHANNELS][NB_DIV],                      /* i  : two entries for each channel in TCX10   */
    STnsData tnsData[CPE_CHANNELS][NB_DIV],                     /* o  : TNS parameter                           */
    float *x[CPE_CHANNELS][NB_DIV],                             /* o  : synthesis @internal_FS                  */
Loading