Re: FS-error diffusion (Was:Re: Different Implementations of VLIW .)
- From: timcaffrey@xxxxxxx (Tim McCaffrey)
- Date: Wed, 21 May 2008 14:29:30 +0000 (UTC)
In article <p9idnSaOrfRHFrPVnZ2dnUVZ8vOdnZ2d@xxxxxxxxxxxx>,
terje.mathisen@xxxxxxxxxxxxx says...
Niels Jørgen Kruse wrote:
Terje Mathisen <terje.mathisen@xxxxxxxxxxxxx> wrote:
That's funny, because I've been helping this guy in c.l.a.x86 speeding
up Floyd-Steinberg error diffusion for reducing true-color images to a
limited palette (i.e. GIF/PNG 8-bit/pixel), and that algorithm (FS), is
a horrible example of a sequentially dependent process:
You start with the top left pixel, pick the closest palette match (which
is an interesting problem all by itself!), calculate the offset between
this color value and the pixel, then distribute the error across all the
surrounding pixels which haven't already been processed.
(I.e. right, down-right, down and down-left.)
Any particular reason you have to do the pixels in this order (other
than to keep track of which have been processed)?
None, except that the algorithm depends on it:
Errors can in theory spread arbitrarily far across the image, instead of
having some kind of exponential decay that would limit the maximum reach
of each update.
Such a limit would make it possible to start in multiple places, running
things in parallel, with a fixup stage at the end, but as it is, the
absolute minimum latency is fixed by the maximum length of the error
propagation, which is length+width.
Since the palette to be used can contain arbitrary values, there is also
no absolute boundary for the maximum/minimum distance in color space
between two neighboring colors. :-(
The nice thing about ordered dithering is that it is completely parallizable.
With enough resolution you can get some decent results if the dither pattern
isn't too large (4x4 is ok, 2x2 is better). It works even better if you can
adjust the pallete for "best" fit.
There are better error-diffusion algorithms that don't spread the error as
far, look better and run faster. Can't remember the name right now :(, and my
text books are buried in storage.
The last time I looked into this, I was programming an 8088 (well, V20),
translating a GIF 256 color image into 8 colors. Ordered dither was slow
enough (640x480 image took ~20 seconds to display, which, BTW, was about the
same time PC-Show took to display the same image on a 486 with a VGA card)
that I never really pursued the ED methods.
- Tim
.
- References:
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Eugene Miya
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Bernd Paysan
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Eugene Miya
- Re: Different Implementations of VLIW .
- From: Robert Myers
- Re: Different Implementations of VLIW .
- From: Eugene Miya
- Re: Different Implementations of VLIW .
- From: Robert Myers
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Robert Myers
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Robert Myers
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- Re: Different Implementations of VLIW .
- From: Robert Myers
- Re: Different Implementations of VLIW .
- From: Nick Maclaren
- FS-error diffusion (Was:Re: Different Implementations of VLIW .)
- From: Terje Mathisen
- Re: Different Implementations of VLIW .
- Prev by Date: Re: Hooking processors together
- Next by Date: Re: Register-less CPU
- Previous by thread: Re: FS-error diffusion
- Next by thread: Re: Different Implementations of VLIW .
- Index(es):
Relevant Pages
|