Re: what kind of compressor is best for...
- From: Thomas Richter <thor@xxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Jan 2010 11:42:34 +0100
jules Gilbert wrote:
Let me pose this problem and see if you can help me,
First, let me described the data. You can build this small test env.
int r1 = random() & 255;
int r2 = random() & 255;
int rr = r1 & r2;
buf[ptr++] = rr;
Given that random() delivers samples from a uniform i.i.d. random source, then bits in r1 & r2 (binary-and) have indeed probabilities 1/4 and 3/4. As symbol probabilities are not exact powers of two, Huffman coding is not directly applicable. Instead, you need arithmetic coding here for optimal results. Non-adaptive coding is sufficient here as the source is stationary. Don't do bzip2, you're just adding overhead for a source as simple as this.
As a side remark, random() is most likely a pseudo-random generator based on linear congruence. In this case, using masks to extract the lower bits generates pretty poor generators with a period of at most 256 (in your case), and thus not a very random source. Rather, try to use the upper bits instead.
- Prev by Date: Re: what kind of compressor is best for...
- Next by Date: Re: what kind of compressor is best for...
- Previous by thread: Re: what kind of compressor is best for...
- Next by thread: Re: what kind of compressor is best for...