Shop OBEX P1 Docs P2 Docs Learn Events
Composite Video — Parallax Forums

Composite Video

Lee MarshallLee Marshall Posts: 106
edited 2007-10-11 15:37 in Propeller 1
im trying to get my head around the whole CVBS/composite video waveform.
so far - gathering a lot of info from www.maxim-ic.com/appnotes.cfm/appnote_number/734
- I understand the following(at least i think i do):

Each line has:
A Sync Pulse(drop to 0v) for 4.7uS
A Breezeway/Front Porch for 0.6uS
A color burst, a sort of sine wave that synchronises an oscillator in the TV to a frequency (around 4.3mhz for PAL).
A section of video which lasts for 52.6uS, this parallels with the electron gun tracking across the line in the screen.


The voltage level of the signal during the active video section dictates the brighness(luma), and the phase difference between the TVs oscillator frequency and the frequency of the active video dictates the color(chroma). so i take it, the frequency of active video is modulated to produce different colors.


What i dont get:
for the active video part of the signal to have a frequency it would have to be like a sine wave/some kind of oscillation. Figure 6 in the link shows a test-bar pattern, but it uses a square wave for each bar of different amplitude. How can this change the color? not only does it not have a frequency, and therefore no phase comparison is possible, but i thought the amplitude of the active video could only change brightness.

This has been bugging me a lot over the last week, and i would really appreciate any insight.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I hear and I forget. I see and I remember. I do and I understand
-Confucius

