Quote:
Originally posted by daveoggy
If I'm happy to just work in RGB32 can I safely delete all the other colour space code?
|
Sure ... delete away.
--------------- To add an xtra check --------------
Look in sample 1.0b, for the following line
Code:
if (vi.IsPlanar()) // is input planar?
env->ThrowError("SimpleSample: input to filter must be in YUY2 or RGB");
This is checking for the input color "packaging". You could do a similar thing and check for RGB32. Then you would be sure no one could pass anything else into your filter.
Code:
if (! (vi.IsRGB32()) ) // is input RGB32?
env->ThrowError("SimpleSample: input to filter must be RGB32");
BTW: vi is a videoInformation object. vi.IsRGB32() is a call to a function of vi. Calling vi's functions is just like checking for values in a big structure. In fact, (without looking at the code), I'm quite sure this is all that vi does. It has a structure of 'flags' and it passes back true/false if you ask it about these. Use a class viewer to see all the calls to vi, or look in the avisynth.h file.
env is a reference back to Avisynth. ThrowError is a function you can call to stop everything.
dot notation vs arrow -- This is in both C and C++ and can be confusing. vi.IsRGB32() means vi is the starting point in memory for the vi structure (object). We know exactly where vi it is, so go call it's IsRGB32() function. For env->ThrowError(), env is a pointer to an env structure. Meaning goto the env pointer memory location ... find where the real env is ... go there .... go call it's function.
Here is a quick link I found on C,C++,Java. It's looks to be short and concise.
http://www.outbacksoftware.com/cpp/cpp.html