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

Integration of fixed point sub-functions - 6

[x] OMASA decoder config updates
[x] Removed intermediate conversions in ivas_mct_core_dec
[x] FTF changes for dirac_dec_decorr function
[x] ivas_jbm_dec_copy_tc_no_tsm and ivas_ism_param_dec_tc_gain_ajust
converted to fixed point
[x] AGC encoder module conversion
parent 0136fc46
Loading
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -156,11 +156,20 @@
#define MIN16B                          ( -32768 )
#define MAX16B_FLT                      32767.0f
#define MIN16B_FLT                      ( -32768.0f )
#ifdef IVAS_FLOAT_FIXED
#define MIN16B_FLT_FX                    -32768 //Q0
#define MIN16B_FLT_FX_IN_Q11             -67108864//Q11
#define MIN16B_FLT_FX_IN_Q15             -1073741824//Q15
#endif
#define PCM16_TO_FLT_FAC                32768.0f
#ifdef IVAS_FLOAT_FIXED
#define PCM16_TO_FLT_FAC_FX                32768
#define PCM16_TO_FLT_FAC_FX                32768 //Q0
#endif // IVAS_FLOAT_FIXED
#define MDFT_NORM_SCALING               ( 1.0f / PCM16_TO_FLT_FAC )
#ifdef IVAS_FLOAT_FIXED
#define MDFT_NORM_SCALING_FX            65536 //Q31 
#define LOG2_MDFT_NORM_SCALING_FX       -503316448 //Q25
#endif
#define MAX_FRAME_COUNTER               200
#define MAX_BITS_PER_FRAME              10240           /* Bits per frame for max. bitrate 512kbps, == IVAS_MAX_BITS_PER_FRAME */

@@ -734,6 +743,9 @@ enum
#define L_HP20_MEM                          4                      /* HP20 filter memory length */

#define CLDFB_NO_CHANNELS_MAX               60                     /* CLDFB resampling - max number of CLDFB channels, == IVAS_CLDFB_NO_CHANNELS_MAX */
#ifdef IVAS_FLOAT_FIXED
#define CLDFB_NO_CHANNELS_MAX_FX            30720                  /*Q9*/ 
#endif
#define CLDFB_NO_COL_MAX                    16                     /* CLDFB resampling - max number of CLDFB col., == IVAS_CLDFB_NO_COL_MAX */
#define CLDFB_NO_COL_MAX_SWITCH             6                      /* CLDFB resampling - max number of CLDFB col. for switching */
#define CLDFB_NO_COL_MAX_SWITCH_BFI         10                     /* CLDFB resampling - max number of CLDFB col. for switching, BFI */
+3 −1
Original line number Diff line number Diff line
@@ -248,7 +248,9 @@ typedef struct _IVAS_RENDER_CONFIG
{
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics;
    float directivity[IVAS_MAX_NUM_OBJECTS * 3];

#ifdef IVAS_FLOAT_FIXED
    Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3];    // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15}
#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

#endif /* COMMON_API_TYPES_H */
+53 −4
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "ivas_prot_fx.h"
#include "prot_fx1.h"

#define IVAS_FLOAT_FIXED_TO_BE_REMOVED

/*-----------------------------------------------------------------------*
 * Local constants
@@ -734,30 +735,51 @@ ivas_error ivas_ism_config_fx(
 * Reset ISM metadata parameters
 *-------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void ivas_ism_reset_metadata(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
#ifdef IVAS_FLOAT_FIXED
    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;
#endif
    // To be removed later /////////////////////
    move16();
#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED
    hIsmMeta->azimuth = 0.0f;
    hIsmMeta->elevation = 0.0f;
    hIsmMeta->yaw = 0.0f;
    hIsmMeta->pitch = 0.0f;
    hIsmMeta->radius = 1.0f;
    ////////////////////////////////////////////
#endif
    hIsmMeta->ism_metadata_flag = 0;
    move16();
    hIsmMeta->non_diegetic_flag = 0;
    move16();

    return;
}
#else
void ivas_ism_reset_metadata(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
    hIsmMeta->azimuth = 0.0f;
    hIsmMeta->elevation = 0.0f;
    hIsmMeta->yaw = 0.0f;
    hIsmMeta->pitch = 0.0f;
    hIsmMeta->radius = 1.0f;
    hIsmMeta->ism_metadata_flag = 0;
    hIsmMeta->non_diegetic_flag = 0;

    return;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_ism_reset_metadata_API()
@@ -1006,6 +1028,32 @@ ISM_MODE ivas_ism_mode_select(
 * Deallocate ISM metadata handles
 * ---------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void ivas_ism_metadata_close(
    ISM_METADATA_HANDLE hIsmMetaData[], /* i/o: object metadata handles             */
    const Word16 first_idx              /* i  : index of first handle to deallocate */
)
{
    Word16 n;

    test();
    IF( hIsmMetaData == NULL || *hIsmMetaData == NULL )
    {
        return;
    }

    FOR( n = first_idx; n < MAX_NUM_OBJECTS; n++ )
    {
        IF( hIsmMetaData[n] != NULL )
        {
            free( hIsmMetaData[n] );
            hIsmMetaData[n] = NULL;
        }
    }

    return;
}
#else
void ivas_ism_metadata_close(
    ISM_METADATA_HANDLE hIsmMetaData[], /* i/o: object metadata handles             */
    const int16_t first_idx             /* i  : index of first handle to deallocate */
@@ -1029,6 +1077,7 @@ void ivas_ism_metadata_close(

    return;
}
#endif


/*-------------------------------------------------------------------*
+41 −2
Original line number Diff line number Diff line
@@ -3554,12 +3554,22 @@ void ivas_mdct_core_tns_ns(
    const int16_t MCT_flag                                      /* i  : hMCT handle allocated (1) or not (0)    */
);

