Commit 0053b744 authored by emerit's avatar emerit
Browse files

align code with float

parent 0dd9ce61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2465,7 +2465,7 @@ ivas_error ivas_init_decoder_fx(
#ifdef FIX_POINT_HRTF_FILE_FORMAT_REVERB
#ifdef FIX_POINT_HRTF_FILE_OPTIM
        IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
                                                  st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ),
                                                  st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0 ) ),
                   IVAS_ERR_OK ) )
        {
            return error;
+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
            /* Open Crend Binaural renderer */
#ifdef FIX_POINT_HRTF_FILE_FORMAT_REVERB
#ifdef FIX_POINT_HRTF_FILE_OPTIM
            IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0 ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
#endif
+2 −2
Original line number Diff line number Diff line
@@ -1575,7 +1575,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
            {
#ifdef FIX_POINT_HRTF_FILE_FORMAT_REVERB
#ifdef FIX_POINT_HRTF_FILE_OPTIM
                IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0 ) ), IVAS_ERR_OK ) )
#else
                IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
#endif
+91 −39
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ ivas_error ivas_hrtf_init(
 * Open hHrtf handle
 *------------------------------------------------------------------------*/
static ivas_error ivas_hrtf_open(
    HRTFS_HANDLE hHrtf_in,
    HRTFS_HANDLE *hHrtf_out /* o  : HRTF handle     */
)
{
@@ -153,8 +152,6 @@ static ivas_error ivas_hrtf_open(
    ivas_error error;

    IF( *hHrtf_out == NULL )
    {
        if ( hHrtf_in == NULL )
    {
        IF( ( hHrtf = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL )
        {
@@ -172,11 +169,6 @@ static ivas_error ivas_hrtf_open(

        *hHrtf_out = hHrtf;
    }
        else
        {
            *hHrtf_out = hHrtf_in;
        }
    }
    ELSE
    {
        return IVAS_ERR_INTERNAL;
@@ -221,6 +213,7 @@ static ivas_error ivas_rend_initCrend_fx(
    const AUDIO_CONFIG outConfig,
#ifdef FIX_POINT_HRTF_FILE_OPTIM
    HRTFS_CREND_HANDLE hHrtfCrend,
    const Word16 ext_rend_flag,
#else
    HRTFS_CREND_HANDLE hSetOfHRTF,
#endif
@@ -255,11 +248,31 @@ static ivas_error ivas_rend_initCrend_fx(
    IF( hHrtf == NULL )
    {
#ifdef FIX_POINT_HRTF_FILE_OPTIM
        test();
        IF( hHrtfCrend != NULL && ext_rend_flag == 0 )
        {
            /* HRTF set loaded from binary file */
            hHrtf = hHrtfCrend;
            hHrtf->init_from_rom = 0;
            move16();
        }
        ELSE
        {
            /* create new handle when HRTF is loaded from ROM, or external renderer is used */
        IF( NE_32( ( error = ivas_hrtf_open( hHrtfCrend, &hHrtf ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = ivas_hrtf_open( &hHrtf ) ), IVAS_ERR_OK ) )
            {
                return error;
            }

            hHrtf->init_from_rom = 1;
            IF( hHrtfCrend != NULL )
            {
                hHrtf->init_from_rom = 0;
            }
            move16();
        }

        /* create new handle when HRTF is loaded from ROM, or external renderer is used */
#else
        IF( NE_32( ivas_hrtf_open( &hHrtf ), IVAS_ERR_OK ) )
        {
@@ -1021,8 +1034,7 @@ static ivas_error ivas_rend_initCrend_fx(
    }
    ELSE
    {
        if ( hHrtf->init_from_rom == 0 )
        {

        IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) )
        {
            hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */
@@ -1031,7 +1043,30 @@ static ivas_error ivas_rend_initCrend_fx(
            move16();
        }

            IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_7_1 ) )
        if ( ext_rend_flag == 1 )
        {
            if ( hHrtfCrend == NULL )
            {
                return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " );
            }
            hHrtf->latency_s_fx = hHrtfCrend->latency_s_fx;
            hHrtf->max_num_iterations = hHrtfCrend->max_num_iterations;
            hHrtf->index_frequency_max_diffuse = hHrtfCrend->index_frequency_max_diffuse;
            hHrtf->factor_Q_inv_diffuse_weight = hHrtfCrend->factor_Q_inv_diffuse_weight;
            hHrtf->factor_Q_latency_s_fx = hHrtfCrend->factor_Q_latency_s_fx;
            hHrtf->factor_Q_pOut_to_bin = hHrtfCrend->factor_Q_pOut_to_bin;

            FOR( j = 0; j < BINAURAL_CHANNELS; j++ )
            {
                hHrtf->num_iterations_diffuse[j] = hHrtfCrend->num_iterations_diffuse[j];
                hHrtf->pIndex_frequency_max_diffuse[j] = hHrtfCrend->pIndex_frequency_max_diffuse[j];
                hHrtf->pOut_to_bin_diffuse_re_fx[j] = hHrtfCrend->pOut_to_bin_diffuse_re_fx[j];
                hHrtf->pOut_to_bin_diffuse_im_fx[j] = hHrtfCrend->pOut_to_bin_diffuse_im_fx[j];
            }


            test();
            IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_7_1 ) && EQ_16( ext_rend_flag, 0 ) )
            {
                /* hack to enable pointers swapping - needed when indexes of 'channelIndex_CICPx[]' are not in increasing order */
                FOR( i = 5; i < hHrtf->max_num_ir; i++ )
@@ -1043,9 +1078,6 @@ static ivas_error ivas_rend_initCrend_fx(

                    FOR( j = 0; j < BINAURAL_CHANNELS; j++ )
                    {
                        hHrtf->factor_Q_inv_diffuse_weight = hHrtfCrend->factor_Q_inv_diffuse_weight;
                        hHrtf->factor_Q_latency_s_fx = hHrtfCrend->factor_Q_latency_s_fx;
                        hHrtf->factor_Q_pOut_to_bin = hHrtfCrend->factor_Q_pOut_to_bin;
                        hHrtf->inv_diffuse_weight_fx[j][tmp2] = hHrtfCrend->inv_diffuse_weight_fx[j][tmp];
                        hHrtf->num_iterations[tmp2][j] = hHrtfCrend->num_iterations[tmp][j];
                        hHrtf->pIndex_frequency_max[tmp2][j] = hHrtfCrend->pIndex_frequency_max[tmp][j];
@@ -1068,8 +1100,15 @@ static ivas_error ivas_rend_initCrend_fx(
                    move16();
                }
                ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_7_1 ) )
                {
                    IF( EQ_16( ext_rend_flag, 0 ) )
                    {
                        tmp = channelIndex_CICP14[i];
                    }
                    ELSE
                    {
                        tmp = channelIndex_CICP12[i];
                    }
                    move16();
                }
                ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) )
@@ -1103,6 +1142,8 @@ static ivas_error ivas_rend_initCrend_fx(
                    hHrtf->num_iterations[i][j] = hHrtfCrend->num_iterations[tmp][j];

                    /* in case of HRTF handle reuse, swap the pointers for correct deallocation at the exit */
                    if ( ext_rend_flag == 0 )
                    {
#define WMC_TOOL_SKIP
                        swap( hHrtf->pIndex_frequency_max[i][j], hHrtf->pIndex_frequency_max[tmp][j], const Word16 * );
                        MOVE( 3 );
@@ -1112,8 +1153,14 @@ static ivas_error ivas_rend_initCrend_fx(
                        MOVE( 3 );
#undef WMC_TOOL_SKIP
                    }
                    else
                    {
                        hHrtf->pIndex_frequency_max[i][j] = hHrtfCrend->pIndex_frequency_max[tmp][j];
                        hHrtf->pOut_to_bin_re_fx[i][j] = hHrtfCrend->pOut_to_bin_re_fx[tmp][j];
                        hHrtf->pOut_to_bin_im_fx[i][j] = hHrtfCrend->pOut_to_bin_im_fx[tmp][j];
                    }
                }
            }
            hHrtf->init_from_rom = inConfig;
        }
    }

@@ -2522,7 +2569,12 @@ ivas_error ivas_rend_openCrend(
#ifdef FIX_POINT_HRTF_FILE_FORMAT_REVERB
    HRTFS_STATISTICS_HANDLE hHrtfStatistics,
#endif
    const Word32 output_Fs )
    const Word32 output_Fs
#ifdef FIX_POINT_HRTF_FILE_OPTIM
    ,
    const Word16 ext_rend_flag
#endif
)
{
    Word16 i, subframe_length;
    Word16 max_total_ir_len;
@@ -2543,7 +2595,7 @@ ivas_error ivas_rend_openCrend(
#ifdef FIX_POINT_HRTF_FILE_OPTIM
    IF( ( *pCrend )->hHrtfCrend == NULL )
    {
        IF( NE_32( ( error = ivas_rend_initCrend_fx( *pCrend, inConfig, outConfig, hHrtfCrend, output_Fs ) ), IVAS_ERR_OK ) )
        IF( NE_32( ( error = ivas_rend_initCrend_fx( *pCrend, inConfig, outConfig, hHrtfCrend, ext_rend_flag, output_Fs ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
+4 −0
Original line number Diff line number Diff line
@@ -1307,6 +1307,10 @@ ivas_error ivas_rend_openCrend(
    HRTFS_STATISTICS_HANDLE hHrtfStatistics,
#endif
    const Word32 output_Fs 
#ifdef FIX_POINT_HRTF_FILE_OPTIM
    ,    
    const Word16 ext_rend_flag
#endif
);

void ivas_rend_closeCrend(   
Loading