Video Signals And Timing: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Brendan (talk | contribs)
Quick explanation of margins..
Combuster (talk | contribs)
added more vars, removed round(x, 0) constructs
Line 70: Line 70:
The formula's provided by VESA use various scales of constants. Brendan's working on changing the scales to units. Right now, the scale space is still unknown.
The formula's provided by VESA use various scales of constants. Brendan's working on changing the scales to units. Right now, the scale space is still unknown.


== GTF Using resolution and refresh rate ==
== Common parts of the GTF formulas ==


<tt>[[#H_PIXELS_RND|H_PIXELS_RND]] = ( ''ROUND'' ( [[#H_PIXELS|H_PIXELS]] / [[#CELL_GRAN_RND|CELL_GRAN_RND]] ) ) * [[#CELL_GRAN_RND|CELL_GRAN_RND]]
<tt>[[#H_PIXELS_RND|H_PIXELS_RND]] = ( ''ROUND'' ( [[#H_PIXELS|H_PIXELS]] / [[#CELL_GRAN_RND|CELL_GRAN_RND]] ) ) * [[#CELL_GRAN_RND|CELL_GRAN_RND]]
Line 77: Line 77:
{<br />
{<br />
:[[#V_LINES_RND|V_LINES_RND]] = ''ROUND'' ( [[#V_LINES|V_LINES]] / 2 )<br />
:[[#V_LINES_RND|V_LINES_RND]] = ''ROUND'' ( [[#V_LINES|V_LINES]] / 2 )<br />
:[[#V_FIELD_RATE_REQUIRED|V_FIELD_RATE_REQUIRED]] = [[#REFRESH_RATE_REQUIRED|V_LINES]] * 2<br />
:[[#V_FIELD_RATE_REQUIRED|V_FIELD_RATE_REQUIRED]] = [[#REFRESH_RATE_REQUIRED|REFRESH_RATE_REQUIRED]] * 2<br />
:[[#INTERLACE|INTERLACE]] = 0.5<br />
:[[#INTERLACE|INTERLACE]] = 0.5<br />
} '''else''' {<br />
} '''else''' {<br />
:[[#V_LINES_RND]] = ''ROUND'' ( [[#V_LINES]]) )<br />
:[[#V_LINES_RND|V_LINES_RND]] = ''ROUND'' ( [[#V_LINES|V_LINES]]) )<br />
:[[#V_FIELD_RATE_REQUIRED]] = [[#REFRESH_RATE_REQUIRED]]<br />
:[[#V_FIELD_RATE_REQUIRED|V_FIELD_RATE_REQUIRED]] = [[#REFRESH_RATE_REQUIRED|REFRESH_RATE_REQUIRED]]<br />
:[[#INTERLACE]] = 0<br />
:[[#INTERLACE|INTERLACE]] = 0<br />
}<br />
}<br />


'''if''' ( [[#MARGINS_REQUIRED]] == '''true''' ) {<br />
'''if''' ( [[#MARGINS_REQUIRED]] == '''true''' ) {<br />
:[[#TOP_MARGIN_LINES]] = ''ROUND'' ( [[#MARGIN_PRECENT]] / 100 * [[#V_LINES_RND]] )<br />
:[[#TOP_MARGIN_LINES|TOP_MARGIN_LINES]] = ''ROUND'' ( [[#MARGIN_PRECENT]] / 100 * [[#V_LINES_RND]] )<br />
:[[#BOTTOM_MARGIN_LINES]] = ''ROUND'' ( [[#MARGIN_PRECENT]] / 100 * [[#V_LINES_RND]] )<br />
:[[#BOTTOM_MARGIN_LINES|BOTTOM_MARGIN_LINES]] = ''ROUND'' ( [[#MARGIN_PRECENT]] / 100 * [[#V_LINES_RND]] )<br />
:[[#LEFT_MARGIN_PIXELS]] = ( ''ROUND'' ( ( [[#H_PIXELS_RND]] * [[#MARGIN_PRECENT]] / 100 / [[#CELL_GRAN_RND]] ) , 0 ) ) * [[#CELL_GRAN_RND]]<br />
:[[#LEFT_MARGIN_PIXELS|LEFT_MARGIN_PIXELS]] = ( ''ROUND'' ( [[#H_PIXELS_RND]] * [[#MARGIN_PRECENT]] / 100 / [[#CELL_GRAN_RND]] ) ) * [[#CELL_GRAN_RND]]<br />
:[[#RIGHT_MARGIN_PIXELS]] = ( ''ROUND'' ( ( [[#H_PIXELS_RND]] * [[#MARGIN_PRECENT]] / 100 / [[#CELL_GRAN_RND]] ) , 0 ) ) * [[#CELL_GRAN_RND]]<br />
:[[#RIGHT_MARGIN_PIXELS|RIGHT_MARGIN_PIXELS]] = ( ''ROUND'' ( [[#H_PIXELS_RND]] * [[#MARGIN_PRECENT]] / 100 / [[#CELL_GRAN_RND]] ) ) * [[#CELL_GRAN_RND]]<br />
} '''else''' {<br />
} '''else''' {<br />
:[[#TOP_MARGIN_LINES]] = 0<br />
:[[#TOP_MARGIN_LINES|TOP_MARGIN_LINES]] = 0<br />
:[[#BOTTOM_MARGIN_LINES]] = 0<br />
:[[#BOTTOM_MARGIN_LINES|BOTTOM_MARGIN_LINES]] = 0<br />
:[[#LEFT_MARGIN_PIXELS]] = 0<br />
:[[#LEFT_MARGIN_PIXELS|LEFT_MARGIN_PIXELS]] = 0<br />
:[[#RIGHT_MARGIN_PIXELS]] = 0<br />
:[[#RIGHT_MARGIN_PIXELS|RIGHT_MARGIN_PIXELS]] = 0<br />
}</tt>
}


== GTF Using resolution and refresh rate ==

<tt>
[[#H_PERIOD_ESTIMATE]] = ( 1 / [[#V_FIELD_RATE_REQUIRED]] - [[#MIN_V_SYNC_AND_BACK_PORCH]] / 1000000 )
[[#H_PERIOD_ESTIMATE]] = ( 1 / [[#V_FIELD_RATE_REQUIRED]] - [[#MIN_V_SYNC_AND_BACK_PORCH]] / 1000000 )
:/ ( [[#V_LINES_RND]] + 2 * [[#TOP_MARGIN_LINES]] + [[#MIN_PORCH_RND]] + [[#INTERLACE]] ) * 1000000
:/ ( [[#V_LINES_RND]] + 2 * [[#TOP_MARGIN_LINES]] + [[#MIN_PORCH_RND]] + [[#INTERLACE]] ) * 1000000
Line 153: Line 156:
==== CELL_GRAN_RND ====
==== CELL_GRAN_RND ====
Cell granularity - the amount of pixels the timings should be aligned to. For example, a VGA uses horizontal timings in multiples of the character clock, each character being 8 (graphics and some text modes) or 9 (most text modes) pixels wide. For a VGA graphics mode, you'll want to supply 8 here because of that. Depending on your specific hardware, you supply either 8 or 1.
Cell granularity - the amount of pixels the timings should be aligned to. For example, a VGA uses horizontal timings in multiples of the character clock, each character being 8 (graphics and some text modes) or 9 (most text modes) pixels wide. For a VGA graphics mode, you'll want to supply 8 here because of that. Depending on your specific hardware, you supply either 8 or 1.

==== MARGIN_PERCENT ====
'''Todo''' Equals 1.8


==== MIN_PORCH_RND ====
==== MIN_PORCH_RND ====
Line 167: Line 167:


In theory it would be possible to use margins to simulate a small screen on a larger screen, or to simulate different aspect ratios perfectly. For example, if you were setting up a 640 * 480 video mode on a 16:10 display you could make the left and right margin 64 pixels each (with no top or bottom margins), so that it looks exactly the same as it would on a 4:3 display, rather than being stretched to fit. The opposite is also possible (e.g. displaying 16:10 video data on a 4:3 display with "letterboxing"). Unfortunately the GTF calculations don't actually support different sized left/right and top/bottom margins.
In theory it would be possible to use margins to simulate a small screen on a larger screen, or to simulate different aspect ratios perfectly. For example, if you were setting up a 640 * 480 video mode on a 16:10 display you could make the left and right margin 64 pixels each (with no top or bottom margins), so that it looks exactly the same as it would on a 4:3 display, rather than being stretched to fit. The opposite is also possible (e.g. displaying 16:10 video data on a 4:3 display with "letterboxing"). Unfortunately the GTF calculations don't actually support different sized left/right and top/bottom margins.

==== MARGIN_PERCENT ====
(Percentage!) Amount of margins you want to have around your screen. VESA suggests a default of 1.8 to allow for screens that do not perfectly fit the image to the center.


==== INTERLACE_REQUIRED ====
==== INTERLACE_REQUIRED ====
Line 176: Line 179:
==== H_PIXELS ====
==== H_PIXELS ====
Horizontal resolution of the display you want. For a 640x480 resolution, supply 640. Note that video cards will usually want this to be a multiple of eight because of [[#CELL_GRAN_RND|cell granularity]].
Horizontal resolution of the display you want. For a 640x480 resolution, supply 640. Note that video cards will usually want this to be a multiple of eight because of [[#CELL_GRAN_RND|cell granularity]].

==== REFRESH_RATE_REQUIRED ====

==== V_LINES_RND ====
Amount of active display scanlines per frame. Equals [[#V_LINES|the Y resolution]] unless interlaced modes are used.

==== H_PIXELS_RND ====
Actual horizontal resolution used. Basically contains [[#H_PIXELS|the X resolution]] rounded to the nearest allowed boundary.

==== V_FIELD_RATE_REQUIRED ====
Rate of complete images being sent to the monitor per second. Unless interlaced mode is used, equals the refresh rate.

==== TOP_MARGIN_LINES ====
Amount of margin at the top.

==== BOTTOM_MARGIN_LINES ====
Amount of margin at the bottom

==== LEFT_MARGIN_PIXELS ====
Amount of margin at the left

==== RIGHT_MARGIN_PIXELS ====
Amount of margin at the right


= Brendan's Original Posts =
= Brendan's Original Posts =