Skip to content

Converting RGB8 buffer into ArrayFire compatible layout #215

Answered by 9prady9
IvanChepurnyi asked this question in Q&A
Discussion options

You must be logged in to vote

ArrayFire's built-in imageio functions automatically convert input color pixels, triplets(RGB) or quartets(RGBA), to a non-interleaved data i.e. for example, a bunch of RGB(s) will get converted to three sets of R(s) followed by G(s) and then by B(s). Another way to think about this is, a matrix of RGB triplets is converted to three matrices of R, G, B stacked on top of each other. This is done to extract maximum performance and it suits the GPU memory accesses work.

Since, you are using an external crate that is loading/saving the images for you. When you pass the data to Array::new you need to take care of this interleaved format conversion. There is simple solution to this problem howe…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by 9prady9
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #215 on December 09, 2020 05:15.