Skip to content

Commit c6b70f7

Browse files
committed
Update Block.cpp
~ Fixed streamSize prediction on Block size (was too low when not using RLE): changed from 8 bits per pixel to 16, as 16 is the actual max
1 parent b22be16 commit c6b70f7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Block.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,13 @@ void dc::Block<size>::createRLESequence(void) {
179179
*/
180180
template<size_t size>
181181
size_t dc::Block<size>::streamSize(void) const {
182-
return 4u // 4 bits for bit length
183-
+ (size * size * 8u); // Upper estimate for needed bits
182+
if (this->rle_Data == nullptr) {
183+
return 4u // 4 bits for bit length
184+
+ (size * size * 16u); // Upper estimate for needed bits
185+
} else {
186+
// Exact prediction if RLE sequence is known
187+
return 4u + (size * size * this->rle_Data->front()->data_bits);
188+
}
184189
}
185190

186191
/**

0 commit comments

Comments
 (0)