From: <sv...@op...> - 2024-12-02 18:09:34
|
Author: sagamusix Date: Mon Dec 2 19:09:28 2024 New Revision: 22451 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22451 Log: [Mod] Extend IT sample compression test to also cover lower bit widths. Modified: trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/test/test.cpp ============================================================================== --- trunk/OpenMPT/test/test.cpp Mon Dec 2 11:40:25 2024 (r22450) +++ trunk/OpenMPT/test/test.cpp Mon Dec 2 19:09:28 2024 (r22451) @@ -3987,12 +3987,22 @@ 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++) |