Skip to content

Rewrite the API#44

Merged
shssoichiro merged 9 commits intomainfrom
many-refactors
Jan 5, 2026
Merged

Rewrite the API#44
shssoichiro merged 9 commits intomainfrom
many-refactors

Conversation

@shssoichiro
Copy link
Member

This rewrite has the following goals:

  • Remove code that is unrelated to storing frame data, such as the math module
  • Rework the public interface to focus on visible pixels first, rather than including padding first
    • This includes hiding access to padding data behind a Cargo feature
  • Ensure that data access is safe and performant
    • This is enabled by making sure we limit the number of ways to instantiate a frame, and that those ways are thoroughly validated. Currently the only way to initialize a Frame or Planes is through the FrameBuilder interface.
    • We want to avoid the current pattern where API users are accessing the raw data and using unsafe blocks to manually iterate over the visible pixels. Users should feel comfortable that v_frame's accessors are performant.

@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 97.25490% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.20%. Comparing base (c21abb1) to head (e4eeeb5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/plane.rs 95.52% 6 Missing ⚠️
src/frame.rs 99.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #44       +/-   ##
===========================================
+ Coverage   79.22%   97.20%   +17.97%     
===========================================
  Files           4        3        -1     
  Lines        1011      286      -725     
===========================================
- Hits          801      278      -523     
+ Misses        210        8      -202     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shssoichiro shssoichiro marked this pull request as ready for review December 14, 2025 06:52
@shssoichiro shssoichiro force-pushed the many-refactors branch 5 times, most recently from 62fe0f2 to 8e4a7cb Compare December 14, 2025 21:14
This rewrite has the following goals:
- Remove code that is unrelated to storing frame data, such as the
  `math` module
- Rework the public interface to focus on visible pixels first, rather
  than including padding first
  - This includes hiding access to padding data behind a Cargo feature
- Ensure that data access is safe and performant
  - This is enabled by making sure we limit the number of ways to
    instantiate a frame, and that those ways are thoroughly validated.
    Currently the only way to initialize a `Frame` or `Plane`s is
    through the `FrameBuilder` interface.
  - We want to avoid the current pattern where API users are accessing
    the raw data and using `unsafe` blocks to manually iterate over the
    visible pixels. Users should feel comfortable that v_frame's
    accessors are performant.
Copy link
Member

@lu-zero lu-zero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool, maybe we could also experiment with const-generics now that they are very stable?

@shssoichiro
Copy link
Member Author

Before merging, I'm going through av-scenechange to make sure this suits the needs there. (if it works in av-scenechange then it should be compatible with rav1e as well)

@shssoichiro shssoichiro marked this pull request as draft December 15, 2025 06:58
@shssoichiro shssoichiro marked this pull request as ready for review January 5, 2026 14:46
@shssoichiro
Copy link
Member Author

Finished getting av-scenechange updated to work with this. I had to copy a few utility structs like PlaneSlice over to that crate, but I think it makes sense to do so, and keep v_frame minimal. With that, that means this should be ready to squash and merge.

@shssoichiro shssoichiro merged commit 22e6cab into main Jan 5, 2026
9 checks passed
@shssoichiro
Copy link
Member Author

@lu-zero Followup thought I had on the bitdepth const generics: Although it's probably not worthwhile to apply it through the entire crate, I think it could be useful in certain hot functions, similar to how we might use it for block sizes in SAD/SATD.

image

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.

2 participants