X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Flls.c;h=792ffa757633c6c35f0ccd178d069bd3ff79092b;hb=87d718aefc4f8f3d890c2a18f64706908f4ab107;hp=50a5003763d34b5497215a6073b23c381893d23e;hpb=408ec4e2a6c3fb40e14ac4f0fb2fb9e40ff3e6a3;p=ffmpeg diff --git a/libavutil/lls.c b/libavutil/lls.c index 50a5003763d..792ffa75763 100644 --- a/libavutil/lls.c +++ b/libavutil/lls.c @@ -3,23 +3,25 @@ * * Copyright (c) 2006 Michael Niedermayer * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 */ @@ -28,10 +30,6 @@ #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 #include -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]); }