8000 Pass an Iterator as source (for BGR->RGB for example) · Issue #26 · bvibber/mtpng · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Pass an Iterator as source (for BGR->RGB for example) #26
Open
@Zerowalker

Description

@Zerowalker

Is it possible to add the ability to pass an iterator into the encoder (without having an effect on performance)?
I tried looking through the code but it was a bit too complex for me.

Why I ask is that in case you have BGR data, you currently have to convert it beforehand.
Which means going through everything just to convert it,
it's very fast though, but I would imagine it being faster if it could be done when the data is actually being encoded.

Here's an example of BGR to RGB:

pub fn bgr_to_rgb(b: &mut [u8]) {
    // swap R<->B to convert BGR->RGB
    b.chunks_exact_mut(3).for_each(|l| l.swap(0, 2));
}

Now if we could pass an iterator the swap could be done on-the-fly which might be more cache friendly as well.

Thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0