Commit 04c53858 authored by vasilache's avatar vasilache
Browse files

MASA coherence and deindex_lead fixes to align with BASOP

parent fbf45522
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1178,6 +1178,10 @@ enum
#define MASA_RATIO_TOLERANCE                    0.1f
#define MASA_RATIO_THRESHOLD                    0.1f
#define MASA_ANGLE_TOLERANCE                    0.5f
#ifdef  NON_BE_FIX_1048_THRESHOLD_COH_BASOP
#define MASA_SUR_COH_THRESHOLD                  1e-7f
#define MASA_SUR_COH_PRECISION                  1e7f
#endif
#define MASA_LIMIT_NO_BANDS_SUR_COH             8
#define MINIMUM_BIT_BUDGET_NORMAL_META          100
#define DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC     4
+4 −0
Original line number Diff line number Diff line
@@ -828,7 +828,11 @@ void deindex_lvq_SHB(

        /* find idx_leader */
        i = 1;
#ifdef NONBE_FIX_1054_NEGATIVE_LVQ_INDEX
        while ( index > table_no_cv[i] )
#else
        while ( index >= table_no_cv[i] )
#endif
        {
            i++;
        }
+6 −0
Original line number Diff line number Diff line
@@ -56,6 +56,12 @@

/* #################### End DEBUGGING switches ############################ */

/* ################### Start FIXES switches ########################### */

#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP             /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/
#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX               /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */

/* #################### End FIXES switches ############################ */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */

+7 −1
Original line number Diff line number Diff line
@@ -3829,6 +3829,9 @@ static int16_t read_surround_coherence_hr(
    IVAS_QDIRECTION *q_direction;
    int16_t min_index;
    int16_t d, idx;
#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP
    int32_t int_error_ratio_surr;
#endif
    coding_subbands = hQMetaData->q_direction[0].cfg.nbands;
    q_direction = hQMetaData->q_direction;

@@ -3851,7 +3854,10 @@ static int16_t read_surround_coherence_hr(
            {
                error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf];
            }

#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP
            int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr );
            error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD );
#endif
            if ( error_ratio_surr <= 0 )
            {
                error_ratio_surr = 0;
+7 −2
Original line number Diff line number Diff line
@@ -4508,7 +4508,9 @@ static int16_t encode_surround_coherence_hr(
    int16_t max_val = 0, nbits_max;
    int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx;
    int16_t idx16;

#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP
    int32_t int_error_ratio_surr;
#endif
    coding_subbands = hQMetaData->q_direction[0].cfg.nbands;
    all_coherence_zero = hQMetaData->all_coherence_zero;
    q_direction = &( hQMetaData->q_direction[0] );
@@ -4537,7 +4539,10 @@ static int16_t encode_surround_coherence_hr(
                {
                    error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf];
                }

#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP
                int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr );
                error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD );
#endif

                if ( error_ratio_surr <= 0 )
                {