diff options
author | BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com> | 2024-06-05 16:22:11 +0200 |
---|---|---|
committer | BlueCube3310 <53150244+BlueCube3310@users.noreply.github.com> | 2024-08-27 09:23:17 +0200 |
commit | 76c82116532223f8be75816786d7031c25af090e (patch) | |
tree | 0d3b2fb8cdb267bfc26d2adf19a916e621b27a1d /modules/cvtt/image_compress_cvtt.cpp | |
parent | db76de5de8a415b29be4c7dd84b99bd0fe260822 (diff) | |
download | redot-engine-76c82116532223f8be75816786d7031c25af090e.tar.gz |
Image: Add a method for detecting signed values
Diffstat (limited to 'modules/cvtt/image_compress_cvtt.cpp')
-rw-r--r-- | modules/cvtt/image_compress_cvtt.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 6b905c5ea1..2087dde2a1 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -174,17 +174,7 @@ void image_compress_cvtt(Image *p_image, Image::UsedChannels p_channels) { p_image->convert(Image::FORMAT_RGBH); } - const uint8_t *rb = p_image->get_data().ptr(); - - const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]); - int pixel_element_count = w * h * 3; - for (int i = 0; i < pixel_element_count; i++) { - if ((source_data[i] & 0x8000) != 0 && (source_data[i] & 0x7fff) != 0) { - is_signed = true; - break; - } - } - + is_signed = p_image->detect_signed(); target_format = is_signed ? Image::FORMAT_BPTC_RGBF : Image::FORMAT_BPTC_RGBFU; } else { p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert |