Quantcast Avisynth: ConvertToYUY2() - Page 3 - digitalFAQ.com Forums [Archives]
  #41  
03-14-2004, 05:06 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
Yep thats the sense, but ....

I don't need to pu a converttoYUY2() at the end so CCE can handle it correctly, like phil also reported. But that maybe depends on the CCE Vers. u use.

And I still don't know WHY you still get washed colors from YV12 4:2:0 avs outputs even xvid is decompressor instead of ati codec.
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-14-2004, 06:34 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
@jorel: Just one quick question... Were your ATI codecs listed under 'A' in DXMan? Because I just wanted to make sure that I use the correct Decompressor... I can't find any ATI codecs with DXMan BUT, I also don't see XviD codecs although I know that they're installed...
__________________
j3llyG0053
Reply With Quote
  #43  
03-14-2004, 09:04 AM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Yep thats the sense, but ....

I don't need to pu a converttoYUY2() at the end so CCE can handle it correctly, like phil also reported. But that maybe depends on the CCE Vers. u use.

And I still don't know WHY you still get washed colors from YV12 4:2:0 avs outputs even xvid is decompressor instead of ati codec.
no incredible, maybe i was not clear, let me try:

i'm using cce 2660107 that don't need the convertion
but,don't know why,don't work without converttoYUY2()
in the script using XviD codec!

more details:
have the washed colors ONLY using the ati codecs WITHOUT converttoYUY2() in the script,
with XviD codec the colors don't change,but is equal the best color of ati codec.
using the converttoYUY2() in all situations is better but,
without use with xvid codec in cce266 don't work

i can't explain the reason,don't know why!

sorry the "redundant" words!

Reply With Quote
  #44  
03-14-2004, 09:12 AM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Jellygoose
@jorel: Just one quick question... Were your ATI codecs listed under 'A' in DXMan? Because I just wanted to make sure that I use the correct Decompressor... I can't find any ATI codecs with DXMan BUT, I also don't see XviD codecs although I know that they're installed...
your right Jell!
DXMan can't find the ati codecs
try control pannel-multimedia-video codecs, for me was the only way.

but can find the xvid and in properties we can adjust
brightness and all parameters of the codec.
is the last of the DXMan list (here show in alphabetical order)


Reply With Quote
  #45  
03-14-2004, 01:50 PM
BobNET BobNET is offline
Free Member
 
Join Date: Sep 2003
Location: Ontario, Canada
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to BobNET
As promised, here's the results of the tests I did with TMPGEnc:

Part 1

Introduction

TMPGEnc expects its input to be RGB24, and will use the codecs installed on the system to convert it if it's in another format. However, the ATI YUV12 Codec is broken (more on that in a future post), so colours will be distorted if an AviSynth script outputs YV12. Placing ConvertToYUY2() at the end of the script will force AviSynth to do the conversion to a codec that is not broken, but TMPGEnc will still have to convert the incoming YUY2 data to RGB.

Hypothesis

If the system is plagued with ATI's codecs, using ConvertToRGB24() at the end of an AviSynth script will eliminate one colourspace conversion and be slightly faster than using ConvertToYUY2(). Since in any case, TMPGEnc will convert the incoming data to RGB, this is not expected to lose any more chroma information than any other method.

Experiment

1. I ripped a short, 4:05 clip (actually, it's the music video for UHF by Weird Al Yankovic, from his Complete Video Collection). The AVS is very simple: FieldDeinterlace() followed by a resize to 352x240; the image itself isn't important, I just wanted something small that wouldn't take long to encode (since I'll be encoding it about a dozen times).

2. The first encode was done with my basic script. The output was YV12, and therefore would need the ATI codec to convert it to RGB24. I ran TMPGEnc with the same input twice and kept the lowest time, since ideally most of the input would be cached and hard drive accesses wouldn't be a factor. TMPGEnc was the only program running, other than the usual processes running on Windows XP.

3. I repeated the process three more times, each with ConvertToYUY2(), ConvertToRGB24(), and ConvertToRGB32() as the very last line in the script.

4. I ran each conversion again, just to be sure, and once more kept the lowest times for each colourspace.

Results
  • YV12 00:06:27
  • YUY2 00:05:54
  • RGB24 00:05:49
  • RGB32 00:05:55

Notes

Surprisingly, the YV12 encode (when the ATI codec was used) was the slowest. This seems to indicate that the YV12 -> RGB conversion code in AviSynth is much more optimized than the code in the ATI codec.

As expected, the RGB24 encode was the fastest, but by a very small margin. The next fastest encode was with YUY2 output, but this requires an additional colourspace conversion. RGB32, despite being aligned on 32-bit boundaries, was slightly slower (perhaps TMPGEnc always uses RGB24, and does a conversion when presented with RGB32 input).

Conclusions

If you're stuck using the ATI YUV12 codec (as it seems some of us are), and you're using TMPGEnc to create your MPEG video, add ConvertToRGB24() as the very last line of your AviSynth script.

I also wonder which is faster at converting from YV12 to RGB, AviSynth or the XviD codec (assuming they give the same results). If the AviSynth code is faster, all TMPGEnc users (not just those with the ATI codec) will benefit from using ConvertToRGB24() in their scripts.

