Shop OBEX P1 Docs P2 Docs Learn Events
TV Graphics/Bitmap Questions — Parallax Forums

TV Graphics/Bitmap Questions

DogPDogP Posts: 168
edited 2007-02-08 19:27 in Propeller 1
Hey,

I got my Propeller chip a couple days ago and got it hooked up and all working. I've been playing with a few of the demos and reading manuals/posts trying to learn all I can, but I've got a few questions.

First, let me describe what I'm wanting to do. I have a device that outputs 384x224 (2 bits/pixel) video. I want to take this data and output it to a TV. I think I should be able to read this data into memory and output the bitmap to the screen. I was able to create a 384x224 screen by modifying the graphics demo, so I'm glad to know I can output that resolution and still have it be recognizable [noparse]:)[/noparse] .

The first thing I'm confused about is tiles. Looking through the graphics and TV driver, it looks like it uses 16x16 tiles. How do they work, and do I have to use them? What I really want to do is output raw pixels to the display without doing a bunch of plot(x,y) (which of course won't give an acceptable speed). I need 4 shades including black (2bits), and the shades required is constant across an entire frame. I'd like to be able to change the shades between frames, but that's not a high priority.

Also, I was messing with the interlaced bit... when I set it, the screen draws 112 pixels each frame alternating from a 224 pixel map at 60Hz, correct? And when I set it to progressive, it draws only 112 pixels, except both interlaced frames are the same image (basically 30Hz)? It's not actually outputting a progressive 60Hz signal, correct?

Thanks,

Pat

Comments

  • asterickasterick Posts: 158
    edited 2007-02-07 21:46
    You're going to have to write a display driver from scratch. The reason most programs use 16x16 blocks is because the WAITVID instruction uses a 4 color palette (8 bits per color, totaling out to 32 bits) and a 16 entry pixel map( 2bpp x 16 = 32bits)

    You can cheat by setting the 'frame clocks' to 4 pixels, using %11_10_01_00 as your immediate for the pixels value and load 4 pixels into the palette. That would give you the ability to have a pixel display. You should consider that this requires you to generate the video in realtime since there is not enough memory for a full frame buffer. There are other tricks you can do, but this is by far the easiest. You can also hard code the palette if you want a 4 color screen (MUCH easier, and requires less processor time since it requires only one WAITVID). That method only requires (width * height / 16) longs of memory.

    There is no maximum horizontal resolution persay on an NTSC signal, just an ammount of time you can display things. there are 188 full color bursts in a NTSC display frame, which is essentially the highest resolution you can use and garuntee that your chroma is going to be accurate. You can drive it higher if you use a high quality video encoder (since it uses true sinus output, rather than a square chroma signal). As far as how high you can drive it and the picture still be ledgable, ~256 horizontal pixels is decent (that uses about 11/16ths of a chroma).

    224 is a perfectly resonable vertical resolution. 240~242 is about the highest you can drive it, but a lot of your lines will be cropped on certain TVs. (This is why they say that the NES has a vertical resolution of 224, even though the system ACTUALLY draws a full 240 vertical lines, the top 8 and bottom 8 are usually clipped by your television)
  • DogPDogP Posts: 168
    edited 2007-02-07 23:15
    Hmm... okay, I was wondering if I was going to have to write my own driver for it. I doubt I'm ready to just jump in and write one, so I'll probably just spend some time learning the Prop ASM and work towards creating a display driver that I can work with. I figured I'd have to create the image in real time though, since the display is updated at about 50Hz. What I'm really thinking is to create a 384x112 display every TV frame, since the interlaced TV is only showing that anyway.

    BTW, here's an example of an image I'm trying to display.

    en.wikipedia.org/wiki/Image:Mario%27s_Tennis_screenshot.png

    It's a display from the sorta VR system that Nintendo made back in 95 (Virtual Boy). I hope if I only do 384x112 interlaced I'll actually be able to capture both displays (4 bits/pixel) and show in 3D w/ red/blue glasses, but that's just a wishlist item right now.

    Thanks,

    Pat
  • Ym2413aYm2413a Posts: 630
    edited 2007-02-08 07:31
    384x112 by 4 colors should be a walk in the park for the Propeller.

    A lot of drivers out already pull a lot more then that.
    Here are some NTSC numbers...

    You can output about 242.5 active lines per field (60 hertz) and about 485 lines per frame (30 hertz).
    Non-interlaced display's a new video frame every field but only has half the vertical resolution. It flickers less due to the higher framerate from doubling up both even and odd fields.

    Non-interlaced is what you would more then likely want to use since your target goal is only 112 lines vertically.
    So what your thinking of doing is very "do-able".

    Remember you can go up to about ~242 lines before you have to start interlacing. ^^
  • DogPDogP Posts: 168
    edited 2007-02-08 18:29
    Yeah, I think the reason I want to interlace is to get close to the correct aspect ratio, and to save memory... 224 almost fills up the screen vertically, but the widest I can get at 384 is a 4:3 ratio, when it should really be 12:7 (I guess that's not that big of a deal). And 384x224x2bpp takes 5376 longs, so if I want to show both displays (4bpp), there won't be enough memory. I actually want 224 vertical pixels, but I figured I could do 112 for each interlaced frame, giving me 224 @ 30Hz.

    So there's a non-interlaced mode on the TV (regular, non-HD)? I thought the TV automatically interlaced, which is why I thought non-interlaced was just a trick the Prop did to just show double frames (at half the frequency).

    I've been playing with rewriting the TV driver a little bit, so hopefully I'll be able to understand more of what's going on and ask more specific/intelligent questions [noparse];)[/noparse] .

    Thanks,

    Pat
  • Ym2413aYm2413a Posts: 630
    edited 2007-02-08 19:27
    DogP said...

    I've been playing with rewriting the TV driver a little bit, so hopefully I'll be able to understand more of what's going on and ask more specific/intelligent questions [noparse];)[/noparse] .

    Thanks,

    Pat
    Yeah thats the nice thing about the Propeller Tools and Objects. You can just jump in and start playing with thing.

    As for the non-interlaced mode on the TV.
    It's not really a mode. You just send the lines differently. In non-interlaced you just resend the whole screen each frame.
    When you interlace you send only the odd lines of a picture on one field and the evan on the next. (Takes two full sweeps of the screen to generate the full image)
    The television standard has a weird number of total lines and will start the next frame with a offset.

    rstr-ul.gif
    As you can see the second field (pink) started halfway in from the first field (blue) and thats how they interlace with eachother.

    --Andrew Arsenault.
Sign In or Register to comment.