rawspec_initialize needs better Nbps diagnosis and comment cleanup.
texadactyl opened this issue · 0 comments
texadactyl commented
// Validate Nbps. Zero silently defaults to 8 for backwards compatibility
// with pre-Nbps versions. Any other value except 8, or 16 is treated as 8
// and a warning is issued to stderr.
if(ctx->Nbps == 0) {
ctx->Nbps = 8;
} else if(ctx->Nbps != 8 && ctx->Nbps != 16) {
NbpsIsExpanded = ctx->Nbps == 4;
ctx->Nbps = 8;
}
Nbps = raw hdr NBITS. According to according to the raw file document https://github.com/UCBerkeleySETI/breakthrough/blob/master/doc/RAW-File-Format.md, 3 values are valid:
- "8": 1 sample occupying 2 bytes: 8-bit real, 8-bit imaginary
- "4" 1 sample occupying 1 byte: 4-bit real, 4-bit imaginary
- "2" 2 samples occupying 1 byte:
-- sample1: 2-bit real, 2-bit imaginary
-- sample2: 2-bit real, 2-bit imaginary
But, the above GPU code doesn't seem to match.
- 16, handled in gpu code, is not in the documentation. This is the case of 1 sample consisting of a 16-bit real and a 16-bit imaginary. Add to documentation.
- 2 is missing from gpu code. Update documentation to say "not currently supported".
- 0 is handled in GPU code (replaced with "8") but not mentioned in the document. Update documentation to mention backwards compatibility with pre-Nbps versions of raw header.
- Erroneous values (not 4, 8, or 16) should be diagnosed in gpu code and result in a return with 1 (error) to caller.