Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 1997 10:16:10 -0500 (EST)
From:      Charles Henrich <henrich@crh.cl.msu.edu>
To:        tom@inna.net, freebsd-multimedia@freebsd.org
Subject:   Re: Video Capture for FreeBSD
Message-ID:  <199703061516.KAA03252@crh.cl.msu.edu>
References:  <5flsrp$f0n$1@msunews.cl.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In lists.freebsd.multimedia you write:

>Thanks!

>It looks ugly but I defined :

>char bigbuff[921600]

>then changed the writing routine to look like :

> for (c = 0 ; c < ROWS*COLS*3; c++) {
>                bigbuff[c]= ((*rgb16 >> 7) & 0xf8);     /* r */
>                c++;
>                bigbuff[c]= ((*rgb16 >> 2) & 0xf8);     /* g */
>                c++;
>                bigbuff[c]= ((*rgb16++ << 3) & 0xf8);   /* b */
>        }
>        write(o, &bigbuff[0], 921600);

>I would be interested in seeing how this could be done more elegantly.

>Thanks!  It now runs in 2.54 seconds!  I can take my QuickCam off the
>air and replace it with the WinTV card and a security camera.

Change the code back to what it was.. Find all occurences of operation on that
descriptor and chaqnge them to operations on a file pointer (e.g. fopen instead
of open, fclose instead of close, fwrite instead of write)..

This will give you buffered writes which should provide you a very large
performance win.

-Crh
-- 

       Charles Henrich     Michigan State University     henrich@msu.edu

                         http://pilot.msu.edu/~henrich



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703061516.KAA03252>