Skip to content

Commit 4c33872

Browse files
authored
Cleanup 10.3.23 (#71)
* Change crf lookup table * Checkbox for showing the features * Try updating bevy dependencies * Fixes for updated bevy dependencies * UI fixes for auto mode * Documentation, cleanup, and update deprecated calls * Update crate versions
1 parent 3f0d5da commit 4c33872

File tree

19 files changed

+195
-119
lines changed

19 files changed

+195
-119
lines changed

.idea/runConfigurations/Check_stable.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_adder_viz_dynamic.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adder-codec-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "adder-codec-core"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
authors = ["Andrew C. Freeman"]
66
description = """Core library for encoding/decoding ADΔER events

adder-codec-core/src/codec/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,8 @@ pub enum CodecError {
242242
#[cfg(feature = "compression")]
243243
#[error("Arithmetic coding error")]
244244
ArithmeticCodingError(#[from] arithmetic_coding::Error),
245+
246+
/// Vision application error
247+
#[error("Vision application error")]
248+
VisionError(String),
245249
}

adder-codec-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub enum TimeMode {
7272
}
7373

7474
/// The size of the image plane in pixels
75-
#[derive(Clone, Copy)]
75+
#[derive(Clone, Copy, Debug)]
7676
pub struct PlaneSize {
7777
width: u16,
7878
height: u16,
@@ -181,7 +181,7 @@ pub const D_ZERO_INTEGRATION: D = 254;
181181
/// Special symbol signifying no [`Event`] exists
182182
// pub const D_NO_EVENT: D = 253;
183183

184-
#[derive(Clone, Copy, PartialEq, Default)]
184+
#[derive(Clone, Copy, PartialEq, Default, Debug)]
185185
pub enum Mode {
186186
/// Preserve temporal coherence for framed inputs. When an event fires, the ticks
187187
/// remaining for that input frame (and its associated intensity) are discarded. The

adder-codec-rs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "adder-codec-rs"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
edition = "2021"
55
authors = ["Andrew C. Freeman"]
66
description = """Encoder/transcoder/decoder for ADΔER (Address, Decimation, Δt Event Representation) streams.
@@ -27,7 +27,7 @@ docs-only = ["opencv", "dep:fast-math", "adder-codec-core"]
2727

2828

2929
[dependencies]
30-
adder-codec-core = { path = "../adder-codec-core", version = "0.2.0", default-features = false, optional = true}
30+
adder-codec-core = { path = "../adder-codec-core", version = "0.2.1", default-features = false, optional = true}
3131
async-trait = "0.1.66"
3232
bincode = "1.3.3"
3333
bitvec = "1.0.1"

adder-codec-rs/src/bin/adder_video_player.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use adder_codec_rs::framer::scale_intensity::event_to_intensity;
66
use adder_codec_rs::transcoder::source::video::show_display_force;
77
use bitstream_io::{BigEndian, BitReader};
88
use clap::Parser;
9-
use ndarray::{Array, Array3};
9+
use ndarray::Array;
1010
use opencv::core::{create_continuous, Mat, MatTraitManual, CV_64F, CV_64FC3};
1111
use std::cmp::max;
1212
use std::error::Error;

adder-codec-rs/src/framer/driver.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ impl FramerBuilder {
134134
FrameSequence::<T>::new(self)
135135
}
136136

137+
/// Set whether to detect features.
137138
pub fn detect_features(mut self, detect_features: bool) -> FramerBuilder {
138139
self.detect_features = detect_features;
139140
self
@@ -231,7 +232,7 @@ pub struct FrameSequence<T> {
231232
/// The state of the frame sequence
232233
pub state: FrameSequenceState,
233234
pub(crate) frames: Vec<VecDeque<Frame<Option<T>>>>,
234-
pub frame_idx_offsets: Vec<i64>,
235+
pub(crate) frame_idx_offsets: Vec<i64>,
235236
pub(crate) pixel_ts_tracker: Vec<Array3<BigT>>,
236237
pub(crate) last_filled_tracker: Vec<Array3<i64>>,
237238
pub(crate) last_frame_intensity_tracker: Vec<Array3<T>>,
@@ -618,10 +619,12 @@ impl<T: Clone + Default + FrameValue<Output = T> + Serialize> FrameSequence<T> {
618619
true
619620
}
620621

622+
/// Get the instantaneous intensity for each pixel
621623
pub fn get_running_intensities(&self) -> &Array3<i32> {
622624
&self.running_intensities
623625
}
624626

627+
/// Get the features detected for the next frame, and pop that off the feature vec
625628
pub fn pop_features(&mut self) -> Option<Vec<Coord>> {
626629
self.features.push_back(vec![]);
627630
self.features.pop_front()

adder-codec-rs/src/transcoder/source/davis.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,9 @@ impl<W: Write + 'static> Integration<W> {
446446
for (e1, e2) in events.iter().tuple_windows() {
447447
video.encoder.ingest_event(*e1)?;
448448
if e2.delta_t != e1.delta_t {
449-
video.feature_test(e1);
449+
if let Err(e) = video.feature_test(e1) {
450+
return Err(CodecError::VisionError(e.to_string()));
451+
}
450452
}
451453
}
452454
}
@@ -568,9 +570,6 @@ impl<W: Write + 'static> Integration<W> {
568570
for events in &big_buffer {
569571
for (e1, e2) in events.iter().tuple_windows() {
570572
video.encoder.ingest_event(*e1)?;
571-
if e2.delta_t != e1.delta_t {
572-
video.feature_test(e1);
573-
}
574573
}
575574
}
576575

@@ -873,6 +872,10 @@ impl<W: Write + 'static + std::marker::Send> Source<W> for Davis<W> {
873872
ret
874873
}
875874

875+
fn crf(&mut self, crf: u8) {
876+
self.video.update_crf(crf, true);
877+
}
878+
876879
fn get_video_mut(&mut self) -> &mut Video<W> {
877880
&mut self.video
878881
}
@@ -894,7 +897,7 @@ impl<W: Write + 'static> VideoBuilder<W> for Davis<W> {
894897
}
895898

896899
fn crf(mut self, crf: u8) -> Self {
897-
self.video.update_crf(crf);
900+
self.video.update_crf(crf, false);
898901
self
899902
}
900903

@@ -963,8 +966,8 @@ impl<W: Write + 'static> VideoBuilder<W> for Davis<W> {
963966
self
964967
}
965968

