Commit 3c61d3ea authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Conversion and integration of MC-Param, SBA and MASA encoder paths

[x] init functions for mc_param (open, close ,reconfig)
[x] bw_detect_fx, ivas_get_spar_md_from_dirac_fx, pca_enc functions, requantize_direction_EC_3()
[x] Conversion changes related to masa metadata direction alignment, detect framing async
[x] Q info addition
parent b7185db9
Loading
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1168,6 +1168,14 @@ enum
#define IVAS_PCA_THRES_MIN_DOT2                 0.0f
#define IVAS_PCA_THRES_DIST_ALT                 6.0f

#ifdef IVAS_FLOAT_FIXED
#define IVAS_PCA_QUAT_EPS_FX                    215 // Q31
#define IVAS_PCA_THRES_MIN_DOT_FX               1717986918 // 0.8 in Q31
#define IVAS_PCA_THRES_MIN_DOT2_FX              0
#define IVAS_PCA_THRES_DIST_ALT_FX              1610612736 // 6 in Q28
#endif


typedef enum
{
    PCA_MODE_ACTIVE = 0,
@@ -1289,11 +1297,16 @@ enum
#define MASA_COHERENCE_TOLERANCE                0.1f
#define MASA_COHERENCE_THRESHOLD                0.1f
#ifdef IVAS_FLOAT_FIXED
#define MASA_COHERENCE_TOLERANCE_FX            419430/*0.1 Q22*/
#define MASA_COHERENCE_THRESHOLD_FX             214748365 // 0.1 in Q31
#endif
#define MASA_RATIO_TOLERANCE                    0.1f
#define MASA_RATIO_THRESHOLD                    0.1f
#define MASA_ANGLE_TOLERANCE                    0.5f
#ifdef IVAS_FLOAT_FIXED
#define MASA_RATIO_TOLERANCE_FX                 419430/*0.1 Q22*/
#define MASA_ANGLE_TOLERANCE_FX                 ONE_IN_Q21/*0.5f q22*/
#endif
#define MASA_LIMIT_NO_BANDS_SUR_COH             8
#define MINIMUM_BIT_BUDGET_NORMAL_META          100
#define DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC     4
+1058 −31

File changed.

Preview size limit exceeded, changes collapsed.

+83 −21
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ void destroy_cpe_enc(
void ivas_mct_enc_close(
    MCT_ENC_HANDLE *hMCT                                        /* i/o: MCT encoder structure                   */
);
#ifndef IVAS_FLOAT_FIXED

ivas_error ivas_corecoder_enc_reconfig(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const int16_t nSCE_old,                                     /* i  : number of SCEs in previous frame        */
@@ -169,7 +169,7 @@ ivas_error ivas_corecoder_enc_reconfig(
    const int32_t brate_CPE,                                    /* i  : bitrate to be set for the CPEs          */
    const MC_MODE last_mc_mode                                  /* i  : switching between MC modes: last mode   */
);
#endif

ivas_error ivas_sce_enc(
    Encoder_Struct *st_ivas,                                    /* i/o: IVAS encoder structure                  */
    const int16_t sce_id,                                       /* i  : SCE # identifier                        */
@@ -811,7 +811,6 @@ void ivas_smc_mode_selection(
);

/*! r: S/M decision (0=speech or noise,1=unclear,2=music) */
#ifndef IVAS_FLOAT_FIXED
int16_t ivas_acelp_tcx20_switching(
    Encoder_State *st,                                          /* i/o: encoder state structure                 */
    const float *inp,                                           /* i  : new input signal                        */
@@ -825,7 +824,6 @@ int16_t ivas_acelp_tcx20_switching(
    float *res_cod_SNR_M,
    const int16_t flag_16k_smc                                  /* i  : flag to indicate if the OL SMC is run at 16 kHz */
);
#endif

#ifndef IVAS_FLOAT_FIXED
void ivas_decision_matrix_enc(
@@ -6291,18 +6289,19 @@ void ivas_calc_c_p_coeffs(
);
#ifdef IVAS_FLOAT_FIXED
void ivas_get_spar_md_from_dirac_fx(
    Word32 azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES],
	Word32 ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES],
	Word32 diffuseness[IVAS_MAX_NUM_BANDS],
    Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES],   // Q22
    Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES],   // Q22
    Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS],  // Q30
    const Word16 n_ts,
    Word32 ***mixer_mat,
    Word32 ***mixer_mat_fx,
    Word16 *q_mixer_mat_fx,
    ivas_spar_md_t *hSpar_md,
    ivas_spar_md_com_cfg *hSpar_md_cfg,
    const Word16 start_band,
    const Word16 end_band,
    const Word16 order,
    const Word16 dtx_vad,
    Word32 Wscale_d[IVAS_MAX_NUM_BANDS],
    Word32 Wscale_d[IVAS_MAX_NUM_BANDS],    // Q29
    const UWord8 useLowerRes,
    const Word16 active_w_vlbr,
    const Word16 dyn_active_w_flag
@@ -6647,6 +6646,17 @@ void ivas_pca_enc(
    const int16_t n_channels                                    /* i  : number of channels                      */
);

#ifdef IVAS_FLOAT_FIXED
void ivas_pca_enc_fx(
    const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i  : configuration structure                 */
    PCA_ENC_STATE *hPCA,                        /* i  : PCA encoder structure                   */
    BSTR_ENC_HANDLE hMetaData,                  /* i/o: MetaData handle                         */
    Word32 *data_f[8],                           /* i  : input/transformed audio channels    Q11    */
    const Word16 input_frame, /* i  : input frame length                      */
    const Word16 n_channels   /* i  : number of channels                      */
);
#endif

void ivas_pca_read_bits( 
    Decoder_State *st0,                                         /* i/o: decoder state structure - for bitstream handling*/
    PCA_DEC_STATE *hPCA                                         /* i/o: PCA encoder structure                   */
@@ -6697,6 +6707,11 @@ void eye_matrix_fx(
  const Word16 n,
  const Word16 d
);

void eye_matrix_fx32(
    Word32 *mat, // Q
    const Word16 n,
    const Word32 d ); // Q
#endif
void cov_subfr( 
    float **ptr_sig, 
@@ -6705,6 +6720,14 @@ void cov_subfr(
    const int16_t len 
);

#ifdef IVAS_FLOAT_FIXED
void cov_subfr_fx(
    Word32 **ptr_sig_fx, // Q11
    Word64 *r_fx_64, // Q11
    const Word16 n_channels,
    const Word16 len );
#endif

void eig_qr( 
    const float *A, 
    const int16_t num_iter, 
@@ -6712,16 +6735,39 @@ void eig_qr(
    const int16_t n 
);

#ifdef IVAS_FLOAT_FIXED
void eig_qr_fx(
    const Word32 *A_fx, // A_q
    Word16 A_q,
    const Word16 num_iter,
    Word32 *EV_fx, // Q31
    Word32 *Vals_fx, // A_q
    const Word16 n );
#endif

void exhst_4x4( 
    float *cost_mtx, 
    int16_t *path, 
    const int16_t maximize 
);

#ifdef IVAS_FLOAT_FIXED
void exhst_4x4_fx(
    Word16 *cost_mtx, // Q
    Word16 *path,
    const Word16 maximize );
#endif

float mat_det4( 
    const float *m 
);

#ifdef IVAS_FLOAT_FIXED
Word16 mat_det4_fx( 
    const Word16 *m // Q15
);
#endif

/* quaternion utilities */
void mat2dquat( 
    const float *a, 
@@ -6729,6 +6775,14 @@ void mat2dquat(
    float *qr 
);

#ifdef IVAS_FLOAT_FIXED
void mat2dquat_fx(
    const Word16 *a, // Q15
    Word16 *ql, // Q15
    Word16 *qr // Q15
);
#endif

void dquat2mat( 
    const float *ql, 
    const float *qr,
@@ -6751,6 +6805,7 @@ void pca_interp_preproc(
    float *ql_interp,
    float *qr_interp 
);

#ifdef IVAS_FLOAT_FIXED
void dquat2mat_fx(
  const Word16 *ql,
@@ -6777,6 +6832,13 @@ void pca_enc_s3(
    int32_t *index 
);

#ifdef IVAS_FLOAT_FIXED
void pca_enc_s3_fx( 
    Word16 *q, // Q15
    Word32 *index 
);
#endif

void pca_dec_s3( 
    const int32_t index, 
    float *q 
+20 −0
Original line number Diff line number Diff line
@@ -3350,6 +3350,13 @@ UWord16 quantize_direction_fx(
    const MC_LS_SETUP mc_format /* i  : channel format if in MC-mode      */
);

Word16 quantize_direction2D_fx(
    Word32 phi,                 /* i  : input azimuth value            Q22 */
    const Word16 no_cw,         /* i  : number of bits                  */
    Word32 *phi_q,              /* o  : quantized azimuth value        Q22 */
    UWord16 *index_phi,         /* o  : quantized azimuth index         */
    const MC_LS_SETUP mc_format /* i  : channel format if in MC-mode    */
);
void quantize_direction_frame_fx(
    IVAS_QDIRECTION *q_direction,                                                     /* i/o: quantized direction structure            */
    Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES],   /* o  : Q22                                      */
@@ -3392,4 +3399,17 @@ void ivas_merge_masa_transports_fx(
    Word32 *data_out_f_fx[],
    const Word16 input_frame,
    const Word16 num_transport_channels );

void ivas_param_mc_enc_close_fx(
    PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle                        */
    const Word32 input_Fs          /* i  : input sampling rate                                 */
);

ivas_error ivas_param_mc_enc_open_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle                                 */
);

ivas_error ivas_param_mc_enc_reconfig_fx(
    Encoder_Struct *st_ivas /* i/o: IVAS encoder handle                                 */
);
#endif
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "cnst.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "prot_fx.h"
#ifdef IVAS_FLOAT_FIXED
#include "prot_fx.h"
#include "ivas_rom_com_fx.h"
@@ -490,7 +491,7 @@ ELSE
}
}

*phi_hat = L_add( L_add( ( id_phi * delta_phi_fx ), dd_fx ), DEGREE_180_Q_22 );
*phi_hat = L_add_sat( L_add_sat( ( id_phi * delta_phi_fx ), dd_fx ), DEGREE_180_Q_22 );
move32();
id_phi = add( id_phi, shr( n, 1 ) );

Loading