Thread: AviSynth Q&A
View Single Post
Old 2nd August 2002, 17:49   #13  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
(Suggestion for update on colorspaces)

Q23: How do I convert between the colorspaces ?

A: Converting to YUY2:

ConvertToYUY2()

and for converting to RGB:

ConvertToRGB()

Note that converting between colorspaces isn't completely lossless, and doing several conversions back and forth may degrade your signal. The first conversion back and forth does not hurt your source, but if you use three or more, it may.

Q24: What/when do I care when filter X works in RGB- or YUV-space ?

A: The main reason why you should care is the improvement in speed you can obtain by not unnecessarily changing between colorspaces. If your source is YUV (when encoding DVD's for example, or captures from digital sources) try to use only filters/plugins which work in YUV-space. On the other hand if your source is in RGB (for example from analog captures) try to use only filters/plugins which work in RGB-space.

Speed is also quite different between the different colorspaces, because each colorspace takes up different amounts of memory. The slowest colorspace is usually RGB24, because every pixel has an odd alignment in memory, avoid using this mode. The fastest mode is usually YUY2, because data only takes up half as much space as RGB32. So if you have to process your video a lot, try using ConvertToYUY2() before you do your filtering. Note that ConvertToRGB converts to RGB32 if the source is YUY2 - use ConvertToRGB32 to force a RGB24 to RGB32 conversion.

You should also consider your destination colorspace. If you plan on converting to DivX/Xvid/HuffYUV in Virtual Dub without applying filters in Virtual Dub, "Fast Recompress" will deliver the YUY-data directly to the codec, saving you another colorspace conversion. On the other hand, if you plan using TMPGEnc or Virtual Dub in "Full Processing" mode, you may consider delivering the source as RGB.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote