Bug 1566

Summary: srzip input sends all data for one channel before any data for another channel
Product: libsigrok Reporter: Gerhard Sittig <Gerhard.Sittig>
Component: OtherAssignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Gerhard Sittig 2020-06-28 21:42:34 CEST
The current implementation of the session_driver.c code appears to read 
srzip input strictly by channel, providing all data for an individual 
channel before any data for another channel is sent. Which is fine for 
display or dump purposes, but may cause trouble for output modules like 
VCD and CSV which need to defer the output of sample data for a sample 
number until all data for that time was seen. Which translates to: must 
store _all_ data that happens to be in the srzip input file during the 
"merge sort" of the channels' samples.

This is not a blocker with the current mainline implementation. But will 
become a limiting element when mixed signal support for VCD gets added, or 
when CSV output gets fixed to handle analog data or mixed signal input.

Here is debug output from a development version to illustrate the situation:

$ sigrok-cli -i m2m-1.sr -O vcd -o m2m-2.vcd
sr: output/vcd: STATS: rcvd logic, snum 0, count 2000000
sr: output/vcd: STATS: rcvd analog A0, snum 0, count 1048560
sr: output/vcd: STATS: rcvd analog A0, snum 1048560, count 951440
sr: output/vcd: STATS: rcvd analog A1, snum 0, count 1048560
sr: output/vcd: STATS: rcvd analog A1, snum 1048560, count 951440
sr: output/vcd: STATS: rcvd analog A2, snum 0, count 1048560
sr: output/vcd: STATS: rcvd analog A2, snum 1048560, count 951440
sr: output/vcd: STATS: rcvd analog A3, snum 0, count 1048560
sr: output/vcd: STATS: rcvd analog A3, snum 1048560, count 951440
sr: output/vcd: STATS: rcvd analog A4, snum 0, count 1048560
sr: output/vcd: STATS: dumped, count 1048560, upto 1048560
sr: output/vcd: STATS: rcvd analog A4, snum 1048560, count 951440
sr: output/vcd: STATS: dumped, count 951440, upto 2000000
sr: output/vcd: STATS: rcvd df end
sr: output/vcd: STATS: dumped, count 1, upto 2000001