Log in

View Full Version : (Bad?) idea about Avisynth2 and color spaces


pandv
7th July 2002, 20:48
I downloaded the source code and tried to see if this idea is possible. But my time is over and I don't understand the source code. So, I explain the idea and let it for the Avisynth gurus.

Objectives:

- Allow Avisynth to use more color spaces (YIV, planar spaces, one channel R,G,or B,...)
- Eliminate the need for explicit calls to ConvertTo...
- Maintain the compatibility with old filters.

Changes:
- Define new enums for the new alloweds color spaces.
- Define, of course, new functions to translate between the diferents color spaces. Example: one channel R,G,or B to RGB -> pad with 0.
- In the new filters, in AvisynthPluginInit call a new function to declare explicity the color spaces supporteds (or modify AddFunction to allow a optional parameter). Store this new info (maybe in a new member of AVSFunction struct).
- If it's a old filter, set this info to RGB24,RGB32 and YUV2. Or best, try to pass a test frame and intercept the exception produced if it's not supported (maybe modifying ScriptEnvironment::ThrowError if a flag is activated).
- When Avisynth creates the filter graph, check for compatibility and insert the color transformation functions if it's needed (or, maybe, Cache:GetFrame can be modified to do the transformation).

Can this works?. If not, sorry for your time.

If this has not sense, feel free to delete the post.

pandv.

Richard Berg
7th July 2002, 21:19
There was some discussion of this here (http://forum.doom9.org/showthread.php?s=&threadid=28250), though not on the scale you propose. My gut reaction is that the extra colorspace conversions would more than negate whatever advantages YIV/YV12/planar-space filters would bring, but I obviously don't know any better than you do.

Chibi Jasmin
11th July 2002, 14:35
Well, since YV12 is what is on the DVD, you would actually save one conversion...it has been discussed somewhere in this thread, too: http://forum.doom9.org/showthread.php?s=&threadid=11442 :D