Shop OBEX P1 Docs P2 Docs Learn Events
PAL Video example — Parallax Forums

PAL Video example

AribaAriba Posts: 2,690
edited 2013-03-23 00:06 in Propeller 2
After a few hours of checking every detail of the PAL timing, I got a working PAL example.
I should believe it when Chip says:
cgracey wrote: »
PAL is a real pain! ...

What seems to be very important is the transition from V-Sync to the first (blank) line. After this was right, I finally got colors. Just not the right ones. The PAL coefficients in the Prop2_Docs seem to be wrong, and I don't know how to calculate them.
So I just tried around, made a mix from NTSC and PAL coefficients and got accetable but not perfect color hues.

Attached is the code for the ones that live in the PAL world.

Andy

Comments

  • TubularTubular Posts: 4,691
    edited 2013-03-17 21:38
    Hi Andy,

    Very well done - that seems to work both on my monitor (reports "PAL" rather than NTSC) and some other gear here that seems to regard it as a standard PAL signal
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-18 00:42
    Hi Andy.

    THANKS.

    It Works correct.


    Ariba wrote: »
    After a few hours of checking every detail of the PAL timing, I got a working PAL example.
    I should believe it when Chip says:


    What seems to be very important is the transition from V-Sync to the first (blank) line. After this was right, I finally got colors. Just not the right ones. The PAL coefficients in the Prop2_Docs seem to be wrong, and I don't know how to calculate them.
    So I just tried around, made a mix from NTSC and PAL coefficients and got accetable but not perfect color hues.

    Attached is the code for the ones that live in the PAL world.

    Andy
    1024 x 768 - 57K
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-18 03:06
    Hi Ariba.

    Now with some fine adjustments to remove right side zigzag from colour edges
    1024 x 768 - 79K
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-03-18 06:16
    Nice work Andy!

    Now PAL users will have working examples too.
  • nutsonnutson Posts: 242
    edited 2013-03-18 07:05
    Well, some of them. The PAL example does not show up for me (I use a TV to VGA converter), the NTSC examples display all OK. I looked at the signal with my scope, it looks perfect, even the pre and post egalisation pulses are there.

    One strange finding: my scope (TEK TDS2022B) will trigger OK on "all fields" and on "all lines", it will not trigger on "even field" or "odd field" (understandable, there is no odd er even fields in 312 line or 262 line TV signal), but it will trigger OK on a given "line number" in the NTSC signal, and will not do that on the PAL signal. Strange.

    Maybe PAL really is a pain.....
  • nutsonnutson Posts: 242
    edited 2013-03-18 08:16
    Tried the big flatscreen downstairs. NTSC is perfect, PAL displays with quite some error. This JVC set is not hapy with the PAL signal, and my TV to VGA converter does not take it.
    1024 x 768 - 124K
    1024 x 768 - 82K
    1024 x 768 - 67K
  • cgraceycgracey Posts: 14,134
    edited 2013-03-18 08:26
    Ariba wrote: »
    The PAL coefficients in the Prop2_Docs seem to be wrong, and I don't know how to calculate them.

    I think those numbers were correct. What probably needed changing was the reference phase.
  • AribaAriba Posts: 2,690
    edited 2013-03-18 12:46
    Thank you Chip

    I have set the reference burst to orange, according a document I have found on the NET.
    But rereading this document (again) I see that only the V part modulation (which is R-Y) must switch between positive and negative, and not the whole burst. I don't know what exactly Bit0 of SETVID affects, but I had the idea to try it totally different.

    Instead of switching the modulation direction every second line, I made a positive and a negative set of Q coefficients and switch between these two with SETVIDQ. And voila, the colors are perfectly right here with the PAL coefficients that you suggest in the Docs.

    So here is another version of the PAL color bars to try.

    Andy
  • jmgjmg Posts: 15,171
    edited 2013-03-18 12:50
    nutson wrote: »
    ... This JVC set is not hapy with the PAL signal, and my TV to VGA converter does not take it.

    I think PAL with no saturation is legal, (at least in classic signal flows) so perhaps a version with no Burst, or Chroma, could check if it is a Colour modulation, or Sync issue ?
    A test pattern that had optional cross hatch with border, and optional colour could be useful ?
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-18 12:54
    Hi Ariba.

    Thanks.

    Now I need only fine trim to remove zigzag on right side of colour strips.

    This version give even correct aspect ratio on LCD TV 7'' PAL only

    Ariba wrote: »
    Thank you Chip

    I have set the reference burst to orange, according a document I have found on the NET.
    But rereading this document (again) I see that only the V part modulation (which is R-Y) must switch between positive and negative, and not the whole burst. I don't know what exactly Bit0 of SETVID affects, but I had the idea to try it totally different.

    Instead of switching the modulation direction every second line, I made a positive and a negative set of Q coefficients and switch between these two with SETVIDQ. And voila, the colors are perfectly right here with the PAL coefficients that you suggest in the Docs.

    So here is another version of the PAL color bars to try.

    Andy
    1024 x 768 - 82K
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-03-18 12:58
    Here is some PAL info that may be helpfull
    http://dxr3.sourceforge.net/download/hardware/l865a.pdf
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-18 13:04
    Hi Ariba.

    Adjusted now.

    It is this 2 places I need change
    1. mov    x,#37            'x,#59    top blanks
    2. mov     x,#45            'x,#53    bottom blanks
    
    
    1024 x 768 - 83K
  • AribaAriba Posts: 2,690
    edited 2013-03-18 13:52
    Thanks, Sapieha and Tonyp12

    This datasheet shows the timing and levels, but what I need is the math of the Y/I/Q coefficients. Wikipedia and this doc helped a lot:
    http://www.deetc.isel.ipl.pt/Analisedesinai/sm/downloads/doc/ch08.pdf

    @Sapieha
    If you reduce the top and bottom blanks, you must increase the visible lines by the same amount otherwise the vertical timing is totally wrong.

    Andy
  • AribaAriba Posts: 2,690
    edited 2013-03-18 23:05
    OK, the next version.
    This time without the zig-zag borders. The timing was too exact for non interlacing what caused this ziz-zag. With a lttle detune it goes away.
    Attached is also another color bars code which shows all colors of Videomode 8. Looks like the colors are right now.

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-19 00:48
    Hi Ariba.

    Both function correct.

    Now I need only find H-sync timings to skip blank strips -- My LCD TV-monitor not need that ones.
    Ariba wrote: »
    OK, the next version.
    This time without the zig-zag borders. The timing was too exact for non interlacing what caused this ziz-zag. With a lttle detune it goes away.
    Attached is also another color bars code which shows all colors of Videomode 8. Looks like the colors are right now.

    Andy
  • cgraceycgracey Posts: 14,134
    edited 2013-03-19 07:47
    Ariba wrote: »
    Thank you Chip

    I have set the reference burst to orange, according a document I have found on the NET.
    But rereading this document (again) I see that only the V part modulation (which is R-Y) must switch between positive and negative, and not the whole burst. I don't know what exactly Bit0 of SETVID affects, but I had the idea to try it totally different.

    Instead of switching the modulation direction every second line, I made a positive and a negative set of Q coefficients and switch between these two with SETVIDQ. And voila, the colors are perfectly right here with the PAL coefficients that you suggest in the Docs.

    So here is another version of the PAL color bars to try.

    Andy

    Wow! I never thought of handling the phase negation by using a different set of coefficients. Makes sense!

    What bit 0 of the VID configuration register does is select between phase (=0) and -phase (=1) for modulated video. It also selects the polarity of HSYNC for VGA modes.
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-19 08:09
    Hi Chip - Ariba.

    Can one of You say me what I'm doing vrong.
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-19 09:06
    Hi Chip - Ariba.

    I think I fond it.
    Code attached.
  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-19 10:18
    Yep, you had the wrong mode.
  • AribaAriba Posts: 2,690
    edited 2013-03-19 10:41
    Yes, the mode was wrong. But you should also change the vertical synchronisation when you port an NTSC demo to PAL.
    The attached file shows the NTSC and PAL vertical sync, so you can see the differencies.

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-19 10:53
    Thanks Ariba

    Ariba wrote: »
    Yes, the mode was wrong. But you should also change the vertical synchronisation when you port an NTSC demo to PAL.
    The attached file shows the NTSC and PAL vertical sync, so you can see the differencies.

    Andy
  • AribaAriba Posts: 2,690
    edited 2013-03-19 10:57
    cgracey wrote: »
    Wow! I never thought of handling the phase negation by using a different set of coefficients. Makes sense!

    What bit 0 the VID configuration register does is select between phase (=0) and -phase (=1) for modulated video, and also selects the polarity of HSYNC for VGA modes.

    Thanks Chip

    Can it be that the VID bit0 not just reverses the modulation direction but also makes a phase-jump of 180 degree? This would explain why a phase switch per VID bit0 not gives the same result as negating the Q coefficients.

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-19 11:13
    Hi Ariba.

    Can You help now from that tile-texture driver help build ---- Tile-Char driver

    Regards
  • cgraceycgracey Posts: 14,134
    edited 2013-03-19 15:24
    Ariba wrote: »
    Thanks Chip

    Can it be that the VID bit0 not just reverses the modulation direction but also makes a phase-jump of 180 degree? This would explain why a phase switch per VID bit0 not gives the same result as negating the Q coefficients.

    Andy

    I'm not sure. I suppose it would have to do with the state of the phase when bit0 is toggled. I just used the same technique that I used in Prop1, and today I don't remember any more than that.
  • AribaAriba Posts: 2,690
    edited 2013-03-19 21:37
    Sapieha wrote: »
    Hi Ariba.

    Can You help now from that tile-texture driver help build ---- Tile-Char driver

    Regards

    Not sure if you call this Tile-Char driver, but I have made a Video text driver. Like the VGA version I posted once this driver uses Video mode 7 and holds the font in the stack ram (128 chars
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-20 01:45
    Hi Ariba.

    Thanks.
    Works very nice on my hardware.


    Ariba wrote: »
    Not sure if you call this Tile-Char driver, but I have made a Video text driver. Like the VGA version I posted once this driver uses Video mode 7 and holds the font in the stack ram (128 chars
  • potatoheadpotatohead Posts: 10,261
    edited 2013-03-23 00:06
    Andy, this driver is excellent! I can't view the PAL color on my current hardware, but both NTSC / PAL display well monochrome. The signal quality is so much better now that we are not slamming rough waves into analog displays.

    At the 96 columns, my monochrome amber NTSC display is just pixel perfect. That's about what it was designed for.

    I find the 64 and 72 column text readable on an ordinary NTSC TV as well.

    I've attached modified code to fire off a second monitor on pins 3&5 and NTSC component output. The same kind of modification should work on PAL too, but I didn't have a device to test on.
Sign In or Register to comment.