Although I have no evidence to support this yet, I'd expect CinemaCraft users (also only those with ATI's codec) to be better off adding ConvertToYUY2() to the bottom of their scripts since it accepts YUY2 input (the loss by interpolating every other line of chroma is much less than what ATI's codec does).

Part 2 coming soon: the problem with the ATI YUV12 Codec (as soon as I finish lunch ).
__________________
--
Chris "Bob" Odorjan
Reply With Quote
  #46  
03-14-2004, 04:11 PM
BobNET BobNET is offline
Free Member
 
Join Date: Sep 2003
Location: Ontario, Canada
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to BobNET
Here's the second part of my tests:

Part 2

As jorel explained, the ATI YUV12 Codec incorrectly converts from YV12 to RGB. The colours look "washed": there's less contrast and they generally look duller. Here's why:

YUV data is usually clamped, the luma (Y) component to [16,235], and the chroma (U and V) components to [16,240]. This is exactly what Limiter() does. But the ATI codec scales the values to those ranges instead. So a clip that's all black (Y,U,V = 0,128,128) will be turned into (Y,U,V = 16,128,128) by Limiter(). Then when the ATI codec gets ahold of it, it will scale the ranges further, so the resultant will be (Y,U,V = 30,128,128). Similarly, something all white (Y,U,V = 255,128,128) will result in (Y,U,V = 217,128,128). You can already guess that this will reduce the contrast of the video.

Actually, the formula for scaling would be something like:
Code:
y' = y * (235 - 16) / 256 + 16
u' = u * (240 - 16) / 256 + 16
v' = v * (240 - 16) / 256 + 16
I saved the MPEG files created in Part 1 for each colourspace. I loaded the files into AviSynth using the following script:

Code:
yv12=DirectShowSource("yv12.m1v").ConvertToYV12().Histogram("Levels").Subtitle("YV12")
rgb24=DirectShowSource("rgb24.m1v").ConvertToYV12().Histogram("Levels").Subtitle("RGB24")

StackVertical(yv12,rgb24)
ConvertToRGB32()
The RGB24, RGB32, and YUY2 copies look the same, so I only loaded one for comparison. I convert to YV12 after loading the files (DirectShowSource() returns YUY2) to be able to use the Histogram("Levels") function, and convert to RGB32 at the end to avoid using the ATI codec.

Here's the output:


As you can see, the contrast is much lower in the YV12 version. Also look at the black bar on the right side of the image (between the image and the histogram), it's slightly brighter than the RGB24 version. And from the histogram, you can see that all three components are "compressed" into a smaller range (the leftmost bar on the Y component represents all the values clamped to 16 by Limiter(), but shifted over by the ATI codec).

Now, here's the same thing with Levels(16,1,235,0,255,false) added to the YV12 version:


The colours are almost back to the original, but obviously some information is lost (the black bars in the histogram). (The Levels() command given isn't perfect either, it doesn't rescale the chroma properly. Something with UToY()/VToY()/YToUV() could, though.)

Doing a more direct comparison, here's the results using the following script:

Code:
yv12=DirectShowSource("yv12.m1v").ConvertToYV12() #.Levels(16,1,235,0,255,false)
rgb24=DirectShowSource("rgb24.m1v").ConvertToYV12()

Subtract(yv12,rgb24)
ConvertToRGB32()
With Levels() commented out:


With Levels() uncommented:


In conclusion, don't use the ATI YUV12 Codec if you can avoid it. If you're stuck with it, and you're using TMPGEnc, add ConvertToRGB24() to the end of any AviSynth scripts you have returning results in the YV12 colourspace. If you're using CCE, using ConvertToYUY2() may or may not be an improvement...
__________________
--
Chris "Bob" Odorjan
Reply With Quote
  #47  
03-15-2004, 10:24 AM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Where can I download Xvid YV12 codec?
I do not see it listed on the Xvid site.
Reply With Quote
  #48  
03-15-2004, 10:44 AM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Peter1234
Where can I download Xvid YV12 codec?
I do not see it listed on the Xvid site.
hey Peter1234, seems that you don't read this thread from the begining!
but no problem...
incredible post the link in the first page, take a look:
"incredible Posted: Fri Mar 12, 2004 3:25 pm"

http://www.kvcd.net/forum/viewtopic....er=asc&start=0


@ BobNET:
i'm still reading your 2 great (very cool) last posts with pictures!
Reply With Quote
  #49  
03-15-2004, 01:09 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
That was the post at 4:25 pm

But here's the link .....

http://roeder.goe.net/~koepi/xvid.shtml
Reply With Quote
  #50  
03-15-2004, 01:40 PM
Peter1234 Peter1234 is offline
Free Member
 
Join Date: Feb 2003
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. I just wasn't sure what to use. I un-installed the ATI codec and executed XviD-1.0-RC3-29022004.exe. Everything seems to still be working, but I am still checking. The last time I tried a different YV12 codec it messed up some other software, but this seems to be OK (I do not have ATI video card).
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: SmoothDeinterlace and ConvertToYUY2? shgr Avisynth Scripting 35 11-05-2004 07:38 AM
TO use Use ConvertToYuY2() Or Not? Major Video Encoding and Conversion 18 09-20-2004 01:42 PM
Avishynht 2.54 y converttoyuy2().... generador Convertir y Codificar Video (Español) 3 01-27-2004 10:48 AM
AVISYNHT 2.5 Y CONVERTTOYUY2()........¿SON COMPATIBLESSSSSS? generador Convertir y Codificar Video (Español) 4 10-21-2003 12:54 PM
ConvertToYUY2() CaLaFaT Convertir y Codificar Video (Español) 5 07-14-2003 12:48 AM

Thread Tools



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