Re: MMX speedup for Floyd Steinberg error diffusion
- From: Terje Mathisen <spamtrap@xxxxxxxxxx>
- Date: Fri, 09 May 2008 10:21:40 +0200
Jim Leonard wrote:
On May 8, 11:00 am, Terje Mathisen <spamt...@xxxxxxxxxx> wrote:How does it handle the corner/edge cases?
I.e. the last pixel on a scan line has no down-right neighbor, the first
pixel has no down-left and the last scanline has nothing below at all!
The "off-screen" pixels as ignored, because they do not contribute to
the error information distributed to the visible pixels. A dumb but
easy way to implement this without conditional branches every
iteration (to check if you are operating on off-screen pixels) is to
operate on a bitmap that has a 1-pixel border around the right/left/
bottom sides.
OK, that's fast at least. :-)
Anyway, to speed up the dithering stage I would use MMX/SSE and work on
multiple lines in parallel, keeping the intermediate results in
registers until we're finished with them.
I don't see how you'd implement that, because the very top-left pixel
can conceivably promote enough error, distributed downward, to affect
the bottom-right pixel...
Sure, but that's no problem: The SIMD registers works as a rectangular cache block around the current pixel, avoiding the need to write to memory between the multiple updates to each surrounding pixel.
You do need to keep one extra line in a register, just to accumulate the error terms from the line above.
Terje
--
- <Terje.Mathisen@xxxxxxxxxxxxx>
"almost all programming can be viewed as an exercise in caching"
.
- References:
- MMX speedup for Floyd Steinberg error diffusion
- From: rep_movsd
- Re: MMX speedup for Floyd Steinberg error diffusion
- From: Maarten Kronenburg
- Re: MMX speedup for Floyd Steinberg error diffusion
- From: Maarten Kronenburg
- Re: MMX speedup for Floyd Steinberg error diffusion
- From: rep_movsd
- Re: MMX speedup for Floyd Steinberg error diffusion
- From: Terje Mathisen
- Re: MMX speedup for Floyd Steinberg error diffusion
- From: Jim Leonard
- MMX speedup for Floyd Steinberg error diffusion
- Prev by Date: Re: MMX speedup for Floyd Steinberg error diffusion
- Next by Date: Re: MMX speedup for Floyd Steinberg error diffusion
- Previous by thread: Re: MMX speedup for Floyd Steinberg error diffusion
- Next by thread: Re: MMX speedup for Floyd Steinberg error diffusion
- Index(es):
Relevant Pages
|