This commit is contained in:
glenux 2005-10-30 23:36:20 +00:00
parent eb35c087db
commit 3a6dfba055

View file

@ -1,17 +1,17 @@
#include "eyd_compressor.hh" #include "eyd_compressor_rle1.hh"
namespace EydLib { namespace EydLib {
/* /*
class BitCompressor { class BitCompressorRle1 {
private: private:
BitGroup _last_group; BitGroup _last_group;
int _last_count; int _last_count;
std::list<BitGroup> _compressed; std::list<BitGroup> _compressed;
public: public:
BitCompressor(); BitCompressorRle1();
void clear(); void clear();
void append(BitGroup bg); void append(BitGroup bg);
@ -20,18 +20,18 @@ namespace EydLib {
}; };
*/ */
BitCompressor::BitCompressor(int size) : _rle(size) { BitCompressorRle1::BitCompressorRle1(int size) : _rle(size) {
_group_size = size; _group_size = size;
_last_count = 0; _last_count = 0;
} }
void BitCompressor::clear(){ void BitCompressorRle1::clear(){
// we clear everything // we clear everything
_last_count = 0; _last_count = 0;
_compressed.clear(); _compressed.clear();
} }
void BitCompressor::flushRleData(){ void BitCompressorRle1::flushRleData(){
BitGroup len(_group_size); BitGroup len(_group_size);
_compressed.push_back(_rle); _compressed.push_back(_rle);
printf("Last count %d\n", _last_count); printf("Last count %d\n", _last_count);
@ -42,7 +42,7 @@ namespace EydLib {
_last_count = 0; _last_count = 0;
} }
void BitCompressor::flushRawData(){ void BitCompressorRle1::flushRawData(){
int i; int i;
for (i=0; i<_last_count; i++){ for (i=0; i<_last_count; i++){
// on duplique les RLE trouvés // on duplique les RLE trouvés
@ -54,7 +54,7 @@ namespace EydLib {
_last_count = 0; _last_count = 0;
} }
void BitCompressor::append(BitGroup data){ void BitCompressorRle1::append(BitGroup data){
// take the data and make it smaller... // take the data and make it smaller...
if (_last_count > 0) { if (_last_count > 0) {
// there are data in the compressor // there are data in the compressor
@ -87,7 +87,7 @@ namespace EydLib {
_last_count++; _last_count++;
} }
std::list<BitGroup> BitCompressor::flush(){ std::list<BitGroup> BitCompressorRle1::flush(){
// we add the data from _last* to the outlist // we add the data from _last* to the outlist
std::list<BitGroup> result; std::list<BitGroup> result;
result = _compressed; result = _compressed;
@ -95,7 +95,7 @@ namespace EydLib {
return result; return result;
} }
bool BitCompressor::hasContent(){ bool BitCompressorRle1::hasContent(){
return (!_compressed.empty()); return (!_compressed.empty());
} }
} }