966-
fn detect_features(mut self, detect_features: bool) -> Self {
967-
self.video = self.video.detect_features(detect_features);
969+
fn detect_features(mut self, detect_features: bool, show_features: bool) -> Self {
970+
self.video = self.video.detect_features(detect_features, show_features);
968971
self
969972
}
970973
}

adder-codec-rs/src/transcoder/source/framed.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ impl<W: Write + 'static> Source<W> for Framed<W> {
170170
})
171171
}
172172

173+
fn crf(&mut self, crf: u8) {
174+
self.video.update_crf(crf, true);
175+
}
176+
173177
fn get_video_mut(&mut self) -> &mut Video<W> {
174178
&mut self.video
175179
}
@@ -191,7 +195,7 @@ impl<W: Write + 'static> VideoBuilder<W> for Framed<W> {
191195
}
192196

193197
fn crf(mut self, crf: u8) -> Self {
194-
self.video.update_crf(crf);
198+
self.video.update_crf(crf, true);
195199
self
196200
}
197201

@@ -263,8 +267,8 @@ impl<W: Write + 'static> VideoBuilder<W> for Framed<W> {
263267
self
264268
}
265269

266-
fn detect_features(mut self, detect_features: bool) -> Self {
267-
self.video = self.video.detect_features(detect_features);
270+
fn detect_features(mut self, detect_features: bool, show_features: bool) -> Self {
271+
self.video = self.video.detect_features(detect_features, show_features);
268272
self
269273
}
270274
}

0 commit comments

Comments
 (0)