Mercurial > libavcodec.hg
comparison fft-test.c @ 9295:b225f51903af libavcodec
Mark non-exported functions in test and example programs as static.
author | diego |
---|---|
date | Tue, 31 Mar 2009 09:32:59 +0000 |
parents | ea0e5e9a520f |
children | 2313bf51945b |
comparison
equal
deleted
inserted
replaced
9294:bf264662cd6b | 9295:b225f51903af |
---|---|
43 pim += (MUL16(are, bim) + MUL16(bre, aim));\ | 43 pim += (MUL16(are, bim) + MUL16(bre, aim));\ |
44 } | 44 } |
45 | 45 |
46 FFTComplex *exptab; | 46 FFTComplex *exptab; |
47 | 47 |
48 void fft_ref_init(int nbits, int inverse) | 48 static void fft_ref_init(int nbits, int inverse) |
49 { | 49 { |
50 int n, i; | 50 int n, i; |
51 double c1, s1, alpha; | 51 double c1, s1, alpha; |
52 | 52 |
53 n = 1 << nbits; | 53 n = 1 << nbits; |
62 exptab[i].re = c1; | 62 exptab[i].re = c1; |
63 exptab[i].im = s1; | 63 exptab[i].im = s1; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits) | 67 static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits) |
68 { | 68 { |
69 int n, i, j, k, n2; | 69 int n, i, j, k, n2; |
70 double tmp_re, tmp_im, s, c; | 70 double tmp_re, tmp_im, s, c; |
71 FFTComplex *q; | 71 FFTComplex *q; |
72 | 72 |
91 tabr[i].re = tmp_re; | 91 tabr[i].re = tmp_re; |
92 tabr[i].im = tmp_im; | 92 tabr[i].im = tmp_im; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 void imdct_ref(float *out, float *in, int nbits) | 96 static void imdct_ref(float *out, float *in, int nbits) |
97 { | 97 { |
98 int n = 1<<nbits; | 98 int n = 1<<nbits; |
99 int k, i, a; | 99 int k, i, a; |
100 double sum, f; | 100 double sum, f; |
101 | 101 |
109 out[i] = -sum; | 109 out[i] = -sum; |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 /* NOTE: no normalisation by 1 / N is done */ | 113 /* NOTE: no normalisation by 1 / N is done */ |
114 void mdct_ref(float *output, float *input, int nbits) | 114 static void mdct_ref(float *output, float *input, int nbits) |
115 { | 115 { |
116 int n = 1<<nbits; | 116 int n = 1<<nbits; |
117 int k, i; | 117 int k, i; |
118 double a, s; | 118 double a, s; |
119 | 119 |
127 output[k] = s; | 127 output[k] = s; |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 float frandom(void) | 132 static float frandom(void) |
133 { | 133 { |
134 AVLFG prn; | 134 AVLFG prn; |
135 av_lfg_init(&prn, 1); | 135 av_lfg_init(&prn, 1); |
136 return (float)((av_lfg_get(&prn) & 0xffff) - 32768) / 32768.0; | 136 return (float)((av_lfg_get(&prn) & 0xffff) - 32768) / 32768.0; |
137 } | 137 } |
138 | 138 |
139 int64_t gettime(void) | 139 static int64_t gettime(void) |
140 { | 140 { |
141 struct timeval tv; | 141 struct timeval tv; |
142 gettimeofday(&tv,NULL); | 142 gettimeofday(&tv,NULL); |
143 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; | 143 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; |
144 } | 144 } |
145 | 145 |
146 void check_diff(float *tab1, float *tab2, int n) | 146 static void check_diff(float *tab1, float *tab2, int n) |
147 { | 147 { |
148 int i; | 148 int i; |
149 double max= 0; | 149 double max= 0; |
150 double error= 0; | 150 double error= 0; |
151 | 151 |
160 } | 160 } |
161 av_log(NULL, AV_LOG_INFO, "max:%f e:%g\n", max, sqrt(error)/n); | 161 av_log(NULL, AV_LOG_INFO, "max:%f e:%g\n", max, sqrt(error)/n); |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 void help(void) | 165 static void help(void) |
166 { | 166 { |
167 av_log(NULL, AV_LOG_INFO,"usage: fft-test [-h] [-s] [-i] [-n b]\n" | 167 av_log(NULL, AV_LOG_INFO,"usage: fft-test [-h] [-s] [-i] [-n b]\n" |
168 "-h print this help\n" | 168 "-h print this help\n" |
169 "-s speed test\n" | 169 "-s speed test\n" |
170 "-m (I)MDCT test\n" | 170 "-m (I)MDCT test\n" |