Basis Universal v1.13:

- Optimized ETC1S encoder (3-4.5x faster)
- Added optional SSE 4.1 support to encoder
- Switched from std::vector to a custom vector in the encoder and transcoder
- Added CppSPMD (SSE only for now)
- UASTC RDO is now more effective, but the command line parameter controlling qualiy has changed (to "lambda")
This commit is contained in:
Rich Geldreich
2021-03-09 11:00:25 -05:00
parent 4299495f77
commit 2d4fe933b2
38 changed files with 1457 additions and 528 deletions

View File

@@ -1,5 +1,5 @@
// basisu_enc.cpp
// Copyright (C) 2019-2020 Binomial LLC. All Rights Reserved.
// Copyright (C) 2019-2021 Binomial LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
#include "basisu_bc7enc.h"
#include "apg_bmp.h"
#include "jpgd.h"
#include <vector>
#if defined(_WIN32)
// For QueryPerformanceCounter/QueryPerformanceFrequency
@@ -33,6 +34,9 @@ namespace basisu
{
uint64_t interval_timer::g_init_ticks, interval_timer::g_freq;
double interval_timer::g_timer_freq;
#if BASISU_SUPPORT_SSE
bool g_cpu_supports_sse41;
#endif
uint8_t g_hamming_dist[256] =
{
@@ -53,10 +57,12 @@ namespace basisu
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
};
// Encoder library initialization (just call once at startup)
void basisu_encoder_init()
{
detect_sse41();
basist::basisu_transcoder_init();
pack_etc1_solid_color_init();
//uastc_init();
@@ -400,6 +406,8 @@ namespace basisu
if ((!has_alpha) || ((image_save_flags & cImageSaveIgnoreAlpha) != 0))
{
const uint64_t total_bytes = (uint64_t)img.get_width() * 3U * (uint64_t)img.get_height();
if (total_bytes > INT_MAX)
return false;
uint8_vec rgb_pixels(static_cast<size_t>(total_bytes));
uint8_t *pDst = &rgb_pixels[0];
@@ -464,7 +472,11 @@ namespace basisu
}
}
data.resize((size_t)filesize);
if (!data.try_resize((size_t)filesize))
{
fclose(pFile);
return false;
}
if (filesize)
{