views:

370

answers:

2

assuming i had RGBA (32 bits) output from frame-grabber, with alpha channel unused (values retained while filled by frame-grabbers), is there any effective conversion method to RGB (24 bits) ?

I am dealing with 5 MegaPixels streaming images so speed does matter too. keep in mind that data in alpha channel can be discarded.

+1  A: 

Just copy RGB bytes and discard alpha channel (1 byte). Possible optimizations will be hardware specific. For instance Intel has special color conversion functions in IPP library.

Kirill V. Lyadvinsky
Yeah, just skip the alpha bits and copy the rest. If you're working with hardware, it'll probably have an internal buffer, use that.
Aviral Dasgupta
A: 

Just copy the data and skip the unused alpha bytes.

If speed is important for you, you may want to use SSE or MMX and use the built-in bit-shuffling instructions. That is usually a bit faster than ordinary c-code.

5 megapixels doesn't sound like that much of data unless you have to do it at 100fps though.

Nils Pipenbrinck