Quantcast Avisynth: Why to use Converttoxxx() Multiple Times - digitalFAQ.com Forums [Archives]
  #1  
10-06-2005, 08:03 AM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
I have seen in many scripts that ppl use the same converttoXXX() after loading the source and then at the end of the script.

What is the benefit ??

What is the disadvantage ??

Does it degrade video quality using the colourspace conversion two times ???

Why not use it only once ...either in the begining or at the end ????
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
  #2  
10-06-2005, 08:47 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by supermule
I have seen in many scripts that ppl use the same converttoXXX() after loading the source and then at the end of the script.
What is the benefit ??
What is the disadvantage ??
Does it degrade video quality using the colourspace conversion two times ???
Why not use it only once ...either in the begining or at the end ????
Each color space conversion degrade final quality a little bit.
As a general rule, you only must to do color space conversion only when it is needed.
Some filters works in a color space and not in another, so you will need to change it before to apply the filter.
If your encoder works with a specific color space (cce = yuy2, HC encoder = yuv12, tmpgenc = rgb) maybe you will need to change the color space twice in same script.
Reply With Quote
  #3  
10-06-2005, 08:53 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
I have seen in many scripts that ppl use the same converttoXXX() after loading the source and then at the end of the script.
Here ? No way.
The only color convertion you can have is in the very last line of the script. A convertion before that is often due to lazyness of people that don't wan't to install the correct codecs, except in rare case (old codecs that do not output in YV12).

