-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add binary capture file parser #396
Conversation
Parser for Agilent/Keysight/Rigol binary capture files
Leaks everywhere, I should learn proper memory management. Thanks for having a look, I'll fix those up soon. |
float sample = 0; | ||
for(size_t k=0; k<wh.samples; k++) | ||
{ | ||
if (dh.type == 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code can be optimized to avoid doing comparison in a big loop (which slow down process for nothing)
You can do the comparison before the for() and have 2 branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Data type check is now outside the loop.
This PR adds a parser for Agilent, Keysight and Rigol multi-channel binary waveform capture files.
I've added helper functions
ReadFromFile()
,BytesToInt()
,BytesToFloat()
andBytesToDouble()
to make parsing the file headers easier. I don't write C++ code all that often so let me know if there's a better way to do this.See related PR ngscopeclient/scopehal-apps#307 for changes to Import dialog.