Logic Sniffer RLE
The OpenBench Logic Sniffer has the ability to encode its captured samples as RLE (Run-Length Encoding). This allows the Logic Sniffer to extends its total capture time with the same amount of memory.
Run-Length Encoding is a simple encoding scheme in which you count the consecutive occurrences of a sample and send this count value along with the sample value itself. RLE provides good results when capturing a signal that changes relatively slow with respect to the sample rate. An optimization to the RLE encoding scheme is that only counts greater than one are to be send thereby saving memory when the captured signal changes rapidly.
An example, suppose the following series of samples:
0 0001 0 0000 0 0000 0 0000 0 0000 0 0010 0 0010 0 0001
Assuming the most significant bit (bit 5, or the leftmost bit) is used to differentiate between a RLE-count and sample value, we can encode the above series with RLE as:
0 0001 0 0000 1 0100 <-- ! four times previous sample 0 0010 1 0010 <-- ! two times previous sample 0 0001
It is easily seen that the RLE encoded variant "saves" two samples with respect to the original sample series.
There are multiple implementations of the RLE encoding scheme used in various firmwares of the Logic Sniffer. It appears that the RLE encoding in the original SUMP client only supported 32-bit values (requiring all channel groups to be enabled). Some firmwares support 8-, 16- and 32-bit RLE counts.
Issues to resolve
As the number of alternative firmwares grow, subtle differences in the RLE implementations can/will occur. Clients either need to distinguish between the various firmware implementations, or all firmwares need to work similar. Some of these issues are:
- count rollovers; forum member DavidFrancis already pointed out several times that RLE count rollovers are handled differently by the various firmwares. For example, rasmus' firmware emits a sample value between each count rollover. This while dogsbody's firmware does not emit a sample value between count rollovers;
- count values; does a count value of 4 mean four times the previous sample, or four repetitions of the previous sample, making a total of five equal consecutive samples?