Skip to content

Commit

Permalink
Merge branch 'deps-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Oct 22, 2024
2 parents c545ac2 + c67f8e2 commit eb961fd
Show file tree
Hide file tree
Showing 55 changed files with 191 additions and 226 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ build-freemovr-calibration-webapp:
- echo $PATH
- rustup target add wasm32-unknown-unknown

- cargo install wasm-bindgen-cli --version 0.2.92 --force --locked
- cargo install wasm-bindgen-cli --version 0.2.95 --force --locked
- cargo install grass

- wasm-bindgen --version
Expand Down Expand Up @@ -1222,7 +1222,7 @@ braid-webapps:
# ... and install latest (and therefore matching) wasm-pack
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# ... and wasm-bindgen-cli
- cargo install wasm-bindgen-cli --version 0.2.92 --force --locked
- cargo install wasm-bindgen-cli --version 0.2.95 --force --locked
- cargo install grass
- rustup target add wasm32-unknown-unknown
- export PATH="$PATH:$CARGO_HOME/bin"
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ debug = true

[workspace.dependencies]
num-traits = "0.2"
simba = "0.9"
simba = { version = "0.9", default-features = false }
nalgebra = "0.33"
nalgebra-mvn = "0.15"
adskalman = "0.16"
Expand All @@ -150,6 +150,10 @@ serde = "1.0"
serde_yaml = "0.9"
chrono = { version = "0.4.35", default-features = false }
eyre = "0.6.12"
image = { version = "0.25", default-features = false }
rerun = { version = "0.19", default-features = false, features = ["sdk"] }
wasm-bindgen = { version = "0.2.95" }
web-sys = { version = "0.3.72" }

[replace]
# "tokio-threadpool:0.1.6" = {git="https://bare-git.strawlab.org/tokio.git", rev="472e64c1ea67f3976191cb1b291061faf2082735"}
Expand Down
2 changes: 1 addition & 1 deletion ads-webasm-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rust-version = "1.76"
crate-type = ["cdylib", "rlib"]

