Commit f1843c22 authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Merge branch 'main' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into 1036_basop_port_fl_code

parents 58c3c80f 04c6120f
Loading
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -623,7 +623,9 @@ ivas_error config_acelp1_fx(
    const Word16 tdm_lp_reuse_flag,        /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const Word16 tdm_low_rate_mode,        /* i  : secondary channel low rate mode flag */
    const Word16 idchan,                   /* i  : stereo channel ID               */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    const Word16 active_cnt, /* i  : Active frame counter            */
#endif
    const Word16 tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag*/
    const Word16 tdm_LRTD_flag,        /* i  : LRTD stereo mode flag           */
    const Word16 GSC_IVAS_mode         /* i  : GSC IVAS mode                   */
@@ -806,7 +808,9 @@ ivas_error config_acelp1_fx(

        test();
        test();
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        test();
#endif
        IF( !tdm_lp_reuse_flag || idchan == 0 )
        {
            /* LSF Q bit-budget */
@@ -883,7 +887,11 @@ ivas_error config_acelp1_fx(

            bits = sub( bits, acelp_cfg->mid_lsf_bits );
        }
#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) )
#else
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) )
#endif
        {
            bits = sub( bits, TDM_IC_LSF_PRED_BITS );
        }
+0 −5
Original line number Diff line number Diff line
@@ -397,13 +397,8 @@ void ivas_get_dirac_sba_max_md_bits_fx(
        /* OSBA needs an additional 2-bits safety margin to avoid acelp crashes */
        IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) )
        {
#ifdef NONBE_FIX_SBA_SIGNALING_BITS_B
            ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 7 );
            move16();
#else
            ( *metadata_max_bits ) = sub( ( *metadata_max_bits ), 3 );
            move16();
#endif
        }
    }
    ELSE IF( LE_32( sba_total_brate, IVAS_32k ) )
+32 −19
Original line number Diff line number Diff line
@@ -884,12 +884,13 @@ void ivas_lfe_dec_close_fx(
    LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */
);


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) */
    const Word16 pitch_buf_PCh_fx[],  /* i  : primary channel pitch buffer                                  Q6 */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    Word16 tdm_lspQ_PCh_fx[],         /* o  : Q LSPs for primary channel                                   Q15 */
#endif
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 */
@@ -2500,7 +2501,7 @@ Word16 ivas_sba_get_nchan_metadata_fx(
);

#ifdef NONBE_FIX_1052_SBA_EXT
/*! r: number of bits in SPAR SID frame */
/*! r: number of bits in SBQ SID frame */
Word16 ivas_sba_spar_sid_bitlen_fx(
    const Word16 nchan_transport /* i  : number of transport channels            */
);
@@ -3499,7 +3500,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512_fx(
    BSTR_ENC_HANDLE hMetaData,  /* i/o: metadata bitstream handle */
    IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle           */
    const Word16 bits_sph_idx,
    const Word16 bits_sp_coh );
    const Word16 bits_sp_coh 
);

void ivas_merge_masa_metadata_fx(
    MASA_ENCODER_HANDLE hMasa,           /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */
    OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i  : ISM-object metadata to be merged with the MASA metadata                      */
@@ -3521,12 +3524,14 @@ void ivas_param_mc_enc_fx(
    Word32 *data_f_fx[],       /* i/o: input/transport MC data                     Q11 */
    const Word16 input_frame   /* i  : input frame length                                   */
);

void ivas_merge_masa_transports_fx(
    Word32 data_in_f1_fx[][L_FRAME48k], // Qx
    Word32 *data_in_f2_fx[],            // Qx
    Word32 *data_out_f_fx[],            // Qx
    const Word16 input_frame,
    const Word16 num_transport_channels );
    const Word16 num_transport_channels 
);

void ivas_param_mc_enc_close_fx(
    PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle                        */
@@ -3625,11 +3630,18 @@ ivas_error ivas_masa_encode_fx(
void ivas_write_format_sid_fx(
    const IVAS_FORMAT ivas_format,                      /* i  : IVAS format                             */
    const Word16 element_mode,                          /* i  : element bitrate                         */
#ifdef NONBE_FIX_1052_SBA_EXT_FIX
    BSTR_ENC_HANDLE hBstr,                              /* i/o: encoder bitstream handle                */
    const Word16 sba_order,                             /* i  : Ambisonic (SBA) order                   */
    const Word16 sba_planar                             /* i  : SBA planar flag                         */
#else
BSTR_ENC_HANDLE hBstr          /* i/o: encoder bitstream handle                */
#endif
);

void ivas_write_format_fx( /* i/o: IVAS encoder structure					*/
                           Encoder_Struct *st_ivas );
void ivas_write_format_fx( 
    Encoder_Struct *st_ivas                             /* i/o: IVAS encoder structure					*/
);

ivas_error create_sce_enc_fx(
    Encoder_Struct *st_ivas,                            /* i/o: IVAS encoder structure      */
@@ -5850,7 +5862,8 @@ ivas_error ivas_dirac_enc_fx(
    const Word16 nchan_transport,  /* i  : number of transport channels            */
#endif
    const Word16 hodirac_flag,     /* i  : hodirac flag                            */
    const Word16 shift );
    const Word16 shift 
);

ivas_error ivas_spar_md_enc_init_fx(
    ivas_spar_md_enc_state_t *hMdEnc,           /* o  : MD encoder handle        */
+3 −2
Original line number Diff line number Diff line
@@ -171,10 +171,10 @@ Word16 ivas_sba_get_nchan_fx(
/*-------------------------------------------------------------------*
 * ivas_sba_spar_sid_bitlen_fx()
 *
 * Get number of bits in SPAR SID frame
 * Get number of bits in SBA SID frame
 *-------------------------------------------------------------------*/

/*! r: number of bits in SPAR SID frame */
/*! r: number of bits in SBA SID frame */
Word16 ivas_sba_spar_sid_bitlen_fx(
    const Word16 nchan_transport /* i  : number of transport channels            */
)
@@ -191,6 +191,7 @@ Word16 ivas_sba_spar_sid_bitlen_fx(
}
#endif


/*-------------------------------------------------------------------*
 * ivas_sba_get_nchan_metadata()
 *
+53 −9
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,16 +547,20 @@ 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) */
    const Word16 pitch_buf_PCh_fx[], /* i  : primary channel pitch buffer                                  Q6 */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    Word16 tdm_lspQ_PCh_fx[], /* o  : Q LSPs for primary channel                                   Q15 */
#endif
    Word16 tdm_lsfQ_PCh_fx[],         /* o  : Q LSFs for primary channel                           Qlog2(2.56) */
    Word16 tdm_Pri_pitch_buf_fx[],    /* o  : pitch values for primary channel                              Q6 */
    const Word16 flag_ACELP16k,       /* i  : ACELP@16kHz flag                                                 Q0*/
@@ -562,24 +568,65 @@ 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)*/
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC

#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
#endif
    }
    ELSE IF( EQ_16( flag_ACELP16k, 1 ) )
    {
#ifdef FIX_1111_TDM_LSP_BUFFER
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        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
        {
#endif
            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 );
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        }
#endif
#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
    {
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
#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
#endif
        Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
    }

    IF( EQ_16( flag_ACELP16k, 1 ) )
    {
        Word16 tmp16;
@@ -649,10 +696,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
Loading