Commit 2c5e40de authored by JÜRGEN Gerstacker's avatar JÜRGEN Gerstacker
Browse files

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

Merge branch 'main' of https://forge.3gpp.org/rep/sa4/audio/ivas-basop into 1965-replace-carry-overflow-using-32-bit-operators-by-64-bit-version-ii
parents 99f0ed69 1c1ac790
Loading
Loading
Loading
Loading
Loading
+140 −142
Original line number Diff line number Diff line
@@ -2162,7 +2162,8 @@ ivas_error only_reduce_bits_direction_fx(
    Word16 reduce_bits,
    const Word16 coding_subbands,
    const Word16 no_subframes,
    Word16 *ind_order );
    Word16 *ind_order 
);

void ivas_qmetadata_azimuth_elevation_to_direction_vector_fx(
    const Word32 az, /* i  : azimuth                            Q22     */
@@ -2276,7 +2277,6 @@ void stereo_dtf_cng_fx(
    Word16 q_dft                                                /* i  : Q factor of the DFT data                    */
);


void ivas_spar_update_md_hist_fx(
    ivas_spar_md_dec_state_t *hMdDec                            /* i/o: SPAR MD decoder handle                      */
);
@@ -2304,8 +2304,14 @@ void ivas_dirac_dec_render_sf_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
    Word32 *output_fx[],                                        /* i/o: synthesized core-coder transport channels/DirAC output  */
    const Word16 nchan_transport,                               /* i  : number of transport channels                */
#ifdef FIX_1319_STACK_SBA_DECODER
    Word32 *pppQMfFrame_ts_re_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX],
    Word32 *pppQMfFrame_ts_im_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX]
#else
    Word32 *pppQMfFrame_ts_re_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX],
    Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] );
    Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] 
#endif
);

void ivas_dirac_dec_render_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
@@ -2437,7 +2443,8 @@ ivas_error PsychoacousticParameters_Init_fx(
    const Word8 nBands,                                         /* i  : Number of spectrum subbands                                     */
    const Word16 isTCX20,                                       /* i  : Flag indicating if the subband division is for TCX20 or TCX10   */
    const Word16 isWarped,                                      /* i  : Flag indicating if the scale is linear or warped                */
    PsychoacousticParameters *pPsychParams );
    PsychoacousticParameters *pPsychParams 
);

ivas_error ivas_FB_mixer_open_fx(
    IVAS_FB_MIXER_HANDLE *hFbMixer_out,                         /* i/o: FB mixer handle                             */
@@ -2464,7 +2471,8 @@ void ivas_fb_mixer_cross_fading_fx(
    Word32 *pMdft_out_new_fx,
    const Word16 ch,
    const Word16 frame_len,
    const Word16 cf_offset );
    const Word16 cf_offset 
);

// ivas_omasa_dec.c
ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
@@ -2494,13 +2502,15 @@ Word16 ivas_sba_spar_sid_bitlen_fx(
void ivas_sba_get_spar_hoa_ch_ind_fx(
    const Word16 num_md_chs,       /* i  : number of MD channels       */
    const Word32 ivas_total_brate, /* i  : IVAS total bitrate           */
    Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] );
    Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] 
);

void ivas_sba_get_spar_hoa_md_flag_fx(
    const Word16 sba_order,        /* i  : Ambisonic (SBA) order        */
    const Word32 ivas_total_brate, /* i  : IVAS total bitrate           */
    Word16 *spar_hoa_md_flag,
    Word16 *spar_hoa_dirac2spar_md_flag );
    Word16 *spar_hoa_dirac2spar_md_flag 
);

