Unverified Commit deebe29a authored by norvell's avatar norvell
Browse files

Cleanup and align with float code

parent b983f991
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ int main(
            goto cleanup;
        }

#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
@@ -589,7 +589,7 @@ int main(
        {
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Invalid reverberation configuration parameters\n\n" );
@@ -2115,7 +2115,7 @@ static ivas_error decodeG192(
            goto cleanup;
        }

#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
@@ -2286,7 +2286,7 @@ static ivas_error decodeG192(
                        arg.aeSequence.frameCounter = 0;
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                        {
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" );
+3 −3
Original line number Diff line number Diff line
@@ -1200,7 +1200,7 @@ int main(
            fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            goto cleanup;
        }
#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
@@ -1222,7 +1222,7 @@ int main(
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" );
@@ -1681,7 +1681,7 @@ int main(
                args.aeSequence.frameCounter = 0;
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                {
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" );
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@
/* any switch which is non-be wrt. TS 26.251 V3.0 */

#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API            /* Expose Payload Type setting in RTP Header */
#define FIX_2500_ISM4_BIN_REVERB_DISTORTION             /* FhG: Basop issue #2500: Port the missing part of RenderConfigReader_checkValues() from float; fix RefDist_fx calculation. */
#define FIX_2500_RENDCONF_REFACTOR                      /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION         /* Eri: Basop issue 2023: Distance attenuation scaling, adding clamping of distance att input and listener position */ 
#define USE_RTPDUMP                                     /* FhG: RTPDUMP format (rtptools standard) instead of custom format */
#define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS        /* Nokia: float issue 1569: fix render config checks in renderer */
+11 −25
Original line number Diff line number Diff line
@@ -52,17 +52,6 @@
#define N_BANDS_MIN           ( 2 )
#define N_BANDS_MAX           ( 60 )

#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#define FC_INPUT_MIN_FX       0          // ( 0.0f )
#define FC_INPUT_MAX_Q14      1638400000 // ( 1.0e+5f ) in Q14
#define ACOUSTIC_RT60_MIN_Q26 67109      // ( 1.0e-3f ) in Q26
#define ACOUSTIC_RT60_MAX_Q24 1677721600 // ( 1.0e+2f ) in Q24
#define ACOUSTIC_DSR_MIN_FX   0          // ( 0.0f )
#define ACOUSTIC_DSR_MAX_Q24  1677721600 // ( 1.0e+2f ) in Q24
#define INPUTPREDELAY_MIN_FX  0          // ( 0.0f )
#define INPUTPREDELAY_MAX_Q24 1677721600 // ( 1.0e+2f ) in Q24
#endif

#define FC_INPUT_MIN                ( 0.0f )
#define FC_INPUT_MAX                ( 1.0e+5f )
#define ACOUSTIC_RT60_MIN           ( 1.0e-3f )
@@ -1285,14 +1274,14 @@ static int32_t errorHandler(
 *
 * Verifies if the configuration parameters lie within acceptable limits
 *------------------------------------------------------------------------------------------*/
#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifdef FIX_2500_RENDCONF_REFACTOR
ivas_error RenderConfigReader_checkValues(
    RenderConfigReader *pRenderConfigReader /* i/o : RenderConfigReader handle              */
)
{
    int16_t band_idx, tab_value_err_count;
    int16_t wall_idx;
    uint32_t n, i;
    int16_t n, i;

    tab_value_err_count = 0;

@@ -1408,15 +1397,12 @@ ivas_error RenderConfigReader_checkValues(
        pRenderConfigReader->distAtt[2] = 1.0f;
    }

    /* Verify range of distance attenuation parameters */
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    /* refDist:       0.0 <= distAtt[1] <= 6.3         */
    /* Verify range of distance attenuation parameters: refDist:       0.0 <= distAtt[1] <= 6.3         */
    /*                                                  maxDist:       distAtt[1] <= distAtt[0] <= 63.0 */
    /*                                                  rollOffFactor: 0 <= distAtt[2] <= 4.0           */
    pRenderConfigReader->distAtt[1] = min( max( 0, pRenderConfigReader->distAtt[1] ), DIST_ATT_MAX_REFDIST );
    pRenderConfigReader->distAtt[0] = min( max( pRenderConfigReader->distAtt[1], pRenderConfigReader->distAtt[0] ), DIST_ATT_MAX_MAXDIST );
    pRenderConfigReader->distAtt[2] = min( max( 0.0f, pRenderConfigReader->distAtt[2] ), DIST_ATT_MAX_ROLLOFF );
#endif

    /* Verify range of directivity patterns */
    for ( i = 0; i < pRenderConfigReader->nDP; i++ )
@@ -1428,7 +1414,7 @@ ivas_error RenderConfigReader_checkValues(

    return IVAS_ERR_OK;
}
#else  /* !FIX_2500_ISM4_BIN_REVERB_DISTORTION */
#else
ivas_error RenderConfigReader_checkValues(
    IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o  : Renderer configuration handle          */
)
@@ -1514,7 +1500,7 @@ ivas_error RenderConfigReader_checkValues(

    return IVAS_ERR_OK;
}
#endif /* FIX_2500_ISM4_BIN_REVERB_DISTORTION */
#endif

/*------------------------------------------------------------------------------------------*
 * RenderConfigReader_open()
@@ -3117,7 +3103,7 @@ ivas_error RenderConfigReader_getAcousticEnvironment(
        {
            pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands;
            pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 );
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
            if ( pRenderConfigReader->pAE[n].preDelay > INPUTPREDELAY_MAX ||
                 pRenderConfigReader->pAE[n].preDelay < INPUTPREDELAY_MIN )
            {
@@ -3126,7 +3112,7 @@ ivas_error RenderConfigReader_getAcousticEnvironment(
#endif
            for ( m = 0; m < pAcEnv->nBands; m++ )
            {
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( pRenderConfigReader->pAE[n].pFG->pFc[m] > FC_INPUT_MAX ||
                     pRenderConfigReader->pAE[n].pFG->pFc[m] < FC_INPUT_MIN ||
                     pRenderConfigReader->pAE[n].pRT60[m] > ACOUSTIC_RT60_MAX ||
@@ -3273,7 +3259,7 @@ ivas_error RenderConfigReader_getDirectivity(
    FOR( n = 0; n < 4; n++ )
    {
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
        /* Verify range of directivity patterns */
        /* Range needs to be checked before converting to fixed point -- different from float */
        directivity[n * 3] = max( 0.0f, min( 360.0f, directivity[n * 3] ) );
@@ -3320,7 +3306,7 @@ ivas_error RenderConfigReader_getDistanceAttenuation(

    /* Convert to Word32 */
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#ifndef FIX_2500_ISM4_BIN_REVERB_DISTORTION
#ifndef FIX_2500_RENDCONF_REFACTOR
    /* Range needs to be checked before converting to fixed point -- different from float */
    /* Verify range of distance attenuation parameters: refDist:       0.0 <= distAtt[1] <= 6.3         */
    /*                                                  maxDist:       distAtt[1] <= distAtt[0] <= 63.0 */
+3 −5
Original line number Diff line number Diff line
@@ -78,15 +78,13 @@ ivas_error RenderConfigReader_getDistanceAttenuation(
    Word32 *distAtt_fx                       /* o  : Distance attenuation                   */
);
/* Verifies configuration parameters                                                        */
#ifdef FIX_2500_ISM4_BIN_REVERB_DISTORTION
ivas_error RenderConfigReader_checkValues(
#ifdef FIX_2500_RENDCONF_REFACTOR
    RenderConfigReader *pRenderConfigReader  /* i/o : RenderConfigReader handle             */
);
#else
ivas_error RenderConfigReader_checkValues(
    IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o  : Renderer configuration handle           */
);
#endif
);

/* Reads a configuration                                                                    */
ivas_error RenderConfigReader_read(