diff options
author | Daniel Rakos <daniel.rakos@rastergrid.com> | 2019-05-08 16:43:12 +0200 |
---|---|---|
committer | Daniel Rakos <daniel.rakos@rastergrid.com> | 2019-05-08 16:45:29 +0200 |
commit | f61ab2fe83a6350bb05853d490cf226690484e97 (patch) | |
tree | 68375835e14336dd2cb56846e7b683d8024e8ee4 /modules/cvtt | |
parent | 0239d8bd9fa03965439aac2482d18746f807bd00 (diff) |
Enable BC6H compression for all HDR formats
Previously only RGBH formatted images were compressed to BC6H, this change
enables BC6H compression also for the RH, RGH, and RGBE9995 formats, allowing
1:2, 1:4, and 1:4 size reduction for them, respectively.
This is in particular important for HDRI images which usually come in RGBE9995
format.
Diffstat (limited to 'modules/cvtt')
-rw-r--r-- | modules/cvtt/image_compress_cvtt.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 0a70ff535f..024e9ffc3b 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -145,7 +145,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS int h = p_image->get_height(); bool is_ldr = (p_image->get_format() <= Image::FORMAT_RGBA8); - bool is_hdr = (p_image->get_format() == Image::FORMAT_RGBH); + bool is_hdr = (p_image->get_format() >= Image::FORMAT_RH) && (p_image->get_format() <= Image::FORMAT_RGBE9995); if (!is_ldr && !is_hdr) { return; // Not a usable source format @@ -175,6 +175,10 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS bool is_signed = false; if (is_hdr) { + if (p_image->get_format() != Image::FORMAT_RGBH) { + p_image->convert(Image::FORMAT_RGBH); + } + PoolVector<uint8_t>::Read rb = p_image->get_data().read(); const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]); |