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

Floating point code build fix

[x] With IVAS_FLOAT_FIXED macro commented, build break fixed
parent 920b1add
Loading
Loading
Loading
Loading
Loading
+68 −3
Original line number Diff line number Diff line
@@ -477,6 +477,73 @@ uint8_t apa_reconfigure(
#endif

/* Sets the audio configuration. */
#ifndef IVAS_FLOAT_FIXED
bool apa_set_rate(
    apa_state_t *ps,
    const int32_t output_Fs )
{
    /* make sure pointer is valid */
    if ( ps == NULL )
    {
        return 1;
    }

    /* check range */
    if ( ( output_Fs < APA_MIN_RATE ) || ( output_Fs > APA_MAX_RATE ) )
    {
        return 1;
    }

    /* reset state struct */
    apa_reset( ps );

    /* copy rate to state struct */
    ps->rate = (uint16_t) output_Fs;

    if ( ps->num_channels > APA_MAX_NUM_CHANNELS )
    {
        return 1;
    }

    /*
     * several other parameters depend on the sampling rate
     * and are set below. Some "magic numbers" are used here
     * which are based on typical values of a "pitch" in
     * human voice. The pitch length is the period of the
     * base frequency and is usually assumed to be 40-240
     * samples at 16 kHz.
     */

    /* set segment size */
    /* in the order of a pitch, set to 160 samples at 16 kHz */
    /* used for windowing and as the correlation length, i.e., */
    /* the size of the template segment. */
    ps->l_seg = ( ps->rate / 100 ) * ps->num_channels;

    /* init Hann window */
    /* Note: l_win < APA_BUF_PER_CHANNEL is required */
    /* Length of Hann window should be independent of
     * number of channels - same window applied to all channels */
    ps->l_halfwin = ps->rate / 100;
    hannWindow( ps->l_halfwin * 2, ps->win );

    /* set frame size */
    /* set to 320 samples at 16 kHz */
    ps->l_frm = ( ps->rate / FRAMES_PER_SEC ) * ps->num_channels;

    /* set minimum pitch */
    /* set to 40 samples at 16 kHz */
    /* (defines min change in number of samples, i.e., abs(l_in-l_out) >= p_min) */
    ps->p_min = ( ps->rate / 400 ) * ps->num_channels;

    /* set search length */
    /* must cover one pitch, set to 200 samples at 16 kHz */
    /* (the resulting maximum pitch is then p_min+l_search = 240 samples at 16 kHz) */
    ps->l_search = ( ps->rate / 80 ) * ps->num_channels;

    return 0;
}
#else
bool apa_set_rate(
    apa_state_t *ps,
    const Word32 output_Fs )
@@ -548,7 +615,6 @@ bool apa_set_rate(
    ps->l_search = (UWord16) imult3216( Mult_32_16( ps->rate, INV_80_Q15 ), ps->num_channels );
    move16();

#ifdef IVAS_FLOAT_FIXED
    ps->win_fx = pcmdsp_window_hann_640;
    move16();
    ps->l_halfwin = 320;
@@ -591,10 +657,9 @@ bool apa_set_rate(
     * but for simplicity can be taken as l_seg / 4 */
    ps->signalScaleForCorrelation = getSignalScaleForCorrelation( ps->rate );
    move16();
#endif
    return 0;
}

#endif

/* Set scaling. */
#ifdef IVAS_FLOAT_FIXED
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include "ivas_prot.h"
//#include "ivas_rom_com.h"
#endif
#ifdef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
 * Local functions
 *-------------------------------------------------------------------*/
@@ -985,3 +986,4 @@ void lsf_mid_dec_fx(

    return;
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -1270,7 +1270,7 @@ ivas_error ivas_ism_metadata_enc(
        *ism_total_brate = 0;
        for ( ch = 0; ch < nchan_ism; ch++ )
        {
            *ism_total_brate = L_add( *ism_total_brate, ivas_interformat_brate_fx( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ) );
            *ism_total_brate = L_add( *ism_total_brate, ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ) );
            move32();

            if ( ism_imp[ch] > 1 && flag_omasa_ener_brate == 1 && brate_limit_flag >= 0 )
+55 −1
Original line number Diff line number Diff line
@@ -13078,7 +13078,7 @@ ivas_error IVAS_REND_GetSamples(
 *
 *
 *-------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
void IVAS_REND_Close(
    IVAS_REND_HANDLE *phIvasRend /* i/o: Pointer to renderer handle */
)
@@ -13132,7 +13132,61 @@ void IVAS_REND_Close(

    return;
}
#else
void IVAS_REND_Close(
    IVAS_REND_HANDLE *phIvasRend /* i/o: Pointer to renderer handle */
)
{
    uint16_t i;
    IVAS_REND_HANDLE hIvasRend;

    /* Validate function arguments */
    if ( phIvasRend == NULL || *phIvasRend == NULL )
    {
        return;
    }
    hIvasRend = *phIvasRend;

    if ( hIvasRend->efapOutWrapper.hEfap != NULL )
    {
        efap_free_data( &hIvasRend->efapOutWrapper.hEfap );
    }

    /* clear inputs */
    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
        clearInputIsm( &hIvasRend->inputsIsm[i] );
    }
    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
        clearInputMc( &hIvasRend->inputsMc[i] );
    }
    for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
    {
        clearInputSba( &hIvasRend->inputsSba[i] );
    }
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        clearInputMasa( &hIvasRend->inputsMasa[i] );
    }

    /* clear Config. Renderer */
    ivas_render_config_close( &( hIvasRend->hRendererConfig ) );

    ivas_limiter_close( &hIvasRend->hLimiter );


    closeHeadRotation( hIvasRend );

    ivas_external_orientation_close( &hIvasRend->hExternalOrientationData );
    ivas_combined_orientation_close( &hIvasRend->hCombinedOrientationData );

    free( hIvasRend );
    *phIvasRend = NULL;

    return;
}
#endif

#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_masa_ext_rend_dirac_rend_init(