Browse code

lls: move to the private namespace

The functions are private.

Luca Barbato authored on 2013/02/25 16:06:59
Showing 4 changed files
... ...
@@ -203,7 +203,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
203 203
         double var[MAX_LPC_ORDER+1], av_uninit(weight);
204 204
 
205 205
         for(pass=0; pass<lpc_passes; pass++){
206
-            av_init_lls(&m[pass&1], max_order);
206
+            avpriv_init_lls(&m[pass&1], max_order);
207 207
 
208 208
             weight=0;
209 209
             for(i=max_order; i<blocksize; i++){
... ...
@@ -212,7 +212,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
212 212
 
213 213
                 if(pass){
214 214
                     double eval, inv, rinv;
215
-                    eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1);
215
+                    eval= avpriv_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1);
216 216
                     eval= (512>>pass) + fabs(eval - var[0]);
217 217
                     inv = 1/eval;
218 218
                     rinv = sqrt(inv);
... ...
@@ -222,9 +222,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
222 222
                 }else
223 223
                     weight++;
224 224
 
225
-                av_update_lls(&m[pass&1], var, 1.0);
225
+                avpriv_update_lls(&m[pass&1], var, 1.0);
226 226
             }
227
-            av_solve_lls(&m[pass&1], 0.001, 0);
227
+            avpriv_solve_lls(&m[pass&1], 0.001, 0);
228 228
         }
229 229
 
230 230
         for(i=0; i<max_order; i++){
... ...
@@ -30,13 +30,13 @@
30 30
 
31 31
 #include "lls.h"
32 32
 
33
-void av_init_lls(LLSModel *m, int indep_count)
33
+void avpriv_init_lls(LLSModel *m, int indep_count)
34 34
 {
35 35
     memset(m, 0, sizeof(LLSModel));
36 36
     m->indep_count = indep_count;
37 37
 }
38 38
 
39
-void av_update_lls(LLSModel *m, double *var, double decay)
39
+void avpriv_update_lls(LLSModel *m, double *var, double decay)
40 40
 {
41 41
     int i, j;
42 42
 
... ...
@@ -48,7 +48,7 @@ void av_update_lls(LLSModel *m, double *var, double decay)
48 48
     }
49 49
 }
50 50
 
51
-void av_solve_lls(LLSModel *m, double threshold, int min_order)
51
+void avpriv_solve_lls(LLSModel *m, double threshold, int min_order)
52 52
 {
53 53
     int i, j, k;
54 54
     double (*factor)[MAX_VARS + 1] = (void *) &m->covariance[1][0];
... ...
@@ -105,7 +105,7 @@ void av_solve_lls(LLSModel *m, double threshold, int min_order)
105 105
     }
106 106
 }
107 107
 
108
-double av_evaluate_lls(LLSModel *m, double *param, int order)
108
+double avpriv_evaluate_lls(LLSModel *m, double *param, int order)
109 109
 {
110 110
     int i;
111 111
     double out = 0;
... ...
@@ -116,6 +116,25 @@ double av_evaluate_lls(LLSModel *m, double *param, int order)
116 116
     return out;
117 117
 }
118 118
 
119
+#ifndef FF_API_LLS_PRIVATE
120
+void av_init_lls(LLSModel *m, int indep_count)
121
+{
122
+    return avpriv_init_lls(m, indep_count);
123
+}
124
+void av_update_lls(LLSModel *m, double *param, double decay)
125
+{
126
+    return avpriv_update_lls(m, param, decay);
127
+}
128
+void av_solve_lls(LLSModel *m, double threshold, int min_order)
129
+{
130
+    return avpriv_solve_lls(m, threshold, min_order);
131
+}
132
+double av_evaluate_lls(LLSModel *m, double *param, int order)
133
+{
134
+    return avpriv_evaluate_lls(m, param, order);
135
+}
136
+#endif
137
+
119 138
 #ifdef TEST
120 139
 
121 140
 #include <stdio.h>
... ...
@@ -129,7 +148,7 @@ int main(void)
129 129
     AVLFG lfg;
130 130
 
131 131
     av_lfg_init(&lfg, 1);
132
-    av_init_lls(&m, 3);
132
+    avpriv_init_lls(&m, 3);
133 133
 
134 134
     for (i = 0; i < 100; i++) {
135 135
         double var[4];
... ...
@@ -139,10 +158,10 @@ int main(void)
139 139
         var[1] = var[0] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
140 140
         var[2] = var[1] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
141 141
         var[3] = var[2] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
142
-        av_update_lls(&m, var, 0.99);
143
-        av_solve_lls(&m, 0.001, 0);
142
+        avpriv_update_lls(&m, var, 0.99);
143
+        avpriv_solve_lls(&m, 0.001, 0);
144 144
         for (order = 0; order < 3; order++) {
145
-            eval = av_evaluate_lls(&m, var + 1, order);
145
+            eval = avpriv_evaluate_lls(&m, var + 1, order);
146 146
             printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
147 147
                    var[0], order, eval, sqrt(m.variance[order] / (i + 1)),
148 148
                    m.coeff[order][0], m.coeff[order][1],
... ...
@@ -37,9 +37,15 @@ typedef struct LLSModel {
37 37
     int indep_count;
38 38
 } LLSModel;
39 39
 
40
+void avpriv_init_lls(LLSModel *m, int indep_count);
41
+void avpriv_update_lls(LLSModel *m, double *param, double decay);
42
+void avpriv_solve_lls(LLSModel *m, double threshold, int min_order);
43
+double avpriv_evaluate_lls(LLSModel *m, double *param, int order);
44
+
45
+#ifndef FF_API_LLS_PRIVATE
40 46
 void av_init_lls(LLSModel *m, int indep_count);
41 47
 void av_update_lls(LLSModel *m, double *param, double decay);
42 48
 void av_solve_lls(LLSModel *m, double threshold, int min_order);
43 49
 double av_evaluate_lls(LLSModel *m, double *param, int order);
44
-
50
+#endif
45 51
 #endif /* AVUTIL_LLS_H */
... ...
@@ -79,6 +79,10 @@
79 79
 #ifndef FF_API_CPU_FLAG_MMX2
80 80
 #define FF_API_CPU_FLAG_MMX2            (LIBAVUTIL_VERSION_MAJOR < 53)
81 81
 #endif
82
+#ifndef FF_API_LLS_PRIVATE
83
+#define FF_API_LLS_PRIVATE              (LIBAVUTIL_VERSION_MAJOR < 53)
84
+#endif
85
+
82 86
 
83 87
 /**
84 88
  * @}