[mythtv] [PATCH] Potential display aspect ratio patch for non-4:3
Doug Larrick
doug at ties.org
Mon Feb 2 16:45:25 EST 2004
On 02/02/04 16:01:01, Chris Pinkham wrote:
> How about these formulas (yDPMM unused but given for reference)::
>
> First example shown with a 1600x900 screen that's 320x180mm w/ square
> pixels.
>
> float xDPMM = pixels_wide / x_mm; 1600 / 320 = 5.0
> float yDPMM = pixels_high / y_mm; 900 / 180 = 5.0
>
> float x_mm_needed = y_mm * XJ_aspect; 180 * 4/3 = 240
> int x_pix_needed = x_mm_needed * xDPMM; 240 * 5 = 1200
>
> 1200/900 = 4/3 aspect ratio
> 1200/1600 = 3/4 width of 16:9 screen.
>
> dispxoff += (diswpoff - x_pix_needed) / 2; (1600 - 1200) / 2 =
> 200;
> diswpoff = x_pix_needed; 1200 =
> 1200;
>
> This equates with the current method of using 3/4 of the 16x9
> screen's
> width.
>
> Now testing 1024x1024 non-square pixels w/ 320x180mm physical size.
>
> xDPMM = 1024 / 320 = 3.2000
> yDPMM = 1024 / 180 = 5.6888
>
> x_mm_needed = 180 * 4/3 = 239.999 (say 240)
> x_pix_needed = 240 * 3.2 = 768
>
> 768 / 1024 = 3/4 width of 16:9 screen.
>
> dispxoff += (1024 - 768) / 2 = 128;
> dispwoff = 768;
>
> Now for my 1280x800 screen which is 332x208mm physical size (99%
> square pixel)
>
> xDPMM = 1280 / 332 = 3.8554
> yDPMM = 800 / 208 = 3.84615
>
> x_mm_needed = 208 * 4/3 = 277.3326
> x_pix_needed = 277.3326 * 3.8854 = 1077.548
>
> 1078 / 800 = ~4/3
> 1078 / 1280 = ~85% of 1280x800 screen (which is accurate since
> it's not
> 16:9, but more like
> 14.5:9)
>
> dispxoff = (1280 - 1078) / 2 = 101
> dispwoff = 1078;
This looks right to me.
-Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040202/ff838884/attachment.pgp
More information about the mythtv-dev
mailing list