Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fn Rav1dFrameContext_bd_fn::get: Replace field with lookups to static versions #752

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

kkysen
Copy link
Collaborator

@kkysen kkysen commented Feb 16, 2024

fn Rav1dFrameContext_bd_fn::new is const and pure, so we can have a pure bitdepth_max: c_int => &'static Rav1dFrameContext_bd_fn fn, thereby avoiding .clone()s and saving on memory.

See #748 (comment) and #748 (comment).

We can also do a similar thing for Rav1dDSPContext, but with it cached based on runtime CPU features.

@rinon rinon force-pushed the sjc/rav1dframecontext/remove_from_task_context branch from 0ea0911 to 2cbf114 Compare February 16, 2024 20:56
src/internal.rs Show resolved Hide resolved
@rinon
Copy link
Collaborator

rinon commented Feb 16, 2024

I like this idea of a static function pointer table, just a small comment. Needs rebasing now too.

Base automatically changed from sjc/rav1dframecontext/remove_from_task_context to main February 16, 2024 21:35
@kkysen kkysen force-pushed the kkysen/fn-Rav1dFrameContext_bd_fn-get branch from d119a91 to dbfbf5c Compare February 16, 2024 22:21
…elf` just from a `bpc` since it's a pure `fn`.
…kup through the existing `bitdepth_max` field, avoiding `.clone()`s and memory.
@kkysen kkysen force-pushed the kkysen/fn-Rav1dFrameContext_bd_fn-get branch from dbfbf5c to 9a7ee23 Compare February 16, 2024 22:22
@kkysen kkysen requested a review from rinon February 16, 2024 22:32
@kkysen kkysen merged commit 202c183 into main Feb 20, 2024
34 checks passed
@kkysen kkysen deleted the kkysen/fn-Rav1dFrameContext_bd_fn-get branch February 20, 2024 22:02
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