Commit c843ec53 for libheif
commit c843ec5397643240af2ca30f1850989208e0d9a7
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Mon Feb 9 19:41:30 2026 +0100
unci: fix byte and component order
diff --git a/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc b/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
index 7d52e575..42f1b6ec 100644
--- a/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
@@ -104,7 +104,7 @@ Error unc_decoder_block_pixel_interleave::decode_tile(const std::vector<uint8_t>
if (!pad_lsb) {
uint32_t bit_offset = 0;
for (uint32_t i = 0; i < num_components; i++) {
- uint32_t idx = reversed ? (num_components - 1 - i) : i;
+ uint32_t idx = reversed ? i : (num_components - 1 - i);
comp[idx].shift = bit_offset;
bit_offset += components[idx].component_bit_depth;
}
@@ -113,7 +113,7 @@ Error unc_decoder_block_pixel_interleave::decode_tile(const std::vector<uint8_t>
uint32_t total_bits = block_size * 8;
uint32_t bit_offset = total_bits;
for (uint32_t i = 0; i < num_components; i++) {
- uint32_t idx = reversed ? (num_components - 1 - i) : i;
+ uint32_t idx = reversed ? i : (num_components - 1 - i);
bit_offset -= components[idx].component_bit_depth;
comp[idx].shift = bit_offset;
}
diff --git a/libheif/codecs/uncompressed/unc_encoder_rgb_hdr_packed_interleave.cc b/libheif/codecs/uncompressed/unc_encoder_rgb_hdr_packed_interleave.cc
index e27e734a..888bcebe 100644
--- a/libheif/codecs/uncompressed/unc_encoder_rgb_hdr_packed_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_encoder_rgb_hdr_packed_interleave.cc
@@ -64,8 +64,9 @@ unc_encoder_rgb_hdr_packed_interleave::unc_encoder_rgb_hdr_packed_interleave(con
m_uncC->set_interleave_type(interleave_mode_pixel);
m_uncC->set_pixel_size(m_bytes_per_pixel);
+ m_uncC->set_block_size(m_bytes_per_pixel);
m_uncC->set_sampling_type(sampling_mode_no_subsampling);
- m_uncC->set_components_little_endian(true);
+ m_uncC->set_block_little_endian(true);
m_uncC->add_component({0, bpp, component_format_unsigned, 0});
m_uncC->add_component({1, bpp, component_format_unsigned, 0});