Keep high-res images at 100% jpeg quality
This commit is contained in:
@@ -25,7 +25,8 @@ namespace OpenVulkano::AR
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr int JPEG_QUALITY = 85;
|
||||
constexpr int JPEG_QUALITY_DS = 85;
|
||||
constexpr int JPEG_QUALITY_FS = 100;
|
||||
|
||||
std::filesystem::path GeneratePath(const std::filesystem::path& baseDir, std::string_view name)
|
||||
{
|
||||
@@ -76,6 +77,7 @@ namespace OpenVulkano::AR
|
||||
tjhandle handle = tjInitCompress();
|
||||
const uint8_t* buffers[3];
|
||||
std::unique_ptr<uint8_t[]> dataBuffer;
|
||||
int jpegQuality = JPEG_QUALITY_FS;
|
||||
if (m_settings.downsampleColor && !highRes)
|
||||
{
|
||||
dataBuffer = YuvUtils::PlansFromNV12(static_cast<uint8_t*>(img.luminescenceOrColor.data), static_cast<uint8_t*>(img.uv.data),
|
||||
@@ -85,6 +87,7 @@ namespace OpenVulkano::AR
|
||||
buffers[0] = dataBuffer.get();
|
||||
buffers[1] = buffers[0] + sizeLum / 4;
|
||||
buffers[2] = buffers[1] + sizeUV / 4;
|
||||
jpegQuality = JPEG_QUALITY_DS; // Use lower quality for downsampled images
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,7 +100,7 @@ namespace OpenVulkano::AR
|
||||
|
||||
uint8_t* outBuffer = nullptr;
|
||||
unsigned long size = 0;
|
||||
if (tjCompressFromYUVPlanes(handle, buffers, resX, nullptr, resY, TJSAMP_420, &outBuffer, &size, JPEG_QUALITY, TJFLAG_FASTDCT)) [[unlikely]]
|
||||
if (tjCompressFromYUVPlanes(handle, buffers, resX, nullptr, resY, TJSAMP_420, &outBuffer, &size, jpegQuality, TJFLAG_FASTDCT)) [[unlikely]]
|
||||
Logger::AR->error("Failed to create JPEG! {}", tjGetErrorStr());
|
||||
else [[likely]]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user