Quantcast KDVD: Resize or Not Resize, that is the Question. - Page 2 - digitalFAQ.com Forums [Archives]
  #21  
09-07-2005, 11:14 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks, Phil. Will do. Will try out the LRemoveDust filters tonight.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
09-07-2005, 11:22 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
@ Phil

For NTSC is 704 exactly the same value

A FULL ntsc active video area on tv is 648x486 (yep).
So such an active window on a DVD would be result as 712x486.
But as our encodings will do result as a "cropped" full ntsc area, means 640x480 on later TV viewing, then we can use the relation of 640x480 on our DVD encoding and that exactly also an active width as in PAL, means 702x480 which does result in a 704x480 encoding.

So crop at 704x480


Phil (just a point of taste), I do avoid using removegrain() in its defaults as it plains a lot of "pocito" details. Thats why I do love that LRemoveDust() Function as it uses a special way to avoid the spatial overshoot on details.

With LRemovedust() you even dont have to use Deen() anymore as it plains a lot (its spatial compound of the c3d default mode is like an eraser, paired with that temporal artifacting compound). The Result is a cleaner, more detailed an FASTER encoding as LRemovedust is fast.

I came to a conclusion .... If LRemovedust(17,1) plains too much details, then ... just don't denoise as other denoisers I know would do plain even more.

@ nicksteel


Quote:
Will try out the LRemoveDust filters tonight
LRemovedust is NOT a filter but a fast function which uses filters from the Removegrain package at www.removegrain.de.tf.
Search in here in the LimitedSharpen Thread to find the LRemovedust() function fom Didée.
Reply With Quote
  #23  
09-07-2005, 11:38 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks, Incredible.

Quote:
function LRemoveDust_YV12(clip input, int clmode, int "limit")
{
limit=default(limit,2)
clmode=default(clmode,17)
repmode = 2
clensed = Clense(input)
rep = Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return LimitChange(rg, input, limit)
}


I've ditched the TemporalRepair part as that's not necessary with mode 17. LimitChange can be found in the latest SSETools plugin, which is in the RemoveGrain v0.9 package.

process chain is
Code:

AVISource()
org=last
ConverttoYV12()
LRemoveDust(17,2)
Think I will start with Boulder's routine (above). I don't know if my 2.8 Gateway 820 dual-core is Prescott P4 or not, so will try different SSE versions.
Reply With Quote
  #24  
09-07-2005, 12:05 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Im not shure, but AFAIK your new "Toaster" even supports SSE3.
Or is that only on newer Athlon 64's supported .... hmmmm
Reply With Quote
  #25  
09-07-2005, 12:07 PM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nicksteel
Think I will start with Boulder's routine (above). I don't know if my 2.8 Gateway 820 dual-core is Prescott P4 or not, so will try different SSE versions.
Try CPU-Z, it will tell you which instruction set your CPU can deal with. I'm quite sure you can use the SSE3 versions of Repair and RemoveGrain and SSETools.

I would also recommend you try tsp's MT plugin, it adds some multithreading capability to Avisynth. If you have a dual-core CPU which also supports hyperthreading, you could run 4 threads. Try MT("LRemoveDust(17,1)",4) and see if you notice any difference in the performance.

http://forum.doom9.org/showthread.php?t=94996

Remember to use the latest Avisynth, now at release candidate stage.
Reply With Quote
  #26  
09-07-2005, 12:18 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
So crop at 704x480
You are so much focused on the with that you do not understand that I am talking about the height !
Look at the lines I have in my script :
Code:
Code:
Mpeg2Source("PATH\NAME.d2v",cpu=4)
Crop(8, 72, 704, 432) # 72_72
#Crop(8, 16, 704, 544) # 16_16
#Crop(8, 0, 704, 576) # fullscreen

FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)
Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)
#Addborders(0,72,0,72) # 72_72
#Addborders(0,16,0,16) # 16_16
LetterBox(16,16,16,16)

Note that the "72_72" means that this lien has to be used in case of movie with 72 pixels wide top/bottom borders. These are actually 2.35:1 movies.
16_16 is for 1.85:1 movies. You can check the width of the borders in DVD2AVI.
The "72" and "16" are for PAL SOURCES.
For NTSC the border in a 2.35:1 sources is smaller than 72, so you must crop less than this else you will cut the head of the character !
Capisce ?

