Skip to content

Commit

Permalink
Format again
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Feb 12, 2024
1 parent 70f52a9 commit 1b692eb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
29 changes: 16 additions & 13 deletions crates/gui/src/bin/ntsc-rs-standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1373,8 +1373,7 @@ impl NtscApp {
control_row(
ui,
|ui| {
let selected_index =
descriptor.id.get_field_enum(effect_settings).unwrap();
let selected_index = descriptor.id.get_field_enum(effect_settings).unwrap();
let selected_item = options
.iter()
.find(|option| option.index == selected_index)
Expand All @@ -1383,10 +1382,8 @@ impl NtscApp {
.selected_text(selected_item.label)
.show_ui(ui, |ui| {
for item in options {
let mut label = ui.selectable_label(
selected_index == item.index,
item.label,
);
let mut label = ui
.selectable_label(selected_index == item.index, item.label);

if let Some(desc) = item.description {
label = label.on_hover_text(desc);
Expand Down Expand Up @@ -1433,20 +1430,19 @@ impl NtscApp {
let mut value = 0i32;
if let Some(v) = descriptor.id.get_field_mut::<i32>(effect_settings) {
value = *v;
} else if let Some(v) = descriptor.id.get_field_mut::<u32>(effect_settings)
{
} else if let Some(v) = descriptor.id.get_field_mut::<u32>(effect_settings) {
value = *v as i32;
}

let slider = ui.add(
egui::Slider::new(&mut value, range.clone()).custom_parser(parse_expression_string),
egui::Slider::new(&mut value, range.clone())
.custom_parser(parse_expression_string),
);

if slider.changed() {
if let Some(v) = descriptor.id.get_field_mut::<i32>(effect_settings) {
*v = value;
} else if let Some(v) =
descriptor.id.get_field_mut::<u32>(effect_settings)
} else if let Some(v) = descriptor.id.get_field_mut::<u32>(effect_settings)
{
*v = value as u32;
}
Expand Down Expand Up @@ -1541,9 +1537,16 @@ impl NtscApp {
let mut changed = false;
for descriptor in descriptors {
// The "Use field" setting has no effect on interlaced video.
let (response, setting_changed) = if descriptor.id == SettingID::USE_FIELD && interlace_mode != VideoInterlaceMode::Progressive {
let (response, setting_changed) = if descriptor.id == SettingID::USE_FIELD
&& interlace_mode != VideoInterlaceMode::Progressive
{
let resp = ui.add_enabled_ui(false, |ui| {
Self::setting_from_descriptor(ui, effect_settings, descriptor, VideoInterlaceMode::Progressive)
Self::setting_from_descriptor(
ui,
effect_settings,
descriptor,
VideoInterlaceMode::Progressive,
)
});

resp.inner
Expand Down
6 changes: 5 additions & 1 deletion crates/gui/src/gst_utils/egui_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ impl EguiSink {
let _ = self.update_texture();
}

fn apply_effect(&self, vframe: &VideoFrame<Readable>, image: &mut ColorImage) -> Result<(), gstreamer::FlowError> {
fn apply_effect(
&self,
vframe: &VideoFrame<Readable>,
image: &mut ColorImage,
) -> Result<(), gstreamer::FlowError> {
let out_stride = image.width() * 4;
process_gst_frame::<u8, Rgbx8>(
&vframe.as_video_frame_ref(),
Expand Down
3 changes: 2 additions & 1 deletion crates/ntscrs/src/f32x4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
fmt::Debug,
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}, sync::OnceLock,
ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign},
sync::OnceLock,
};

/// A trait for 4-wide single-precision floating point SIMD vectors, for both NEON and AVX.
Expand Down
5 changes: 1 addition & 4 deletions crates/ntscrs/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ impl TransferFunction {
// Zero-pad the numerator from the right
num.resize(den.len(), 0.0);

TransferFunction {
num,
den,
}
TransferFunction { num, den }
}

pub fn should_use_row_chunks(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion crates/ntscrs/src/ntsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn filter_plane_with_rows<const ROWS: usize>(

let mut initial_rows: [f32; ROWS] = [0f32; ROWS];
for i in 0..ROWS {
initial_rows[i] = match initial {
initial_rows[i] = match initial {
InitialCondition::Zero => 0.0,
InitialCondition::Constant(c) => c,
InitialCondition::FirstSample => rows[i][0],
Expand Down

0 comments on commit 1b692eb

Please sign in to comment.