History

swr-test: simplify prng code

Michael Niedermayer committed 14 years ago

Commit dcfc12e1 parent e5474f51 file · +5 −4Browse files

Unified · Split

libswresample/swresample_test.c+5−4
@@ -145,10 +145,11 @@ static void audiogen(void *data, enum AVSampleFormat sample_fmt, · 144 unmodified lines
145145 double tabf1[SWR_CH_MAX];
146146 double tabf2[SWR_CH_MAX];
147147 double taba[SWR_CH_MAX];
148− unsigned static seed;
148+ unsigned static rnd;
149149
150150 #define PUT_SAMPLE set(data, ch, k, channels, sample_fmt, v);
151−#define dbl_rand(x) ((seed = seed * 1664525 + 1013904223)*2.0 / (double)UINT_MAX - 1)
151+#define uint_rand(x) (x = x * 1664525 + 1013904223)
152+#define dbl_rand(x) (uint_rand(x)*2.0 / (double)UINT_MAX - 1)
152153 k = 0;
153154
154155 /* 1 second of single freq sinus at 1000 Hz */
@@ -187,8 +188,8 @@ static void audiogen(void *data, enum AVSampleFormat sample_fmt, · 32 unmodified lines
187188 /* 1 second of unrelated ramps for each channel */
188189 for (ch = 0; ch < channels; ch++) {
189190 taba[ch] = 0;
190− tabf1[ch] = 100 + (seed = seed * 1664525 + 1013904223) % 5000;
191− tabf2[ch] = 100 + (seed = seed * 1664525 + 1013904223) % 5000;
191+ tabf1[ch] = 100 + uint_rand(rnd) % 5000;
192+ tabf2[ch] = 100 + uint_rand(rnd) % 5000;
192193 }
193194 for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
194195 for (ch = 0; ch < channels; ch++) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t