Commit e2801e12 authored by vasilache's avatar vasilache Committed by Sandesh Venkatesh
Browse files

fix 853 basop

parent a7542956
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,
+4 −20
Original line number Diff line number Diff line
@@ -5590,46 +5590,30 @@ static Word16 ivas_decode_masaism_metadata_fx(
                    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 */
                    #if 0
#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC 
                    delta_phi = L_shr( delta_phi, 20 );
                    delta_phi = L_shl( delta_phi, 20 );
#endif
                    #endif
#if 1
                    fprintf( pF, "azimuth = %4.2f delta_phi = %4.2f obj = %d \n", (float) azimuth / (float) 4194304, (float) delta_phi / (float) 4194304,  obj );
#endif

#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, (DEGREE_360_Q_22 + 83886) ) ) /* >= 360 in Q22 + 0.02 in Q22, because there is an additional shift left in W_mult_32_16*/
                    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 );
#if 1
                        fprintf( pF, "azimuth = %3.1f obj = %d 1 \n", (float) azimuth / (float) 4194304, obj );
#endif
                    }
                    ELSE
                    {
#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC
             
                        IF( GT_64( -DEGREE_360_Q_22 - 83886, tmp_64 ) )
                        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 );                            
#if 1
                            fprintf( pF, "azimuth = %3.1f obj = %d -1 \n", (float) azimuth / (float) 4194304, obj );
#endif
                            
                        }
                    }
                }