Commit 5affa55f authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

Merge branch 'svd-optimizations-float' of...

Merge branch 'svd-optimizations-float' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into svd-optimizations-float
parents 93b76a61 ffbb5a15
Loading
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@

static float GivensRotation( const float x, const float z );
#ifdef NONBE_SVD_OPTIMIZATION
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 g );
static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel );
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 *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 );
@@ -500,7 +500,7 @@ static void HouseholderReduction(
    for ( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
    {
#ifdef NONBE_SVD_OPTIMIZATION
        biDiagonalReductionLeft( singularVectors_Left, singularValues, secDiag, nChannelsL, nChannelsC, nCh, g );
        biDiagonalReductionLeft( singularVectors_Left, singularValues, nChannelsL, nChannelsC, nCh );
        biDiagonalReductionRight( singularVectors_Left, secDiag, nChannelsL, nChannelsC, nCh, &g );
#else
        biDiagonalReductionLeft( singularVectors_Left, singularValues, secDiag, nChannelsL, nChannelsC, nCh, &sig_x, &g );
@@ -528,16 +528,12 @@ static void HouseholderReduction(
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 g )
    const int16_t currChannel )
{
    int16_t iCh, jCh;
    float norm_x, f, r;

    secDiag[currChannel] = g;
    float norm_x, f, r, g;

    /* Setting values to 0 */
    g = 0.0f;
@@ -673,6 +669,8 @@ static void biDiagonalReductionRight(
    float norm_x, r;
    float abs_x;

    secDiag[currChannel] = *g;

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

@@ -694,10 +692,6 @@ static void biDiagonalReductionRight(
            ( *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] * abs_x ) / maxWithSign( r );
            }

            for ( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /*  nChannelsL */
            {
@@ -706,11 +700,15 @@ static void biDiagonalReductionRight(
                {
                    norm_x += ( singularVectors[iCh][jCh] * singularVectors[currChannel][jCh] );
                }
                norm_x /= abs_x;
                norm_x /= r;
                for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*  nChannelsC */
                {
                    singularVectors[iCh][jCh] += ( norm_x * secDiag[jCh] );
                    singularVectors[iCh][jCh] += ( norm_x * singularVectors[currChannel][jCh] );
                }
            }
            for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
            {
                secDiag[jCh] = ( singularVectors[currChannel][jCh] * abs_x ) / maxWithSign( r );
            }
        }
    }