Quote:
Thats why I do love that LRemoveDust() Function as it uses a special way to avoid the spatial overshoot on details.
I will try.
Reply With Quote
  #27  
09-07-2005, 03:12 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Capisce ?
And you are just thinking in already "detailed" X.xx:1 croppings which arent at ANY interesting to the MAIN subject ... started by prodater and also as you really dont know WHATs really the state of Nicsteels source - just by quoting his lines.
Quote:
Originally Posted by Prodater
Is it worth to resize to 704*576 when we are doing 1:1 or 2:1 DVD backups?
If we keep resolution 720*576, encoding will be really faster, or not?
I think "I" understood HIS purpose of trying to understand the "Logic".
Some people dont just want the food, the want to know WHAT they're eating.

Now related to NicSteels post to make it a bit retrospectively:

The logic of bringing 720x480! to 704x480 IS CROPPING! if you won't loose quality by resize interpolation and IF you want the stream to be still played back in the SAME window as it was meant to be when mastered as original on the DVD! As that tiny little SAP does work in 13.5Mhz period.

Now lets push the FFW Button to "Capice":

Quote:
Crop(8, 72, 704, 432) # 72_72
#Crop(8, 16, 704, 544) # 16_16
#Crop(8, 0, 704, 576) # fullscreen

FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)

Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)
#Addborders(0,72,0,72) # 72_72
#Addborders(0,16,0,16) # 16_16
LetterBox(16,16,16,16)
Finding out standard (MOD16) borders of 2.35:1 and 1.87:1 or 1.85:1 or WHATEVER when these have been set when digitally telecining the Footage can be "seen" on the original or if someone doesnt have that experience/feeling then it can be figured out using displaying/cropping softwares.

Yep Inc. you still think in "overlayed" overscans. I do so as I do have a 16:9 TV where at least at a 1.778:1 DVD I want to avoid watching borders! Means I want to see the borders they where meant to be there at the "academy format" telecine of 720x576.

Quote:
The "72" and "16" are for PAL SOURCES.
Dont explain me PAL, NTSC, and Borders. I know it and not only cause what have been written in Posts, optimalScripts, www sites or xxxDemystified Literature, its a math ... btw. explained by myself in here many times.

16,16 at width (yep yep, again the focussed width) can be used for PAL/NTSC .... the HEIGHT where we would determine the original border cropping can be "figured out" easely using DVD2AVI (if setting within bigger MODs) or that tiny little dv2viewer appl. Remeber? Then you see in which range the sources height is (2.35:1, 1,78:1 or whatever) and .... surprise ... you even have a pre builded cropping line.

So I personally btw. wouldnt use ANY of these "static" suggested resize parameters as people never will understand WHY it is correct in such a case or why it isnt. I thought we are at an "advanced" movie conversation area?

Phillipe, keep your distant, noirotic coool way from your top to the bottom of the roman people (at least when we both are talking/ diskussing) on YOUR side. You can treat every person you want as a fool but people which do have at least something in the head made already their experiences if beeing a fool or not.
I do make it in here official and not via PM cause you do it in here - in the official area.

Its quite symphatic ... in a time where the (also non warez) activity in here shrinked to almost 3% compared to the time before ... to have then almost 50% of these posts in such a distant cool way - nice! .

So don't worry I got my "capice".

These lines above are not related to this crappy 704/borders- or whatever -subject. Its in general and you do focus it many times as new.
Reply With Quote
  #28  
09-07-2005, 03:23 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Lets make a trim() on the "Capice" and applying a loop:
Quote:
Mpeg2Source("PATH\NAME.d2v",cpu=4)
Crop(8, 72, 704, 432) # 72_72
#Crop(8, 16, 704, 544) # 16_16
#Crop(8, 0, 704, 576) # fullscreen

FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)
Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)
#Addborders(0,72,0,72) # 72_72
#Addborders(0,16,0,16) # 16_16
LetterBox(16,16,16,16)
Lets do kick out these remarked lines:

Quote:
Mpeg2Source("PATH\NAME.d2v",cpu=4)
Crop(8, 72, 704, 432) # 72_72
FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)
Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)
LetterBox(16,16,16,16)
So "I do read your lines" and see your'e cropping a 720x576 to 704x432 and finally you just apply a letterbox() on that "cropped" result?
And Nicsteel uses it.

