Commit 5c944f5f authored by vaclav's avatar vaclav
Browse files

[maintenance] formatting, comments

parent b4f570ab
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -860,10 +860,6 @@ void stereo_enc_itd_init(
void stereo_dft_enc_update(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: encoder DFT stereo handle           */
    const int16_t max_bwidth                                    /* i  : maximum encoded bandwidth           */
#ifdef DEBUG_MODE_DFT
    ,
    const int16_t res_code_bits                                 /* i  : bits for residual coding           */
#endif
);

void stereo_dft_enc_destroy(
+6 −11
Original line number Diff line number Diff line
@@ -342,14 +342,11 @@ ivas_error ivas_cpe_enc(
        stereo_dft_enc_analyze( sts, CPE_CHANNELS, input_frame, hCPE->hStereoDft, NULL, hCPE->hStereoDft->DFT, hCPE->input_mem );

        sts[0]->total_brate = ( sts[0]->bits_frame_nominal + 10 ) * FRAMES_PER_SEC; /* add small overhead; st[0]->total_brate used in coder_type_modif() */

        /* Update DFT Stereo memories */
        stereo_dft_enc_update( hCPE->hStereoDft, sts[0]->max_bwidth
#ifdef DEBUG_MODE_DFT
                               ,
                               (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal )
        hCPE->hStereoDft->res_cod_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal );
#endif
        );
        /* Update DFT Stereo memories */
        stereo_dft_enc_update( hCPE->hStereoDft, sts[0]->max_bwidth );

        /* DFT stereo processing */
        stereo_dft_enc_process( hCPE, input_frame );
@@ -561,13 +558,11 @@ ivas_error ivas_cpe_enc(
                }

                stereo_dft_cng_side_gain( hCPE->hStereoDft, hCPE->hStereoCng, sts[0]->core_brate, sts[0]->last_core_brate, sts[0]->bwidth );

                stereo_dft_enc_update( hCPE->hStereoDft, min( SWB, sts[0]->max_bwidth )
#ifdef DEBUG_MODE_DFT
                                                             ,
                                       0
                hCPE->hStereoDft->res_cod_bits = 0;
#endif
                );

                stereo_dft_enc_update( hCPE->hStereoDft, min( SWB, sts[0]->max_bwidth ) );
            }
            else
            {
+30 −21
Original line number Diff line number Diff line
@@ -53,21 +53,21 @@
static void FindChannelRatio(
    MCT_ENC_HANDLE hMCT,                   /* i/o: MCT encoder structure            */
    Encoder_State **sts,                   /* i/o: encoder state structure          */
    int16_t chBitRatios[MCT_MAX_CHANNELS],
    const int16_t nchan /* i  : number of channels      */
    int16_t chBitRatios[MCT_MAX_CHANNELS], /* o  : bit-disctribution channel ratios */
    const int16_t nChannels                /* i  : number of channels to be coded   */
)
{
    float sum_nrg = 0;
    float chRatio;
    float sum_nrg, chRatio;
    int16_t i;
    float nrg[MCT_MAX_CHANNELS] = { 0 };
    float nrg[MCT_MAX_CHANNELS];

    set_f( nrg, 0, MCT_MAX_CHANNELS );

    getChannelEnergies( sts, nrg, nchan );
    getChannelEnergies( sts, nrg, nChannels );

    /*calculate total energy without LFE*/
    for ( i = 0; i < nchan; i++ )
    sum_nrg = 0;
    for ( i = 0; i < nChannels; i++ )
    {
        if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE )
        {
@@ -76,7 +76,7 @@ static void FindChannelRatio(
    }
    sum_nrg = 1.0f / max( sum_nrg, EPSILON );

    for ( i = 0; i < nchan; i++ )
    for ( i = 0; i < nChannels; i++ )
    {
        if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE )
        {
@@ -106,14 +106,20 @@ static void FindChannelRatio(
}


/*----------------------------------------------------------*
 * AdjustChannelRatios()
 *
 * adjust ratio of channels for bit distribution
 *----------------------------------------------------------*/

static void AdjustChannelRatios(
    int16_t chBitRatios[MCT_MAX_CHANNELS],
    const int16_t nchan /* i  : number of channels      */
    int16_t chBitRatios[MCT_MAX_CHANNELS], /* o  : bit-disctribution channel ratios */
    const int16_t nChannels                /* i/o: number of channels               */
#ifdef FIX_I1_113
    ,
    const int32_t ivas_total_brate,
    const int16_t nAvailBits,
    const int16_t sba_order
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate               */
    const int16_t nAvailBits,       /* i  : number of available bits         */
    const int16_t sba_order         /* i  : Ambisonic (SBA) order            */
#endif
)
{
@@ -148,12 +154,12 @@ static void AdjustChannelRatios(
    ratio_diff = 0;
    sum_ratio = 0.0f;
    sum_tar_ratio = 0.0f;
    for ( i = 0; i < nchan; i++ )
    for ( i = 0; i < nChannels; i++ )
    {
        sum_ratio += (float) chBitRatios[i];
        sum_tar_ratio += (float) force_ch_bit_ratios[i];
    }
    for ( i = 3; i < nchan; i++ )
    for ( i = 3; i < nChannels; i++ )
    {
        cur_ratio = (float) chBitRatios[i] / sum_ratio;
        tar_ratio = (float) force_ch_bit_ratios[i] / sum_tar_ratio;
@@ -164,7 +170,8 @@ static void AdjustChannelRatios(
        assert( chBitRatios[i] < ( BITRATE_MCT_RATIO_RANGE - 1 ) );
        ratio_diff += force_ch_bit_ratios[i] - chBitRatios[i];
    }
    for ( i = 0; i < min( 3, nchan ); i++ )

    for ( i = 0; i < min( 3, nChannels ); i++ )
    {
        assert( force_ch_bit_ratios[i] >= 0 );
        chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, force_ch_bit_ratios[i] );
@@ -174,7 +181,7 @@ static void AdjustChannelRatios(
#ifdef FIX_I1_113
    /* make sure final ratios are within range*/
    sum_ratio = 0.0f;
    for ( i = 0; i < nchan; i++ )
    for ( i = 0; i < nChannels; i++ )
    {
        sum_ratio += (float) chBitRatios[i];
    }
@@ -187,6 +194,8 @@ static void AdjustChannelRatios(

    return;
}


/*-------------------------------------------------------------------*
 * ivas_mct_core_enc()
 *
@@ -207,7 +216,7 @@ void ivas_mct_core_enc(
#endif
)
{
    int16_t ch, nSubframes, L_subframeTCX;
    int16_t ch, ch_core, nSubframes, L_subframeTCX;
    int16_t i, cpe_id, n, nAvailBits;
    int16_t nCPE;
    float *orig_spectrum[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */
@@ -284,7 +293,7 @@ void ivas_mct_core_enc(

    for ( ch = 0; ch < (int16_t) ( hMCT->nchan_out_woLFE * 0.5 ); ch++ )
    {
        int16_t ch_core = ch * CPE_CHANNELS;
        ch_core = ch * CPE_CHANNELS;

        if ( switch_bw )
        {
+1 −0
Original line number Diff line number Diff line
@@ -278,6 +278,7 @@ typedef struct stereo_dft_enc_data_struct
    int16_t flip_sign;
#ifdef DEBUG_MODE_DFT
    int16_t verbose;
    int16_t res_cod_bits;
#endif

} STEREO_DFT_ENC_DATA, *STEREO_DFT_ENC_DATA_HANDLE;