Home Products Download Order Contacts

comp.graphics.algorithms

Subject: Re: MMX Optimized Image Processing - Advice needed for data structure



spamtrap@crayne.org wrote:

> Previously, I had written several image processing MMX routines.
>
> (Take _MMXVector8AddConstant routine at
> http://palmxq.cvs.sourceforge.net/palmxq/shuwnyuan/mmx/add.asm?revisio
> n=1.7&view=markup for example)
>
> They are so far so good. However, recently it discover some problem in
> my image data structure and I hope to get some advice from you all.
>
> Consider the following images 16 width and 4 height.
>
> ---------------------------------
> > X X X X X X X X X X X X X X X X|
> > X X X X X X X X X X X X X X X X|
> > X X X X X X X X X X X X X X X X|
> > X X X X X X X X X X X X X X X X|
> ---------------------------------
>
> My routines can process this 2D data, by taking in parameter
> size=4x16=64, and process the image just like a 1D data. All can be
> done in a single loop.
>
> This is because the first data of the next line is just beside the
> last data of the current line. Says, Next pixel of
> (x=15 y=0) is (x=0 y=1)
>
> However, if I need to process just the ROI of the images, says at
> location
> x=1 y=1, with width = 8, height = 4
>
> ---------------------------------
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> ---------------------------------
>
> That is a headache. I can no longer process the data in a single loop.
> This is because The last data of the current line, is NO longer
> besides the first data of the next line.
>
> Any advice on the data structure design? To avoid having two
> loops......
>
> I was once thought to copy the ROI to another new data buffer, so that
> I can process it in a single loop fashion. However, the copy operation
> takes too much time. The ROI itself is sometimes quite large. :(
>
> ---------------------------------
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> > X O O O O O O O O X X X X X X X|
> ---------------------------------
> |
> |/
> .
> -----------------
> > O O O O O O O O|
> > O O O O O O O O|
> > O O O O O O O O|
> > O O O O O O O O|
> -----------------
>
>
> Thank you very much! Hope to get advice from you all.
>
> yccheok

I do have maybe an hint of a solution without changing (almost)
anything in your code :

if you had a variable named X_Offset and Y_Offset, that you applied
systematically, won't it work ?
Obviously at the beginning of your deppest routine you could test
the values and do your single loop as is if (0,0). Otherwise you would
just do the same with the computation of the index on the fly, but
keeping a single loop...

:-)

--


Reply


View All Messages in comp.graphics.algorithms

path:
MMX Optimized Image Processing - Advice needed for data structure =>

Replies:

Copyright 2006 WatermarkFactory.com. All Rights Reserved.