version update, bld tweaks, resize track booby, 10fps for images
[goodguy/cinelerra.git] / cinelerra-5.1 / mpeg2enc / stats.c
1 /* stats.c, coding statistics                                               */
2
3 /* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
4
5 /*
6  * Disclaimer of Warranty
7  *
8  * These software programs are available to the user without any license fee or
9  * royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims
10  * any and all warranties, whether express, implied, or statuary, including any
11  * implied warranties or merchantability or of fitness for a particular
12  * purpose.  In no event shall the copyright-holder be liable for any
13  * incidental, punitive, or consequential damages of any kind whatsoever
14  * arising from the use of these programs.
15  *
16  * This disclaimer of warranty extends to the user of these programs and user's
17  * customers, employees, agents, transferees, successors, and assigns.
18  *
19  * The MPEG Software Simulation Group does not represent or warrant that the
20  * programs furnished hereunder are free of infringement of any third-party
21  * patents.
22  *
23  * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
24  * are subject to royalty fees to patent holders.  Many of these patents are
25  * general enough such that they are unavoidable regardless of implementation
26  * design.
27  *
28  */
29
30 #include <stdio.h>
31 #include <math.h>
32 #include "config.h"
33 #include "global.h"
34
35 /* private prototypes */
36
37 void calcSNR(org,rec)
38 unsigned char *org[3];
39 unsigned char *rec[3];
40 {
41 }
42
43 #if 0
44 static void calcSNR1 _ANSI_ARGS_((unsigned char *org, unsigned char *rec,
45   int lx, int w, int h, double *pv, double *pe));
46
47 static void calcSNR1(org,rec,lx,w,h,pv,pe)
48 unsigned char *org;
49 unsigned char *rec;
50 int lx,w,h;
51 double *pv,*pe;
52 {
53   int i, j;
54   double v1, s1, s2, e2;
55
56   s1 = s2 = e2 = 0.0;
57
58   for (j=0; j<h; j++)
59   {
60     for (i=0; i<w; i++)
61     {
62       v1 = org[i];
63       s1+= v1;
64       s2+= v1*v1;
65       v1-= rec[i];
66       e2+= v1*v1;
67     }
68     org += lx;
69     rec += lx;
70   }
71
72   s1 /= w*h;
73   s2 /= w*h;
74   e2 /= w*h;
75
76   /* prevent division by zero in calcSNR() */
77   if(e2==0.0)
78     e2 = 0.00001;
79
80   *pv = s2 - s1*s1; /* variance */
81   *pe = e2;         /* MSE */
82 }
83 #endif
84
85 void stats()
86 {
87 }