Commit 9c871d5f authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch...

Merge branch '853-ivas_decode_masaism_metadata-decision-logic-change-due-to-precision-difference' into 'main'

[NonBE] ivas_decode_masaism_metadata decision logic change due to precision difference"

Closes #853

See merge request !618
parents 3857b473 0bbf2c7c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1353,7 +1353,10 @@ enum


#define MASA_JBM_RINGBUFFER_FRAMES              3

#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC 
#define TOLERANCE_360_Q22                       1510033326  /* 360 in Q22 + 0.02 in Q22*/
#define MINUS_TOLERANCE_360_Q22                 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */
#endif
typedef enum
{
    MASA_STEREO_NOT_DEFINED,
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@
#define FIX_924_IGF_ROUNDFX_SAT
#define FIX_930_JBM_BUFSIZE_MULT                /* FhG: Fix 930, Word16 too small for apa_buffer_size */
#define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */

#define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC    /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; needs corresponding fix in floating point */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+15 −1
Original line number Diff line number Diff line
@@ -5579,19 +5579,33 @@ static Word16 ivas_decode_masaism_metadata_fx(
                test();
                test();
                test();
                // if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 )
                /*  if ( azimuth * hMasaIsmData->q_azimuth_old[obj] > 0 ) */
                IF( ( ( azimuth > 0 ) && ( hMasaIsmData->q_azimuth_old_fx[obj] > 0 ) ) || ( ( azimuth < 0 ) && ( hMasaIsmData->q_azimuth_old_fx[obj] < 0 ) ) )
                {
                    Word16 tmp_e;
                    delta_phi = L_deposit_h( BASOP_Util_Divide1616_Scale( 180, no_phi_masa[bits_ism[obj] - 1][idx_el], &tmp_e ) );
                    delta_phi = L_shr( delta_phi, sub( 9, tmp_e ) ); /* to maintain Q22 */

#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC
                    Word32 tmp_32;
                    Word64 tmp_64;
                    tmp_32 = L_sub( azimuth, hMasaIsmData->q_azimuth_old_fx[obj] );
                    tmp_64 = W_mult_32_16( tmp_32, no_phi_masa[bits_ism[obj] - 1][idx_el] );

                    IF( GT_64( tmp_64, TOLERANCE_360_Q22 ) ) /* >= 360 in Q22 (because there is an additional shift left in W_mult_32_16) + 0.02 in Q22 to counteract for precision loss, */
#else
                    IF( GT_32( L_sub( azimuth, hMasaIsmData->q_azimuth_old_fx[obj] ), delta_phi ) )
#endif
                    {
                        azimuth = L_sub( azimuth, delta_phi );
                    }
                    ELSE
                    {
#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC
                        IF( GT_64( MINUS_TOLERANCE_360_Q22, tmp_64 ) )
#else
                        if ( GT_32( L_sub( hMasaIsmData->q_azimuth_old_fx[obj], azimuth ), delta_phi ) )
#endif
                        {
                            azimuth = L_add( azimuth, delta_phi );
                        }