inv_sqrt_ex.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. ********************************************************************************
  3. *
  4. * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
  5. * R99 Version 3.3.0
  6. * REL-4 Version 4.1.0
  7. *
  8. ********************************************************************************
  9. *
  10. * File : inv_sqrt.h
  11. * Purpose : Computes 1/sqrt(L_x), where L_x is positive.
  12. * : If L_x is negative or zero, the result is
  13. * : 1 (3fff ffff).
  14. * Description : The function 1/sqrt(L_x) is approximated by a table
  15. * : and linear interpolation. The inverse square root is
  16. * : computed using the following steps:
  17. * 1- Normalization of L_x.
  18. * 2- If (30-exponent) is even then shift right once.
  19. * 3- exponent = (30-exponent)/2 +1
  20. * 4- i = bit25-b31 of L_x; 16<=i<=63 because of normalization.
  21. * 5- a = bit10-b24
  22. * 6- i -=16
  23. * 7- L_y = table[i]<<16 - (table[i] - table[i+1]) * a * 2
  24. * 8- L_y >>= exponent
  25. *
  26. ********************************************************************************
  27. */
  28. #ifndef inv_sqrt_h
  29. #define inv_sqrt_h "$Id $"
  30. /*
  31. ********************************************************************************
  32. * INCLUDE FILES
  33. ********************************************************************************
  34. */
  35. #include "typedef.h"
  36. /*
  37. ********************************************************************************
  38. * DEFINITION OF DATA TYPES
  39. ********************************************************************************
  40. */
  41. /*
  42. ********************************************************************************
  43. * DECLARATION OF PROTOTYPES
  44. ********************************************************************************
  45. */
  46. Word32 Inv_sqrt_ex ( /* (o) : output value (range: 0<=val<1) */
  47. Word32 L_x /* (i) : input value (range: 0<=val<=7fffffff) */
  48. );
  49. #endif