Quote:
What is the benefit ??
Avisynth 2.5 works in YV12 and you have a 15-30% gain in speed if you are in this mode. That explains the first convert (when you don"t have other choice).
The last convert is based on nothing really established : the encoders works with YUY2 (CCE) or RGB24 (tmpgenc). Some people tells that convertting to this colorspace at the end of the script is better than to let the encoder do the conversion itself. I don't think someone ever did a comparitive test on this.

Quote:
What is the disadvantage ??
A conversion is not lossless. The less you have, the better it is.

Quote:
Does it degrade video quality using the colourspace conversion two times ???
Yeap.

Quote:
Why not use it only once ...either in the begining or at the end ????
See above.
Reply With Quote
  #4  
10-06-2005, 09:19 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
He probably means the silly-speeduptrick when using LRemovedust?


Code:
mpeg2source("A_YV12_DVD_Source.d2v") # Loading a YV12 Source
a = last # Caching the chromaplanes!
converttoYUY2().converttoYV12() # the nosense speedup CspaceConversion
LRemovedust(17,1)   # Doing the denoising
mergechroma(last,a) # Back to the non-interpolated origin Chromaplanes
In here imho the Conversion from YV12 to YUY2 and back to YV12 is lossless as above we do finally apply the original chromaplanes back. But this results in Lumadenoising only.

YV12 and YUY2 do have the same 8bit Luma Y Plane
But YV12 chroma does have the half of the YUY2 choma vertical resolution.
Reply With Quote
  #5  
10-06-2005, 09:41 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 incredible
In here imho the Conversion from YV12 to YUY2 and back to YV12 is lossless
I was thinking about rounding in the maths. All operations are done in integers so you can loose a lot. But I don't know what "formula" is used for YUY2 <-> YV12
Reply With Quote
  #6  
10-06-2005, 10:11 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
I was refering to this little Command ---> mergechroma(last,a)
Shure there is an interpolation in the chromasubsampling when going from YV12toYUY2backtoYV12 but with mergechroma(Denoised,Colorcache) I do apply the chroma of the UV from the "Colorcache" YUV clip, means the original --> Colorcache = last
Reply With Quote
  #7  
10-06-2005, 10:12 AM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
Ah! its gets so confusing sometimes.........if I check the info() on the source, I find its YV12, but if I dont use the converttoYV12(), I get extremely, extremely slow processing by TMPGEnc on some sources and normal processing on others (both show YV12()).

I have experimented and found that adding the converttoYV12() to the script improves the processing speed (from appx 28 hrs to 5 hrs) of the TMPGenc encoder.(thanks to dialhot for this suggestion in one of the earlier posts)

Now now where's the catch ????
Reply With Quote
  #8  
10-06-2005, 10: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 supermule
Now now where's the catch ????
The info() is bugged ?

Seriously, if the convertion speeds up your script then you can have this memory alignment problem that Inc fixed with the "tricky trick" () he gives few post above.

Note: when you use info(), just do a script with the source load + the info line. No filters, nothing.
Reply With Quote
  #9  
10-09-2005, 11:25 AM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
Quote:
Originally Posted by supermule
Now now where's the catch ????
when you use info(), just do a script with the source load + the info line. No filters, nothing.
Well I did that but buggily I still found that although info() shows YV12() colorspace, if i still add converttoYV12() it increases the speed (in some to a gr8 extent, as i wrote in my previous post) + it enhances the colors + adds to the compressibility of file(i.e lower file size).

Therefore based on my tests, I have decided to add converttoYV12() in all my scripts.
Reply With Quote
  #10  
10-09-2005, 11:52 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
If the colorspace is already YV12 at the corresponding part of the script, Avisynth does no colorspace conversion when you use ConverttoYV12().
Reply With Quote
  #11  
10-09-2005, 01:47 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 Boulder
If the colorspace is already YV12 at the corresponding part of the script, Avisynth does no colorspace conversion when you use ConverttoYV12().
That should suppose then that the "Info()" command has a bug
Reply With Quote
  #12  
10-09-2005, 02:53 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
I'd say that if supermule has a source which shows YV12 with Info() but still processes faster with ConverttoYV12(), he should upload a few frames somewhere for analysis. I find it quite hard to believe that Info() is buggy since it cannot be too complicated. At the moment Avisynth supports only YUY2, YV12 and RGB.

Avisynth always asks for YV12 first, then falls back to YUY2 if YV12 cannot be delivered by the decoder. It sometimes even does a colorspace conversion without asking, I have to state pixel_type="YUY2" in AviSource in my capture processing scripts to avoid conversion to YV12.

My personal guess is that the performance problem would be solved by Crop(0,0,0,0,true) at the beginning of the script.
Reply With Quote
  #13  
10-09-2005, 04:24 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 Boulder
My personal guess is that the performance problem would be solved by Crop(0,0,0,0,true) at the beginning of the script.
Then you suspect that he just have a memory alignment problem. So do I.
So there si two possibilities:

1/ The info is not buggy, the source is really YV12, but a ConvertYV12() still processes the source. The command is not as optimized as we thought.

2/ The info is buggy, the source is not YV12 and then the Crop won't solve anything.

I bet for the first one but who knows ?
Reply With Quote
  #14  
10-09-2005, 09:40 PM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Boulder
If the colorspace is already YV12 at the corresponding part of the script, Avisynth does no colorspace conversion when you use ConverttoYV12().
Then it does not harm at all, used only when required, which is good ...huh!
Reply With Quote
  #15  
10-09-2005, 09:43 PM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Boulder
I'd say that if supermule has a source which shows YV12 with Info() but still processes faster with ConverttoYV12(), he should upload a few frames somewhere for analysis.
Then so be it, I will upload a clip from the same source for analysis.

Quote:
Originally Posted by Boulder
My personal guess is that the performance problem would be solved by Crop(0,0,0,0,true) at the beginning of the script.
What does this do btw..........
Reply With Quote
  #16  
10-09-2005, 10:34 PM
supermule supermule is offline
Free Member
 
Join Date: Sep 2005
Location: Donkeyland
Posts: 210
Thanks: 0
Thanked 0 Times in 0 Posts
So here's the clip.....


http://rapidshare.de/files/6093600/clip.avi.html

Happy Testing
Reply With Quote
  #17  
10-10-2005, 03:07 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
What does this do btw..........
This "re-align" the memory words. Nothing else.
Reply With Quote
  #18  
10-10-2005, 08:30 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
Quote:
Originally Posted by supermule
So here's the clip.....


http://rapidshare.de/files/6093600/clip.avi.html

Happy Testing
There's nothing wrong with Info(). The file is an XviD file which means that it is YV12 already. ConverttoYV12 doesn't change the video in any way and that's the way it should be. The problem lies within your script or your system.
Reply With Quote
  #19  
10-10-2005, 09:04 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 Boulder
ConverttoYV12 doesn't change the video in any way and that's the way it should be.
Boulder, the commands speed up his script ! That means that the ConvertToYV12 process the clip either if it is already YV12.
Perharps it just realign the words like the Crop line, but it's not accurate to tell the it does not change the video in any way.
Reply With Quote
  #20  
10-10-2005, 09:39 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
ColorYUV shows no change so there is no colorspace conversion. Also the script can load both the stream without ConverttoYV12 and with it simultaneously. Therefore, logic states that there's something else than a colorspace conversion - memory alignment is the most probable reason. I just had to put Crop(0,0,0,0,true) right after MPEG2Source in my last encode because LRemoveDust was dead slow. I remember the same happening with FluxSmooth long time ago. It could also be some cache issue.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Multiple Sources in one script? Bchteam Avisynth Scripting 2 09-19-2003 12:12 AM
Avisynth: Multiple D2V files with Mpeg2Dec3 ? ak47 Avisynth Scripting 0 06-29-2003 11:41 PM
Avisynth: Multiple D2Vs in one script? PyRoMaNiA Avisynth Scripting 2 03-21-2003 11:07 AM
Avisynth: Multiple Avi Sources? urban tec Avisynth Scripting 4 01-16-2003 10:41 PM
Avisynth: Concatenating multiple AVI files? Scav Avisynth Scripting 4 05-20-2002 07:21 AM

Thread Tools



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