Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
6595 Discussions

Image scrolling /shifting algorithm, without secondary buffer!

pandeleflorin
Beginner
132 Views
Hi!
Does anyone did /can help me with an scrolling algorithm for a given image buffer(RGB typically). I mean copying an image onto itself so an "shift" would be achived .Obviously I will have to fill in(overwrite) the new portions of an image, with new pixels...this is not the issue.
The operation must be done as efficiently as possible and without using an secondary buffer if possible, or with an very small secondary buffer, as the primary buffer is much likely to occupy the entire available memory.
By the way, ippiCopy can copy an image onto itself?
In what conditions?
What if the source and destination rectangles overlap?
0 Kudos
5 Replies
Vladimir_Dudnik
Employee
132 Views
We have ippsMove function which designed to work with overlapped memory buffers. Note, there is no ippiMove function.

Vladimir

pandeleflorin
Beginner
132 Views
We have ippsMove function which designed to work with overlapped memory buffers. Note, there is no ippiMove function.

Vladimir

Thank you for the reply, but ippsMove does not help, since I must move a portion of an array to another portion of an array(and ippsMove operates on vectors only - 1D). Basically there is no ROI support and I need it. To be more clear: I have to move an image on two directions let's say up and to the right by a given amount of pixels in each direction. And what appears to be compact memory in 2D is not so in 1D...


I thought about how to do this - Choose the largest rectangle that can be copied without overlapping and do a repeated copy until the hole buffer is done- but if the amount by which I have to move is small, than the size of the largest non overlapping rectangle is also small, making the operation extremely slow. So a secondary buffer should be used. But..what is "small"? How big the secondary buffer needs to be to achieve some speed gain?

I could also use ippsMove one pixel row at a time but this will probably degrade performance just as well.

So this is not as easy as it looks!

PS: Main buffer is expected to currently have about 1GB or more. Further more, the image stored in it is usually limited in width but extremely high(or long if you prefer) so a row by row method will tend to process little information at a time.
Vladimir_Dudnik
Employee
132 Views
I think you may rely on performance of ippsMove function. Yes, it will lead to processing image row by row. But, hey, how do you think ippiCopy function do its job?

Vladimir
pandeleflorin
Beginner
132 Views
I think you may rely on performance of ippsMove function. Yes, it will lead to processing image row by row. But, hey, how do you think ippiCopy function do its job?

Vladimir
Sorry but I was hoping for an hardware (processor) (macro)instruction that would actually do this. A sort of jumped mem line copy with an internal instruction loop. As far as I remember from school, processing an array on pieces (subarrays) is quite common (in plain mathematics not just imaging) and the hardware RAM memory is actually addressed as an array (RAS,CAS if I remember correctly)(and true, fixed number of columns) and not linearly as an Vector.
I do have, however, reasons to believe you rather than my assumptions. I am not good in assembler(or hardware for that matter).
Thank you for your answer.
Vladimir_Dudnik
Employee
132 Views
Usually it is good to process 2D data in rows (better data locality). It also provide simple pattern for parallelization.


Vladimir

Reply