PDA

View Full Version : Question about picture ratio.


SledgeHammer_999
28th July 2009, 21:18
I don't know if this belongs in this category, but it definitely doesn't belong to programming.

I am developing a software player. I am having trouble keeping the correct picture ratio when the Window is resized. But for simplicity I am going to introduce a case scenario:
Let's assume that I have a monitor that operates in 1440*900pixels. Let's assume that my video's dimensions are 720*480. Let's also assume that we go fullscreen and the video has all the display to its disposal. This is how I calculate the new dimensions.
1.I find the ratio between the dimension of the video: width/height=720/480=1.5
2.I check which video dimension is bigger. In our case the width.
3.I make the biggest dimension equal to the equivalent dimension of the available display area. In our case it is the width. So I make the video width=1440.
4.I use the ratio to calculate the other dimension. So height=width/ratio=1440/1.5=960.
5.Then I check if the newly calculated dimension exceeds the equivalent dimension of the available display area. If it does then I make it equal to that dimension and calculate the other dimension(which is bigger). So here the calculated video height is 960. The height of the display area is 900. So I make the video height=900 and recalculate the video width=height*ratio=900*1.5=1350.

So I end up that my video should be displayed in fullscreen in these dimensions 1350*900. But my concern is that other players(vlc/totem/mpc) use fully the available display width(1440). The height should be(in those players) 960 but it isn't. It is even smaller than that, because I can see black-bars above and below.

So obviously I am missing something in my logic. Can you help me?

smok3
28th July 2009, 22:29
probably PAR (http://resizecalc.somestuff.org/index.php?ssmw=720&sar=1.18519&sar2=&ssmh=480&CT=&CL=&CR=&CB=&mplayCrop=&trw=1440&dar=1&dar2=&modw=1&modh=1&padw=&padh=&css=&doit=true).

jmnk
29th July 2009, 00:13
probably PAR (http://resizecalc.somestuff.org/index.php?ssmw=720&sar=1.18519&sar2=&ssmh=480&CT=&CL=&CR=&CB=&mplayCrop=&trw=1440&dar=1&dar2=&modw=1&modh=1&padw=&padh=&css=&doit=true).
+1. A hint. in those 'other players' - when you play the video in non-full-screen mode (hopefully they have a setting to play at 100% video, not 100% screen size) - what is the dimensions you see? Is it 720x480 or more like 853x480?
Another hint. Please do not start another 'what is PAR' thread:)

SledgeHammer_999
29th July 2009, 01:25
ok thank you.
Now my problem is how do I get the PAR of the video? Is this provided by the codecs or from somewhere else?

SledgeHammer_999
29th July 2009, 02:57
Nevermind. I found the answer. It is provided by the codecs.

SledgeHammer_999
29th July 2009, 03:57
Ok I am officialy lost :S How do I use PAR to find the new(correct) dimensions? Is there some kind of formula?

(smok3 I tried to read your source but I can't understand it)

GodofaGap
29th July 2009, 08:59
Multiply the width with the PAR to get the correct square pixel width. Height stays the same.

SledgeHammer_999
29th July 2009, 21:04
So just to be sure that I am doing it correctly:
Video dimensions = 720*480
PAR = 1.184722222
Screen/target dimensions =1440*900

The calculations:
new_width=video width*PAR=720*1.184722222=853
new_height=480
so now we have 853*480. We make the width equal to the screen width, calculate the ratio and use it to change the height
ratio = 1440/853 = 1.688159437
new_height2 = new_height*ratio = 480*1.688159437 = 810.31 = 810
So I should display the video at fullscreen at 1440*810 dimensions.

Is this correct?

cacepi
29th July 2009, 23:15
We make the width equal to the screen width, calculate the ratio and use it to change the height

Is this correct?
PAR is exclusively horizontal: You cannot change the height by setting a different PAR.

Just set your player to full screen and forget about it.

smok3
29th July 2009, 23:30
So just to be sure that I am doing it correctly:
Video dimensions = 720*480
PAR = 1.184722222
Screen/target dimensions =1440*900

The calculations:
new_width=video width*PAR=720*1.184722222=853
new_height=480
so now we have 853*480. We make the width equal to the screen width, calculate the ratio and use it to change the height
ratio = 1440/853 = 1.688159437
new_height2 = new_height*ratio = 480*1.688159437 = 810.31 = 810
So I should display the video at fullscreen at 1440*810 dimensions.

Is this correct?

appears so.

Gavino
29th July 2009, 23:57
So I should display the video at fullscreen at 1440*810 dimensions.

Is this correct?
As a sanity check, you can see that 1440x810 has the aspect ratio 16:9, which is presumably the DAR of your movie.

SledgeHammer_999
30th July 2009, 14:45
ok thank you