Skip to content

Commit

Permalink
[Mod] Extend IT sample compression test to also cover lower bit widths.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22451 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Dec 2, 2024
1 parent e12214b commit eb78951
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3987,12 +3987,22 @@ static void RunITCompressionTest(const std::vector<int8> &sampleData, FlagSet<Ch
static MPT_NOINLINE void TestITCompression()
{
// Test loading / saving of IT-compressed samples
const int sampleDataSize = 65536;
constexpr int sampleDataSize = 131072;
std::vector<int8> sampleData(sampleDataSize, 0);
for(int i = 0; i < sampleDataSize; i++)
{
sampleData[i] = mpt::random<int8>(*s_PRNG);
}
// Fade in the first half of the sample so that we test lower bit widths as well
for(int i = 0; i < sampleDataSize / 2; i++)
{
sampleData[i] = static_cast<int8>(Util::muldivr(sampleData[i], i, sampleDataSize / 2));
}
// Add a few irregularities to the signal to provoke temporary switches to higher bit width
for(int i = 99; i < sampleDataSize / 2; i += 100)
{
sampleData[i] ^= 99;
}

// Run each compression test with IT215 compression and without.
for(int i = 0; i < 2; i++)
Expand Down

0 comments on commit eb78951

Please sign in to comment.