History

swr-test: simplify prng code

Michael Niedermayer committed 14 years ago

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

Showing the changes to libswresample (1 of 1 file). Show all

Unified · Split

libswresample/swresample_test.c+5−4
@@ -145,10 +145,11 @@ static void audiogen(void *data, enum AVSampleFormat sample_fmt, · 144 unmodified lines
145 double tabf1[SWR_CH_MAX];145 double tabf1[SWR_CH_MAX];
146 double tabf2[SWR_CH_MAX];146 double tabf2[SWR_CH_MAX];
147 double taba[SWR_CH_MAX];147 double taba[SWR_CH_MAX];
148 unsigned static seed;148 unsigned static rnd;
149 149
150#define PUT_SAMPLE set(data, ch, k, channels, sample_fmt, v);150#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)
152 k = 0;153 k = 0;
153 154
154 /* 1 second of single freq sinus at 1000 Hz */155 /* 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
187 /* 1 second of unrelated ramps for each channel */188 /* 1 second of unrelated ramps for each channel */
188 for (ch = 0; ch < channels; ch++) {189 for (ch = 0; ch < channels; ch++) {
189 taba[ch] = 0;190 taba[ch] = 0;
190 tabf1[ch] = 100 + (seed = seed * 1664525 + 1013904223) % 5000;191 tabf1[ch] = 100 + uint_rand(rnd) % 5000;
191 tabf2[ch] = 100 + (seed = seed * 1664525 + 1013904223) % 5000;192 tabf2[ch] = 100 + uint_rand(rnd) % 5000;
192 }193 }
193 for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {194 for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
194 for (ch = 0; ch < channels; ch++) {195 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