Fw: BGR->RGB

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



Tuukka wrote:
> Maybe you could convert the images in-place: that is, the conversion
> routine wouldn't copy the image and thus the green pixels wouldn't need
> touched at all (this should already give 30% speedup). Furthermore, cache
> should work better since you would need only half the memory.

I tried that, but I get segmentation faults. This is probably because by the
time the buffer has been converted, it is also accessed by the frame grabber
capturing a new frame. I tried to put it within a mutex block, but that
didn't work either.

The function I used for that is (courtesy of videodog 0.21):

void bgr24_to_rgb24(unsigned char *buf, int size)
{
    unsigned char c;
    unsigned char *p = mem;
    int i = size;

    while (--i)
    {
        c = p[0];
        p[0] = p[2];
        p[2] = c;
        p += 3;
    }
}

/G





[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