Bug 996

Summary: Allow different packing for logic datafeeds (dense packed channels)
Product: libsigrok Reporter: Stefan Brüns <stefan.bruens>
Component: APIAssignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: normal CC: marcus
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Stefan Brüns 2017-07-21 21:45:52 CEST
Currently, the logic datafeed format is fixed:

- All channels from a sample stored in a single integer
- A sample value corresponds to a single bit in the integer
- The bit index is determined by the physical channel number

The last point is problematic for three reasons:

- The sample size has to be larger than strictly necessary, e.g. recording the 11th channel requires use of 2 byte sample units, although 1 byte may suffice
- It forces repacking for e.g. Hameg HMO Scopes when only using the second POD (channels 9-16), as data for each POD is returned individually.
- It makes channel repacking for e.g. Saleae Logic (Pro) 16 more difficult - the device datastream omits unused channels, doing the same for the datafeed would allow using of bitshuffling instead of individual handling of each bit.

-> Add a format specifier for logic datafeeds, with for now 2 options:
a) CHANNEL_PACKING_PHYSICAL - e.g. bit 9 refers to physical channel 9
b) CHANNEL_PACKING_DENSE - e.g. bit 9 refers to the 9th enabled channel
Comment 1 Marcus Comstedt 2017-07-21 21:51:35 CEST
I don't quite follow how you would avoid individual bit handling for Logic (Pro) 16.  Even if the output format is dense, you would still need to pick one bit out each of n uint16_t:s to produce one sample of n channels.