-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Yue Wang edited this page May 5, 2015
·
13 revisions
Welcome to the Compression wiki!
- Using
std::map<Char, Freq>as frequency table. - Note : move to frequency map , huffman tree not tested yet.
- class
Encoder: read a file and build a vector to hold content, for now just limited characters. - class
BitString: a sequential container to store data in bits, push back only. - protocol :
FrequencyTable|CompressedPart|Remainder-->
FrequencyTable|CompressedPart|Remainder|RemainderSizeSo the last bits that less than 8 should be append to Remainder part without compressing.
- 2 4 (8) 12 16
- Design for Version II
- Read file
charbycharand save all data as an largeBitString. - Split the
BitStringobject into anunsigned[], based on the size specified, like 1, 2, 3..16. - Construct a
FrqMap<unsigned int, FreqType>using theunsigned[]. - Construct a
HuffmanTreeusing theFrqMap. - Construct a
CodeMapusingHuffmanTree. - Traverse the
unsigned[]with looking upCodeMapand save the resulted into an outputBitString. - Split the output
BitStringintochar[]. - Output the
char[]as the compressed file.