Commit 54d86d4e authored by TYAGIRIS's avatar TYAGIRIS
Browse files

simplify spherical harm response normalization, non-BE

parent 01e24184
Loading
Loading
Loading
Loading
+46 −1
Original line number Diff line number Diff line
@@ -4017,7 +4017,12 @@ void ivas_compute_spar_params_fx(
Word32 diff_norm_order1_table[4] = { 0, 805306368, 402653184, 268435456 };                                              // q28
Word32 diff_norm_order2_table[6] = { 0, 1342177280, 671088640, 447392416, 335544320, 268435456 };                       // q28
Word32 diff_norm_order3_table[8] = { 0, 1879048192, 939524096, 626349376, 469762048, 375809632, 313174688, 268435456 }; // q28
#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
#define EPSILON_FX_SHIFT 6
#define EPSILON_FX_THR   ( 1 << EPSILON_FX_SHIFT )
#else
#define EPSILON_FX_THR 70
#endif
#define ONE_BY_THREE_Q31 715827882
#define ONE_BY_FIVE_Q31  429496729
#define ONE_BY_SEVEN_Q31 306783378
@@ -4310,6 +4315,25 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                        move16();
                    }
                    norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    IF( LT_32( norm_fx, EPSILON_FX_THR ) )
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/
                            response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30
                            move32();
                        }
                    }
                    ELSE
                    {
                        response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15
                        move32();
                        response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
                        move32();
                    }
#else
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        IF( LT_32( norm_fx, EPSILON_FX_THR ) )
@@ -4335,6 +4359,7 @@ void ivas_get_spar_md_from_dirac_enc_fx(
                            move32();
                        }
                    }
#endif

#ifndef NONBE_FIX_1748_SPAR_DIV_OPT

@@ -4879,6 +4904,25 @@ void ivas_get_spar_md_from_dirac_fx(
                        move16();
                    }
                    norm_fx = L_shr( norm_fx, sub( 1, norm_q ) ); // q30

#ifdef NONBE_FIX_1748_SPAR_DIV_OPT
                    IF( LT_32( norm_fx, EPSILON_FX_THR ) )
                    {
                        FOR( ch = 1; ch < foa_ch; ch++ )
                        {
                            /*when control comes here, response_avg_fx[ch] should be less than EPSILON*/
                            response_avg_fx[ch] = L_shl( response_avg_fx[ch], sub( Q30, EPSILON_FX_SHIFT ) ); // q30
                            move32();
                        }
                    }
                    ELSE
                    {
                        response_avg_fx[ch] = divide3232( response_avg_fx[ch], L_max( norm_fx, response_avg_fx[ch] ) ); // q15
                        move32();
                        response_avg_fx[ch] = L_shl( response_avg_fx[ch], 15 ); // q30
                        move32();
                    }
#else
                    FOR( ch = 1; ch < foa_ch; ch++ )
                    {
                        IF( LT_32( norm_fx, EPSILON_FX_THR ) )
@@ -4904,6 +4948,7 @@ void ivas_get_spar_md_from_dirac_fx(
                            move32();
                        }
                    }
#endif

#ifndef NONBE_FIX_1748_SPAR_DIV_OPT
                    /*normalize 2nd order*/