Use block encoding to store intermediate selectors after endpoint quantization
This change simplifies further modification of the code. Explanation: This change is required for further optimization of the quantization code. Testing: The modified algorithm has been tested on the Kodak test set using 64-bit build with default settings (running on Windows 10, i7-4790, 3.6GHz). All the decompressed test images are identical to the images being compressed and decompressed using original version of Crunch. [Compressing Kodak set without mipmaps] Original: 1582222 bytes / 28.935 sec Modified: 1494501 bytes / 24.528 sec Improvement: 5.54% (compression ratio) / 15.23% (compression time) [Compressing Kodak set with mipmaps] Original: 2065243 bytes / 36.982 sec Modified: 1945365 bytes / 32.308 sec Improvement: 5.80% (compression ratio) / 12.64% (compression time)
This commit is contained in:
@@ -46,6 +46,7 @@ bool dxt5_endpoint_optimizer::compute(const params& p, results& r) {
|
||||
|
||||
if (m_unique_values.size() == 1) {
|
||||
r.m_block_type = 0;
|
||||
r.m_reordered = false;
|
||||
r.m_error = 0;
|
||||
r.m_first_endpoint = m_unique_values[0];
|
||||
r.m_second_endpoint = m_unique_values[0];
|
||||
@@ -101,6 +102,7 @@ bool dxt5_endpoint_optimizer::compute(const params& p, results& r) {
|
||||
}
|
||||
}
|
||||
|
||||
m_pResults->m_reordered = false;
|
||||
if (m_pResults->m_first_endpoint == m_pResults->m_second_endpoint) {
|
||||
for (uint i = 0; i < m_best_selectors.size(); i++)
|
||||
m_best_selectors[i] = 0;
|
||||
@@ -112,11 +114,13 @@ bool dxt5_endpoint_optimizer::compute(const params& p, results& r) {
|
||||
|
||||
if (m_pResults->m_first_endpoint > m_pResults->m_second_endpoint) {
|
||||
utils::swap(m_pResults->m_first_endpoint, m_pResults->m_second_endpoint);
|
||||
m_pResults->m_reordered = true;
|
||||
for (uint i = 0; i < m_best_selectors.size(); i++)
|
||||
m_best_selectors[i] = g_six_alpha_invert_table[m_best_selectors[i]];
|
||||
}
|
||||
} else if (!(m_pResults->m_first_endpoint > m_pResults->m_second_endpoint)) {
|
||||
utils::swap(m_pResults->m_first_endpoint, m_pResults->m_second_endpoint);
|
||||
m_pResults->m_reordered = true;
|
||||
for (uint i = 0; i < m_best_selectors.size(); i++)
|
||||
m_best_selectors[i] = g_eight_alpha_invert_table[m_best_selectors[i]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user