This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TVP7002 horizontal alignment

Other Parts Discussed in Thread: TVP7002

Hello All,

I have used TVP7002 for capturing VGA input(with embedded sync).

Using the following formula to calculate AVID start/stop value:

         AVID Start = Delay Factor + HSync width + Horizontal back-porch
         AVID Stop = AVID Start + Active Pixels + 4
         If AVID Stop >= total pixels/line,  AVID Stop = AVID Stop – total pixels/line

But horizontal alignment have a little offsets from different capture sources.

In the 1280x720@60,  horizontal alignment offsets is huge in the Lenovo thinkpad and Apple mac with the same configuration in the TVP7002.

Lines per frame and clocks per line is below:

Lenovo :

line per frame: 750,  clocks per line : 600

Apple:

line per frame: 748,  clocks per line : 607

Is it necessary to do dynamic adjustment on AVID start/stop register in the specific resolution? if yes, how could I do?

Thank a lots!

BR,

Steven

  • Steven,

    This is a common problem for analog VGA. Whilst there is a VESA specification for most resolutions not all manufacturers of VGA sources follow these 'rules'.

    Unfortunately analog VGA does not have a signal which qualifies where the active video is in the signal.

    Most monitors have an "auto-set" or "auto-adjust" or some similar button or menu option which is used to align both the active video and the sampling phase of the receiver so that it aligns correctly with the source.

    The exact algorithm used by each monitor/TV manufacturer is their intellectual property and as such you will likely not find an exact example of how to do this.

    Basically though there are 2 steps...

    1) Sweep the AVID start/stop so that the starting position starts sampling the video before the expected location then monitor the captured frame buffer until you see a pixel value other than black(ish) appear in the first column. Another way to effectively do this is to start capturing early then analyze the captured frame buffer  to look for the first non black(ish) pixel, then subtract this offest from the start/stop registers so that the first non-black pixel then appears at the start location.

    2) Sweep the sampling phase through all values whilst looking at the first non-black pixel. You should see the captured pixel value cycle through from black to the max pixel value. Do the same on the last pixel so that you find the corresponding max value to black. Then you will have a phase profile showing all phases and corresponding samples. You then set the sample phase to the setting which corresponds to the mid point of the max/min value (remember that this is basically a circle)

    Most monitors will store these alignment and phase settings for each distinct resolution supported so that you do not need to repeat the process every time you change computer display resolution.

    I suggest you have a look at what happens on a regular monitor when the laptop is connected to it and then press the 'auto-set' option. You will see the monitor scan through the alignment and phase cycles on the displayed image then 'snap' back to the correct calculated positions.

    BR,

    Steve

  • Hello Steve,

    Thank you very much!

    It's useful for me. I will try to do "auto-adjust" to correct alignment.

    Thanks again.

    BR,

    Steven

  • Hello, Steve
    Some questions with capture 720P60.
    1. From VESA standard, 720P60 hsync and vsync are both positive polarity.But from some notebook VGA sources, I see the hsync is negative and hsync back porch is different from VESA stardard(hsync back porch should be 220 pixels). Now I have captured two type 720P60 VGA sources and I could determine what type it is by sync polarity. Then set properly AVID start and AVID stop value. It seems OK!
    But I am doubt that I am missing something? Do you know what standard it is?

    2. As i know, hsync width could be read from 0x3Bh register. How about hsync back porch pixels? Is it possible to find it's value from tvp7002 register?

    3. Is there any formula(such as the formula to caculate AVID start value) to calculate VBLK Field 0 Start Line Offset(0x44h) and VBLK Field 0 Duration (0x46h)? Could I use the vsync width (0x3Ch) to adjust vertical alignment?

    Sorry for many questions! Thanks for your patience!

    BR
    Steven

  • This is actually a very complex issue to solve.

    Many computers do not actually send out standards compliant signals so it does not surprise me you are seeing different configurations and timings. VESA was supposed to eliminate this with both DMT and CVT timing specifications (available through VESA.org/Google).

    If you look at all LCD analog monitors they ALL have either a button or a menu option called "auto set" or something similar. When you press this option/button the monitor basically moves the front/back porches around both vertically and horizontally until it finds a non blanking pixel at each of the edges of the image. Then it uses this information to determine the 'best' front/back porch settings. It will also adjust the sample phase so that each pixel is sampled at the optimal point.

    Since there are no additional signals to qualify the video portion of the image it is impossible to exactly determine the front/back porches in any way other than  moving the AVID start/stop settings until you 'see' the start/end of active video. Note, this procedure assumes that the source is generating an image with non black pixels on at least some of the left/right/top/bottom most pixels, otherwise it would not be able to distinguish blanking from black pixels. So, for example, the mainly black boot screen of most computers cannot be used for this procedure. You need to wait until a desktop like image is being displayed.

    As I mentioned earlier you must create your own algorithm for detecting the active pixels in the image, there are no 'standard' ways to achieve this unfortunately.

  • Hi Steve,

    Thanks for your reply.

    It's really complex issue.

    BR,

    Steven