Commit 87130653 authored by vaclav's avatar vaclav
Browse files

port MR

parent e81dcc6b
Loading
Loading
Loading
Loading
Loading
+39 −5
Original line number Diff line number Diff line
@@ -525,6 +525,7 @@ void tdm_bit_alloc(
    *total_brate_sec = L_add( *total_brate_sec, sub( fast_FCB_rates_2sfr[idx], tmp_rate ) ); /*Q0*/
    move32();
}

/* To prevent 13.2 kb/s for primary channel as some bitstream issues arrise with it */
IF( EQ_32( L_sub( element_brate_wo_meta, *total_brate_sec ), ACELP_13k20 ) )
{
@@ -532,6 +533,7 @@ IF( EQ_32( L_sub( element_brate_wo_meta, *total_brate_sec ), ACELP_13k20 ) )
    move32();
}
}

/* prevent 2.4 kb/s and 2.8 kb/s as they are reserved bitrates for DTX and VBR */
test();
IF( EQ_32( *total_brate_sec, PPP_NELP_2k80 ) || EQ_32( *total_brate_sec, SID_2k40 ) )
@@ -545,11 +547,13 @@ move32();

return;
}

/*-------------------------------------------------------------------*
 * td_stereo_param_updt()
 *
 * copy certain TD stereo parameters from primary channel to secondary channel
 *-------------------------------------------------------------------*/

void td_stereo_param_updt_fx(
    const Word16 lsp_old_PCh_fx[],    /* i  : primary channel old LSPs                                     Q15 */
    const Word16 lsf_old_PCh_fx[],    /* i  : primary channel old LSFs                             Qlog2(2.56) */
@@ -562,24 +566,57 @@ void td_stereo_param_updt_fx(
)
{
    Word16 i;

    /* Copy some primary channel information into the secondary channel structure for later usage */
    IF( EQ_16( tdm_use_IAWB_Ave_lpc, 1 ) )
    {
        /*not being assert*/
        Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/

#ifdef FIX_1111_TDM_LSP_BUFFER
        IF( tdm_lspQ_PCh_fx != NULL )
        {
            lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
        }
#else
        lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
#endif
    }
    ELSE IF( EQ_16( flag_ACELP16k, 1 ) )
    {
#ifdef FIX_1111_TDM_LSP_BUFFER
        IF( tdm_lspQ_PCh_fx != NULL )
        {
            Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
            lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
            lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
        }
        ELSE
        {
            Word16 lsp_temp[M];
            Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/
            lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 );
            lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
        }
#else
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
        lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
        lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
#endif
    }
    ELSE
    {
#ifdef FIX_1111_TDM_LSP_BUFFER
        IF( tdm_lspQ_PCh_fx != NULL )
        {
            Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
        }
#else
        Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
#endif
        Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
    }

    IF( EQ_16( flag_ACELP16k, 1 ) )
    {
        Word16 tmp16;
@@ -649,10 +686,7 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat_fx(
    v_sub_16( lsf_SCh_fx, lsf_mean_in_fx, lsf_tmp_fx, M );

    lsf_tmp_ptr1_fx = lsf_tmp_fx;      /*x2.56*/

    lsf_SCh_ptr_fx = lsf_SCh_fx;       /*x2.56*/


    lsf_tmp_ptr2_fx = lsf_tmp_ptr1_fx; /*x2.56*/

    *lsf_SCh_ptr_fx = mult_r( *lsf_tmp_ptr1_fx++, *prd_ptr_fx++ ); // Q2.56 + 15 -15
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@
#define NONBE_FIX_SBA_SIGNALING_BITS_B                  /* FhG: issue 1061: option B: signal sba order additionally in OSBA */
#define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP               /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */
#define FIX_1053_REVERB_RECONFIGURATION                 /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
#define FIX_1111_TDM_LSP_BUFFER                         /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */

/* #################### End BASOP porting switches ############################ */

+8 −0
Original line number Diff line number Diff line
@@ -107,7 +107,11 @@ ivas_error ivas_core_enc_fx(
    Word16 Voicing_flag[CPE_CHANNELS];
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q6 */
    Word16 unbits[CPE_CHANNELS];
#ifdef FIX_1111_TDM_LSP_BUFFER
    Word16 tdm_lsfQ_PCh_fx[M]; /* Q2.56 */
#else
    Word16 tdm_lspQ_PCh_fx[M], tdm_lsfQ_PCh_fx[M]; /* 1 : Q15, 2 : Q2.56 */
#endif
    Word16 last_element_mode, tdm_Pitch_reuse_flag;
    Word32 element_brate, last_element_brate, input_Fs;
    Word16 diff_nBits;
@@ -415,7 +419,11 @@ ivas_error ivas_core_enc_fx(
        test();
        IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && n == 0 )
        {
#ifdef FIX_1111_TDM_LSP_BUFFER
            td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], NULL, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
#else
            td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
#endif
        }
    }