comparison libtwamr/inv_sqrt.h @ 253:54f6bc41ed10

libtwamr: integrate a* modules
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 05 Apr 2024 06:08:15 +0000
parents
children
comparison
equal deleted inserted replaced
252:57b4053559ff 253:54f6bc41ed10
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 ********************************************************************************
33 * INCLUDE FILES
34 ********************************************************************************
35 */
36 #include "typedef.h"
37
38 /*
39 ********************************************************************************
40 * DEFINITION OF DATA TYPES
41 ********************************************************************************
42 */
43
44 /*
45 ********************************************************************************
46 * DECLARATION OF PROTOTYPES
47 ********************************************************************************
48 */
49
50 Word32 Inv_sqrt ( /* (o) : output value (range: 0<=val<1) */
51 Word32 L_x /* (i) : input value (range: 0<=val<=7fffffff) */
52 );
53
54 #endif