-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AWGN resampler test #105
Comments
Wow, that's difficult. especially this code works fine on PC. |
We could add an option (e.g. ifdef) that dumps the necessary data to a file for such cases. |
Since the hardware architecture and compiler are the same, I can only imagine a bug in memory management in our code or some difference is stdlib functions, like random or math. |
ping @baranovmv, I've simply put several print to debug a problem: TEST(resampler, upscaling_twice_awgn) {
enum { ChMask = 0x1 };
MockReader reader;
Resampler resampler(reader, buffer_pool, allocator, config, ChMask);
CHECK(resampler.set_scaling(0.5f));
const size_t sig_len = 2048;
double buff[sig_len * 2];
size_t i;
for (size_t n = 0; n < InSamples; n++) {
const sample_t s = (sample_t)AWGN_generator();
reader.add(1, s);
}
// Put the spectrum of the resampled signal into buff.
// Odd elements are magnitudes in dB, even elements are phases in radians.
get_sample_spectrum1(resampler, buff, sig_len);
for (i = 0; i < sig_len - 1; i += 2) {
if (i <= sig_len * 0.90 / 2) {
if (buff[i] < -60) {
printf("i = %lu, buf[i] = %f\n", i, buff[i]);
}
/* CHECK(buff[i] >= -60); */
} else if (i >= sig_len * 1.00 / 2) {
if (buff[i] > -60) {
printf("i = %lu, buf[i] = %f\n", i, buff[i]);
}
/* CHECK(buff[i] <= -60); */
}
}
} And as a result:
A glimmer of hope: Does it tell something to you ? :) |
test_resampler.cpp: (TEST(resampler, upscaling_twice_awgn)) was skipped, because of a regular failure. There is a little magic here, because this test is passed on all other target platforms. Related: #105
I am not able to reproduce this bug, sorry. I suggest roc to hold this issue until someone will refactor the Resampler. |
It appeared that this test was just broken in several aspects and the problem was not specific to macOS. I was able to reproduce this on Linux too, by setting non-default random seed, e.g. adding The test has several problems:
What I've done (3f62f7a):
The test is now stable both on Linux and macOS. @baranovmv The 90% cut-off border and -60dB magnitude threshold were too optimistic for our resampler with this AWGN generator. I don't know where did the specific requirements come from. For now my goal is to make the test correct and stable. Then we can think whether the relaxed requirement are okay or we need some changes in the resampler or in the test. UPD: after a short discussion, it seems that the relaxed requirements are not great. I think we need to perform more testing on different resampler profiles and inputs. |
Closing this. We can discuss further action in #153. |
The result of last rebase on @baranovmv changes.
The text was updated successfully, but these errors were encountered: