Commit 5a44c58e authored by norvell's avatar norvell
Browse files

Add define FIX_I59_CREND for gcc compiler fixes in ivas_crend_utest_utils.c

parent 3c645067
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@
#define FIX_I59_LFE_CLDFB                               /* Issue 59: correcting LFE handling for fastconv binaural rendering */
#define FIX_I59_DELAY_ROUNDING                          /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */
#define FIX_FIX_I59                                     /* Issue 59:  small fix concerning LFE delay rounding */
#define FIX_I59_CREND                                   /* Issue 59: Fixes for gcc compiler warnings in ivas_crend_utest_utils.c */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+73 −2
Original line number Diff line number Diff line
@@ -82,37 +82,60 @@ static int32_t ivas_check_rounding( float binaural_latencys_s[3], int16_t use_ro
    *err_lfe = 0;
    *err_dec = 0;

    // for ( int ind1 = 0; ind1 < sizeof( sampleRates ) / sizeof( float ); ind1++ ) // gcc complains it cannot resolve the number of array elements this way -- changed to hard-coded loop below
#ifdef FIX_I59_CREND
    for ( int ind1 = 0; ind1 < 3; ind1++ ) 
#else
    for ( int ind1 = 0; ind1 < sizeof( sampleRates ) / sizeof( float ); ind1++ )
#endif
    {
        if ( verbose )
            printf( "\nsample rate = %f", sampleRates[ind1] );
        // for ( int ind2 = 0; ind2 < sizeof( binaural_latencys_s ) / sizeof( float ); ind2++ ) // gcc complains it cannot resolve the number of array elements this way -- changed to hard-coded loop below
            
#ifdef FIX_I59_CREND
        for ( int ind2 = 0; ind2 < 3; ind2++ )
#else
        for ( int ind2 = 0; ind2 < sizeof( binaural_latencys_s ) / sizeof( float ); ind2++ )
#endif
        {
            wanted = (int32_t) roundf( binaural_latencys_s[ind2] * sampleRates[ind1] );
            if ( verbose )
#ifdef FIX_I59_CREND
                printf( "\nbinaural_latencys_s = %f wanted = %d", binaural_latencys_s[ind2], wanted );
#else            
                printf( "\nbinaural_latencys_s = %f wanted = %ld", binaural_latencys_s[ind2], wanted );
#endif
            if ( use_round_latency )
                delay_ns[ind2] = (int32_t) roundf( binaural_latencys_s[ind2] * 1000000000.f );
            else
                delay_ns[ind2] = (int32_t) ( binaural_latencys_s[ind2] * 1000000000.f );
            if ( verbose )
#ifdef FIX_I59_CREND            
                printf( "\n delay_ns[%d] = %d \n", ind2, delay_ns[ind2] );
#else
                printf( "\n delay_ns[%d] = %ld \n", ind2, delay_ns[ind2] );
#endif

            if ( use_round_for_lfe )
                delay_lfe[ind1][ind2] = (int32_t) roundf( delay_ns[ind2] * sampleRates[ind1] / 1000000000.f );
            else
                delay_lfe[ind1][ind2] = (int32_t) NS2SA( sampleRates[ind1], delay_ns[ind2] );
            if ( verbose )
#ifdef FIX_I59_CREND                        
                printf( "\ndelay_lfe[%d][%d] = %d\n", ind1, ind2, delay_lfe[ind1][ind2] );
#else
                printf( "\ndelay_lfe[%d][%d] = %ld\n", ind1, ind2, delay_lfe[ind1][ind2] );
#endif
            *err_lfe += abs( delay_lfe[ind1][ind2] - wanted );

            delay_dec[ind1][ind2] = NS2SA( sampleRates[ind1], (float) delay_ns[ind2] + 0.5f );
            //         delay_dec[ind1][ind2] = NS2SA( sampleRates[ind1], (float) delay_ns[ind2] );

            if ( verbose )
#ifdef FIX_I59_CREND
                printf( "\ndelay_dec[%d][%d] = %d \n", ind1, ind2, delay_dec[ind1][ind2] );
#else
                printf( "\ndelay_dec[%d][%d] = %ld \n", ind1, ind2, delay_dec[ind1][ind2] );
#endif
            *err_dec += abs( delay_dec[ind1][ind2] - wanted );
        }
    }
@@ -1153,32 +1176,80 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl

    int32_t err = 0, err_lfe = 0, err_dec = 0;
    err = ivas_check_rounding( binaural_latencys_fastconv_s, 0, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif
    err += ivas_check_rounding( binaural_latencys_crend_s, 0, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif
    err += ivas_check_rounding( binaural_latencys_td_s, 0, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\n\nerr = %d err_lfe = %d err_dec = %d\n\n", err, err_lfe, err_dec );
#else
    printf( "\n\nerr = %ld err_lfe = %ld err_dec = %ld\n\n", err, err_lfe, err_dec );
#endif

    err = ivas_check_rounding( binaural_latencys_fastconv_s, 0, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif
    err += ivas_check_rounding( binaural_latencys_crend_s, 0, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif
    err += ivas_check_rounding( binaural_latencys_td_s, 0, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\n\nerr = %d err_lfe = %d err_dec = %d\n\n", err, err_lfe, err_dec );
#else    
    printf( "\n\nerr = %ld err_lfe = %ld err_dec = %ld\n\n", err, err_lfe, err_dec );
#endif

    err = ivas_check_rounding( binaural_latencys_fastconv_s, 1, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif
    err += ivas_check_rounding( binaural_latencys_crend_s, 1, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif    
    err += ivas_check_rounding( binaural_latencys_td_s, 1, 0, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\n\nerr = %d err_lfe = %d err_dec = %d\n\n", err, err_lfe, err_dec );
#else        
    printf( "\n\nerr = %ld err_lfe = %ld err_dec = %ld\n\n", err, err_lfe, err_dec );
#endif

    err = ivas_check_rounding( binaural_latencys_fastconv_s, 1, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else        
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif    
    err += ivas_check_rounding( binaural_latencys_crend_s, 1, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\nerr_lfe = %d err_dec = %d", err_lfe, err_dec );
#else    
    printf( "\nerr_lfe = %ld err_dec = %ld", err_lfe, err_dec );
#endif    
    err += ivas_check_rounding( binaural_latencys_td_s, 1, 1, &err_lfe, &err_dec, 0 );
#ifdef FIX_I59_CREND
    printf( "\n\nerr = %d err_lfe = %d err_dec = %d\n\n", err, err_lfe, err_dec );
#else    
    printf( "\n\nerr = %ld err_lfe = %ld err_dec = %ld\n\n", err, err_lfe, err_dec );
#endif    


    ivas_render_config_open( &st_ivas.hRenderConfig );