35 |
|
|
36 |
#include <stdio.h> |
#include <stdio.h> |
37 |
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <sys/time.h> // for gettimeofday |
|
38 |
#include <string.h> // for memset |
#include <string.h> // for memset |
39 |
#include <assert.h> |
#include <assert.h> |
40 |
|
|
41 |
|
#ifndef WIN32 |
42 |
|
#include <sys/time.h> // for gettimeofday |
43 |
|
#else |
44 |
|
#include <time.h> |
45 |
|
#endif |
46 |
|
|
47 |
|
|
48 |
#include "xvid.h" |
#include "xvid.h" |
49 |
|
|
50 |
// inner guts |
// inner guts |
62 |
#include "bitstream/cbp.h" |
#include "bitstream/cbp.h" |
63 |
|
|
64 |
#include <math.h> |
#include <math.h> |
65 |
|
|
66 |
|
#ifndef M_PI |
67 |
|
#define M_PI 3.14159265358979323846 |
68 |
|
#endif |
69 |
|
|
70 |
const int speed_ref = 100; // on slow machines, decrease this value |
const int speed_ref = 100; // on slow machines, decrease this value |
71 |
|
|
72 |
/********************************************************************* |
/********************************************************************* |
76 |
/* returns time in micro-s*/ |
/* returns time in micro-s*/ |
77 |
double gettime_usec() |
double gettime_usec() |
78 |
{ |
{ |
79 |
|
#ifndef WIN32 |
80 |
struct timeval tv; |
struct timeval tv; |
81 |
gettimeofday(&tv, 0); |
gettimeofday(&tv, 0); |
82 |
return tv.tv_sec*1.0e6 + tv.tv_usec; |
return tv.tv_sec*1.0e6 + tv.tv_usec; |
83 |
|
#else |
84 |
|
clock_t clk; |
85 |
|
clk = clock(); |
86 |
|
return clk * 1000000 / CLOCKS_PER_SEC; |
87 |
|
#endif |
88 |
} |
} |
89 |
|
|
90 |
/* returns squared deviates (mean(v*v)-mean(v)^2) of a 8x8 block */ |
/* returns squared deviates (mean(v*v)-mean(v)^2) of a 8x8 block */ |