]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavutil/lls.c
O_DIRECT works!!!
[frescor/ffmpeg.git] / libavutil / lls.c
index 6bf4d927860a59d17ddb53560bc431fc3f444edb..792ffa757633c6c35f0ccd178d069bd3ff79092b 100644 (file)
@@ -3,23 +3,25 @@
  *
  * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file lls.c
+ * @file libavutil/lls.c
  * linear least squares model
  */
 
 
 #include "lls.h"
 
-#ifdef TEST
-#define av_log(a,b,...) printf(__VA_ARGS__)
-#endif
-
 void av_init_lls(LLSModel *m, int indep_count){
     memset(m, 0, sizeof(LLSModel));
 
@@ -51,8 +49,8 @@ void av_update_lls(LLSModel *m, double *var, double decay){
 
 void av_solve_lls(LLSModel *m, double threshold, int min_order){
     int i,j,k;
-    double (*factor)[MAX_VARS+1]= &m->covariance[1][0];
-    double (*covar )[MAX_VARS+1]= &m->covariance[1][1];
+    double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
+    double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
     double  *covar_y            =  m->covariance[0];
     int count= m->indep_count;
 
@@ -111,7 +109,7 @@ double av_evaluate_lls(LLSModel *m, double *param, int order){
 #include <stdlib.h>
 #include <stdio.h>
 
-int main(){
+int main(void){
     LLSModel m;
     int i, order;
 
@@ -119,7 +117,7 @@ int main(){
 
     for(i=0; i<100; i++){
         double var[4];
-        double eval, variance;
+        double eval;
 #if 0
         var[1] = rand() / (double)RAND_MAX;
         var[2] = rand() / (double)RAND_MAX;
@@ -138,7 +136,7 @@ int main(){
         av_solve_lls(&m, 0.001, 0);
         for(order=0; order<3; order++){
             eval= av_evaluate_lls(&m, var+1, order);
-            av_log(NULL, AV_LOG_DEBUG, "real:%f order:%d pred:%f var:%f coeffs:%f %f %f\n",
+            printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
                 var[0], order, eval, sqrt(m.variance[order] / (i+1)),
                 m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
         }