Post Edited (Mr Crowley) : 10/10/2007 4:00:33 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-10 03:59
    My understanding of NTSC color encoding is that there's a color signal superimposed on the brightness signal and the phase angle between this superimposed color signal and the color burst signal determine the hue of the color displayed at any point in the active video section. PAL is similar, uses a different frequency for the color signal, and alternates the phase of the color signal on successive scan lines. The saturation of the color depends on the amplitude of the color signal and is not adjustable using the Propeller's video generator as far as I know.
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-10 04:34
    i am a little unsure of superimposition:

    would this be an example of superimposing a 2mhz wave on a 166khz wave..or is it the other way around?
    (see attachment)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius

    Post Edited (Mr Crowley) : 10/10/2007 4:43:51 AM GMT
    938 x 475 - 47K
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-10 04:41
    Mike is generally right here. When you look into the first lines of the TV driver you will notice a funny number:
    lntsc = 3640 'NTSC color cycles per line * 16
    What's that? Well on the Grayscale Video - the "Luma Signal" - another small signal is superimposed, carrying the "hue" information in its phase, and the "saturation" in its amplitude. it will look like a "ripple" in an oscilloscope. There are 225 such "ripples" in a line of an NTSC signal, colouring the image so to speak. Note that according to the standard only every third pixel can be coloured differently. But this suffices for our human eyes.

    Now the Propeller is limited in range of its outputs: They are digital and you can generate only 8 different voltage levels with 3 pins.
    0 is sync
    1 is blank
    2 ..6 can be used for a grayscale level.

    Additionally, around each third pixel, this signal is "boosted" by a bit, to generate the phase shifted chroma information. The time frame for this signal however is much more precise than the pixel clock, it is that magic number above: 20us/3640. Note however that this is not the "frequency" of this signal!

    The Prop can't be more precise, and this is why there are 15 colour shades only.
    And this signal has a constant amplitude (+1), so - as Mike already said - there is no variability in saturation.

    BTW: I just see your posting: "Superimposed" means just adding (in contrast to a "true" modulation). One generally consideres the "smaller" signal superimposed onto the "larger" one, but this is just a figure of speech.

    Post Edited (deSilva) : 10/10/2007 4:47:22 AM GMT
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-10 05:24
    i had a look at the composite output of a dvd player.
    i noticed a kind of weird square wave(seen in pic) in the first half of the active video, what would this be for??

    and, the signal is AC(as opposed to the lowest voltage being 0v), as if there's a capacitor in the dvd players output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius

    Post Edited (Mr Crowley) : 10/10/2007 5:38:44 AM GMT
    2304 x 1728 - 953K
  • Ken PetersonKen Peterson Posts: 806
    edited 2007-10-10 12:55
    @Mr. Crowley: Most cvbs signals can be AC coupled. In order to dc-align it for sync detect, it is often "clamped".

    What is being displayed on the DVD? This could help you explain the "weird square wave" that you are seeing. Notice you also have another wave that appears in the same area. This is because your scope syncs on one video line at a time so you are seeing several successive video lines "superimposed" on one another on the display. This is not to be confused with your questions about the chroma being superimposed on the luma signals, only to point out that you are viewing several video lines at once due to the persistence of the scope (and your eyes).

    If the DVD that you are playing has closed caption, this information is sent as digital pulses on the video stream during the vertical blank intervals. Read up on closed caption on wikipedia for more details on how this works.

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


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • ericballericball Posts: 774
    edited 2007-10-10 13:20
    composite video = Y(t) + U(t) * sin( Fc * t ) + V(t) * cos( Fc * t ) + sync(t)
    where Fc is the colorburst frequency, Y is the B&W luma signal, and U & V are the color difference signals.

    The TV receiver decodes the video by first separating the luma and chroma signals using filters. The two chroma signals are then separated by modulating the signal with the colorburst frequency (phase-locked to the colorburst portion of the sync).

    The chroma phase versus the colorburst gives the hue (color 1-15 on the Prop), and the amplitude gives the intensity (single value on the Prop).
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-10 17:29
    so, the prop is only capable of greyscale vid out of composite??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius

    Post Edited (Mr Crowley) : 10/10/2007 5:42:12 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-10 18:10
    Why do you ask this???
    Or better: What do you want to ask?
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-10 18:31
    I wanted to know whether the statement
    I said...
    the prop is only capable of greyscale video when in composite mode
    was true/false.
    i guess i should have been more concise about the statement i was making.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius
  • hippyhippy Posts: 1,981
    edited 2007-10-10 18:42
    Mr Crowley said...
    so, the prop is only capable of greyscale vid out of composite??

    I'm not entirely sure of the exact semantics there so my answer is, "The video signal from the propeller from the three-R DAC driving a TV through an RCA Phono gives a colour image".
  • potatoheadpotatohead Posts: 10,260
    edited 2007-10-10 19:24
    It's false.

    With the Parallax reference video circuit, you get color. See here: http://propeller.wikispaces.com/Colors

    There is a screen capture, made with a HYDRA, that displays the standard (non artifacted) colors possible with a Propeller. One set is missing, that's the set along the right.

    The grid of other colors, was created by generating two colored pixels in the space of one NTSC color clock. (320 pixels in the active area, instead of the 160 normally.)


    If you want to build your own video circuit, there are a lot of options for color possible.


    One really easy way to look at color, the way the Propeller currently generates it is this:

    
    If this formats funny, I typed it in the Propeller tool!  Size your browser!
    
    
    
    For a scanline:  \porch\----------active video = 160 colored pixels ------------------\porch\
    
    On that scanline, each pixel looks like:
    
    |-------------|-------------|-------------|-------------|...  = 160 of these.
    
    
    For each pixel, there are on the propeller, 16 phase differences, that show up on screen as sub-pixels:
    
    
    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  = One color clock, with sub-pixels enumerated
    
    
    Colored pixels then, look like this:
    
    |00000000000000|----0--------|-----0-------|----------0--|...
    
         -a-            -b-          -c-             -d-
    
    
    Pixel -a- is a monochrome one.  Pixels -b- through -d- have color information.  Where that sub-pixel is,
    is an indicator of what hue is going to be.  Each of those pixels would be a different hue.
    
    There is more to it than that, of course, but we really don't have control of that on the Prop, with the
    Parallax reference video circuit.
    
    The signal necessary to do this, is generated by the propeller and added to the monochrome video signal
    output.  (This is why it's wise to limit your intensity values to 5, color is +1)
    
    Any pixel size smaller than described above, will result in a color artifact.  Color will be seen, even
    though it's not intended.  That's essentially what is being done in the screen shot I linked to.
    
    Another way to look at it would be to crank the propeller pixel clock up.  Let's say instead of 160 pixel
    resolution, you decide to do 160x16 = 2560 pixel.  Now, you will get colors, depending on which of those
    pixels is set, or reset.
    
    If that 2560 pixel bitmap is only a two color one, as in just on or off, then you would be able to specify
    two intensities, and a lot of hues, no real control over saturation.
    
    If you wanted a monochrome pixel, you would have to pack 16 of them together, with no gaps, to limit the color
    artifacts from occuring.
    
    Older computers, such as the Apple II, Atari, etc...  Leveraged this to generate color displays.  On your
    typical 320 pixel graphics display, one could plot just one pixel and get red, or green, depending on
    it's odd or even status.  Two pixels together were monochrome.
    
    Effective resolution, of a 2560 pixel bitmap, running on an NTSC television is then 160 pixels.
    
    If those pixels were multi-color ones, then you would be able to specify colors, in multiple shades or intensities
    and or grey scale monochrome pixels, all depending on the number of bits per pixel involved.  There still
    would be no control over saturation.
    
    
    
    
    The NTSC standard allows for interlace as well.
    
    Imagine all of that out of phase every other scanline, alternating per frame.  Now, it's possible to get 320
    color pixels of information, but only every other pixel, every other scanline.  This is actually what
    the Parallax TV driver does.  When this is done correctly, artifacts are kept to a minimum, allowing for
    a lot more precise color information to be specified and artifacts kept to a minimum.
    
    For an example of this difference, run the Parallax graphics demo program and look closely at the color
    elements.  You will see pixels moving back and forth on the edges, showing the alternating color phase
    stuff occuring.  The propeller color logic, generates the color information, as closely as it can, given
    whatever the pixel clock actually is, resulting in a color display.
    
    
    



    Also take a look at http://www.ntsc-tv.com/ Lots of detailed information there, circuits, etc...

    Later today, when I'm near a prop, I'll do a screen capture of a color signal ran through an S-video intensity only input. The sub-pixels can be easily seen.

    With static color timing (non interlaced), those show up as thin, smaller than a pixel, lines that texture everything according to it's color. With interlaced timing, it's a rapidly changing pattern of dots, that alternate their position each scan line, going even or odd, on each frame.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Post Edited (potatohead) : 10/10/2007 7:33:12 PM GMT
  • adriftadrift Posts: 25
    edited 2007-10-10 19:33
    My understanding is that you can set Prop registers to allow video output in·a number of·standard·ways: Composite video, including grey scale and color per the rs-170a spec and capable of feeding the video input of a standard TV; the same rs-170a type signal on an rf carrier suitable for a tv antenna input; the video that is called S-video which separates the brightness (with sync) from the color info; and finally 3 -separate channels can be used as in the VGA mode.· Available colors are limited, but color can accompany brightness however you wish.

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


    Regards,
    Jim
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-10 21:40
    I think i understand now,

    as i currently see it, its all about how much of which color is put into each pixel on the screen.
    its sort of like: if the voltage peaks at the same frequency as the color burst, but 256deg out of phase with the color burst frequency, the line would be yellow.
    The greater the variance between the 256deg and the other phases, the more pronounced the yellow is.

    Thanks for all the help, now i can make my video driver!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius
  • adriftadrift Posts: 25
    edited 2007-10-10 21:48
    If the phase is different, the hue (yellowish green vs yellow) is different.· If the signal is larger but at the same phase the saturation is higher (bright vs dark yellow...with almost white and mostly black as the limits).

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


    Regards,
    Jim
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-10 21:48
    It is still a little bit different smile.gif
    But you do not need this, as the Video Logic within the propeller will do most of the color things for itself -
    except in those most exotic cases Potatohead has discussed. And it is much simpler with VGA.

    ---
    Edit: Posts crossed.... Jim is right, of course...

    Post Edited (deSilva) : 10/10/2007 11:12:02 PM GMT
  • potatoheadpotatohead Posts: 10,260
    edited 2007-10-10 23:05
    Are you working on one that yields control of saturation?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
  • Ken PetersonKen Peterson Posts: 806
    edited 2007-10-11 03:17
    @Mr. Crowley: We can all give you different perspectives on NTSC/PAL (CVBS) video, but if you can give us more details about what you are trying to accomplish, we may be able to help you with details that are more relevant to what you are trying to do.

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


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • Lee MarshallLee Marshall Posts: 106
    edited 2007-10-11 15:26
    sry for the delay.
    I wanted to gain a better idea about the workings of composite video, so that i could make a driver optimized for what i want to do.
    i have now achieved this, and i thank you all for the help.
    i dont need control of saturation or anything, i will probably just use basic colours, maybe just greyscale. maybe nothing but b/w, ill see, when i come to writing my big program.
    it was going to be a BZFlag-like game, but i see someone has already started on something similar. maybe ill do an armagetron advanced.
    that reminds me, has anyone written an ethernet interface yet?

    my view on the prop 2 matter:
    i think the prop 2 needs more ram, maybe ~128K, you just cant put many reasonable quality bitmaps along with a lot of code in 32KB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I hear and I forget. I see and I remember. I do and I understand
    -Confucius
  • potatoheadpotatohead Posts: 10,260
    edited 2007-10-11 15:37
    Well, good news on that score. Prop II will be 256K, 16 COG --I forget the clock, but I think it's 160Mhz. Also will feature block read write between HUB and COG. All very good news for video.

    On this Prop, there are drivers written for an external SRAM. That's 512K, plenty for an 8 bit double buffered screen, assets and such, at TV resolution. A standard color one can be found in the HYDRA forum. I think it's about done, or done enough to be worked with. jasper_m & epmoyer got that up and running fairly quickly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
Sign In or Register to comment.