remove rayon

main
_ 2023-09-14 21:53:37 -05:00
parent 44a24d0d2d
commit cfae81c780
4 changed files with 10 additions and 81 deletions

72
Cargo.lock generated
View File

@ -632,40 +632,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
"memoffset 0.9.0",
"scopeguard",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.16" version = "0.8.16"
@ -809,12 +775,6 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]] [[package]]
name = "emath" name = "emath"
version = "0.22.0" version = "0.22.0"
@ -935,7 +895,6 @@ version = "0.1.0"
dependencies = [ dependencies = [
"eframe", "eframe",
"linuxvideo", "linuxvideo",
"rayon",
"thiserror", "thiserror",
"tokio", "tokio",
"zune-core", "zune-core",
@ -1396,15 +1355,6 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "memoffset"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
version = "0.2.1" version = "0.2.1"
@ -1854,28 +1804,6 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "rayon"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.3.5" version = "0.3.5"

View File

@ -8,7 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
eframe = "0.22.0" eframe = "0.22.0"
linuxvideo = { path = "deps/LinuxVideo" } linuxvideo = { path = "deps/LinuxVideo" }
rayon = "1.7.0"
thiserror = "1.0.48" thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["full"] } tokio = { version = "1.32.0", features = ["full"] }
zune-core = { path = "deps/zune-image/zune-core" } zune-core = { path = "deps/zune-image/zune-core" }

View File

@ -30,7 +30,7 @@ pub enum MsgToDriver
pub enum MsgToGui pub enum MsgToGui
{ {
NewRgbaFrame (RgbaFrame), NewRgbaFrame ((RgbaFrame, Instant)),
} }
pub struct Driver pub struct Driver
@ -101,7 +101,7 @@ impl Driver
{ {
MsgFromController::RepaintGui (rgba_frame) => MsgFromController::RepaintGui (rgba_frame) =>
{ {
self.send_to_gui.send (MsgToGui::NewRgbaFrame (rgba_frame)).await.ok (); self.send_to_gui.send (MsgToGui::NewRgbaFrame ((rgba_frame, Instant::now ()))).await.ok ();
self.gui_ctx.request_repaint(); self.gui_ctx.request_repaint();
}, },
MsgFromController::StartJpegDecoder (jpeg_frame) => MsgFromController::StartJpegDecoder (jpeg_frame) =>
@ -143,7 +143,10 @@ impl Driver
tokio::task::spawn_blocking (move || tokio::task::spawn_blocking (move ||
{ {
let mut data = vec! [0u8; capture.size_image()]; let mut data = vec! [0u8; capture.size_image()];
capture.wait_for_frame(&mut data).unwrap ();
let len = capture.wait_for_frame(&mut data).unwrap ();
data.resize (len, 0u8);
let frame = JpegFrame let frame = JpegFrame
{ {

View File

@ -120,10 +120,10 @@ impl eframe::App for App {
{ {
match msg match msg
{ {
MsgToGui::NewRgbaFrame (frame) => MsgToGui::NewRgbaFrame ((frame, _present_time)) =>
{ {
texture.set (egui::ColorImage::from_rgba_premultiplied([1280,720], &frame.data), Default::default ()); texture.set (egui::ColorImage::from_rgba_premultiplied([1280,720], &frame.data), Default::default ());
self.latency = Instant::now () - frame.capture_time; self.latency = std::cmp::max (self.latency, Instant::now () - frame.capture_time);
self.camera_frames += 1; self.camera_frames += 1;
// println! (" Camera"); // println! (" Camera");
}, },
@ -139,10 +139,11 @@ impl eframe::App for App {
self.camera_fps = self.camera_frames; self.camera_fps = self.camera_frames;
self.gui_frames = 0; self.gui_frames = 0;
self.camera_frames = 0; self.camera_frames = 0;
self.latency = Duration::default ();
self.next_stat_refresh += Duration::from_secs(1); self.next_stat_refresh += Duration::from_secs(1);
} }
ui.heading (format! ("{0}, {1}, {2}", self.camera_fps, self.gui_fps, self.latency.as_millis ())); ui.heading (format! ("{0}, latency {1} ms", self.camera_fps, self.latency.as_millis ()));
let available = ui.available_size() - egui::Vec2::new (0.0, 20.0); let available = ui.available_size() - egui::Vec2::new (0.0, 20.0);
let tex_size = egui::Vec2::new (texture.size()[0] as f32, texture.size()[1] as f32); let tex_size = egui::Vec2::new (texture.size()[0] as f32, texture.size()[1] as f32);
let scaled_width = available.y * tex_size.x / tex_size.y; let scaled_width = available.y * tex_size.x / tex_size.y;
@ -162,8 +163,6 @@ impl eframe::App for App {
// println! ("GUI"); // println! ("GUI");
ui.checkbox(&mut self.requesting_frames, "Run"); ui.checkbox(&mut self.requesting_frames, "Run");
// driver::sleep_ms (500);
}); });
} }
} }