Open thewyrdguy opened 5 years ago
Thank you for identifying this bug and providing a patch.
Personally I know very little about the SCP-ECG format, but your patch looks correct to me, except that in line 1970, '(p+4)' should again be '(p+5)'.
The original code certainly looks fishy, since p[3] is used as the high byte of the sampling interval and is then used again as the encoding type.
When running parsescp on the example file 'checkpkg/input/test.scp', version 10.6.2 outputs:
(Section 5) Encoding type: 7 <undefined, assuming second differences>
(Section 6) Encoding type: 7 <undefined, assuming second differences> Compression type: 2 <undefined, assuming bimodal>
whereas your version outputs:
(Section 5) Encoding type: 2 (second differences)
(Section 6) Encoding type: 2 (second differences) Compression type: 2 (non-bimodal)
So, it's quite possible that parsescp hasn't ever been tested with an input file that wasn't written in second-difference format. I'm not completely certain what "bimodal compression" is, but it doesn't look like parsescp does anything differently based on the value of that flag.
Do you have any more detail about the origin of the SCP files you're using and what hardware/software generated them? Do you have any example files (anonymized) that you can share?
I've attached a sample to the other ticket.
The title says it all. Encoding type it read from the second byte of sampling period, and compression byte is read from the encoding byte. Here is the patch: