1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
Index: apps/codecs/libfaad/sbr_hfgen.c
===================================================================
--- apps/codecs/libfaad/sbr_hfgen.c  (revision 28070)
+++ apps/codecs/libfaad/sbr_hfgen.c  (working copy)
@@ -212,16 +212,18 @@

 #ifdef FIXED_POINT
     mask = 0;
-
+/*
     for (j = (offset-2); j < (len + offset); j++)
     {
         real_t x;
         x = QMF_RE(buffer[j][bd])>>REAL_BITS;
         mask |= x ^ (x >> 31);
     }
+*/
+    exp = 0;//wl_min_lzc(mask);
+    
+    if (exp!=0) printf("exp1 = %d\n", exp);

-    exp = wl_min_lzc(mask);
-
     for (j = offset; j < len + offset; j++)
     {
         real_t buf_j   = (QMF_RE(buffer[j  ][bd]))>>exp);
@@ -276,18 +278,19 @@

 #ifdef FIXED_POINT
     mask = 0;
-
+/*
     for (j = (offset-2); j < (len + offset); j++)
     {
         real_t x;
         x = QMF_RE(buffer[j][bd])>>REAL_BITS;
         mask |= x ^ (x >> 31);
+        printf("x = %x, x>>31 = %x, x ^ x>>31 = %x\n", x, x>>31, x ^ (x >> 31));
         x = QMF_IM(buffer[j][bd])>>REAL_BITS;
         mask |= x ^ (x >> 31);
     }
+*/
+    exp = 0;//wl_min_lzc(mask);

-    exp = wl_min_lzc(mask);
-
     temp2_r = (QMF_RE(buffer[offset-2][bd])) >> exp;
     temp2_i = (QMF_IM(buffer[offset-2][bd])) >> exp;
     temp3_r = (QMF_RE(buffer[offset-1][bd])) >> exp;
@@ -313,28 +316,13 @@
         r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i);
     }

-    // These are actual values in temporary variable at this point
-    // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
-    // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
-    // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
-    // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
-    // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
-    // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
-    // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
-    // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
-    // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
-    // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+    RE(ac->r12) = r01r - (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
+                         (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
+    IM(ac->r12) = r01i - (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
+                         (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
+    RE(ac->r22) = r11r - (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
+                         (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));

-    RE(ac->r12) = r01r -
-        (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
-        (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
-    IM(ac->r12) = r01i -
-        (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
-        (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
-    RE(ac->r22) = r11r -
-        (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
-        (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
-
 #else

     temp2_r = QMF_RE(buffer[offset-2][bd]);
@@ -362,28 +350,13 @@
         r11r += temp2_r * temp2_r + temp2_i * temp2_i;
     }

-    // These are actual values in temporary variable at this point
-    // temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
-    // temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
-    // temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
-    // temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
-    // temp3_r = QMF_RE(buffer[len+offset-1][bd]);
-    // temp3_i = QMF_IM(buffer[len+offset-1][bd]);
-    // temp4_r = QMF_RE(buffer[offset-2][bd]);
-    // temp4_i = QMF_IM(buffer[offset-2][bd]);
-    // temp5_r = QMF_RE(buffer[offset-1][bd]);
-    // temp5_i = QMF_IM(buffer[offset-1][bd]);
+    RE(ac->r12) = r01r - (temp3_r * temp2_r + temp3_i * temp2_i) +
+                         (temp5_r * temp4_r + temp5_i * temp4_i);
+    IM(ac->r12) = r01i - (temp3_i * temp2_r - temp3_r * temp2_i) +
+                         (temp5_i * temp4_r - temp5_r * temp4_i);
+    RE(ac->r22) = r11r - (temp2_r * temp2_r + temp2_i * temp2_i) +
+                         (temp4_r * temp4_r + temp4_i * temp4_i);

-    RE(ac->r12) = r01r -
-        (temp3_r * temp2_r + temp3_i * temp2_i) +
-        (temp5_r * temp4_r + temp5_i * temp4_i);
-    IM(ac->r12) = r01i -
-        (temp3_i * temp2_r - temp3_r * temp2_i) +
-        (temp5_i * temp4_r - temp5_r * temp4_i);
-    RE(ac->r22) = r11r -
-        (temp2_r * temp2_r + temp2_i * temp2_i) +
-        (temp4_r * temp4_r + temp4_i * temp4_i);
-
 #endif

     RE(ac->r01) = r01r;