Ough.

I don't want to tease you ... really ... (ok, a bit), but YOUR'E the one who is focussing on "read my lines" .. "capice?"



BTW my capice is : Many DVDs arent exactly at standard 2.35:1, 1,778:1 at MOD16, so by cropping using "static" 16, 72 Values could result in by few pix cropped movieareas OR even worst, some height pixels could still be present where some further applied filters would also filter "these" present few pix borders. A sharpener for instance ... ough ... not imagine how it will be seen "uneasy" on a normal TV.
Reply With Quote
  #29  
09-07-2005, 03:50 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
@Inc
I see you like doing as Jorel taking each post, line by line, but I won't don't that myself. The story is simple : I was talking about height (values 72 and 16 are on the height) and you answer to me "Phil, 704 is the correct value even in NTSC". So ? What is the link between something concerning the height and the fact that 704 is the correct width to use for both format ?
Did I say that 704 was not correct ?
Did I say that 480 was not correct ?
I said that 72 and 16 is not correct. Period.

Quote:
Originally Posted by incredible
I don't want to tease you ... really ... (ok, a bit), but YOUR'E the one who is focussing on "read my lines" .. "capice?"
YOU just forgot that YOU weren't the guy that I was talking to. I know that YOU won't use "blindly" the value 72.
NICKSTEEL is not YOU. That is why I told HIM that HE has to be carefull because if HE uses 72 (things that YOU will never do) then HE will have problems.

Look at the script HE posted

Quote:
Originally Posted by Nicksteel
Mpeg2Source("PATH\NAME.d2v",cpu=4)
Crop(8, 72, 704, 336) # 72_72 WRONG !!!
#Crop(8, 16, 704, 448) # 16_16 WRONG !!!
#Crop(8, 0, 704, 480) # fullscreen

FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)
Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)

Addborders(0,72,0,72) # 72_72
#Addborders(0,16,0,16) # 16_16
LetterBox(16,16,16,16)
It's because he posted this script, and because you did not correct the crop lines - you erased them - that I told HIM that the values HE used weren't correct. If you had sent all your explanations about not using fixed values to the correct person (that means HIM, not ME), my post would never existed.

Note: no-one never noticed that when I posted my script I did not uncomment the line correctly (fortunally I put always comments in my scripts even when I do them for me. They eased to understand that there was an error here - and Nicksteel corrected it by himself BTW )
Reply With Quote
  #30  
09-07-2005, 05:19 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by Dialhot
@Inc
I see you like doing as Jorel taking each post, line by line
Dont mix up things. I dont take every post line by line, but one line Im shure of you know of which Im talking about. Just comparing to Jorel is nosnense. "Jorel gots a problem" vs. "I got my limits" thats a clear difference.

Quote:
YOU just forgot that YOU weren't the guy that I was talking to.
Sorry ... did I catch up something wrong?
Isn't that post adressed to me?
Quote:
Originally Posted by Dialhot
Quote:
Originally Posted by incredible
So crop at 704x480
You are so much focused on the with that you do not understand that I am talking about the height !
Look at the lines I have in my script :
Code:
Code:
Mpeg2Source("PATH\NAME.d2v",cpu=4)
Crop(8, 72, 704, 432) # 72_72
#Crop(8, 16, 704, 544) # 16_16
#Crop(8, 0, 704, 576) # fullscreen

FluxSmooth()
TemporalCleaner(ythresh=5,cthresh=7)
Undot()
DCTFilter(1,1,1,1,1,1,0.5,0)
#Addborders(0,72,0,72) # 72_72
#Addborders(0,16,0,16) # 16_16
LetterBox(16,16,16,16)

Note that the "72_72" means that this lien has to be used in case of movie with 72 pixels wide top/bottom borders. These are actually 2.35:1 movies.
16_16 is for 1.85:1 movies. You can check the width of the borders in DVD2AVI.
The "72" and "16" are for PAL SOURCES.
For NTSC the border in a 2.35:1 sources is smaller than 72, so you must crop less than this else you will cut the head of the character !
Capisce ?

Quote:
Thats why I do love that LRemoveDust() Function as it uses a special way to avoid the spatial overshoot on details.
I will try.
If its not adressed to me then I do excuse. But I'd like to know that other Inc. in here

