Commit d8a06435 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'float_dependencies_cleanup_5' into 'main'

Param MC updates and float code cleanup

See merge request !274
parents fe0d451c b60dac8d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1447,6 +1447,11 @@ typedef enum
    PARAM_MC_SYNTH_MONO_STEREO                  /* synthesis to mono or stereo */
} PARAM_MC_SYNTHESIS_CONF;

#ifdef IVAS_FLOAT_FIXED
#define PARAM_MC_REG_SX_FX                         (429496729)                      /* Regularization factor for mixing matrix calculation */
#define PARAM_MC_REG_GHAT_FX                       (2147483)                    /* Regularization factor for mixing matrix calculation */
#endif

#define PARAM_MC_REG_SX                         (0.2f)                      /* Regularization factor for mixing matrix calculation */
#define PARAM_MC_REG_GHAT                       (0.001f)                    /* Regularization factor for mixing matrix calculation */
#define PARAM_MC_MAX_PARAMETER_BANDS            20                          /* Maximum number of parameter bands */
+24 −1
Original line number Diff line number Diff line
@@ -739,6 +739,29 @@ ivas_error ivas_ism_config_fx(
void ivas_ism_reset_metadata(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
    hIsmMeta->azimuth_fx = 0;
    move32();
    hIsmMeta->elevation_fx = 0;
    move32();
    hIsmMeta->yaw_fx = 0;
    move32();
    hIsmMeta->pitch_fx = 0;
    move32();
    hIsmMeta->radius_fx = 1 << 9;
    move16();

    hIsmMeta->ism_metadata_flag = 0;
    move16();
    hIsmMeta->non_diegetic_flag = 0;
    move16();

    return;
}

void ivas_ism_reset_metadata_enc(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
    hIsmMeta->azimuth_fx = 0;
    move32();
@@ -791,7 +814,7 @@ void ivas_ism_reset_metadata_API(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
    ivas_ism_reset_metadata( hIsmMeta );
    ivas_ism_reset_metadata_enc( hIsmMeta );

    return;
}
+77 −8
Original line number Diff line number Diff line
@@ -1095,7 +1095,11 @@ void bitbudget_to_brate(
void ivas_ism_reset_metadata(
    ISM_METADATA_HANDLE hIsmMeta                                /* i/o: ISM metadata handles                        */
);

#ifdef IVAS_FLOAT_FIXED //to be removed when converting encoder
void ivas_ism_reset_metadata_enc(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
);
#endif
void ivas_ism_reset_metadata_API(
    ISM_METADATA_HANDLE hIsmMeta                                /* i/o: ISM metadata handles                        */
);
@@ -1684,8 +1688,13 @@ int16_t res_bpf_adapt(
    const float *bpf_error_signal_8k,                           /* i  : BPF modification signal             */
    float res_buf[STEREO_DFT_N_8k]                              /* i  : residual buffer                     */
);
#endif // IVAS_FLOAT_FIXED

#else // IVAS_FLOAT_FIXED
Word16 res_bpf_adapt_ivas_fx(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */
    const Word32 *bpf_error_signal_8k,     /* i  : BPF modification signal   */
    Word32 res_buf[STEREO_DFT_N_8k]        /* i  : residual buffer Q12       */
);
#endif
void bpf_pitch_coherence(
    Decoder_State *st,                                          /* i/o: decoder state structure             */
    const float pitch_buf[]                                     /* i  : pitch for each subframe [0,1,2,3]   */
@@ -4640,6 +4649,12 @@ void ivas_param_mc_dec_digest_tc(
    float *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output*/
);

void ivas_param_mc_dec_digest_tc_fx(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder handle                                       */
    const uint8_t nCldfbSlots,    /* i  : number of CLFBS slots in the transport channels           */
    Word32 *transport_channels_f_fx[],
    Word16 transport_f_e );

void ivas_param_mc_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                 */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested                     */
@@ -4803,6 +4818,28 @@ int16_t computeMixingMatrices(
    float *Cr                                                   /* o  : residual covariance matrix                                                                                    */
);

#ifdef IVAS_FLOAT_FIXED
Word16 computeMixingMatrices_fx(
    const Word16 num_inputs,               /* i  : number of input channels                                                                                      */
    const Word16 num_outputs,              /* i  : number of output channels                                                                                     */
    const Word32 *Cx,                        /* i  : input channel covariance matrix                                                                               */
    Word16 Cx_e,
    const Word32 *Cy,                        /* i  : target covariance matrix                                                                                      */
    Word16 Cy_e,
    const Word32 *Q,                         /* i  : prototype matrix (usually a upmix matrix)                                                                     */
    Word16 Q_fx_e,
    const Word16 energy_compensation_flag, /* i  : flag indicating that the energy compensation should be performed (i.e. no residual mixing matrix will follow) */
    const Word32 reg_Sx_fx,                     /* i  : regularization factor for the input channel singular values                                                   */
    Word16 reg_Sx_e,
    const Word32 reg_ghat_fx,                   /* i  : regularization factor for the normalization matrix                                                            */
    Word16 reg_ghat_e,
    Word32 *mixing_matrix_fx,                   /* o  : resulting mixing matrix                                                                                       */
    Word16 *mixing_matrix_out_e,
    Word32 *Cr_fx,                               /* o  : residual covariance matrix                                                                                    */
    Word16 *Cr_e
);
#endif

int16_t computeMixingMatricesResidual(
    const int16_t num_outputs,                                  /* i  : number of output channels                                           */
    const float *Cx,                                            /* i  : vector containing the diagonal diffuse prototype covariance         */
@@ -4812,6 +4849,22 @@ int16_t computeMixingMatricesResidual(
    float *mixing_matrix                                        /* o  : resulting residual mixing matrix                                    */
);

#ifdef IVAS_FLOAT_FIXED
Word16 computeMixingMatricesResidual_fx(
    const Word32 num_outputs, /* i  : number of output channels                                           */
    const Word32 *Cx_fx,           /* i  : vector containing the diagonal diffuse prototype covariance         */
    const Word16 Cx_e,
    const Word32 *Cy_fx,           /* i  : matrix containing the missing cov (Cr from computeMixingMatrices()) */
    const Word16 Cy_fx_e,
    const Word32 reg_Sx_fx,        /* i  : regularization factor for the input channel singular values         */
    const Word16 reg_Sx_e,
    const Word32 reg_ghat_fx,      /* i  : regularization factor for the normalization matrix                  */
    const Word16 reg_ghat_e,
    Word32 *mixing_matrix_fx,       /* o  : resulting residual mixing matrix                                    */
    Word16 *mixing_matrix_ret_e
);
#endif

/*! r: error or success */
int16_t svd(
    float InputMatrix[][MAX_OUTPUT_CHANNELS],                   /* i  : matrix to be decomposed (M)                      */
@@ -6469,7 +6522,7 @@ void ivas_ism2sba_sf_fx(
    const Word16 offset,                 /* i  : offset for the interpolatr      */
    const Word16 sba_order               /* i  : Ambisonic (SBA) order           */
);
#endif // IVAS_FLOAT_FIXED
#else // IVAS_FLOAT_FIXED
void ivas_ism2sba_sf(
    float *buffer_in[],                                         /* i  : TC buffer                                       */
    float *buffer_out[],                                        /* o  : TD signal buffers                               */
@@ -6479,7 +6532,7 @@ void ivas_ism2sba_sf(
    const int16_t offset,                                       /* i  : offset for the interpolatr                      */
    const int16_t sba_order                                     /* i  : Ambisonic (SBA) order                           */
);

#endif

/*----------------------------------------------------------------------------------*
 * Amplitude Panning VBAP prototypes
@@ -6893,14 +6946,30 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
    float *output_f[]                                           /* o  : rendered time signal                    */
);


#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_osba_ism_metadata_dec_fx(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure            */
    const Word32 ism_total_brate, /* i  : ISM total bitrate                 */
    Word16 *nchan_ism,            /* o  : number of ISM separated channels  */
    Word16 nb_bits_metadata[]     /* o  : number of ISM metadata bits       */
);
#else
ivas_error ivas_osba_ism_metadata_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int32_t ism_total_brate,                              /* i  : ISM total bitrate                       */
    int16_t *nchan_ism,                                         /* o  : number of ISM separated channels        */
    int16_t nb_bits_metadata[]                                  /* o  : number of ISM metadata bits             */
);

#endif
#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_osba_render_sf_fx(
    Decoder_Struct *st_ivas,        /* i/o: IVAS decoder handle                       */
    const UWord16 nSamplesAsked,    /* i  : number of CLDFB slots requested           */
    UWord16 *nSamplesRendered,      /* o  : number of CLDFB slots rendered            */
    UWord16 *nSamplesAvailableNext, /* o  : number of CLDFB slots still to render     */
    Word32 *p_output[]              /* o  : rendered time signal                      */
);
#else
ivas_error ivas_osba_render_sf(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                     */
    const uint16_t nSamplesAsked,                               /* i  : number of CLDFB slots requested         */
@@ -6908,7 +6977,7 @@ ivas_error ivas_osba_render_sf(
    uint16_t *nSamplesAvailableNext,                            /* o  : number of CLDFB slots still to render   */
    float *output_f[]                                           /* o  : rendered time signal                    */
);

#endif
void ivas_osba_data_close(
    SBA_ISM_DATA_HANDLE *hSbaIsmData                            /* i/o: OSBA rendering handle                   */
);
+5 −5
Original line number Diff line number Diff line
@@ -59,11 +59,6 @@ typedef struct
    int16_t ism_metadata_flag;            /* flag whether metadata are coded in particular frame of particular object */
    int16_t last_ism_metadata_flag;       /* last frame ism_metadata_flag */

    float azimuth;                        /* azimuth value read from the input metadata file */
    float elevation;                      /* elevation value read from the input metadata file */
    float radius;                         /* radius value read from the input metadata file */
    float yaw;                            /* yaw value read from the input metadata file */
    float pitch;                          /* pitch value read from the input metadata file */
#ifdef IVAS_FLOAT_FIXED
    Word32 azimuth_fx;                        /* azimuth value read from the input metadata file */ // q = 22
    Word32 elevation_fx;                      /* elevation value read from the input metadata file */ // q = 22
@@ -71,6 +66,11 @@ typedef struct
    Word32 yaw_fx;                            /* yaw value read from the input metadata file */ // q = 22
    Word32 pitch_fx;                          /* pitch value read from the input metadata file */ // q = 22
#endif
    float azimuth;                        /* azimuth value read from the input metadata file */
    float elevation;                      /* elevation value read from the input metadata file */
    float radius;                         /* radius value read from the input metadata file */
    float yaw;                            /* yaw value read from the input metadata file */
    float pitch;                          /* pitch value read from the input metadata file */

    int16_t non_diegetic_flag;            /* Non-diegetic (non-headtracked) object flag */

+7 −7
Original line number Diff line number Diff line
@@ -4720,7 +4720,7 @@ void updt_dec_common(
    const float *synth                  /* i  : decoded synthesis           */
);
void td_cng_dec_init_flt(
void td_cng_dec_init(
    DEC_CORE_HANDLE st /* i/o: decoder state structure     */
);
@@ -6866,7 +6866,7 @@ void D_ACELP_indexing_ivas(
    int16_t prm[],
    int16_t *BER_detect );
void D_ACELP_decode_43bit_flt(
void D_ACELP_decode_43bit(
    uint16_t idxs[],
    float code[],
    int16_t *pulsestrack );
@@ -8155,7 +8155,7 @@ void coder_acelp_rf(
    float *syn_rf                /* i/o: pointer to RF synthesis     */
);
void decoder_acelp_flt(
void decoder_acelp(
    Decoder_State *st,              /* i/o:  coder memory state         */
    int16_t prm[],                  /* i  : parameters                  */
    const float A[],                /* i  : coefficients NxAz[M+1]      */
@@ -9575,7 +9575,7 @@ void longshiftleft(
    const int16_t len   /* i  : length of vector a[] and d[]          */
);
void open_decoder_LPD_flt(
void open_decoder_LPD(
    Decoder_State *st,               /* i/o: decoder state structure                */
    const int32_t total_brate,       /* i  : total bitrate                          */
    const int32_t last_total_brate,  /* i  : last total bitrate                     */
@@ -9615,7 +9615,7 @@ void reconfig_decoder_LPD_ivas(
    const int16_t L_frame_old  /* i  : frame length             */
);
void mode_switch_decoder_LPD_flt(
void mode_switch_decoder_LPD(
    Decoder_State *st,              /* i/o: decoder state structure             */
    const int16_t bwidth,           /* i  : audio bandwidth                     */
    const int32_t total_brate,      /* i  : total bitrate                       */
@@ -9625,7 +9625,7 @@ void mode_switch_decoder_LPD_flt(
    const int16_t last_element_mode /* i  : last element mode                   */
);
void dec_acelp_tcx_frame_flt(
void dec_acelp_tcx_frame(
    Decoder_State *st,               /* i/o: decoder state structure             */
    int16_t *concealWholeFrame,      /* i/o: concealment flag                    */
    float *output,                   /* o  : synthesis                           */
@@ -9637,7 +9637,7 @@ void dec_acelp_tcx_frame_flt(
    STEREO_CNG_DEC_HANDLE hStereoCng /* i  : stereo CNG handle                   */
);
void decoder_LPD_flt(
void decoder_LPD(
    Decoder_State *st,     /* i/o: decoder memory state pointer        */
    float signal_out[],    /* o  : signal with LPD delay (7 subfrs)    */
    float signal_outFB[],  /* o  : synthesis @output_FS                */
Loading