From eb7895177106941d62c9114e79b64235f6ece9f5 Mon Sep 17 00:00:00 2001 From: Johannes Schultz Date: Mon, 2 Dec 2024 18:09:28 +0000 Subject: [PATCH] [Mod] Extend IT sample compression test to also cover lower bit widths. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22451 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- test/test.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test.cpp b/test/test.cpp index 9d173348cb..116bcc9be4 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -3987,12 +3987,22 @@ static void RunITCompressionTest(const std::vector &sampleData, FlagSet sampleData(sampleDataSize, 0); for(int i = 0; i < sampleDataSize; i++) { sampleData[i] = mpt::random(*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(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++)