Electronics > Projects, Designs, and Technical Stuff

On the fly data compression with 32 bit uC

<< < (3/4) > >>

oPossum:

--- Quote from: shafri on November 24, 2010, 05:15:57 am ---
any adc value spikes will ruin the rest of data.

--- End quote ---

No! There will be one or more wrong values, but the error is held over so it will correct when the data settles. It is essentially a low pass filter.

Note this line in the code:

prev_adc += delta;

That is very important.
Doing it this way...

prev_adc = adc;

would cause all readings following an overflow to be incorrect.

Mechatrommer:

--- Quote from: oPossum on November 24, 2010, 02:35:32 pm ---No! There will be one or more wrong values, but the error is held over so it will correct when the data settles. It is essentially a low pass filter.
prev_adc += delta;

--- End quote ---
correct! i just re-created it, a self-correcting algol, compromise only in the vicinity of spikes. not a 100% data match though, but brilliant!
ps: i abandoned it long time ago due to its lossy nature :P

TheDirty:
It would not be hard to make it lossless with an RLE type scheme, if you really needed it.

packet length | start value | delta | delta | delta...

Mechatrommer:
yes but more codes is needed to do the decision. if there are still more room for the mcu, it can as well do variable length coding if more compression is needed, where it try to do the smallest bit length first, and increase the bitlength as necessary based on behaviour of data coming. zad's link will be a good read.

oPossum:

--- Quote from: TheDirty on November 24, 2010, 04:50:20 pm ---It would not be hard to make it lossless with an RLE type scheme, if you really needed it.

packet length | start value | delta | delta | delta...

--- End quote ---

Hmm. Inspiration for this concept...

marker | absolute | delta | delta | delta...

The marker would be a special value outside the delta range. For example a signed 8 bit value can be -128 to 127. So use -127 to 127 for delta, and -128 for marker.

No limit on run length with this method. And no streaming problems (no need to know packet length at head of data block).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod