Commit 9b6039c3 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'enc_funcs_fxd_16' into 'main'

SBA, OMASA path sub-functions conversion and integration, cleanup

See merge request !665
parents 6c8a9816 7d978928
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1043,6 +1043,15 @@ typedef enum
#define DIRAC_MONO_MIN_THRESH                    1e2f
#define DIRAC_MONO_FRAME_THRESH                    15 /* 30ms */


#define DIRAC_MONO_THRESH_SILENCE_FX				(Word32)3e4
#define DIRAC_MONO_NORM_FACTOR_FX					(Word64)1e13
#define DIRAC_MONO_ONE_ON_NORM_FACTOR_FX			(Word64)1/1e13
#define DIRAC_MONO_MAX_THRESH_FX					(Word32)1e6
#define DIRAC_MONO_MIN_THRESH_FX					(Word32)1e2
#define DIRAC_MONO_NORM_FACTOR_M                    1220703104
#define DIRAC_MONO_NORM_FACTOR_E                    44

typedef enum
{
    DIRAC_OPEN,                                 /* initialize to default value              */
@@ -1304,6 +1313,7 @@ enum
#define MASA_RATIO_THRESHOLD                    0.1f
#define MASA_ANGLE_TOLERANCE                    0.5f
#ifdef IVAS_FLOAT_FIXED
#define MASA_RATIO_THRESHOLD_FX                    214748365 // 0.1 in Q31
#define MASA_RATIO_TOLERANCE_FX                 419430/*0.1 Q22*/
#define MASA_ANGLE_TOLERANCE_FX                 ONE_IN_Q21/*0.5f q22*/
#endif
+0 −17
Original line number Diff line number Diff line
@@ -714,17 +714,6 @@ ivas_error ivas_FB_mixer_open_fx(

                FOR( j = start_diff_band_non48k; j < num_bands; j++ )
                {
#if 1 // TODO: To be removed later
                    if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL )
                    {
                        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" );
                    }

                    if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL )
                    {
                        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" );
                    }
#endif
                    IF( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] = (Word32 *) malloc( sizeof( Word32 ) * pActive_bins_per_band[j] ) ) == NULL )
                    {
                        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" );
@@ -757,12 +746,6 @@ ivas_error ivas_FB_mixer_open_fx(
        {
            return error;
        }
#if 1 // TODO: To be removed later
        if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif
    }

    *hFbMixer_out = hFbMixer;
+6 −4
Original line number Diff line number Diff line
@@ -3773,7 +3773,7 @@ void stereo_cng_compute_PScorr(

void stereo_cng_dec_update(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                    Q0*/
);

void stereo_cna_update_params(
@@ -3784,9 +3784,9 @@ void stereo_cna_update_params(
);
void stereo_cna_update_params_fx(
  CPE_DEC_HANDLE hCPE,         /* i/o: CPE decoder structure       */
  Word32 *output_fx[CPE_CHANNELS], /* i  : Output signal               */
  const Word16 output_frame,  /* i  : Output frame length         */
  const Word16 tdm_ratio_idx  /* i  : TDM ratio index             */
  Word32 *output_fx[CPE_CHANNELS], /* i  : Output signal               OUTPUT_Q*/
  const Word16 output_frame,  /* i  : Output frame length					 Q0*/
  const Word16 tdm_ratio_idx  /* i  : TDM ratio index						 Q0*/
);
void dtx_enc_init(
    Encoder_State *st,                                          /* i  : Encoder state handle                    */
@@ -6875,6 +6875,7 @@ void ivas_spar_arith_coeffs_com_init(
  const Word16 table_idx,
  const Word16 enc_dec);

#ifndef IVAS_FLOAT_FIXED
int16_t ivas_arith_encode_cmplx_cell_array(
    ivas_arith_t *pArith_re,
    ivas_arith_t *pArith_re_diff,
@@ -6887,6 +6888,7 @@ int16_t ivas_arith_encode_cmplx_cell_array(
    const int16_t any_diff ,
    const int16_t wc_strat_arith
);
#endif

ivas_error ivas_huffman_decode(
    ivas_huffman_cfg_t *huff_cfg,
+29 −0
Original line number Diff line number Diff line
@@ -3288,6 +3288,23 @@ void computeReferencePower_enc_fx(
    Word16 ref_power_w,                               /* i  : use 0 if hodirac is enabled     */
    const Word16 nchan_ana                            /* i  : number of analysis channels     */
);

void computeReferencePower_enc_fx_dirac(
    const Word16 *band_grouping,                      /* i  : Band grouping for estimation    */
    Word32 Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i  : Real part of input signal       */
    Word32 Cldfb_ImagBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i  : Imag part of input signal       */
    Word16 e_Cldfb,                                   /* i  : exponent of Cldfb buffer		  */
    Word32 *reference_power,                          /* o  : Estimated power                 */
    Word16 *e_reference,                              /* o  : exponent of reference_power	  */
    const Word16 enc_param_start_band,                /* i  : first band to process           */
    const Word16 num_freq_bands,                      /* i  : Number of frequency bands       */
    const IVAS_FORMAT ivas_format,                    /* i  : ivas_format                     */
    Word16 ref_power_w,                               /* i  : use 0 if hodirac is enabled     */
    const Word16 nchan_ana,                           /* i  : number of analysis channels     */
    Word16 *mono_frame_count,                         /* i/o: Mono Frame Count                */
    Word16 *dirac_mono_flag                           /* i/o: Mono Flag                       */
);

void ivas_omasa_enc_fx(
    OMASA_ENC_HANDLE hOMasa,          /* i/o: OMASA encoder handle                        */
    MASA_ENCODER_HANDLE hMasa,        /* i/o: MASA encoder handle                         */
@@ -3412,4 +3429,16 @@ ivas_error ivas_param_mc_enc_open_fx(
ivas_error ivas_param_mc_enc_reconfig_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle                                 */
);

Word16 ivas_arith_encode_cmplx_cell_array(
    ivas_arith_t *pArith_re,
    ivas_arith_t *pArith_re_diff,
    const Word16 *pDo_diff,
    const Word16 nB,
    Word16 *pSymbol_re,
    Word16 *pSymbol_old_re,
    ivas_cell_dim_t *pCell_dims,
    BSTR_ENC_HANDLE hMetaData,
    const Word16 any_diff,
    const Word16 wc_strat_arith );
#endif
+1 −1
Original line number Diff line number Diff line
@@ -1551,7 +1551,7 @@ void ivas_create_fullr_dmx_mat_fx(
        {
            FOR( b = start_band; b < end_band; b++ )
            {
                tmp_p1_re[j][j][b] = L_shl( 1, q_dm_fv_re );
                tmp_p1_re[j][j][b] = L_shl_sat( 1, q_dm_fv_re );
                move32();
                max_val = L_max( max_val, L_abs( tmp_p1_re[j][j][b] ) );
            }
Loading