#ifdef IVAS_FLOAT_FIXED
void ivas_mct_core_dec(
    MCT_DEC_HANDLE hMCT,                                         /* i/o: MCT decoder structure       */
    CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS],                         /* i/o: CPE decoder structure       */
    const Word16 nCPE,                                          /* i  : number of CPEs              */
    Word32 *signal_out_fx[],
    Word16 q_x[MCT_MAX_CHANNELS]
);
#else
void ivas_mct_core_dec(
    MCT_DEC_HANDLE hMCT,                                        /* i/o: MCT decoder structure                   */
    CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS],                        /* i/o: CPE decoder structure                   */
    const int16_t nCPE,                                         /* i  : number of CPEs                          */
    float *signal_out[]                                         /* o  : synthesis @internal_FS                  */
);
#endif

void ivas_mct_dec_mct(
    MCT_DEC_HANDLE hMCT,                                        /* i/o: MCT decoder structure                   */
@@ -4819,16 +4829,46 @@ int16_t ivas_agc_enc_get_flag(
    const int16_t nchan_transport                               /* i  : number of transport channels            */
);

#ifdef IVAS_FLOAT_FIXED
Word16 ivas_agc_enc_get_flag_fx(
  const Word16 nchan_transport /* i  : number of transport channels            */
);
#endif

ivas_error ivas_spar_agc_enc_open( 
    ivas_agc_enc_state_t **hAgcEnc,                             /* i/o: AGC decoder handle                      */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
    const int16_t nchan_inp                                     /* i  : number of input channels                */
);

#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_spar_agc_enc_open_fx(
  ivas_agc_enc_state_t **hAgcEnc,                               /* i/o: SPAR AGC encoder handle     */
  const Word32 input_Fs,                                        /* i  : input sampling rate         */
  const Word16 nchan_inp                                        /* i  : number of input channels    */
);
#endif

void ivas_spar_agc_enc_close( 
    ivas_agc_enc_state_t **hAgcEnc                              /* i/o: AGC encoder handle                      */
);

#ifdef IVAS_FLOAT_FIXED
void ivas_spar_agc_enc_close_fx(
  ivas_agc_enc_state_t **hAgcEnc /* i/o: SPAR AGC encoder handle      */
);

void ivas_agc_enc_process_fx(
  ivas_agc_enc_state_t *hAgcEnc,             /* i/o: AGC encoder handle       */
  BSTR_ENC_HANDLE hMetaData,                 /* i/o: MetaData handle          */
  Word32 **ppPcm_in,                         /* i  : input audio channels     */
  Word32 **ppPcm_out,                        /* o  : output audio channels    */
  const Word16 n_channels,                   /* i  : number of channels       */
  const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i  : configuration structure  */
  Word16 *q_ppPcm
);
#endif

void ivas_agc_enc_process( 
    ivas_agc_enc_state_t *hAgcEnc,                              /* i/o: AGC encoder handle                      */
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: MetaData handle                         */
@@ -6642,8 +6682,7 @@ void ivas_omasa_modify_masa_energy_ratios(
ivas_error ivas_td_binaural_open_fx(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure  */
    Word16 * SrcInd,         /*Temporarily used to store the updated value of SrcInd*/
    Word16 *num_src,
    Word16 *directivity_fx
    Word16 *num_src
);
#endif // IVAS_FLOAT_FIXED

+22 −0
Original line number Diff line number Diff line
@@ -147,6 +147,14 @@ ivas_error ivas_omasa_ism_metadata_dec_fx(
    const Word16 dirac_bs_md_write_idx, /* i  : DirAC bitstream write index       */
    Word16 nb_bits_metadata[]           /* o  : number of ISM metadata bits       */
);
ivas_error ivas_omasa_dec_config_fx(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure                                  */
    UWord16 *nSamplesRendered, /* o  : number of samples flushed from the previous frame (JBM) */
    Word16 Q_cldfbSynDec,      /* i  : Q factor for cldfb state                                */
    Word16 *num_src,
    Word16 SrcInd[MAX_NUM_TDREND_CHANNELS],
    Word16 *data               /* o  : output synthesis signal                                 */
);
#endif

void ivas_omasa_modify_masa_energy_ratios_fx(
@@ -564,6 +572,20 @@ void ivas_jbm_dec_get_adapted_subframes_fx(
    Word16 *nb_subframes                                       /* i/o: number of subframes in the frame                            */
);

void ivas_jbm_dec_copy_tc_no_tsm_fx(
  Decoder_Struct *st_ivas,  /* i/o: IVAS decoder handle        Q0  */
  Word32 *tc_fx[],          /* i  : transport channels         Q11 */
  const Word16 output_frame /* i  : output frame size          Q0  */
);

void ivas_ism_param_dec_tc_gain_ajust_fx(
  Decoder_Struct *st_ivas,        /* i/o: IVAS decoder handle                                         */
  const UWord16 nSamples,         /* i  : number of samples to be compensate                          */
  const UWord16 nFadeLength,      /* i  : length of the crossfade in samples                          */
  Word32 *transport_channels_f[], /* i  : synthesized core-coder transport channels/DirAC output  Q_tc*/
  Word16 *Q_tc                    /* i/o : Q of input tc buffer                                       */
);

#ifdef IVAS_FLOAT_FIXED
/*! r: number of bits read */
Word16 read_GR0(
Loading