Skip to content

Commit

Permalink
Update Block.cpp
Browse files Browse the repository at this point in the history
~ 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
  • Loading branch information
ThenTech committed Oct 15, 2018
1 parent b22be16 commit c6b70f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,13 @@ void dc::Block<size>::createRLESequence(void) {
*/
template<size_t size>
size_t dc::Block<size>::streamSize(void) const {
return 4u // 4 bits for bit length
+ (size * size * 8u); // Upper estimate for needed bits
if (this->rle_Data == nullptr) {
return 4u // 4 bits for bit length
+ (size * size * 16u); // Upper estimate for needed bits
} else {
// Exact prediction if RLE sequence is known
return 4u + (size * size * this->rle_Data->front()->data_bits);
}
}

/**
Expand Down

0 comments on commit c6b70f7

Please sign in to comment.