Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From your example it seems that the few bits that change are not always the same (e.g. always the lowest 4). So I would suggest a simple run length encoding of the bits on the transposed array. Without having a distribution of your numbers/data, I would suggest to start with 4 bits for the length, but there you could try a little bit with some of your example inputs.</p> <p>The pseudocode (for compression) would look like this:</p> <pre><code> for bitpos = 0 to 31 for datapos = 0 to 255 BitString.append(getbit(data[datapos], bitpos); endfor endfor result=""; pos = 0; while (notEndOfString) # count 1s count = 0; while (pos &lt; 32*256 AND count &lt; 16 AND BitString[pos]==1) count++; pos++; endwhile result.append4BitNumber(count); # count 0s count = 0; while (pos &lt; 32*256 AND count &lt; 16 AND BitString[pos]==0) count++; pos++; endwhile result.append4BitNumber(count); endwhile </code></pre> <p>Maybe one could increase the compression by applying afterwards Lempel-Ziv or a Huffman encoding - but without more information about the distribution of the input data one can not say more (this holds for this problem in general - with a better information of the input data, one could tailor some kind of compression to it).</p> <p><strong>EDIT</strong>: Another easy approach would be to make an encoding of the changing bit positions: You start with your initial 32 bit word, then you store for every data word 3 bits defining how much bits change (i.e. 0..7), and afterwards you store 0..7 times 4 bits where the 4 bits encode the position of the chaning bit. That means when e.g. on average 2 bits change you need for your 32*256 bit packet 32+255*(3+8)=2837 => approx 35% of its original size.</p> <p>If you often have the same numbers of bits changing, some of these 4 bits pattern would appear very often, while others not at all => a Huffman coding on these 4 bits-groups would compress it optimal (if you know that these pattern probabilities would never change, you could even make a static Huffman tree, so you dont have to store it).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload