Home Products Download Order Contacts

comp.graphics.algorithms

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



spamtrap@crayne.org writes:

>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......

One approach is to divide the input image into fixed-size tiles,
probably square and some power of 2 on a side. Each tile stores its
pixels consecutively in memory. This takes a little extra overhead when
you read in and write out the image.

When you want to process a particular ROI, you start by figuring out
which tiles are within the ROI. There will be three types of tiles:
1. tiles that are completely within the ROI
2. tiles where only a fraction of the pixels are within the ROI
3. tiles that contain no pixels within the ROI

Type-1 tiles can be processed by special-case code that knows you are
processing a fixed number of pixels in contiguous locations. This will
be the bulk of the ROI, so most of the pixels will be calculated fast.
Type-2 requires slower pixel-by-pixel operations, but since these tiles
are located only along the edges of the ROI, not too many pixels are
involved. Type-3 tiles are completely ignored.

(If it turns out to be advantageous, you can also copy each Type-2 tile
to a spare tile buffer, use your fast type-1 code on the whole tile, and
then copy back only the appropriate pixels that are within the ROI).

The basic idea is to make *most* of the pixels go fast.

Dave


Reply


View All Messages in comp.graphics.algorithms

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

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

Copyright 2006 WatermarkFactory.com. All Rights Reserved.