Using video input in Squeak

Dean_Swan at Mitel.COM Dean_Swan at Mitel.COM
Thu Jul 22 01:58:35 UTC 2004


Hi Rob, Bert, Jack:

Form asGrayScale actually does extract the green component from 32 bit 
forms, or converts a lower depth Form to a 32 bit form and then extracts 
the green component.  It is NOT however, a single BitBlt call.  It does a 
copyBits for each column, and some fancy form/bitmap substituion to treat 
the 32 bit form as if it were an 8 bit form four times as wide.  How would 
you accomplish this with only a "single BitBlt call"?

Also, I timed my Form>>yComponent example against Form>>asGrayScale.  Not 
surprisingly, Form>>asGrayScale is about 133 times faster.  I may try 
optimizing mine using Form>>asGrayScale's trick of making a 32 bit form 
out of any form and then just extracting the RGB bits from the 32 bit 
pixelValues.  That would eliminate all the Color object allocations (2 per 
pixel), which should speed it up a bit, but I don't know if I can get 133x 
from that.  Ok... I tried it.  It's only good for about a 5x speedup. 
Maybe I'll dabble with it more later, but it will probably need to be a 
primitive to get anywhere close to fast enough for video.

Rob, just a caveat using Form>>asGrayScale - It is an approximation.  I 
tried it using a workspace as the test bitmap, and the selected text 
didn't come out as selected because with default colors, selected text is 
black on a bright green and the background is bright white.  This leads to 
what looks like no selected text in the grayscale version, where the 
"properly" calculated Form>>yComponent method does show the selected text 
as black on medium gray.

                        -Dean





Bert Freudenberg <bert at impara.de>
Sent by: squeak-dev-bounces at lists.squeakfoundation.org
07/21/04 06:02 AM
Please respond to The general-purpose Squeak developers list

 
        To:     The general-purpose Squeak developers list 
<squeak-dev at lists.squeakfoundation.org>
        cc: 
        Subject:        Re: Using video input in Squeak



Am 20.07.2004 um 20:53 schrieb Jack Johnson:

> I can't help you with the implementation details, but I can tell you
> that in order to generate B&W, most people will average the RGB to get
> an 8-bit grayscale value.  The overhead of this for a live video feed
> can be noticeable, and you'll find that for most video systems if you
> just take the values for green and compose a B&W image from it, the
> contrast will be more what you would want or expect from B&W video.

Yep, this can be very efficiently done in a single BitBlt call (mapping 
green component directly into black or white). See ColorMap>>mapPixel:, 
which is what the bitblt primitive does for each pixel when you set an 
instance of ColorMap as the bitblt's colorMap.

- Bert -




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040721/fd1aaef6/attachment.htm


More information about the Squeak-dev mailing list