From ce438efb576d3fc1f62b0733b1401232b17a747d Mon Sep 17 00:00:00 2001 From: glenux Date: Mon, 31 Oct 2005 07:42:04 +0000 Subject: [PATCH] --- src/lib/eyd_compressor_rle2.cpp | 15 ++++++++++++--- src/lib/eyd_compressor_rle2.hh | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/eyd_compressor_rle2.cpp b/src/lib/eyd_compressor_rle2.cpp index 590d3ad..f719ffc 100644 --- a/src/lib/eyd_compressor_rle2.cpp +++ b/src/lib/eyd_compressor_rle2.cpp @@ -6,7 +6,6 @@ namespace EydLib { /* class BitCompressorRle2 { private: - BitGroup _last_group; int _last_count; std::list _compressed; @@ -20,7 +19,7 @@ namespace EydLib { }; */ - BitCompressorRle2::BitCompressorRle2() { + BitCompressorRle2::BitCompressorRle2(int size) : _rle(size) { _last_count = 0; _compressed.clear(); } @@ -32,7 +31,17 @@ namespace EydLib { } 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){ diff --git a/src/lib/eyd_compressor_rle2.hh b/src/lib/eyd_compressor_rle2.hh index a00aeaf..73c8953 100644 --- a/src/lib/eyd_compressor_rle2.hh +++ b/src/lib/eyd_compressor_rle2.hh @@ -18,7 +18,6 @@ namespace EydLib { class BitCompressorRle2 { private: BitGroup _rle; - BitGroup _last_group; int _last_count; int _group_size; std::list _compressed;