Essentially Im not interested in widths heights, PALs, NTSCs in that post or where ever.
The Essential you can read in the line dealing with the words "cool way". Its not my job to give you hints on that, but I do point on it if it comes to limits like in threads before which I dont quote now - hint: "taxes".

I think its all mentioned, think about it or not.
Reply With Quote
  #31  
09-08-2005, 07:33 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for everything guys.

Did first encodes with LRemoveDust() last night. No problem with SSE3 dlls. Encoded non-cropped 95 minute film in about 60 minutes while running 2 DVDShrinks concurrently, so pretty fast.

Couple questions though.

First encode (DVD NTSC Film) was true anamorphic (widescreen , but no borders in raw source). Also detected as anamorphic by FitCD. Size was no problem, so I did not crop, just processed with 16:9 flag in Tmpgenc. Should I always crop to 704, even if no size problems when final size allows muxing with original AC3?

LoadPlugin("C:\video\moviestacker\Filters\MPEG2Dec 3dg.dll")
LoadPlugin("C:\video\moviestacker\Filters\RepairSS E3.dll")
LoadPlugin("C:\video\moviestacker\Filters\RemoveGr ainSSE3.dll")
LoadPlugin("C:\video\moviestacker\Filters\SSE3Tool s.dll")

Mpeg2Source("C:\film\film.d2v",idct=7)

LRemoveDust_YV12(17,2)

function LRemoveDust_YV12(clip input, int clmode, int "limit")
{
limit=default(limit,2)
clmode=default(clmode,17)
repmode = 2
clensed = Clense(input)
rep = Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return LimitChange(rg, input, limit)
}

Second encode (DVD NTSC Film) had 60 pixels top and bottom in DVD2AVI. Processed with 16:9 flag in Tmpgenc and used:

LoadPlugin("C:\video\moviestacker\Filters\MPEG2Dec 3dg.dll")
LoadPlugin("C:\video\moviestacker\Filters\RepairSS E3.dll")
LoadPlugin("C:\video\moviestacker\Filters\RemoveGr ainSSE3.dll")
LoadPlugin("C:\video\moviestacker\Filters\SSE3Tool s.dll")

Mpeg2Source("C:\film\film.d2v",idct=7)

Crop(8, 60, 704, 360)# 60_60

LRemoveDust_YV12(17,2)

Addborders(0,60,0,60) # 60_60

function LRemoveDust_YV12(clip input, int clmode, int "limit")
{
limit=default(limit,2)
clmode=default(clmode,17)
repmode = 2
clensed = Clense(input)
rep = Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return LimitChange(rg, input, limit)
}

Do I need to use more filtering than only LRemoveDust() as in above? The output looks very good.
Reply With Quote
  #32  
09-08-2005, 07:42 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nicksteel
Should I always crop to 704, even if no size problems when final size allows muxing with original AC3?
Cropping is not linked to size but to quality. The less you have to encode, the better will be the quality.
If you encoded in 720 with a CQ=90 and the size is still smaller than 4.37, so for sure you have no need to encode in 704. But if the CQ was 65...

Quote:
Do I need to use more filtering than only LRemoveDust() as in above? The output looks very good.
Inc says that you don't need because LRemoveDust is already a combination of filters.
Reply With Quote
  #33  
09-08-2005, 08:09 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks, Phil. CQ was 90. I only take other measures if CQ falls below 85 or so.

In fact, if CQ is 90 and final DVDLab Pro size is a little large (say DVDShrink 95% compression), I use DVDShrink to size final output.
Reply With Quote
  #34  
09-08-2005, 08:21 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nicksteel
In fact, if CQ is 90 and final DVDLab Pro size is a little large (say DVDShrink 95% compression), I use DVDShrink to size final output.
That's generally what I do also but for such little compression you can also use the transcoder that is included in DVDLabPro.
Reply With Quote
  #35  
09-08-2005, 08:51 AM
nicksteel nicksteel is offline
Free Member
 
Join Date: Nov 2002
Posts: 863
Thanks: 0
Thanked 0 Times in 0 Posts
Shows you my level of ignorance about DVDLab Pro. Will try the transcoder next time instead of DVDShrink. Does DVDLab Pro give indication of compression level required?

