Function FAVCResize(clip clip, string Region, float o, int Ratio) {

Under = 1.33
Upper = 1.74
Ratio = Float(Ratio)/1000

HRes1 = (Region=="PAL") ? 576-o*32 : 480-o*32
VRes1 = (Region=="PAL") ? 768-o*42.666667 : 640-o*42.666667
VRes2 = (Region=="PAL") ? 1024-o*56.888889 : 853.333333-o*56.888889

Hori = (Ratio<Under) ? 720-o*32-(Round((720-o*32-(540-o*24)*Ratio)/32)*32) : nop()
Bord = (Ratio<Under) ? (720-o*32-Hori)/2 : nop()
UnderVid = (Ratio<Under) ? LanczosResize(clip, Hori, HRes1) : nop()
UnderVid = (Ratio<Under) ? Addborders(UnderVid, Bord+o*16, o*16, Bord+o*16, o*16) : nop()
clip = (Ratio<Under) ? UnderVid : clip

Vert = (Ratio>=Under)&&(Ratio<Upper) ? Round((VRes1/(Ratio*32)))*32 : nop()
Bord = (Ratio>=Under)&&(Ratio<Upper) ? (HRes1-Vert)/2 : nop()
MidVid = (Ratio>=Under)&&(Ratio<Upper) ? LanczosResize(clip, 720-o*32, Vert) : nop()
MidVid = (Ratio>=Under)&&(Ratio<Upper) ? Addborders(MidVid, o*16, Bord+o*16, o*16, Bord+o*16) : nop()
clip = (Ratio>=Under)&&(Ratio<Upper) ? MidVid : clip

Vert = (Ratio>=Upper) ? Round((VRes2/(Ratio*32)))*32 : nop()
Bord = (Ratio>=Upper) ? (HRes1-Vert)/2 : nop()
UpperVid = (Ratio>=Upper) ? LanczosResize(clip, 720-o*32, Vert) : nop()
UpperVid = (Ratio>=Upper) ? Addborders(UpperVid, o*16, Bord+o*16, o*16, Bord+o*16) : nop()
clip = (Ratio>=Upper) ? UpperVid : clip

return(clip)
}

Function FAVCResize2(clip clip, string Region, float o, int Ratio) {

Under = 1.33
Ratio = Float(Ratio)/1000

HRes1 = (Region=="PAL") ? 576-o*32 : 480-o*32
VRes1 = (Region=="PAL") ? 768-o*42.666667 : 640-o*42.666667

Hori = (Ratio<Under) ? 352-o*32-(Round((352-o*32-(264-o*24)*Ratio)/32)*32) : nop()
Bord = (Ratio<Under) ? (352-o*32-Hori)/2 : nop()
UnderVid = (Ratio<Under) ? BiCubicResize(clip, Hori, HRes1) : nop()
UnderVid = (Ratio<Under) ? Addborders(UnderVid, Bord+o*16, o*16, Bord+o*16, o*16) : nop()
clip = (Ratio<Under) ? UnderVid : clip

Vert = (Ratio>=Under) ? Round((VRes1/(Ratio*32)))*32 : nop()
Bord = (Ratio>=Under) ? (HRes1-Vert)/2 : nop()
MidVid = (Ratio>=Under) ? BiCubicResize(clip, 352-o*32, Vert) : nop()
MidVid = (Ratio>=Under) ? Addborders(MidVid, o*16, Bord+o*16, o*16, Bord+o*16) : nop()
clip = (Ratio>=Under) ? MidVid : clip

return(clip)
}

Function FAVCResize3(clip clip, string Region, float o, int Ratio) {

Under = 1.33
Ratio = Float(Ratio)/1000

HRes1 = (Region=="PAL") ? 288-o*32 : 240-o*32
VRes1 = (Region=="PAL") ? 384-o*42.666667 : 320-o*42.666667

Hori = (Ratio<Under) ? 352-o*32-(Round((352-o*32-(264-o*24)*Ratio)/32)*32) : nop()
Bord = (Ratio<Under) ? (352-o*32-Hori)/2 : nop()
UnderVid = (Ratio<Under) ? BiLinearResize(clip, Hori, HRes1) : nop()
UnderVid = (Ratio<Under) ? Addborders(UnderVid, Bord+o*16, o*16, Bord+o*16, o*16) : nop()
clip = (Ratio<Under) ? UnderVid : clip

Black = (Ratio>=Under) ? Round((HRes1-VRes1/Ratio)/32)*32 : nop()
Vert = (Ratio>=Under) ? HRes1-Black : nop()
MidVid = (Ratio>=Under) ? BiLinearResize(clip, 352-o*32, Vert) : nop()
MidVid = (Ratio>=Under) ? Addborders(MidVid, o*16, Black/2+o*16, o*16, Black/2+o*16) : nop()
clip = (Ratio>=Under) ? MidVid : clip

return(clip)
}

Function MenuResize(clip clip, string Region, float o, int Ratio) {

Under = 1.33
Ratio = Float(Ratio)/1000

HRes1 = (Region=="PAL") ? 576-o*32 : 480-o*32
VRes1 = (Region=="PAL") ? 768-o*42.666667 : 640-o*42.666667
VRes2 = (Region=="PAL") ? 1024-o*56.888889 : 853.333333-o*56.888889

Hori = (Ratio<Under) ? 720-o*32-(Round((720-o*32-(540-o*24)*Ratio)/32)*32) : nop()
Bord = (Ratio<Under) ? (720-o*32-Hori)/2 : nop()
UnderVid = (Ratio<Under) ? LanczosResize(clip, Hori, HRes1) : nop()
UnderVid = (Ratio<Under) ? Addborders(UnderVid, Bord+o*16, o*16, Bord+o*16, o*16) : nop()
clip = (Ratio<Under) ? UnderVid : clip

Vert = (Ratio>=Under) ? Round((VRes1/(Ratio*32)))*32 : nop()
Bord = (Ratio>=Under) ? (HRes1-Vert)/2 : nop()
MidVid = (Ratio>=Under) ? LanczosResize(clip, 720-o*32, Vert) : nop()
MidVid = (Ratio>=Under) ? Addborders(MidVid, o*16, Bord+o*16, o*16, Bord+o*16) : nop()
clip = (Ratio>=Under) ? MidVid : clip

return(clip)
}