Commit afc77096 authored by Jonas Svedberg's avatar Jonas Svedberg
Browse files

renamed define and aligned ivas-float negations to BASOP and ALT-BASOP

parent 67533608
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@
#define FIX_955_FASTCONV_REND_IN_ISM                    /* VA: put FastConv rendering call under DEBUGGING */


#define FIX_976_USAN_PVQ_DEC_OMASA                      /* Ericsson:  premature cast to unsigned detected by USAN corrected  */
#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR                      /* Ericsson:  premature cast to unsigned detected by USAN corrected  */


/* #################### End BE switches ################################## */
+21 −4
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ static void pvq_decode_band(
    }

    set_s( g_part_s, -32768, Np );

    if ( Np > 1 )
    {
        decode_energies( st, hPVQ, Np, dim_part, bits_part, g_part_s, band_bits_tot, bits_left, sfmsize, strict_bits );
@@ -113,10 +114,26 @@ static void pvq_decode_band(
    for ( j = 0; j < Np; j++ )
    {
        g_part[j] = -( (float) g_part_s[j] ) / 32768; 
#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR
          /* note: here  g_part_s needs to be become exactly  1.0(float)  esp. for Np==1 , thus  g_part_s was initilized to  (int16_t) -32768 */
#endif 

        if ( g_part_s[j] == -32768 )
        {
            printf( "\n Error  negative mag negative int16_t . Np=%2d in split j=%2d \n", Np, j );
        }
#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR
        /* aligned to BASOP to avoid ASAN undefined negation issue with -(-32768) */
        g_part_s[j] =  negate(g_part_s[j]);        
#else
        g_part_s[j] = -g_part_s[j];    
#endif 
    }


    srt_vec_ind( g_part_s, sg_part, idx_sort, Np );


    for ( j = 0; j < Np; j++ )
    {
        js = idx_sort[Np - 1 - j];
@@ -420,7 +437,7 @@ static void densitySymbolIndexDecode(
    {
        tot = res * ( res + 1 ) + 1;
        dec_freq = rc_decode( &st->BER_detect, hPVQ, tot );
#ifdef FIX_976_USAN_PVQ_DEC_OMASA
#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR
        alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1;
#else
        alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1;
@@ -442,7 +459,7 @@ static void densitySymbolIndexDecode(
        dec_freq = rc_decode( &st->BER_detect, hPVQ, tot );
        if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 )
        {
#ifdef FIX_976_USAN_PVQ_DEC_OMASA
#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR
            alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c );
#else
            alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c );
+6 −0
Original line number Diff line number Diff line
@@ -124,7 +124,13 @@ static void pvq_encode_band(
    for ( j = 0; j < Np; j++ )
    {
        g_part[j] = -( (float) g_part_s[j] ) / 32768;
#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR
        /* aligned to BASOP to avoid ASAN undefined negation issue with -(-32768) */
        g_part_s[j] = negate( g_part_s[j] );
#else
        g_part_s[j] = -g_part_s[j];
#endif 

    }

    srt_vec_ind( g_part_s, sg_part, idx_sort, Np );