[dependencies]
wasm-bindgen = "0.2.92"
wasm-bindgen = { workspace = true }
js-sys = "0.3"
chrono = { version = "0.4.23", default-features = false, features = [
"clock",
Expand Down
4 changes: 2 additions & 2 deletions ads-webasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rust-version = "1.76"
yew = { version = "0.21.0", features = ["csr"] }
js-sys = "0.3"
gloo-file = "0.2"
wasm-bindgen = "0.2.92"
wasm-bindgen = { workspace = true }
serde = "1.0"
serde_yaml = "0.9"
serde_derive = "1.0"
Expand All @@ -30,7 +30,7 @@ rust-cam-bui-types = { path = "../rust-cam-bui-types" }
bui-backend-session-types = { path = "../bui-backend-session/types" }

[dependencies.web-sys]
version = "0.3"
workspace = true
features = [
"CanvasRenderingContext2d",
"Document",
Expand Down
2 changes: 1 addition & 1 deletion apriltag/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ machine-vision-formats = "0.1"

[dev-dependencies]
convert-image = { path = "../convert-image" }
image = { version = "0.24.2", default-features = false, features = ["jpeg"] }
image = { workspace = true, features = ["jpeg"] }
2 changes: 1 addition & 1 deletion apriltag/apriltag-track-movie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn run_cli(cli: Cli) -> Result<()> {
if false {
// This block for debugging ffmpeg video decoding.
let png_buf =
convert_image::frame_to_image(&decoded_mono8, convert_image::ImageOptions::Png)?;
convert_image::frame_to_encoded_buffer(&decoded_mono8, convert_image::ImageOptions::Png)?;
let fname = format!("frame{frame:09}.png");
println!("saving png {fname}");
let mut file = std::fs::File::create(&fname)?;
Expand Down
4 changes: 2 additions & 2 deletions braid-april-cal/braid-april-cal-webapp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ crate-type = ["cdylib", "rlib"]
yew = { version = "0.21.0", features = ["csr"] }
yew-tincture = "0.2.2"
js-sys = "0.3"
wasm-bindgen = "0.2.92"
web-sys = { version = "0.3", features = [
wasm-bindgen = { workspace = true }
web-sys = { workspace = true, features = [
"CssStyleDeclaration",
"HtmlAnchorElement",
"Url",
Expand Down
8 changes: 3 additions & 5 deletions braid-april-cal/braid-april-cal-webapp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,9 @@ fn download_file(orig_buf: &[u8], filename: &str) {
let array = js_sys::Array::new();
array.push(&b.buffer());

let blob = web_sys::Blob::new_with_u8_array_sequence_and_options(
&array,
web_sys::BlobPropertyBag::new().type_(mime_type),
)
.unwrap();
let options = web_sys::BlobPropertyBag::new();
options.set_type(mime_type);
let blob = web_sys::Blob::new_with_u8_array_sequence_and_options(&array, &options).unwrap();
let data_url = web_sys::Url::create_object_url_with_blob(&blob).unwrap();
let document = web_sys::window().unwrap().document().unwrap();
let anchor = document
Expand Down
5 changes: 1 addition & 4 deletions braid-april-cal/flytrax-apriltags-calibration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ anyhow = "1.0.71"
apriltag-sys = "0.3"
base64 = "0.6"
clap = { version = "4.3.4", features = ["derive"] }
image = { version = "0.24.2", default-features = false, features = [
"png",
"jpeg",
] }
image = { workspace = true, features = ["png", "jpeg"] }
machine-vision-formats = "0.1"
nalgebra = { workspace = true }
resvg = "0.19"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(crate) fn doit<P: AsRef<std::path::Path>>(
let rasterized = crate::tiny_skia_frame::Frame::new(pixmap)?;
let mut png_fname = std::path::PathBuf::from(out_fname.as_ref());
png_fname.set_extension("png");
let png_buf = convert_image::frame_to_image(&rasterized, convert_image::ImageOptions::Png)?;
let png_buf = convert_image::frame_to_encoded_buffer(&rasterized, convert_image::ImageOptions::Png)?;
std::fs::write(&png_fname, png_buf)?;
log::info!("Saved image for debugging to: {}", png_fname.display());
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion braid-process-video/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resvg = "0.19"
tagger = "4.0"
tiny-skia = "0.6.1"
usvg = { version = "0.19.0", default-features = false }
image = { version = "0.24.2", default-features = false, features = ["png"] }
image = { workspace = true, features = ["png"] }
base64 = "0.6"
ordered-float = "1"
regex = "1"
Expand Down
10 changes: 5 additions & 5 deletions braid-process-video/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl PerCamRender {
let (frame0_png_buf, width, height) = match frame_ref {
DynamicFrame::Mono8(frame_mono8) => {
let frame0_png_buf =
convert_image::frame_to_image(frame_mono8, convert_image::ImageOptions::Png)
convert_image::frame_to_encoded_buffer(frame_mono8, convert_image::ImageOptions::Png)
.unwrap()
.into();
(
Expand All @@ -261,7 +261,7 @@ impl PerCamRender {
}
DynamicFrame::RGB8(frame_rgb8) => {
let frame0_png_buf =
convert_image::frame_to_image(frame_rgb8, convert_image::ImageOptions::Png)
convert_image::frame_to_encoded_buffer(frame_rgb8, convert_image::ImageOptions::Png)
.unwrap()
.into();
(
Expand Down Expand Up @@ -303,7 +303,7 @@ impl PerCamRender {
)
.unwrap();
let frame0_png_buf =
convert_image::frame_to_image(&frame, convert_image::ImageOptions::Png)
convert_image::frame_to_encoded_buffer(&frame, convert_image::ImageOptions::Png)
.unwrap()
.into();

Expand Down Expand Up @@ -339,10 +339,10 @@ impl<'a> PerCamRenderFrame<'a> {
pub(crate) fn set_original_image(&mut self, frame: &DynamicFrame) -> Result<()> {
let png_buf = match frame {
basic_frame::DynamicFrame::Mono8(frame_mono8) => {
convert_image::frame_to_image(frame_mono8, convert_image::ImageOptions::Png)?
convert_image::frame_to_encoded_buffer(frame_mono8, convert_image::ImageOptions::Png)?
}
basic_frame::DynamicFrame::RGB8(frame_rgb8) => {
convert_image::frame_to_image(frame_rgb8, convert_image::ImageOptions::Png)?
convert_image::frame_to_encoded_buffer(frame_rgb8, convert_image::ImageOptions::Png)?
}
_ => {
panic!("only rgb8 and mono8 supported");
Expand Down
2 changes: 1 addition & 1 deletion braid-process-video/src/output_video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl<'lib> VideoStorage<'lib> {

// Write rasterized image to disk as PNG.
let png_buf =
convert_image::frame_to_image(&rasterized, convert_image::ImageOptions::Png)?;
convert_image::frame_to_encoded_buffer(&rasterized, convert_image::ImageOptions::Png)?;
std::fs::write(format!("frame{:05}.png", out_fno), png_buf)?;
}

Expand Down
1 change: 0 additions & 1 deletion braid/braid-run/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ bytes = "1.0"
clap = { version = "4.3.4", features = ["derive"] }
preferences-serde1 = "2.0.0"
qrcodegen = "1.4"
image = "0.24.2"
hyper = "1.1"
lazy_static = "1.4"
csv = "1.1"
Expand Down
4 changes: 2 additions & 2 deletions braid/braid-run/braid_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ log = "0.4"
wasm-logger = "0.2.0"
gloo-events = "0.1.1"
gloo-utils = "0.1"
wasm-bindgen = "0.2.92"
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
yew = { version = "0.21.0", features = ["csr"] }
Expand All @@ -33,7 +33,7 @@ rust-cam-bui-types = { path = "../../../rust-cam-bui-types" }
ads-webasm = { path = "../../../ads-webasm" }

[dependencies.web-sys]
version = "0.3"
workspace = true
features = [
"Event",
"EventSource",
Expand Down
10 changes: 5 additions & 5 deletions braid/braid-run/braid_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,16 +471,16 @@ fn view_model_server_link(opt_addr: &Option<std::net::SocketAddr>) -> Html {

async fn post_callback(msg: &BraidHttpApiCallback) -> Result<(), FetchError> {
use web_sys::{Request, RequestInit, Response};
let mut opts = RequestInit::new();
opts.method("POST");
opts.cache(web_sys::RequestCache::NoStore);
let opts = RequestInit::new();
opts.set_method("POST");
opts.set_cache(web_sys::RequestCache::NoStore);
let buf = serde_json::to_string(&msg).unwrap_throw();
opts.body(Some(&JsValue::from_str(&buf)));
opts.set_body(&JsValue::from_str(&buf));
let headers = web_sys::Headers::new().unwrap_throw();
headers
.append("Content-Type", "application/json")
.unwrap_throw();
opts.headers(&headers);
opts.set_headers(&headers);

let url = "callback";
let request = Request::new_with_str_and_init(url, &opts)?;
Expand Down
4 changes: 2 additions & 2 deletions braidz-export-rrd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ serde_yaml = "0.9"
color-eyre = "0.6.2"

tracing = "0.1.40"
rerun = "0.17.0"
rerun = { workspace = true, features = ["image"] }
image = { workspace = true, features = ["jpeg"] }
opencv-ros-camera = { workspace = true }
cam-geom = { workspace = true }
nalgebra = { workspace = true }
regex = "1.10.3"
ndarray = "0.15.6"
machine-vision-formats = "0.1.1"
rayon = "1.9.0"
opencv = { version = "0.88.8", optional = true }
Expand Down
43 changes: 9 additions & 34 deletions braidz-export-rrd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ use braidz_types::{camera_name_from_filename, CamNum};
use clap::{Parser, ValueEnum};
use color_eyre::eyre::{self as anyhow, WrapErr};
use frame_source::{ImageData, Timestamp};
use machine_vision_formats::{pixel_format, PixFmt};
use mp4_writer::Mp4Writer;
use mvg::rerun_io::{cam_geom_to_rr_pinhole_archetype as to_pinhole, AsRerunTransform3D};
use ndarray::Array;
use rayon::prelude::*;
use std::{collections::BTreeMap, path::PathBuf};

Expand Down Expand Up @@ -262,6 +260,7 @@ impl OfflineBraidzRerunLogger {
#[cfg(not(feature = "undistort-images"))]
{
let _ = intrinsics; // silence unused warning.
let _ = calibration; // silence unused warning.
tracing::error!(
"Support to undistortion images was not compiled. \
Images will be distorted but geometry will be linear."
Expand Down Expand Up @@ -482,7 +481,7 @@ impl OfflineBraidzRerunLogger {
fn to_rr_image(
im: ImageData,
undist_cache: Option<&UndistortionCache>,
) -> anyhow::Result<(rerun::Image, DynamicFrame)> {
) -> anyhow::Result<(rerun::EncodedImage, DynamicFrame)> {
let decoded = match im {
ImageData::Decoded(decoded) => decoded,
_ => anyhow::bail!("image not decoded"),
Expand All @@ -502,37 +501,13 @@ fn to_rr_image(
decoded
};

if true {
// jpeg compression
let contents = basic_frame::match_all_dynamic_fmts!(
&decoded,
x,
convert_image::frame_to_image(x, convert_image::ImageOptions::Jpeg(80),)
)?;
let format = Some(rerun::external::image::ImageFormat::Jpeg);
Ok((
rerun::Image::from_file_contents(contents, format).unwrap(),
decoded,
))
} else {
// Much larger file size but higher quality.
let w = decoded.width() as usize;
let h = decoded.height() as usize;

let image = match decoded.pixel_format() {
PixFmt::Mono8 => {
let mono8 = decoded.clone().into_pixel_format::<pixel_format::Mono8>()?;
Array::from_vec(mono8.into()).into_shape((h, w, 1)).unwrap()
}
_ => {
let rgb8 = decoded
.clone()
.into_pixel_format::<machine_vision_formats::pixel_format::RGB8>()?;
Array::from_vec(rgb8.into()).into_shape((h, w, 3)).unwrap()
}
};
Ok((rerun::Image::try_from(image)?, decoded))
}
// jpeg compression TODO: give open to save uncompressed?
let contents = basic_frame::match_all_dynamic_fmts!(
&decoded,
x,
convert_image::frame_to_encoded_buffer(x, convert_image::ImageOptions::Jpeg(80),)
)?;
Ok((rerun::EncodedImage::from_file_contents(contents), decoded))
}

fn main() -> anyhow::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion braidz-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ serde-xml-rs = "0.5.1"
hdrhistogram = "7.1"
base64 = "0.12"
ordered-float = "1"
image = {version = "0.24", default-features = false, features=["png"]}
image = { workspace = true, features=["png"]}
regex = "1.8.4"

csv-eof = {path="../csv-eof"}
Expand Down
7 changes: 5 additions & 2 deletions braidz-parser/src/incremental_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,11 @@ impl<R: Read + Seek> IncrementalParser<R, BasicInfoParsed> {
for cam_id in basics.cam_info.camid2camn.keys() {
let relname = format!("{}/{cam_id}.png", flydra_types::IMAGES_DIRNAME);
match self.archive.open(relname) {
Ok(rdr) => {
let decoder = image::codecs::png::PngDecoder::new(rdr)?;
Ok(mut rdr) => {
let mut buf = Vec::new();
rdr.read_to_end(&mut buf)?;
let cur = std::io::Cursor::new(buf);
let decoder = image::codecs::png::PngDecoder::new(cur)?;
let (w, h) = image::ImageDecoder::dimensions(&decoder);
result.insert(cam_id.clone(), (w as usize, h as usize));
}
Expand Down
16 changes: 0 additions & 16 deletions braidz-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,22 +557,6 @@ pub enum MaybeGzippedReader<'a> {
Gzipped(libflate::gzip::Decoder<zip_or_dir::FileReader<'a>>),
}

impl<'a> MaybeGzippedReader<'a> {
pub fn size(&self) -> u64 {
match self {
Self::Raw(f) => f.size(),
Self::Gzipped(gz) => gz.as_inner_ref().size(),
}
}

pub fn position(&self) -> u64 {
match self {
Self::Raw(f) => f.position(),
Self::Gzipped(gz) => gz.as_inner_ref().position(),
}
}
}

impl<'a> Read for MaybeGzippedReader<'a> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
match self {
Expand Down
4 changes: 2 additions & 2 deletions braidz-viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gloo = "0.8.0"
gloo-file = "0.2"
yew = { version = "0.21.0", features = ["csr"] }

wasm-bindgen = "0.2.92"
wasm-bindgen = { workspace = true }
js-sys = "0.3.28"
plotters = { version = "0.3.4", default-features = false, features = [
"bitmap_encoder",
Expand All @@ -40,7 +40,7 @@ braidz-parser = { path = "../braidz-parser" }
wasm-bindgen-futures = { version = "0.4.37" }

[dependencies.web-sys]
version = "0.3.64"
workspace = true
features = [
"Blob",
"DateTimeValue",
Expand Down
3 changes: 2 additions & 1 deletion ci2-pyloncxx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,8 @@ impl<'a> ci2::Camera for WrappedCamera<'a> {

let fno: usize = match self.framecounting_method {
FramecoutingMethod::BaslerGigE(ref mut i) => {
// Basler GigE cameras wrap after 65535 block
// Basler GigE cameras wrap after 65535 block. TODO: support
// "Extended ID" mode which does not have this wraparound.
if block_id < 30000 && i.previous_block_id > 30000 {
// check nothing crazy is going on
if (i.store_fno - i.last_rollover) < 30000 {
Expand Down
Loading

0 comments on commit eb961fd

Please sign in to comment.