I try to do all my encodes to allow AC3 and sometimes run into slightly oversized final files. Sometimes I have to go to MP2 files, but try to avoid it whenever possible due to use of external sound system. I always give video quality precedence over audio, but like to have both.
Reply With Quote
  #36  
09-08-2005, 10:44 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nicksteel
Shows you my level of ignorance about DVDLab Pro. Will try the transcoder next time instead of DVDShrink. Does DVDLab Pro give indication of compression level required?
It asks you the size of the file you want to obtain if I'm not wrong. Actually it is less convenient than the automatic mode in DVDShrink.
Reply With Quote
  #37  
09-08-2005, 12:52 PM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
You might want to use ConverttoRGB24() at the end of your scripts to ensure the colorspace conversion is done properly, that is, if you use TMPGEnc. For CCE you need ConverttoYUY2(), of course.

I wouldn't use limit=2 with DVD sources, limit 1 should be enough. For a slight extra compression, add parameter limitU=255 to LimitChange. It will allow chroma to be processed just as RemoveGrain(mode=17) would do instead of limiting the change to the amount of pixels you set the limit to in LRemoveDust. I'm quite positive you won't notice any difference at all, but the encoder will
Reply With Quote
  #38  
09-09-2005, 09:34 AM
Boulder Boulder is offline
Free Member
 
Join Date: Sep 2002
Location: Lahti, Finland
Posts: 1,652
Thanks: 0
Thanked 0 Times in 0 Posts
Note: I split the thread, the further, non-resizing discussion is here : http://www.kvcd.net/forum/viewtopic.php?t=16122
Reply With Quote
  #39  
09-12-2005, 02:19 AM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
Why not use the VM functions (also used in DIKO), it saves from doing manual calculations (done internally by the script) and so the consequent errors caused by manual resizing and adding borders can be ommitted!!!!.

You need to pass parameters to it thru avs script
Code:
Loadplugins
loadother avisynth filters

WIDESCREEN=1
Overscan=0
source_widescreen=1
WIDTH=720
HEIGHT=576
INTERLACED=false
DivXResize(WIDTH, HEIGHT, 0, "LanczosResize",WIDESCREEN)
DivXBorders(HEIGHT,OVERSCAN)

Code:
Function DivXResize(clip c, int WIDTH, int HEIGHT, int OVERSCAN, string RESIZER, int widescreen) {

ratio=((c.width()+.0)/(c.height()+.0))+.0
ratio=(ratio<1.33333) ? 1.333333 : ratio
halfheight43=(round(c.width()/1.33333)-c.height())/2
halfheight43=(widescreen==1)&&(ratio>1.7777) ? (round(c.width()/1.77777)-c.height())/2 : halfheight43

#Crop to fullscreen it this has been asked
fullscreen_cropper=round ((c.width()-(c.height()*1.33333) ) /2)
f_c_mod=fullscreen_cropper % 2
fullscreen_cropper=( f_c_mod == 1) ? (fullscreen_cropper+1) : fullscreen_cropper

ratio=(widescreen == 2) ? 1.333333 : ratio
c= (widescreen == 2) ? c.crop(fullscreen_cropper,0,(c.width()-2*fullscreen_cropper),0): c

#What would be the height keeping the aspect ratio if width was 640/320-NTSC or 768/384-PAL(4:3)
no_borders_height1=(c.height() < HEIGHT)? c.height() : HEIGHT

#4:3 (option 0 and 2)
no_borders_height1=(HEIGHT == 480) ? ceil(640*(1/ratio)) : no_borders_height1
no_borders_height1=(HEIGHT == 240) ? ceil(320*(1/ratio)) : no_borders_height1

no_borders_height1=(HEIGHT == 576) ? ceil(768*(1/ratio)) : no_borders_height1
no_borders_height1=(HEIGHT == 288) ? ceil(384*(1/ratio)) : no_borders_height1

#anamorphic (option 1)
no_borders_height1=(HEIGHT == 480)&&(widescreen==1)&&(ratio>1.7777) ? ceil(848*(1/ratio)) : no_borders_height1
no_borders_height1=(HEIGHT == 240)&&(widescreen==1)&&(ratio>1.7777) ? ceil(424*(1/ratio)) : no_borders_height1

no_borders_height1=(HEIGHT == 576)&&(widescreen==1)&&(ratio>1.7777) ? ceil(1024*(1/ratio)) : no_borders_height1
no_borders_height1=(HEIGHT == 288)&&(widescreen==1)&&(ratio>1.7777) ? ceil(512*(1/ratio)) : no_borders_height1


#Now how much we have to shrink to make it fit inside a macroblock?
mod16height=no_borders_height1 % 16

#If the rest is <=8, subtracts the rest, else, completes to 16.
completion= (mod16height <= 8) ? (-mod16height) : (16-mod16height)
no_borders_height2=no_borders_height1+completion

#finally resize
c=Eval( RESIZER + "(c," +  string(WIDTH) + "," + string(no_borders_height2) + ")" )

#add lateral overscan
c=letterbox(c,0,0,overscan*8,overscan*8)
return(c)
}

