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



--
video4linux-list mailing list
Unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to