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

fix 853 basop

parent 342430c5
Loading
Loading
Loading
Loading
+34 −2
Original line number Diff line number Diff line
@@ -5522,7 +5522,12 @@ static Word16 ivas_decode_masaism_metadata_fx(
    Word16 nb_bits_read;
    Word32 delta_phi; // Q22
    Word16 meta_write_index;
#if 1
    static FILE *pF = NULL;

    if ( pF == NULL )
        pF = fopen( "./direction.txt", "w" );
#endif
    nb_bits_read = *next_bit_pos;
    move16();
    nbands = hQMetaData->q_direction->cfg.nbands;
@@ -5585,19 +5590,46 @@ 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, 22 );
                    delta_phi = L_shl( delta_phi, 22 );
                    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*/
#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 ) )
#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
                            
                        }
                    }
                }