XTC reader: frames handed up as stored, streams indexed in parallel
The main loop's read (ReadRawImage) now hands a camera frame up as the
file stores it - 16-bit pixels, UINT16_WIDENED, as the marCCD reader
does - wherever there is no pixel offset to take off and no gain to
divide by; the GPU preprocessor widens it on the device. The host no
longer widens 3.7 Mpx to int32 per frame (the loop that was ~79% of
the main pass's user cycles). xtc::ReadFrame becomes xtc::ReadPixels,
the stored pixels only; the int32 decode (LoadImage, or an offset or
gain) widens them in one plain loop.
The streams are indexed in parallel (one worker per stream, up to the
hardware threads), merged in the order given: each index is a walk of
small reads, waiting on the disk one at a time.
Measured on a Rayonix MX340 run, 1920x1920 (RTX 5080, 5950X, page
cache warm, other agents' builds running; output identical but for the
known run-to-run flip of one observation on one set, which the
baseline shows between its own runs):
main pass, 2000 frames: 479 -> 789 frames/s (lcls222),
413 -> 477, 388 -> 452 (the two forms of
lcls242, there indexing-bound)
Step 1, 48 streams/82k frames: 34-51 s -> 2.4 s with the headers
warm, 58.2 s -> 5.7 s evicted from cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
This commit is contained in:
1 parent
b9ada7914b
commit
eb47013d4f
3 files changed
+45
-16
No files matched your search
+2
-9
@@ -146,18 +146,11 @@ Index IndexFile(const std::string &file) {
|
||||
return index;
|
||||
}
|
||||
|
||||
void ReadFrame(const Frame &frame, int32_t *out, std::vector<uint8_t> &scratch) {
|
||||
const size_t npixel = static_cast<size_t>(frame.width) * frame.height;
|
||||
scratch.resize(2 * npixel);
|
||||
void ReadPixels(const Frame &frame, uint16_t *out) {
|
||||
std::ifstream f = Open(frame.file);
|
||||
if (!ReadAt(f, frame.offset, scratch.data(), scratch.size()))
|
||||
if (!ReadAt(f, frame.offset, out, 2 * static_cast<size_t>(frame.width) * frame.height))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
frame.file + ": an image ends past the end of the file");
|
||||
for (size_t i = 0; i < npixel; i++) {
|
||||
uint16_t v;
|
||||
std::memcpy(&v, scratch.data() + 2 * i, 2);
|
||||
out[i] = static_cast<int32_t>(v) - static_cast<int32_t>(frame.pixel_offset);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace xtc
|
||||
Reference in new issue
Block a user