Skip to content

Commit

Permalink
Merge branch 'main' into zehiko/tc-for-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
zehiko authored Nov 4, 2024
2 parents 1bcd40b + 045048f commit 74311fd
Show file tree
Hide file tree
Showing 67 changed files with 1,646 additions and 617 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,42 @@ jobs:
mode: minimum
count: 1
labels: "📊 analytics, 🟦 blueprint, 🪳 bug, 🌊 C++ API, CLI, codegen/idl, 🧑‍💻 dev experience, dependencies, 📖 documentation, 💬 discussion, examples, exclude from changelog, 🪵 Log & send APIs, 📉 performance, 🐍 Python API, ⛃ re_datastore, 🔍 re_query, 📺 re_viewer, 🔺 re_renderer, 🚜 refactor, ⛴ release, 🦀 Rust API, 🔨 testing, ui, 🕸️ web"

wasm-bindgen-check:
name: Check wasm-bindgen version
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.34.0

- name: Get current wasm-bindgen version
id: current-version
run: |
version=$(pixi run taplo get -f crates/viewer/re_viewer/Cargo.toml "target.*.dependencies.wasm-bindgen")
echo "current_version=$version" >> $GITHUB_OUTPUT
- name: Get previous wasm-bindgen version
id: previous-version
run: |
prev_ref=$(git rev-parse --abbrev-ref HEAD)
git checkout main
version=$(pixi run taplo get -f crates/viewer/re_viewer/Cargo.toml "target.*.dependencies.wasm-bindgen")
echo "previous_version=$version" >> $GITHUB_OUTPUT
git checkout $prev_ref
- name: Require label if versions changed
if: ${{ steps.current-version.outputs.current_version != steps.previous-version.outputs.previous_version }}
uses: mheap/github-action-required-labels@v3
with:
mode: exactly
count: 1
labels: "wasm-bindgen version update"
45 changes: 20 additions & 25 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ dependencies = [
"futures-io",
"futures-lite",
"parking",
"polling 3.7.3",
"polling",
"rustix",
"slab",
"tracing",
Expand Down Expand Up @@ -1110,7 +1110,7 @@ checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
dependencies = [
"bitflags 2.6.0",
"log",
"polling 3.7.3",
"polling",
"rustix",
"slab",
"thiserror",
Expand Down Expand Up @@ -2370,6 +2370,15 @@ dependencies = [
"simd-adler32",
]

[[package]]
name = "ffmpeg-sidecar"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bd1e249e0ceeb0f5c9f84a3c6941c3bde3ebc2815f4b94531a7e806af61c4c0"
dependencies = [
"anyhow",
]

[[package]]
name = "filetime"
version = "0.2.25"
Expand All @@ -2384,9 +2393,9 @@ dependencies = [

[[package]]
name = "fixed"
version = "1.27.0"
version = "1.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048"
checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a"
dependencies = [
"az",
"bytemuck",
Expand Down Expand Up @@ -3304,9 +3313,9 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"

[[package]]
name = "infer"
version = "0.15.0"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199"
checksum = "bc150e5ce2330295b8616ce0e3f53250e53af31759a9dbedad1621ba29151847"
dependencies = [
"cfb",
]
Expand Down Expand Up @@ -4715,22 +4724,6 @@ dependencies = [
"wasm-bindgen-futures",
]

[[package]]
name = "polling"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
dependencies = [
"autocfg",
"bitflags 1.3.2",
"cfg-if",
"concurrent-queue",
"libc",
"log",
"pin-project-lite",
"windows-sys 0.48.0",
]

[[package]]
name = "polling"
version = "3.7.3"
Expand Down Expand Up @@ -5946,6 +5939,7 @@ dependencies = [
"re_log",
"re_log_types",
"re_query",
"re_renderer",
"re_tracing",
"re_types_core",
"re_ui",
Expand Down Expand Up @@ -5998,14 +5992,14 @@ dependencies = [
name = "re_space_view_map"
version = "0.20.0-alpha.1+dev"
dependencies = [
"ahash",
"egui",
"glam",
"itertools 0.13.0",
"nohash-hasher",
"re_data_ui",
"re_entity_db",
"re_log",
"re_log_types",
"re_math",
"re_query",
"re_renderer",
"re_space_view",
Expand Down Expand Up @@ -6334,6 +6328,7 @@ dependencies = [
"criterion",
"crossbeam",
"econtext",
"ffmpeg-sidecar",
"indicatif",
"itertools 0.13.0",
"js-sys",
Expand Down Expand Up @@ -6552,7 +6547,7 @@ dependencies = [
"document-features",
"ewebsock",
"parking_lot",
"polling 2.8.0",
"polling",
"re_format",
"re_log",
"re_log_types",
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ econtext = "0.2" # Prints error contexts on crashes
ehttp = "0.5.0"
enumset = "1.0.12"
env_logger = { version = "0.10", default-features = false }
fixed = { version = "<1.28", default-features = false } # 1.28+ is MSRV 1.79+
ffmpeg-sidecar = "1.1.2"
fixed = { version = "1.28", default-features = false }
flatbuffers = "23.0"
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false }
Expand All @@ -192,7 +193,7 @@ image = { version = "0.25", default-features = false }
indent = "0.1"
indexmap = "2.1" # Version chosen to align with other dependencies
indicatif = "0.17.7" # Progress bar
infer = "0.15" # infer MIME type by checking the magic number signaturefer MIME type by checking the magic number signature
infer = "0.16" # infer MIME type by checking the magic number signaturefer MIME type by checking the magic number signature
insta = "1.23"
itertools = "0.13"
js-sys = "0.3"
Expand Down Expand Up @@ -223,7 +224,7 @@ pathdiff = "0.2"
pico-args = "0.5"
ply-rs = { version = "0.1", default-features = false }
poll-promise = "0.3"
polling = "2.2.0"
polling = "3.7.3"
pollster = "0.3"
prettyplease = "0.2"
proc-macro2 = { version = "1.0", default-features = false }
Expand Down Expand Up @@ -318,7 +319,7 @@ wgpu = { version = "22.1", default-features = false, features = [
wgpu-core = "22.1"
wgpu-types = "22.0"
xshell = "0.2"
zip = { version = "0.6", default-features = false }
zip = { version = "0.6", default-features = false } # We're stuck on 0.6 because https://crates.io/crates/protoc-prebuilt is still using 0.6


# ---------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion crates/build/re_types_builder/src/docs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{codegen::Target, Objects};

/// A high-level representation of the contetns of a flatbuffer docstring.
/// A high-level representation of the contents of a flatbuffer docstring.
#[derive(Debug, Clone)]
pub struct Docs {
/// All docmentation lines, including the leading tag, if any.
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_entity_db/src/store_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl StoreBundle {
/// One is created if it doesn't already exist.
pub fn entry(&mut self, id: &StoreId) -> &mut EntityDb {
self.entity_dbs.entry(id.clone()).or_insert_with(|| {
re_log::debug!("Creating new store: {id}");
re_log::trace!("Creating new store: '{id}'");
EntityDb::new(id.clone())
})
}
Expand All @@ -96,7 +96,7 @@ impl StoreBundle {

let mut blueprint_db = EntityDb::new(id.clone());

re_log::debug!("Creating a new blueprint {id}");
re_log::trace!("Creating a new blueprint '{id}'");

blueprint_db.set_store_info(re_log_types::SetStoreInfo {
row_id: *re_chunk::RowId::new(),
Expand Down
10 changes: 8 additions & 2 deletions crates/store/re_video/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ features = ["all"]


[features]
default = ["av1"]
default = ["av1", "ffmpeg"]

## Enable serialization for data structures that support it.
serde = ["dep:serde"]

## Native AV1 decoding.
av1 = ["dep:dav1d"]

## Decode H.264 using ffmpeg over CLI.
ffmpeg = ["dep:ffmpeg-sidecar"]

## Enable faster native video decoding with assembly.
## You need to install [nasm](https://nasm.us/) to compile with this feature.
nasm = [
Expand All @@ -49,9 +52,11 @@ econtext.workspace = true
itertools.workspace = true
parking_lot.workspace = true
re_mp4.workspace = true
serde = { workspace = true, optional = true }
thiserror.workspace = true

ffmpeg-sidecar = { workspace = true, optional = true }
serde = { workspace = true, optional = true }

# We enable re_rav1d on native, UNLESS we're on Linux Arm64
# See https://github.com/rerun-io/rerun/issues/7755
[target.'cfg(all(not(target_arch = "wasm32"), not(all(target_os = "linux", target_arch = "aarch64"))))'.dependencies]
Expand Down Expand Up @@ -83,6 +88,7 @@ web-sys = { workspace = true, features = [
] }

[dev-dependencies]
# For the `frames` example:
indicatif.workspace = true
criterion.workspace = true

Expand Down
1 change: 1 addition & 0 deletions crates/store/re_video/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ fn main() {
native: { not(target_arch = "wasm32") },
linux_arm64: { all(target_os = "linux", target_arch = "aarch64") },
with_dav1d: { all(feature = "av1", native, not(linux_arm64)) }, // https://github.com/rerun-io/rerun/issues/7755
with_ffmpeg: { all(feature= "ffmpeg", native) }
}
}
42 changes: 34 additions & 8 deletions crates/store/re_video/examples/frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use indicatif::ProgressBar;
use parking_lot::Mutex;

fn main() {
re_log::setup_logging();

// frames <video.mp4>
let args: Vec<_> = std::env::args().collect();
let Some(video_path) = args.get(1) else {
Expand Down Expand Up @@ -83,13 +85,20 @@ fn main() {
.create(true)
.truncate(true)
.open(output_dir.join(format!("{i:0width$}.ppm")))
.expect("failed to open file");
write_binary_ppm(
&mut file,
frame.content.width,
frame.content.height,
&frame.content.data,
);
.expect("failed to oformatpen file");

let frame = &frame.content;
match frame.format {
re_video::PixelFormat::Rgb8Unorm => {
write_ppm_rgb24(&mut file, frame.width, frame.height, &frame.data);
}
re_video::PixelFormat::Rgba8Unorm => {
write_ppm_rgba32(&mut file, frame.width, frame.height, &frame.data);
}
re_video::PixelFormat::Yuv { .. } => {
re_log::error_once!("YUV frame writing is not supported");
}
}
}
}
}
Expand All @@ -98,7 +107,24 @@ fn num_digits(n: usize) -> usize {
(n as f64).log10().floor() as usize + 1
}

fn write_binary_ppm(file: &mut File, width: u32, height: u32, rgba: &[u8]) {
fn write_ppm_rgb24(file: &mut File, width: u32, height: u32, rgb: &[u8]) {
assert_eq!(width as usize * height as usize * 3, rgb.len());

let header = format!("P6\n{width} {height}\n255\n");

let mut data = Vec::with_capacity(header.len() + width as usize * height as usize * 3);
data.extend_from_slice(header.as_bytes());

for rgb in rgb.chunks(3) {
data.extend_from_slice(&[rgb[0], rgb[1], rgb[2]]);
}

file.write_all(&data).expect("failed to write frame data");
}

fn write_ppm_rgba32(file: &mut File, width: u32, height: u32, rgba: &[u8]) {
assert_eq!(width as usize * height as usize * 4, rgba.len());

let header = format!("P6\n{width} {height}\n255\n");

let mut data = Vec::with_capacity(header.len() + width as usize * height as usize * 3);
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_video/src/decode/async_decoder_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl AsyncDecoderWrapper {
let comms = Comms::default();

let thread = std::thread::Builder::new()
.name("av1_decoder".into())
.name(format!("decoder of {debug_name}"))
.spawn({
let comms = comms.clone();
move || {
Expand Down
5 changes: 3 additions & 2 deletions crates/store/re_video/src/decode/av1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ impl SyncDav1dDecoder {
re_tracing::profile_function!();
econtext::econtext_function_data!(format!(
"chunk timestamp: {:?}",
chunk.composition_timestamp
chunk.presentation_timestamp
));

re_tracing::profile_scope!("send_data");
match self.decoder.send_data(
chunk.data,
None,
Some(chunk.composition_timestamp.0),
Some(chunk.presentation_timestamp.0),
Some(chunk.duration.0),
) {
Ok(()) => {}
Expand Down Expand Up @@ -255,6 +255,7 @@ fn create_frame(debug_name: &str, picture: &dav1d::Picture) -> Result<Frame> {
info: FrameInfo {
presentation_timestamp: Time(picture.timestamp().unwrap_or(0)),
duration: Time(picture.duration()),
..Default::default()
},
})
}
Expand Down
Loading

0 comments on commit 74311fd

Please sign in to comment.