Skip to content

fix(scopes): compute waveform luma envelopes by image X column (#82) - #93

Merged
Mike-Solar merged 1 commit into
OakVideoEditorCommunity:mainfrom
liangshengsheng12333:fix/waveform-x-column-82
Nov 20, 2026
Merged

Mike-Solar merged 1 commit into
OakVideoEditorCommunity:mainfrom
liangshengsheng12333:fix/waveform-x-column-82

Conversation

@liangshengsheng12333

Copy link
Copy Markdown

Summary

Fixes #82.

Previously, waveform_envelope sliced the row-major luma buffer into contiguous 1D runs, which aggregated horizontal rows (Y) rather than vertical image columns (X). This PR updates the waveform math and connects frame dimensions from ScopeData through LumaDataSource so each output column aggregates every Y row at its corresponding image X coordinates.

Changes

  • crates/oak-app/src/widgets/scopes/math.rs:
    • Update waveform_envelope to take (samples, width, height, columns) and compute per-X-column (min, max) luma envelopes across all Y rows.
    • Handle non-divisible widths, tiny images (width < columns), empty frames, zero dimensions/columns, truncated buffers, and non-finite (NaN/±Inf) samples safely.
    • Add table-driven 2D unit tests covering top/bottom splits, left/right splits, non-divisible widths, tiny images, and degenerate inputs.
  • crates/oak-app/src/oakui/scopes.rs:
    • Store width and height on ScopeData and populate them in analyze_f32_rgba and analyze_bgra8.
    • Update analyzed_samples_feed_the_scope_math for 2D X-column semantics and add a left/right split test via analyze_bgra8.
  • crates/oak-app/src/widgets/scopes/mod.rs & crates/oak-app/src/panels/program_viewer.rs:
    • Add LumaDataSource::luma_dimensions and propagate ScopeData dimensions through ScopeState to Waveform::envelope (leaving Histogram and Vectorscope behavior unchanged).
  • crates/oak-app/src/panels/program_viewer/tests.rs:
    • Assert that ScopeState receives the expected frame width and height.

Testing

  • rustc --edition 2024 --test on math.rs and oakui/scopes.rs: 15/15 unit tests passed.
  • rustfmt --edition 2024 --check on all modified files: passed.
  • python tooling/check_sdk_consumers.py: passed.
  • Note: Full workspace cargo test relies on CI (local checkout lacks the quercus-engine submodule and FFmpeg cache).

@Mike-Solar
Mike-Solar merged commit fa5ff69 into OakVideoEditorCommunity:main Nov 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v0.6] Waveform: compute luma envelopes by image X column

2 participants