Function DivXBorders(clip c, int HEIGHT, int OVERSCAN) {
halfheight43=(HEIGHT-c.height())/2
c=addborders(c,0,halfheight43,0,halfheight43)
#Add vertical overscan
c=letterbox(c,overscan*8,overscan*8,overscan*8,overscan*8)
return(c)
}

Function SimpleDVDCrop(clip c, bool interlaced) {
   global SourceDVDHeight=c.height()
   global SourceDVDWidth=c.width()
   c=(interlaced==false) ? AutoCrop(c,0, 4, 2, 2, 2, 2, 2, 40, 10) : c
   return(c)
}

Function SimpleDVDResize(clip c, int NewFullWidth, int NewFullHeight, int source_widescreen, int widescreen) {
   SAR=(source_widescreen==0) ? 1.3333 : 1.77777
   DAR=(widescreen==0) ? 1.3333 : 1.77777
   #Factor is: (SourceHeight with borders*SourceAspectRatio) /
   #            (Newheight with borders*DestinationAspectRatio)
   factor= ((SourceDVDHeight*1.0)*SAR) / ( (NewFullHeight*1.0)*DAR)
   # Stores parameters to be used again later
   global gNewFullWidth = NewFullWidth
   global gNewFullHeight = NewFullHeight
   #

   NewCroppedHeight = (SAR==DAR)&&(NewFullHeight==SourceDVDHeight) ? c.height() : round((c.height()+.0)/(factor+.0)/16)*16
   NewCroppedWidth= round((NewFullWidth - (((NewFullWidth+.0)/(SourceDVDWidth+.0))*((SourceDVDWidth+.0)-(c.width()+.0))))/4)*4
   c=bicubicResize(c,int(NewCroppedWidth),int(NewCroppedHeight))
   return(c)
}

Function SimpleAddBorders(clip c) {
   HorizontalBorder=((gNewFullWidth-c.width()) != 0 ) ? (gNewFullWidth-c.width)/2 : 0

   FullVerticalBorder=((gNewFullHeight-c.height()) != 0 ) ? (gNewFullHeight-c.height) : 0
   TopBorder=(FullVerticalBorder !=0) ? round((FullVerticalBorder/16))*8 : 0
   BottomBorder=(FullVerticalBorder !=0) ? ( round((FullVerticalBorder/16))*8+(FullVerticalBorder % 16) ) : 0
   c=addborders(c,HorizontalBorder,TopBorder,HorizontalBorder,BottomBorder)
   return(c)
}
I have used them in my scripts without any problems.
Reply With Quote
  #40  
09-12-2005, 03:17 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by supermule
Why not use the VM functions (also used in DIKO), it saves from doing manual calculations
Because they do not take in account borders that exist in original DVD sources and that should be cropped before the calc to enhance the result (and speed).
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Another Crop and Resize Question (VHS capture) Icarus3000 Avisynth Scripting 3 07-20-2005 03:49 AM
Avisynth: Crop and resize question urban tec Avisynth Scripting 3 06-13-2005 08:28 AM
MovieStacker: Resize or not? That is the question! zagor Video Encoding and Conversion 3 04-09-2004 03:16 PM
How do you resize an avi? raven2707 Video Encoding and Conversion 5 11-07-2003 12:56 PM
Resize maurus Convertir y Codificar Video (Español) 5 11-04-2003 01:55 AM

Thread Tools



 
All times are GMT -5. The time now is 01:53 AM  —  vBulletin © Jelsoft Enterprises Ltd