Commit 7382184b authored by vaclav's avatar vaclav
Browse files

Merge branch 'cleanup_20250826' into 'main'

Cleanup 20250826

See merge request !2228
parents 8e168ec7 84db99db
Loading
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -564,7 +564,6 @@ static void setupWithSingleFormatInput(
        positionProvider->numObjects = args.inConfig.numAudioObjects;
        for ( int16_t i = 0; i < positionProvider->numObjects; ++i )
        {
#ifdef FIX_1376_MISSING_ISM_METADATA
            /* Check if path to metadata file was given */
            if ( isEmptyString( args.inMetadataFilePaths[i] ) )
            {
@@ -573,18 +572,11 @@ static void setupWithSingleFormatInput(
            }

            /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string contains "NULL" */
#else
            /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */
#endif
            char charBuf[FILENAME_MAX];
            strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 );
            charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0';
            to_upper( charBuf );
#ifdef FIX_1376_MISSING_ISM_METADATA
            if ( strncmp( charBuf, "NULL", 4 ) == 0 )
#else
            if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 )
#endif
            {
                continue;
            }
@@ -2592,6 +2584,7 @@ static CmdlnArgs defaultArgs(
    const char *executableName )
{
    CmdlnArgs args;
    int16_t i;

    strncpy( args.executableName, executableName, RENDERER_MAX_CLI_ARG_LENGTH );
    clearString( args.inputFilePath );
@@ -2610,11 +2603,7 @@ static CmdlnArgs defaultArgs(
    args.outConfig.outSetupCustom.num_lfe = 0;
    args.inConfig.ambisonicsBuses->audioConfig = IVAS_AUDIO_CONFIG_INVALID;

#ifdef FIX_1376_MISSING_ISM_METADATA
    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS; ++i )
#else
    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
#endif
    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS; ++i )
    {
        clearString( args.inMetadataFilePaths[i] );
    }
@@ -2651,7 +2640,7 @@ static CmdlnArgs defaultArgs(
    args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
    args.syncMdDelay = 0;

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
        args.directivityPatternId[i] = 65535;
    }
+1 −5
Original line number Diff line number Diff line
@@ -163,9 +163,6 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1348_OVERFLOW                               /* FhG: fix BASOP overflow in hq_lr_dec(), brings floating-point code inline with FX */
#define FIX_1369_HQ_LR_OVERFLOW                         /* FhG: fix BASOP overflow in hq_lr_enc(), brings floating-point code inline with FX */
#define FIX_1376_MISSING_ISM_METADATA                   /* FhG: IVAS_rend: throw error if there exists an ISM input without a corresponding metadata file path */
#define FIX_1330_JBM_MEMORY                             /* VA: issue 1330: memory savings in the JBM decoder */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1371_EARLY_PART_INIT_FASTCONV               /* Nokia: fix uninitialized variable in FASTCONV path of binaural reverb init */
@@ -179,9 +176,8 @@

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define	NONBE_SVD_OPTIMIZATION

#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0  */

/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+1 −5
Original line number Diff line number Diff line
@@ -262,14 +262,10 @@ void hq_lr_dec(
        frac1 = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
        L_tmp = Pow2( 30, frac1 );
        exp = sub( exp, 30 );
#ifdef FIX_1348_OVERFLOW
#ifdef BASOP_NOGLOB
        Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */
#else
        Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) );          /* Q -6 */
#endif
#else
        Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) );                        /* Q -6 */
#endif
        Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) );
    }
+1 −161
Original line number Diff line number Diff line
@@ -60,17 +60,9 @@

static float GivensRotation( const float x, const float z );

#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *g );
#else
static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *sig_x, float *g );
#endif

#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionRight( float singularVectors[][MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *g );
#else
static void biDiagonalReductionRight( float singularVectors[][MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *sig_x, float *g );
#endif

static void singularVectorsAccumulationLeft( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC );

@@ -497,27 +489,16 @@ static void HouseholderReduction(
    float *eps_x )
{
    int16_t nCh;
#ifdef NONBE_SVD_OPTIMIZATION
    float g_left = 0.0f;
    float g_right = 0.0f;
#else
    float sig_x = 0.0f;
    float g = 0.0f;
#endif


    /* Bidiagonal Reduction for every channel */
    for ( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
    {
#ifdef NONBE_SVD_OPTIMIZATION
        secDiag[nCh] = g_right; /* from the previous channel */
        biDiagonalReductionLeft( singularVectors_Left, nChannelsL, nChannelsC, nCh, &g_left );
        singularValues[nCh] = g_left;
        biDiagonalReductionRight( singularVectors_Left, nChannelsL, nChannelsC, nCh, &g_right );
#else
        biDiagonalReductionLeft( singularVectors_Left, singularValues, secDiag, nChannelsL, nChannelsC, nCh, &sig_x, &g );
        biDiagonalReductionRight( singularVectors_Left, secDiag, nChannelsL, nChannelsC, nCh, &sig_x, &g );
#endif

        *eps_x = max( *eps_x, ( fabsf( singularValues[nCh] ) + fabsf( secDiag[nCh] ) ) );
    }
@@ -535,7 +516,7 @@ static void HouseholderReduction(
 *
 *
 *-------------------------------------------------------------------------*/
#ifdef NONBE_SVD_OPTIMIZATION

static void biDiagonalReductionLeft(
    float singularVectors[][MAX_OUTPUT_CHANNELS],
    const int16_t nChannelsL,
@@ -553,7 +534,6 @@ static void biDiagonalReductionLeft(
    {
        norm_x = 0.0f;


        for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
        {
            norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][currChannel] );
@@ -586,78 +566,7 @@ static void biDiagonalReductionLeft(

    return;
}
#else
static void biDiagonalReductionLeft(
    float singularVectors[][MAX_OUTPUT_CHANNELS],
    float singularValues[MAX_OUTPUT_CHANNELS],
    float secDiag[MAX_OUTPUT_CHANNELS],
    const int16_t nChannelsL,
    const int16_t nChannelsC,
    const int16_t currChannel,
    float *sig_x,
    float *g )
{
    int16_t iCh, jCh, idx;
    float norm_x, f, r;

    secDiag[currChannel] = ( *sig_x ) * ( *g );

    /* Setting values to 0 */
    ( *sig_x ) = 0.0f;
    ( *g ) = 0.0f;

    if ( currChannel < nChannelsL ) /* i <= m */
    {
        idx = currChannel;

        for ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
        {
            ( *sig_x ) += fabsf( singularVectors[jCh][currChannel] );
        }

        if ( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
            norm_x = 0.0f;

            for ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
                singularVectors[jCh][currChannel] = ( singularVectors[jCh][currChannel] / maxWithSign( ( *sig_x ) ) );
                norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][currChannel] );
            }
            ( *g ) = -( singularVectors[currChannel][idx] >= 0 ? 1 : ( -1 ) ) * sqrtf( norm_x );
            r = ( *g ) * singularVectors[currChannel][idx] - norm_x;
            singularVectors[currChannel][idx] = ( singularVectors[currChannel][idx] - ( *g ) );

            for ( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
            {
                norm_x = 0.0f;
                for ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
                    norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][iCh] );
                }

                f = norm_x / maxWithSign( r );


                for ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
                    singularVectors[jCh][iCh] += ( f * singularVectors[jCh][currChannel] );
                }
            }


            for ( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
                singularVectors[jCh][currChannel] = ( singularVectors[jCh][currChannel] * ( *sig_x ) );
            }
        }

        singularValues[currChannel] = ( ( *sig_x ) * ( *g ) );
    }

    return;
}
#endif

/*-------------------------------------------------------------------------
 * biDiagonalReductionRight()
@@ -665,7 +574,6 @@ static void biDiagonalReductionLeft(
 *
 *-------------------------------------------------------------------------*/

#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionRight(
    float singularVectors[][MAX_OUTPUT_CHANNELS],
    const int16_t nChannelsL,
@@ -714,75 +622,7 @@ static void biDiagonalReductionRight(

    return;
}
#else
static void biDiagonalReductionRight(
    float singularVectors[][MAX_OUTPUT_CHANNELS],
    float secDiag[MAX_OUTPUT_CHANNELS],
    const int16_t nChannelsL,
    const int16_t nChannelsC,
    const int16_t currChannel,
    float *sig_x,
    float *g )
{
    int16_t iCh, jCh, idx;

    float norm_x, r;

    /* Setting values to 0 */
    ( *sig_x ) = 0.0f;
    ( *g ) = 0.0f;

    if ( currChannel < nChannelsL && currChannel != ( nChannelsC - 1 ) ) /* i <=m && i !=n */
    {
        idx = currChannel + 1;

        for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
        {
            ( *sig_x ) += fabsf( singularVectors[currChannel][jCh] );
        }

        if ( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
            norm_x = 0.0f;

            for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
            {
                singularVectors[currChannel][jCh] = ( singularVectors[currChannel][jCh] / maxWithSign( ( *sig_x ) ) );
                norm_x += ( singularVectors[currChannel][jCh] * singularVectors[currChannel][jCh] );
            }
            ( *g ) = -( singularVectors[currChannel][idx] >= 0 ? 1 : ( -1 ) ) * sqrtf( norm_x );
            r = ( *g ) * singularVectors[currChannel][idx] - norm_x;
            singularVectors[currChannel][idx] = ( singularVectors[currChannel][idx] - ( *g ) );

            for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
            {
                secDiag[jCh] = singularVectors[currChannel][jCh] / maxWithSign( r );
            }

            for ( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /*  nChannelsL */
            {
                norm_x = 0.0f;
                for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
                {
                    norm_x += ( singularVectors[iCh][jCh] * singularVectors[currChannel][jCh] );
                }

                for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*  nChannelsC */
                {
                    singularVectors[iCh][jCh] += ( norm_x * secDiag[jCh] );
                }
            }

            for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*  nChannelsC */
            {
                singularVectors[currChannel][jCh] = ( singularVectors[currChannel][jCh] * ( *sig_x ) );
            }
        }
    }

    return;
}
#endif

/*-------------------------------------------------------------------------
 * singularVectorsAccumulationLeft()
+1 −5
Original line number Diff line number Diff line
@@ -336,14 +336,10 @@ void hq_lr_enc(
        frac1 = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
        L_tmp = Pow2( 30, frac1 );
        exp = sub( exp, 30 );
#ifdef FIX_1369_HQ_LR_OVERFLOW
#ifdef BASOP_NOGLOB
        Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */
#else
        Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) );          /* Q -6 */
#endif
#else
        Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) );                        /* Q -6 */
#endif
        Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) );
    }