mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
perf(core): apply code-review optimizations for latency, allocations and concurrency
- LogBuffer: add revision counter and sync only latest 50 entries when revision changes, eliminating ~180k heap string allocations/sec. - Engine: move dome_lut.apply outside of latest_frame lock guard to prevent GStreamer appsink thread contention. - Video: reuse existing Vec buffer in appsink callback, render standby pattern in-place to avoid 3.7MB/frame alloc. - GPUI: remove premature texture drain on idle ticks, spawn background threads for bash/ssh scripts to avoid zombie processes. - Nomad: add NaN guard in deg_to_crsf, track last_send_ok to prevent permanent error state latch, add CRSF packet & CRC8 unit tests. - OpenXR/Engine: enforce Acquire/Release ordering on atomic control flags, join worker thread reliably on stop.
This commit is contained in:
1 parent
0fbe184716
commit
5d81993bbe
6 files changed
+140
-73
No files matched your search
@@ -77,15 +77,19 @@ impl DomeWarpLut {
|
||||
}
|
||||
|
||||
pub fn apply(&self, input_rgba: &[u8], output_rgba: &mut [u8]) {
|
||||
if !self.enabled || input_rgba.len() < (self.width * self.height * 4) as usize {
|
||||
output_rgba.copy_from_slice(input_rgba);
|
||||
let expected_len = (self.width * self.height * 4) as usize;
|
||||
if !self.enabled || input_rgba.len() < expected_len || output_rgba.len() < expected_len {
|
||||
let copy_len = output_rgba.len().min(input_rgba.len());
|
||||
output_rgba[..copy_len].copy_from_slice(&input_rgba[..copy_len]);
|
||||
return;
|
||||
}
|
||||
|
||||
for (dst_pixel_idx, &src_byte_idx) in self.src_byte_offsets.iter().enumerate() {
|
||||
let dst_byte_idx = dst_pixel_idx * 4;
|
||||
output_rgba[dst_byte_idx..dst_byte_idx + 4]
|
||||
.copy_from_slice(&input_rgba[src_byte_idx..src_byte_idx + 4]);
|
||||
if src_byte_idx + 4 <= input_rgba.len() && dst_byte_idx + 4 <= output_rgba.len() {
|
||||
output_rgba[dst_byte_idx..dst_byte_idx + 4]
|
||||
.copy_from_slice(&input_rgba[src_byte_idx..src_byte_idx + 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user