Quantcast Avisynth: MA Script for Interlaced Sources? - Page 3 - digitalFAQ.com Forums [Archives]
  #41  
03-30-2004, 09:11 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Dialhot,
I suspected that, but I wasn't sure so I just used two functions. I was not sure if AviSynth would properly keep track of multilple variables with the same name. It is great to have experts like you helping out.
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
  #42  
03-30-2004, 09:15 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 Peter1234
I was not sure if AviSynth would properly keep track of multilple variables with the same name
Actually there you are not instanciating a variable, but a parameter. And for sure, that is why function are made for : don't have to repeat something used more than one time.
Reply With Quote
  #43  
03-30-2004, 09:46 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Ok. This seems to work also. Thanks Dialhot.

### for interlaced source only
### DV codec required if AVI is DV

LoadPlugin("C:\Filters25\undot.dll")
LoadPlugin("C:\Filters25\STMedianFilter.dll")
LoadPlugin("C:\Filters25\Convolution3DYV12.dll")

AVISource("C:\Documents and Settings\user\Desktop\type2.avi")
ConvertToYV12
Levels(0,0.94,255,0,255)

SeparateFields()
odd=SelectOdd().Kwag_MA()
even=SelectEven().Kwag_MA()
Interleave(even,odd)
Weave()

Function Kwag_MA(clip input) {
undot(input)
Limiter(input)
STMedianFilter(input,3, 3, 1, 1 )
MergeChroma(input,blur(1.5))
MergeLuma(input,blur(0.1))
ScriptClip(" nf = YDifferenceToNext()" +chr(13)+
\ "unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2,
\ 100)) ).TemporalSoften( fmin( round(2/nf), 6),
\ round(1/nf) , round(3/nf) , 1, 1) ")
Convolution3D(input,preset="movieLQ")
Limiter(input)}

Function fmin( int f1, int f2) {return ( f1<f2 ) ? f1 : f2}

EDIT: Do not actually use the above script. Concept is correct but function is not correct. The corrected script follows:

### for AviSynth 2.5
### for interlaced source only
### DV codec required if AVI is DV

LoadPlugin("C:\Filters25\undot.dll")
LoadPlugin("C:\Filters25\asharp.dll")
LoadPlugin("C:\Filters25\UnFilter.dll")
LoadPlugin("C:\Filters25\STMedianFilter.dll")
LoadPlugin("C:\Filters25\Convolution3DYV12.dll")

AVISource("C:\Documents and Settings\user\Desktop\type2.avi")
ConvertToYV12

SeparateFields()
odd=SelectOdd().Kwag_MA()
even=SelectEven().Kwag_MA()
Interleave(odd,even)
Weave()

Function Kwag_MA(clip input) {
undot(input)
Limiter()
asharp(1, 4)
STMedianFilter(3, 3, 1, 1 )
MergeChroma(blur(1.5))
MergeLuma(blur(0.1))
ScriptClip(" nf = YDifferenceToNext()" +chr(13)+
\ "unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2,
\ 100)) ).TemporalSoften( fmin( round(2/nf), 6),
\ round(1/nf) , round(3/nf) , 1, 1) ")
Convolution3D(preset="movieLQ")
Limiter()}

Function fmin( int f1, int f2) {return ( f1<f2 ) ? f1 : f2}
Reply With Quote
  #44  
04-02-2004, 12:43 PM
cweb cweb is offline
Free Member
 
Join Date: Jan 2003
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
I had tried this interlaced MA script with Incredible's modifications (suggested in this thread). The result was ok though I didn't think it was any better than the classic fixed script. My final CQ was still low (around 34) so I just went for a higher CQ anyway.
Reply With Quote
  #45  
04-02-2004, 01:27 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 cweb
My final CQ was still low (around 34) so I just went for a higher CQ anyway.
Thats cause of interlacing encoding! Interlaced mpeg2 needs much more bitrate!
Reply With Quote
  #46  
04-02-2004, 07:31 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
The following

Kwag_MA()

was used in palce of

SeparateFields()
odd=SelectOdd().Kwag_MA()
even=SelectEven().Kwag_MA()
Interleave(even,odd)
Weave()

in my corrected script above to produce an output file using Kwag's original script at CQ70 (from an interlaced DV test clip). This file was then compared to a file generated using CQ70 and the corrected scrlpt above. Both files looked the same visually to my non-expert eyes, but the file generated using separated fields was 5.7% smaller. My conclusion is that it is better to use the script with separated fields for interlaced inputs. I assume that this is because the 1/2 frame image from separated fields is smoother since it does not have the inconsistencies between adjacent rows that the non-separated full frame has and therefore can be compressed using less bits. But, I am not an expert. Does that seem reasonable to anyone else?
Reply With Quote
  #47  
04-02-2004, 08:03 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 Peter1234
I assume that this is because the 1/2 frame image from separated fields is smoother since it does not have the inconsistencies between adjacent rows that the non-separated full frame has and therefore can be compressed using less bits. But, I am not an expert. Does that seem reasonable to anyone else?
I think the reason is elsewhere : the "YDifferenceToNext" can't work correcly when "next frame" is in fact "half frame from current frame + half frame from next frame" (that is what interlacing is, isn't it ?).

Thus, the MA part of the script is less efficient.
Reply With Quote
  #48  
04-02-2004, 09:08 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Dialhot,
I think you must be correct. My theory does not make sense because the fields are recombined again before encoding. Therefore the difference must be something in Kwag's MA script. Thanks for your answer.
Reply With Quote
  #49  
04-02-2004, 09:13 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
The MA script, as is, was never intended for interlaced sources

-kwag
Reply With Quote
  #50  
04-02-2004, 09:46 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Kwag,
Doesn't separating the fields get around the problems MA has with interlaced sources? With separated fields, doesn't the MA script only see non-interlaced source and so it be happy?
Reply With Quote
  #51  
04-02-2004, 10:04 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, but fields are different, and the encoder will see artifacts (jagged lines, etc.). So the results will be a mess

-kwag
Reply With Quote
  #52  
04-03-2004, 07:36 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
The problem with separate fields is the "temporalSmoother" and also teh Temporal component of StmedianFilter(xx,1,1)! Means ... by just separating the fields, the temporal radius "reference" would just compare to the next field which isnt correct .... he should compare with every second field.

Thats why boulder posted some time ago the MA-interlaced modding .. where fields will be treated by selectodd/seelecteven and afterwards being interleaved.
Reply With Quote
  #53  
04-03-2004, 02:47 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
incredible,
I thought what I posted was just another version of that, at least that was the intent. Apparently, Kwag is saying that is still not a good thing to do. Am I missing something?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Guide to dealing with interlaced sources Boulder Avisynth Scripting 121 04-07-2008 09:36 AM
Avisynth: Interlaced sources guide? [See pg2] J-Wo Avisynth Scripting 50 04-20-2004 07:41 AM
Avisynth: optimal script for dvd sources? CheronAph Avisynth Scripting 6 12-16-2003 07:54 AM
DVD2SVCD: Script for Interlaced sources azel Video Encoding and Conversion 3 11-02-2003 11:29 AM
Avisynth: Multiple Sources in one script? Bchteam Avisynth Scripting 2 09-19-2003 12:12 AM

Thread Tools



 
All times are GMT -5. The time now is 08:54 PM  —  vBulletin © Jelsoft Enterprises Ltd