Re: BGR->RGB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Georgios Kapetanakis wrote:
> 
> > > The routine I'm using is not very fast, but it's the best I can do (it
> takes
> > > approx. 35ms to execute).
I think the fastest routine would be a precomputed lookup table. Use the
BGR value as an index into a list of RGB values. Write another program
to calculate the lookup table, possibly save it as a file so you can
reload it instead of recalculating it. Drawback is that it uses a lot of
memory: it would be about 67MB long if you use 32bit values (for
efficiency and speed). Bit shifting takes a long time, possibly longer
than byte-swapping, although byte swapping inside a register using
assembler instructions might be as fast as table lookup. An optimising c
compiler might translate bitshifts of 4 or 8 into swaps or it might not.
Martin





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux