Log in

View Full Version : Can anyone *please* check my math on this?


Laughlyn
1st January 2004, 05:47
Pretty basic question, and I think I've got it figured out already, but something about just bugs me... So I was hoping someone here might be able to confirm whether or not this is correct:

I have a 320x160 source file that I'm converting SVCD, using AVISynth to resize it.

Now, previous experience tells me that a 640x480 file resizes nicely to 480x480 and plays properly. 320x160 would be equal to 640x320, so to simply resize it while keeping the aspect ratio would be:

LanczosResize(480,320)
AddBorders(0,80,0,80)

And if I wanted to add a 24-pixel border to all sides, it would be:

LanczosResize(432,272)
AddBorders(24,104,24,104)

Is, uhm, that right?
For some reason, I'm just not able to confidently reconcile my numbers today. (Hopefully, that little problem will clear up before I do my taxes...lol)

Thanks for any help. :)

b00zed
1st January 2004, 08:27
Looks fine to me

You can, of course, load the AVS into MPC and query its final dimensions if you're unsure.

Kedirekin
1st January 2004, 14:58
320/160 * 1/1 = 2 (2.0:1 - strange aspect ratio, but we'll run with it)
[1/1 is the avi display aspect ratio (DAR) here, just to keep calculations consistent]

480/320 * 4/3 = 2 (good) [4/3 is SVCD DAR]

432/272 * 4/3 = 2.117

Close, but not quite. Rather than thinking in terms of adding equal borders, think in terms of shrinking the image (keeping 4:3 display aspect in mind). I'll admit it takes a little mental gymnastics, but just remember than any adjustment factor for the vertical dimension needs to be multiplied by 3/4 for the horizontal.

To resize the vertical dimension to 272, we need a vertical factor of 1.700 (=272/160).
The horizontal factor is then 1.275 (=1.700*3/4).
320 * 1.275 = 408.

To double check,
408/272 * 4/3 = 2 (good)

Alternatively to resize horizontally to 432, we need a horizontal factor of 1.350 (=432/320).
This gives a vertical factor of 1.800 (=1.350*4/3).
160 * 1.800 = 288.

To double check,
432/288 * 4/3 = 2 (also good)

Boy I hope I did that all right. I find it challenging too.

I leave the border calculations to you.