I am working on algorithm where i can have any number of 16 bit values(For instance i have 1000 16 bit values , and all are sensor data, so no particular series or repetition). I want to stuff all of this data into an 8 or a 10 byte array(each and every value of the 1000 16 bits numbers should be inside the 10 byte array) . The information should be such that i can also easily decode to read each and every value from the 1000 values. I have thought of using sin function by dividing the values by 100 so every data point would always be in 8 bits(0-1 sin value range) , but that only covers up small range of data and not huge number of values. Pardon me if i am asking for too much. I am just curious if its possible or not.
-
It's not really clear what you want to do? 8 or 10 bytes are enough to store 4 or 5 elements of 16 bit integers. You want to store 1000 values into 5 elements of an array? – Gerhardh Apr 23 '19 at 11:38
-
3It's quite unclear what you're asking, but if I understood correctly, the answer is "no, there is no way to do this". It should be pretty obvious that 1000 16 bit values cannot be stored in a 10 byte array. – Jabberwocky Apr 23 '19 at 11:44
-
8 to 10 bytes could name a file that contains your 1000 values. – jxh Apr 23 '19 at 11:49
-
" all are sensor data, so no particular series or repetition" is certainly not so. A true random number generator has "no particular series or repetition". Sensor data is not random. – chux - Reinstate Monica Apr 23 '19 at 12:14
1 Answers
The answer to this question is rather obvious with a little knowledge in information sciences. It is not possible to store that much information in so little memory, and the data you are talking about just contains too much information.
Some data, like repetitive data or data which is following some structure (like constantly rising values), contains very little information. The task of compression algorithms is to figure out the structure or repetition and instead of storing the pure data to store the structure or rule how to reproduce the data instead.
In your case, the data is coming from sensors and unless you are willing to lose a massive amount of information, you will not be able to generate a compressed version of it with a compression factor in the magnitude your are talking about (1000 × 2 bytes into 10 bytes). If your sensors more or less produce the same values all the time with just a little jitter, a good compression can be achieved (but for this your question is way to broad to be answered here) but it will probably never be in the range of reducing your 1000 values to 10 bytes.

- 56,346
- 20
- 107
- 159