Commit 33cc0215 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_1164_fix' into 'main'

Fix for 3GPP issue 1164: Assertion in reduce_metadata_further_fx for OMASA LTV input

See merge request !979
parents e48b0493 16c32dd7
Loading
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -2509,6 +2509,8 @@ static void reduce_metadata_further_fx(
        Word32 x, y, z;
        Word32 veclen, L_tmp;

        W_tmp = 0;
        move64();
        FOR( band = 0; band < numCodingBands; band++ )
        {
            xSum = 0;
@@ -2537,9 +2539,14 @@ static void reduce_metadata_further_fx(
                ySum = L_add( ySum, y );
                zSum = L_add( zSum, z );

                bandSumEnergy = L_add( bandSumEnergy, energy[sf][band] );
                W_tmp = W_add( W_tmp, energy[sf][band] );
            }

            tmp2 = W_norm( W_tmp );
            tmp2 = s_min( 32, tmp2 );
            bandSumEnergy = W_extract_h( W_shl( W_tmp, tmp2 ) );
            tmp2 = sub( add( hMasa->data.q_energy, tmp2 ), 32 );

            aziRad = BASOP_util_atan2( ySum, xSum, 0 ); // Q13
            W_xSum_sq = W_mult0_32_32( xSum, xSum );    // 2 * hMasa->data.q_energy - Q6
            W_ySum_sq = W_mult0_32_32( ySum, ySum );    // 2 * hMasa->data.q_energy - Q6
@@ -2567,6 +2574,7 @@ static void reduce_metadata_further_fx(
                }
                // hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0] = (uint8_t) roundf( spreadCohSum / ( bandSumEnergy + EPSILON ) * 255.0f );
                tmp = BASOP_Util_Divide3232_Scale( spreadCohSum, bandSumEnergy, &exp );
                exp = add( exp, sub( tmp2, hMasa->data.q_energy ) );
                tmp = mult_r( tmp, 32640 /* 255 in Q7 */ );                                                                    // 15 - exp + 7 - 15 => 7 - exp
                hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0] = (UWord8) shr( tmp, sub( 7, exp ) ); // Q0
                move16();