Shop OBEX P1 Docs P2 Docs Learn Events
Can Propeller Display a Human Face on the TV? — Parallax Forums

Can Propeller Display a Human Face on the TV?

william chanwilliam chan Posts: 1,326
edited 2006-05-08 16:20 in Propeller 1
Hi,

How difficult is it to display a human face on the TV?

Thanks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-20 11:26
    How 'human' do you want it?

    Maxx Headroom or Pamela Anderson?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • cgraceycgracey Posts: 14,133
    edited 2006-04-20 15:55
    william chan said...
    Hi,

    How difficult is it to display a human face on the TV?

    Thanks.

    Well, it wouldn't be hard, except for one thing: It takes a lot of RAM to hold something that looks photographic. A smiley face is another matter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • william chanwilliam chan Posts: 1,326
    edited 2006-04-21 05:43
    Hi Chip,

    How many bytes of memory would be required to display a still photograph on 1/16 of the TV screen,
    based on normal TV resolution?
    Can the Propeller's shared memory be used for this purpose?
    Is the access to the shared memory fast enough to hold the still photograph onscreen?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my

    Post Edited (william chan) : 4/21/2006 5:46:22 AM GMT
  • cgraceycgracey Posts: 14,133
    edited 2006-04-21 05:56
    At 256 by 192 pixels, there are 49,152 pixels on the screen. 1/16th of that would be only 3,072 pixels. If you used 1 byte per pixel, for maximum quality, that would take 3KB. That's not much, is it?
    Andre LaMothe has made video drivers that can use 1 byte per pixel. These are tile and sprite engines that don't require much display RAM. You would need something like this. Andre's Hydra game console, which is based on the Propeller, will have drivers to do this sort of thing. Parallax will probably get around to making such a driver, but I don't know when. It would be neat if someone out there made it and offered it to everybody. I'm really not sure what Andre's plans are for his source code.
    william chan said...
    Hi Chip,

    How many bytes of memory would be required to display a still photograph on 1/16 of the TV screen,
    based on normal TV resolution?
    Can the Propeller's shared memory be used for this purpose?
    Is the access to the shared memory fast enough to hold the still photograph onscreen?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • william chanwilliam chan Posts: 1,326
    edited 2006-04-21 10:03
    But at 256 x 192 pixels only, it wont look like a very nice Pamela Anderson would it?, especially after divided by 8 or 16.
    Can the total number of pixels on the TV be increased, or is 256 x 192 some kind of standard?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-04-21 14:37
    The problem is the 32K onboard memory. To be able to store 49,152 pixels of info, you need to store sub-byte data for each pixel.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1+1=10
  • rokickirokicki Posts: 1,000
    edited 2006-04-21 16:55
    The key here is compression; one cog can decompress a compressed representation of each raster line in time for the display cog to see it as (640?) pixels of real data. With this approach it should be pretty easy to get a pretty good face in 32K bytes. Note also that the TV has a significantly limited chroma bandwidth, so you won't actually get 640 *real* color pixels out of any NTSC or PAL TV anyway.

    Hmm, real-time JPEG decompression, anyone?
  • cgraceycgracey Posts: 14,133
    edited 2006-04-21 17:31
    It's mainly a limitation of TV resolution. 192 visible lines is about all you can get in non-interlaced NTSC. The Propeller can do interlaced signaling, as well, and this would double the visible lines, but the flicker is awful.
    william chan said...
    But at 256 x 192 pixels only, it wont look like a very nice Pamela Anderson would it?, especially after divided by 8 or 16.
    Can the total number of pixels on the TV be increased, or is 256 x 192 some kind of standard?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-04-21 17:53
    I wonder how perceptible the flicker would be with a grayscale image? Usually it's the high-constrast stuff (i.e. when one scan line looks far different from its interlaced neighbor) that causes noticable flicker. The Commodore Amiga had an interlaced video mode, which was very unpleasant to look at with text and hi-res graphics. But we look at low-gradient interlaced images on TV all the time without too much complaint. The grayscale resolution of the Propeller may be fine enough for flicker not to be so annoying with certain images. 'Twould be an interesting experiment...

    -Phil
  • Tom WalkerTom Walker Posts: 509
    edited 2006-04-21 18:04
    Phil,
    Interlace flicker on the Amiga was a "personality feature". :^)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • cgraceycgracey Posts: 14,133
    edited 2006-04-21 18:19
    Yeah, low contrasts from line to line don't look that bad in interlaced mode. The Propeller's video generator uses a 3-bit DAC (1R, 2R, 4R resistors connected to three I/O pins) to make the video signal. Values 0 and 1 get used only for sync and colorburst. Values 2 through 7 are black to white. So, there are only six levels of grey. This isn't too good for photographic presentation. We'll have to improve this in the next generation.
    Phil Pilgrim (PhiPi) said...
    I wonder how perceptible the flicker would be with a grayscale image? Usually it's the high-constrast stuff (i.e. when one scan line looks far different from its interlaced neighbor) that causes noticable flicker. The Commodore Amiga had an interlaced video mode, which was very unpleasant to look at with text and hi-res graphics. But we look at low-gradient interlaced images on TV all the time without too much complaint. The grayscale resolution of the Propeller may be fine enough for flicker not to be so annoying with certain images. 'Twould be an interesting experiment...

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • BeanBean Posts: 8,129
    edited 2006-04-21 18:28
    Six levels of grey might not be too bad if you dither the image using something like the "Floyd-Steinberg dithering algorithm"
    · X 7
    3 5 1

    I've seen some 4 level dithered images that looked pretty good. That is 256 grayscales dithered to a 4 grayscale output display.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    "SX-Video OSD module"·available·for only·$49.95·www.sxvm.com
    Available now! Cheap 4-digit LED display with driver IC·www.hc4led.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • william chanwilliam chan Posts: 1,326
    edited 2006-04-24 02:13
    I noticed that the Propeller board has a VGA output as well.

    Is the resolution for the VGA output 640x480? How many colours? Much better than the TV?

    Can external RAM or EEPROM be used to hold a photographic still image?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • El PaisaEl Paisa Posts: 375
    edited 2006-04-24 12:09
    Now that· the demo board has a VGA connector my question is:
    What kind of graphics data can be displayed with a 32k memory limitation?
  • cgraceycgracey Posts: 14,133
    edited 2006-04-24 14:49
    Not much in the way of full-screen bitmaps, however the software drivers (objects) that we've written are tile-based, so you can get a good amount of text characters on the screen. The Propeller has a built-in font of 256 different 16x32-pixel characters. This takes very little memory to display, much like DOS did.
    El Paisa said...
    Now that· the demo board has a VGA connector my question is:
    What kind of graphics data can be displayed with a 32k memory limitation?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • El PaisaEl Paisa Posts: 375
    edited 2006-04-24 15:46
    Chip:
    Two questions
    1.· The intent of the VGA is only to display text only?.
    2·. There is a way to add external memory to display graphics?
    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-05-04 07:11
    Attached are photos of a TV screen displaying Propeller output. (Send the children out of the room before clicking. You don't want to frighten them!) The images both use four of the six available gray levels and the Graphics.spin and TV.spin objects from the stock library. The first includes some very rudimentary halftoning to achieve 13 gray levels total. The second is dithered. I converted these photos to grayscale to remove some color moir
    800 x 600 - 64K
    800 x 600 - 83K
  • william chanwilliam chan Posts: 1,326
    edited 2006-05-04 07:29
    The photos are beautiful !

    Hey, does anybody know how many chars can be displayed on the TV by the propeller at any one time?

    Same as the SX?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-05-04 13:51
    Slick Trick Phil... Nice.... Real Nice... Leads me to some ideas as well....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK
    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-05-08 06:40
    Furthering my investigation of this subject, I've discovered a way to get a true grayscale image with 12 usable luminance levels. It involves adding a 2.2K resistor to an additional port pin and switching to VGA mode for that portion of the display line which is to be grayscale. Each 32-bit long can contain eight 4-bit grayscale pixels, each ranging in value from 4 to 15. But the data in each long has to be sliced, diced, and shuffled quite a bit to make it work.

    Attached is a snapshot of a TV screen driven by the Propeller. The mugshot in the upper-left corner is 128 x 96 pixels and requires 6144 bytes of hub memory to store. There is no halftoning or dithering involved. The mugshot is generated in VGA mode; the rest of each line, including the syncs and colorburst are in video mode. Since vcfg is not double-buffered, I made sure that the switch was performed during a color value that displayed the same level in both modes. And even though VGA mode was used for part of the line, the resulting signal is still NTSC video. The second attachment shows a scope trace of a scan line that includes the mugshot.

    It was impossible to get a true 4:3 aspect ratio for the mugshot. Eight clocks per pixel made the picture too narrow; nine, too wide. But it's closer than I was getting before with ten. Again, the grayscale data were generated from a .png file by my PC, which produced a list of longs. These were copied and pasted into the spin program that generated the output.

    This technique could be extended further to get 192 (at four pixels per long) luminance levels. But the memory buffer requirements are doubled.

    -Phil
    800 x 600 - 47K
    640 x 480 - 11K
  • rokickirokicki Posts: 1,000
    edited 2006-05-08 15:21
    Actually, I was thinking about this. If I use *two* cogs, both in video mode, and fully synchronised, I should be able to get
    four bits per color, right, for a total of 4096 colors? And three cogs would theoretically give me six bits per color? With so
    many bits, the voltage divider slightly different, but it should be doable. This way there should be no need to switch to
    VGA mode and back. Is there something I'm missing with this approach? I'm not too worried about the memory
    consumption; that's simply a matter of appropriate compression.

    And I should be able to set the frame/pixel rate so I get four pixels per VIDWAIT instruction, so I can (assuming I can
    generate the raster lines fast enough) have each pixel be a completely unique color, right?

    I was thinking of putting together a simple demo that just showed 4096 static colors over NTSC, but I ran out of weekend.

    By the way, the Graphics_Demo is really impressive. The static pictures I've seen do not give it justice. I need to study
    how it all works.

    And as everyone says, the propstick is great! It was fun and easy to build; the few mistakes I made were easily corrected.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-05-08 16:20
    Colors, in NTSC and PAL, are genererated in HSB (hue, saturation, and brightness) color space, not RGB. The brightness is the easiest, since it's just a voltage level, and you can simply add levels, weighted from multiple digital bits, to get as much resolution as you want. Hue and saturation are another matter, though. In TV signals, color info rides on the brightness level as a signal modulated at 3.57MHz. The phase of this signal, relative to the colorburst at the beginning of each line, determines the hue. And the amplitude of the modulation determines the saturation. So to get more colors, you'd not only have to interpolate brightness levels, you'd also have to interpolate the phase and amplitude of the color subcarrier.

    Also, synchronizing two cogs in the manner you suggest would not be easy. Andre' LaMothe has been able to do it, so that two cogs can take turns processing and displaying video; but I don't think anyone has successfully used two cogs to get better resolution. The major difficulty is getting the colorburst phases to match. There is no way to force their synchronization. It has to be done by finessing the PLL that generates the 16 x 3.57MHz internal color reference.

    I'm certainly not trying to discourage experimentation. After all, the joy of hacking is why the Propeller exists! But a realistic assessment of the terrain can sometimes be helpful. The Propeller is great at what it does, and sometimes you can manipulate it in ways the designers didn't envision to do even more. But at some point, you do hit the wall.

    -Phil
Sign In or Register to comment.