Note that there are some explanatory texts on larger screens.

plurals
  1. POCompressing a byte array in Java and decompressing in C
    primarykey
    data
    text
    <p>I currently have the following array in a Java program, </p> <pre><code>byte[] data = new byte[800]; </code></pre> <p>and I'd like to compress it before sending it to a microcontroller over serial (115200 Baud). I would like to then decompress the array on the microcontroller in C. However, I'm not quite sure what the best way to do this is. Performance is an issue since the microcontroller is just an arduino so it can't be too memory/cpu intensive. The data is more or less random (<strong>edit</strong> I guess it's not really that random, see the edit below) I'd say since it represents a rgb color value for every 16 bits. </p> <p>What would be the best way to compress this data? Any idea how much compression I could possibly get?</p> <p><strong>edit</strong></p> <p>Sorry about the lack of info. I need the compression to be lossless and I do only intend to send 800 bytes at a time. My issue is that 800 bytes won't transfer fast enough at the rate of 115200 baud that I am using. I was hoping I could shrink the size a little bit to improve speed.</p> <p>Every two bytes looks like:</p> <p>0RRRRRGGGGGBBBBB</p> <p>Where R G and B bits represent the values for color channels red, green, and blue respectively. Every two bytes is then an individual LED on a 20x20 grid. I would imagine that many sets of two bytes would be identical since I frequently assign the same color codes to multiple LEDs. It may also be the case that RGB values are often > 15 since I typically use bright colors when I can (However, this might be a moot point since they are not all typically > 15 at once).</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.
 

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