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

Merge branch 'ivas_param_mc_Dec_render_and_flt_Cleanup' into 'main'

ivas_mc_param_dec_render conversion, float code clean up.

See merge request !277
parents c4fcb767 ba5bee0d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6440,7 +6440,7 @@ void ivas_binaural_add_LFE(
    float *input_f[],                                           /* i  : transport channels                                      */
    float *output_f[]                                           /* o  : synthesized core-coder transport channels/DirAC output  */
);
void ivas_binaural_add_LFE_fix(
void ivas_binaural_add_LFE_fx(
  Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure                                 */
  Word16 output_frame,    /* i  : length of input frame                                  */
  Word32 *input_fx[],        /* i  : transport channels                                     */
+56 −0
Original line number Diff line number Diff line
@@ -2058,4 +2058,60 @@ void td_bwe_dec_init_ivas_fx(
    TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle      */
    const Word32 output_Fs    /* i  : output sampling rate    */
);

void ivas_dirac_dec_render_sf_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport,                              /* i  : number of transport channels            */
    float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX],
    float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX]
);

void ivas_dirac_dec_render_fx(
    Decoder_Struct *st_ivas,        /* i/o: IVAS decoder handle                      */
    const Word16 nchan_transport,   /* i  : number of transport channels             */
    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    */
    float *output_f[]               /* o  : rendered time signal                     */
);

void ivas_dirac_dec_read_BS_fx(
    const int32_t ivas_total_brate,                             /* i  : IVAS total bitrate                      */
    Decoder_State *st,                                          /* i/o: decoder Core state structure            */
    DIRAC_DEC_HANDLE hDirAC,                                    /* i/o: decoder DirAC handle                    */
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom,       /* i/o: common spatial rendering data handle    */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: q metadata                              */
    int16_t *nb_bits,                                           /* o  : number of bits read                     */
    const int16_t last_bit_pos,                                 /* i  : last read bitstream position            */
    const int16_t hodirac_flag,                                 /* i  : flag to indicate HO-DirAC mode          */
    int16_t *dirac_to_spar_md_bands                             /* o  : DirAC->SPAR MD bands                    */
);

ivas_error ivas_dirac_dec_config_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                                       */
    const DIRAC_CONFIG_FLAG flag_configopen                     /* i/ : Flag determining if we open or reconfigure the DirAC decoder */
);

void ivas_dirac_dec_output_synthesis_cov_close_fx(
    DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params,  /* i  : handle for the covariance synthesis parameters                                                         */
    DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state /* i/o: handle for the covariance synthesis state                                                              */
);

ivas_error ivas_init_decoder_fx(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);

ivas_error ivas_ism_dec_config_fx(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure              */
    const ISM_MODE last_ism_mode, /* i/o: last ISM mode                       */
    UWord16 *nSamplesRendered,    /* o  : number of samples flushed when the renderer granularity changes */
    Word16 *data                  /* o  : output synthesis signal                 */
);

ivas_error ivas_ism_metadata_dec_create_fx(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure      */
    const Word16 n_ISms,       /* i  : number of objects           */
    Word32 element_brate_tmp[] /* o  : element bitrate per object  */
);
#endif
+9 −8
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@ static void ivas_binRenderer_filterModule(
    float out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : imag part of Binaural signals     */
    float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],                           /* i  : real part of LS signals           */
    float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],                           /* i  : imag part of LS signals           */
    const Word16 numTimeSlots,                                                                        /* i  : number of time slots to process   */
    const int16_t numTimeSlots,                                                                        /* i  : number of time slots to process   */
    BINAURAL_RENDERER_HANDLE hBinRenderer                                                             /* i/o: fastconv binaural renderer handle */
)
{
    Word16 bandIdx, k, chIdx, tapIdx;
    int16_t bandIdx, k, chIdx, tapIdx;
    float *filterStatesLeftRealPtr, *filterStatesLeftImagPtr;
    const float *filterTapsLeftRealPtr, *filterTapsLeftImagPtr, *filterTapsRightRealPtr, *filterTapsRightImagPtr;

@@ -121,12 +121,12 @@ static void ivas_binRenderer_filterModule(
}
#else
/*-------------------------------------------------------------------------
 * ivas_binRenderer_filterModule_fixed()
 * ivas_binRenderer_filterModule_fx()
 *
 *
 *-------------------------------------------------------------------------*/

static void ivas_binRenderer_filterModule_fixed(
static void ivas_binRenderer_filterModule_fx(
    Word64 out_Conv_CLDFB_real[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : real part of Binaural signals     */
    Word64 out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : imag part of Binaural signals     */
    Word32 CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],                           /* i  : real part of LS signals           */
@@ -227,11 +227,12 @@ static void ivas_binRenderer_filterModule_fixed(
 *
 * Open convolution module handle of fastconv binaural renderer
 *-------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (int16_t) ceil( 0.6f * hBinRenConvModule->numTaps )
#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (int16_t) ceil( 0.5f * hBinRenConvModule->numTaps )
#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (int16_t) ceil( 0.4f * hBinRenConvModule->numTaps )
#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (int16_t) ceil( 0.3f * hBinRenConvModule->numTaps )
#endif

static ivas_error ivas_binRenderer_convModuleOpen(
    BINAURAL_RENDERER_HANDLE hBinRenderer,
@@ -1868,7 +1869,7 @@ void ivas_binaural_add_LFE(
}

#else
void ivas_binaural_add_LFE_fix(
void ivas_binaural_add_LFE_fx(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure                                 */
    Word16 output_frame,     /* i  : length of input frame                                  */
    Word32 *input_fx[],      /* i  : transport channels                                     */
@@ -2063,7 +2064,7 @@ void ivas_binRenderer(
            set64_fx( Cldfb_ImagBuffer_Binaural_fx[i][j], 0, hBinRenderer->conv_band );
        }
    }
    ivas_binRenderer_filterModule_fixed( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, exp_real_final );
    ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, exp_real_final );
#endif

    /* Obtain the binaural dmx and compute the reverb */
@@ -2241,7 +2242,7 @@ void ivas_binRenderer_fx(
        ivas_sba2mc_cldfb_fixed(*(hBinRenderer->hInputSetup), RealBuffer_fx, ImagBuffer_fx,
            hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx);
    }
    ivas_binRenderer_filterModule_fixed(Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in);
    ivas_binRenderer_filterModule_fx(Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in);

    FOR(i = 0; i < BINAURAL_CHANNELS; i++)
    {
+0 −63
Original line number Diff line number Diff line
@@ -168,16 +168,6 @@ ivas_error ivas_cpe_dec(
    {
        if ( st_ivas->hQMetaData != NULL && ivas_total_brate > IVAS_SID_5k2 )
        {
#ifdef IVAS_FLOAT_FIXED
            if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
            {
                stereo_dft_config_fx( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, Mpy_32_32(1503238554 /* 0.7f in Q31 */, L_mult0(st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC) ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
            else
            {
                stereo_dft_config_fx( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, L_mult0(st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
#else
            if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
            {
                stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
@@ -186,21 +176,10 @@ ivas_error ivas_cpe_dec(
            {
                stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
#endif
        }
        else
        {
            /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */
#ifdef IVAS_FLOAT_FIXED
            if ( ivas_total_brate <= IVAS_SID_5k2 )
            {
                stereo_dft_config_fx( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
            else
            {
                stereo_dft_config_fx( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
#else
            if ( ivas_total_brate <= IVAS_SID_5k2 )
            {
                stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
@@ -209,7 +188,6 @@ ivas_error ivas_cpe_dec(
            {
                stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
            }
#endif
        }
    }

@@ -222,11 +200,7 @@ ivas_error ivas_cpe_dec(
        }
        else
        {
#ifdef IVAS_FLOAT_FIXED
            stereo_dft_config_fx( NULL, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
#else
            stereo_dft_config( NULL, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
#endif
        }
    }

@@ -241,9 +215,6 @@ ivas_error ivas_cpe_dec(
        {
            /* Update DFT Stereo memories */
            stereo_dft_dec_update( hCPE->hStereoDft, output_frame, 0 );
#ifdef IVAS_FLOAT_FIXED
            stereo_dft_dec_update_fx( hCPE->hStereoDft, output_frame, 0 );
#endif

            if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 )
            {
@@ -702,20 +673,6 @@ ivas_error create_cpe_dec(
            }
            set_zero( hCPE->input_mem_LB[i], STEREO_DFT32MS_OVL_16k );

#ifdef IVAS_FLOAT_FIXED
            IF( ( hCPE->input_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
            }
            set32_fx( hCPE->input_mem_fx[i], 0, NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) );

            IF( ( hCPE->input_mem_LB_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * STEREO_DFT32MS_OVL_16k ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
            }
            set32_fx( hCPE->input_mem_LB_fx[i], 0, STEREO_DFT32MS_OVL_16k );
#endif

            if ( i == 0 )
            {
                if ( ( hCPE->input_mem_BPF[0] = (float *) malloc( sizeof( float ) * STEREO_DFT32MS_OVL_16k ) ) == NULL )
@@ -723,13 +680,6 @@ ivas_error create_cpe_dec(
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
                }
                set_zero( hCPE->input_mem_BPF[0], STEREO_DFT32MS_OVL_16k );
#ifdef IVAS_FLOAT_FIXED
                if ( ( hCPE->input_mem_BPF_fx[0] = (Word32 *) malloc( sizeof( Word32 ) * STEREO_DFT32MS_OVL_16k ) ) == NULL )
                {
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) );
                }
                set32_fx( hCPE->input_mem_BPF_fx[0], 0, STEREO_DFT32MS_OVL_16k );
#endif

            }

@@ -886,9 +836,6 @@ ivas_error create_cpe_dec(

        hCPE->hStereoMdct->reverse_dmx = 0;
        hCPE->hStereoMdct->smooth_ratio = 1.f;
#ifdef IVAS_FLOAT_FIXED
        hCPE->hStereoMdct->smooth_ratio_fx = ONE_IN_Q26;
#endif
        set_s( hCPE->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB );
        set_s( hCPE->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB );
        hCPE->hStereoMdct->lastCoh = 1.f;
@@ -989,12 +936,6 @@ void destroy_cpe_dec(
            hCPE->input_mem[n] = NULL;
            free( hCPE->output_mem[n] );
            hCPE->output_mem[n] = NULL;
#ifdef IVAS_FLOAT_FIXED
            free( hCPE->input_mem_LB_fx[n] );
            hCPE->input_mem_LB_fx[n] = NULL;
            free( hCPE->input_mem_fx[n] );
            hCPE->input_mem_fx[n] = NULL;
#endif

            if ( hCPE->prev_synth_chs[n] != NULL )
            {
@@ -1004,10 +945,6 @@ void destroy_cpe_dec(
        }
        free( hCPE->input_mem_BPF[0] );
        hCPE->input_mem_BPF[0] = NULL;
#ifdef IVAS_FLOAT_FIXED
        free( hCPE->input_mem_BPF_fx[0] );
        hCPE->input_mem_BPF_fx[0] = NULL;
#endif

    }

+831 −7

File changed.

Preview size limit exceeded, changes collapsed.

Loading