From owner-freebsd-multimedia Thu Mar 6 07:16:17 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id HAA22838 for multimedia-outgoing; Thu, 6 Mar 1997 07:16:17 -0800 (PST) Received: from crh.cl.msu.edu (crh.cl.msu.edu [35.8.1.24]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id HAA22826 for ; Thu, 6 Mar 1997 07:16:12 -0800 (PST) Received: (from henrich@localhost) by crh.cl.msu.edu (8.8.5/8.8.4) id KAA03252; Thu, 6 Mar 1997 10:16:10 -0500 (EST) Date: Thu, 6 Mar 1997 10:16:10 -0500 (EST) From: Charles Henrich Message-Id: <199703061516.KAA03252@crh.cl.msu.edu> To: tom@inna.net, freebsd-multimedia@freebsd.org Subject: Re: Video Capture for FreeBSD Newsgroups: lists.freebsd.multimedia References: <5flsrp$f0n$1@msunews.cl.msu.edu> X-Newsreader: NN version 6.5.0 #1 (NOV) Sender: owner-multimedia@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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