This commit is contained in:
glenux 2005-10-31 07:42:04 +00:00
parent dac71a8592
commit ce438efb57
2 changed files with 12 additions and 4 deletions

View file

@ -6,7 +6,6 @@ namespace EydLib {
/* /*
class BitCompressorRle2 { class BitCompressorRle2 {
private: private:
BitGroup _last_group;
int _last_count; int _last_count;
std::list<BitGroup> _compressed; std::list<BitGroup> _compressed;
@ -20,7 +19,7 @@ namespace EydLib {
}; };
*/ */
BitCompressorRle2::BitCompressorRle2() { BitCompressorRle2::BitCompressorRle2(int size) : _rle(size) {
_last_count = 0; _last_count = 0;
_compressed.clear(); _compressed.clear();
} }
@ -32,7 +31,17 @@ namespace EydLib {
} }
void BitCompressorRle2::appendBit(bool bit){ void BitCompressorRle2::appendBit(bool bit){
if (!bit){
_last_count++;
} else {
// on écrit _last_count sur la sortie
if (_last_count > 0){
BitGroup result(_rle.size());
result.setValue(_last_count);
_compressed.push_back(result);
}
_last_count=0;
}
} }
void BitCompressorRle2::append(BitGroup data){ void BitCompressorRle2::append(BitGroup data){

View file

@ -18,7 +18,6 @@ namespace EydLib {
class BitCompressorRle2 { class BitCompressorRle2 {
private: private:
BitGroup _rle; BitGroup _rle;
BitGroup _last_group;
int _last_count; int _last_count;
int _group_size; int _group_size;
std::list<BitGroup> _compressed; std::list<BitGroup> _compressed;