-
Notifications
You must be signed in to change notification settings - Fork 605
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
Implement a rows()
iterator on SubImage
#2300
Comments
What would be the return type of this function? |
rows()
iterator on GenericImageView
rows()
iterator on SubImage
Ah, you are correct! With GenericImageView we have no guarantee that pixels in a row are laid out in memory contiguously. We can however guarantee this about the |
The I've gone in circles about this part of the API. First I think that it would be nice to constrain the layout of GenericImage. Then I realize that you can just use ImageBuffer directly if you want that, so I think about deprecating GenericImage. But that would break a lot of downstream code, so might as well just leave it around? |
I don't think I think we need a type or a trait for a rectangular sub-image of an existing image, so that we could implement |
How often is image pixel data non-contiguous, and is it worth catering to the potential non-contiguous image use-cases at the cost of heavier genericness? Additionally, do crop and region drawing functions even need a Perhaps we should simply remove/deprecate all the generic traits since they have dubious usefulness and could be misleading to users. |
From perf perspective having a match on an enum per row is not too bad, as long as the innermost loop can be iterating over a slice (loop per pixel type). |
Right now the
ImageBuffer
type has arows()
function to iterate over the rows of the image, butGenericImageView
SubImage
does not.Working with rows rather than individual pixels is often much faster, because it lets you leverage SIMD to process multiple pixels at once. For example, #2295 would be trivial to fix given this API.
The text was updated successfully, but these errors were encountered: