Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove some allocations from HDR Decoder#1965

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
JulianKnodt wants to merge1 commit intoimage-rs:main
base:main
Choose a base branch
Loading
fromJulianKnodt:hdr_decoder

Conversation

@JulianKnodt
Copy link
Contributor

A larger change was proposed in#1599,
but this is intended tofix#1882 precisely.

It adds extra trait implementations toPixels, and removes the allocation while keeping the API the same.

@fintelia
Copy link
Contributor

I've only skimmed it, but this PR looks kinda hard to review because moves around a bunch of finicky code.

One thing that particularly stands out to me though is that it uses a macro to generate generic, unsafe trait impls, on a public type. That's both a public API addition and inserts new unsafe code to the library. Potentially hard to justify for a minor perf improvement

@JulianKnodt
Copy link
ContributorAuthor

JulianKnodt commentedJul 19, 2023
edited
Loading

One alternative is to create a clone of theimage_transform which instead returns the colors in place.

Other than exposing anunsafe impl directly to the users, it's also possible to directly transmute the underlying types at the point where the bytemuck cast was added. I wasn't sure if that would be more or less preferred.

@fintelia
Copy link
Contributor

Looking though this now, the PR basically just changes a memcpy into an unsafe transmute? That's not an improvement IMO. We'd ideally like this crate to be#[forbid(unsafe_code)], and while we're not quite there yet, I'd really rather not add any more unsafe in the meantime

@JulianKnodt
Copy link
ContributorAuthor

JulianKnodt commentedJul 19, 2023
edited
Loading

For me, as long as the unsafe code is entirely within the confines of the API and with controlled types, then it's fine to introduce. But that's a personal opinion, so I've ripped it out & should be cleaner now.

@JulianKnodtJulianKnodtforce-pushed thehdr_decoder branch 3 times, most recently from7f9b197 to94847faCompareJuly 19, 2023 16:16
@197g197g added the kind: slowNot wrong, but still unusable labelAug 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

kind: slowNot wrong, but still unusable

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Unnecessarymemset()+memcpy() in HDR decoding

3 participants

@JulianKnodt@fintelia@197g

[8]ページ先頭

©2009-2025 Movatter.jp