void ivas_omasa_dirac_rend_jbm_fx(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder handle                      */
@@ -2637,28 +2647,15 @@ Word16 getNumChanAnalysis_fx(
    Encoder_Struct *st_ivas /* i  : IVAS encoder structure              */
);


/*----------------------------------------------------------------------------------*
 * Limiter prototypes
 *----------------------------------------------------------------------------------*/


ivas_error ivas_limiter_open(
    IVAS_LIMITER_HANDLE *hLimiter_out, /* o  : limiter struct handle                   */
    const int16_t num_channels,        /* i  : number of I/O channels                  */
    const int32_t sampling_rate        /* i  : sampling rate for processing            */
);

void ivas_limiter_close(
    IVAS_LIMITER_HANDLE *phLimiter /* i/o: pointer to limiter handle, can be NULL  */
);

void ivas_limiter_dec(
    IVAS_LIMITER_HANDLE hLimiter,       /* i/o: limiter struct handle                                           */
    float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer                                             */
    const int16_t num_channels,         /* i  : number of channels to be processed                              */
    const int16_t output_frame,         /* i  : number of samples per channel in the buffer                     */
    const int16_t BER_detect            /* i  : BER detect flag                                                 */
);
void ivas_limiter_dec_fx(
    IVAS_LIMITER_HANDLE hLimiter,        /* i/o: limiter struct handle                                           */
    Word32 *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer                                             */
@@ -2667,13 +2664,7 @@ void ivas_limiter_dec_fx(
    const Word16 BER_detect,             /* i  : BER detect flag                                                 */
    Word16 q_factor                      /* i  : Q factor of the output samples                                  */
);
void limiter_process(
    IVAS_LIMITER_HANDLE hLimiter,  /* i/o: limiter struct handle                                           */
    const int16_t output_frame,    /* i  : number of samples to be processed per channel in the I/O buffer */
    const float threshold,         /* i  : signal amplitude above which limiting starts to be applied      */
    const int16_t BER_detect,      /* i  : BER detect flag                                                 */
    int16_t *strong_saturation_cnt /* i/o: counter of strong saturations (can be NULL)                     */
);

void limiter_process_fx(
    IVAS_LIMITER_HANDLE hLimiter,  /* i/o: limiter struct handle                                              */
    const Word16 output_frame,     /* i  : number of samples to be processed per channel in the I/O buffer    */
@@ -2722,13 +2713,15 @@ void ivas_lfe_lpf_enc_apply_fx(
// ivas_arith.c
void ivas_ari_done_encoding_14bits_fx(
    BSTR_ENC_HANDLE hBstr,
    Tastat *s );
    Tastat *s 
);

void ivas_ari_encode_14bits_ext_fx(
    BSTR_ENC_HANDLE hBstr,
    Tastat *s,
    Word32 symbol,
    const UWord16 *cum_freq );
    const UWord16 *cum_freq 
);

void ms_inv_mask_processing_fx(
    STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT encoder structure                  */
@@ -2839,6 +2832,7 @@ void ivas_spar_bitrate_dist_fx(
    const Word16 sba_order,        /* i  : Ambisonic (SBA) order                   */
    const Word16 bwidth            /* i  : audio bandwidth                         */
);

ivas_error ivas_corecoder_enc_reconfig_fx(
    Encoder_Struct *st_ivas,          /* i/o: IVAS encoder structure                */
    const Word16 nSCE_old,            /* i  : number of SCEs in previous frame      */
@@ -2855,6 +2849,7 @@ void ivas_sba_zero_vert_comp_fx(
    const Word16 sba_planar, /* i  : SBA planar flag             */
    const Word16 input_frame /* i  : frame length                */
);

void tdm_configure_dec_fx(
    const Word16 ivas_format,     /* i  : IVAS format                     */
    const Word16 ism_mode,        /* i  : ISM mode in combined format     */
@@ -2877,6 +2872,7 @@ Word16 mdct_classifier_ivas_fx(
    const Word32 brate         /* i  : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
);


/*----------------------------------------------------------------------------------*
 * Range Coder prototypes
 *----------------------------------------------------------------------------------*/
@@ -6380,7 +6376,6 @@ void tdm_bit_alloc(
    const Word16 tdm_inst_ratio_idx                            /* i  : instantaneous correlation ratio index   */
);


/*! r: value of the indice */
uint16_t get_indice_st(
    Decoder_State *st,                                          /* i/o: decoder state structure                 */
@@ -6389,6 +6384,7 @@ uint16_t get_indice_st(
    const Word16 nb_bits                                        /* i  : number of bits to quantize the indice   */
);


/*----------------------------------------------------------------------------------*
 * MDCT Stereo prototypes
 *----------------------------------------------------------------------------------*/
@@ -6409,9 +6405,11 @@ Word16 write_stereo_to_bitstream_fx
    BSTR_ENC_HANDLE hBstr                                       /* i/o: bitstream handle                        */
);


/*----------------------------------------------------------------------------------*
 * Stereo CNG prototypes
 *----------------------------------------------------------------------------------*/

void stereo_cng_dec_update(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    const Word32 ivas_total_brate                               /* i  : IVAS total bitrate                    Q0*/
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
#define FIX_1129_EXT_REND_OUTPUT_HIGH                   /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */
#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328  */
#define FIX_1319_STACK_SBA_DECODER                      /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */

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

+3 −6
Original line number Diff line number Diff line
@@ -356,17 +356,14 @@ ivas_error ivas_core_dec_fx(
        move16();
    }

    save_hb_synth_32_fx = NULL;
    test();
    test();
    test();
    IF( sba_dirac_stereo_flag && hSCE && LE_32( sts[0]->total_brate, SID_2k40 ) && EQ_16( sts[0]->cng_type, FD_CNG ) )
    if ( sba_dirac_stereo_flag && hSCE && LE_32( sts[0]->total_brate, SID_2k40 ) && EQ_16( sts[0]->cng_type, FD_CNG ) )
    {
        save_hb_synth_32_fx = hSCE->save_hb_synth_fx;
    }
    ELSE
    {
        save_hb_synth_32_fx = NULL;
    }

    /*------------------------------------------------------------------*
     * Decode SID for MDCT-Stereo DTX mode
@@ -1447,7 +1444,7 @@ ivas_error ivas_core_dec_fx(
         *--------------------------------------------------------*/

        Word16 exp_max;
        Word32 output_fx_loc[L_FRAME48k];
        Word32 *output_fx_loc = synth_32_fx[0];

        exp_max = 0;
        move16();
+14 −15
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ ivas_error ivas_cpe_dec_fx(
    Word16 q_res_buf;
    Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */
    CPE_DEC_HANDLE hCPE;
    STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft;
    Decoder_State **sts;
    Word32 ivas_total_brate;
    ivas_error error;
@@ -159,6 +160,12 @@ ivas_error ivas_cpe_dec_fx(
        }
    }

    hConfigDft = NULL;
    if ( hCPE->hStereoDft != NULL )
    {
        hConfigDft = hCPE->hStereoDft->hConfig;
    }

    /*------------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -222,25 +229,16 @@ ivas_error ivas_cpe_dec_fx(
    test();
    IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && ( NE_32( hCPE->element_brate, hCPE->last_element_brate ) || NE_16( hCPE->last_element_mode, hCPE->element_mode ) || sts[0]->ini_frame == 0 || ( NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) ) )
    {
        STEREO_DFT_CONFIG_DATA_HANDLE hConfig;
        IF( hCPE->hStereoDft == NULL )
        {
            hConfig = NULL;
        }
        ELSE
        {
            hConfig = hCPE->hStereoDft->hConfig;
        }
        test();
        IF( st_ivas->hQMetaData != NULL && GT_32( ivas_total_brate, IVAS_SID_5k2 ) )
        {
            IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
            {
                stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.7f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
                stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.7f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
            ELSE
            {
                stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
                stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
        }
        ELSE
@@ -248,11 +246,11 @@ ivas_error ivas_cpe_dec_fx(
            /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */
            IF( LE_32( ivas_total_brate, IVAS_SID_5k2 ) )
            {
                stereo_dft_config_fx( hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
                stereo_dft_config_fx( hConfigDft, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
            ELSE
            {
                stereo_dft_config_fx( hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
                stereo_dft_config_fx( hConfigDft, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
        }
    }
@@ -592,7 +590,7 @@ ivas_error ivas_cpe_dec_fx(

    test();
    test();
    IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
    IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
    {
        IF( NE_32( ( error = ivas_core_dec_fx( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) )
        {
@@ -610,9 +608,10 @@ ivas_error ivas_cpe_dec_fx(
    /*----------------------------------------------------------------*
     * Stereo decoder & upmixing
     *----------------------------------------------------------------*/

    test();
    test();
    IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
    IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
    {
        Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; // q_dft
        set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX );
+172 −32

File changed.

Preview size limit exceeded, changes collapsed.

Loading