vcmohan
8th June 2005, 03:59
I am trying to put some initialization code in the constructor of my plugin. I find that if I have that code and I have an error situation (in this case wrong format) then instead of a ThrowError message I get a Unrecognised Exception. This is so even though the code is after Throw Error message. If I move that peice of code either to the GetFrame method or to the Create_Function area it works fine. I could not localize that problem to either the first or second loop eventhough the first one seems to have a larger effect? Is the compiler VC++ 6 the problem or some thing else. My code is below and the relevant portions are in the comments area.
class Gauss : public GenericVideoFilter {
// bool k3x3; // true for 3 X 3 size, false for 5X5 size
// double sd; // standard deviation
bool uu,vv; // whether u and v planes also to be used in yuy2 and yv12 formats.
int kern[5];
int ksize;
public:
//Definition of function
Gauss(PClip _child,
int _ksize, bool _uu, bool _vv,
int k0, int k1, int k2, int k3, int k4,
IScriptEnvironment* env) ;
virtual ~Gauss(){}; //destructor
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};
/*************************************************
* The following is the implementation
* of the defined functions.
*************************************************/
//Here is the acutal constructor code used
Gauss::Gauss(PClip _child,
int _ksize, bool _uu, bool _vv,
int k0, int k1, int k2, int k3, int k4,
IScriptEnvironment* env) :
GenericVideoFilter(_child),ksize(_ksize),uu(_uu),vv(_vv)
// kern[0](k0),kern[1](k1),kern[2](k2),kern[3](k3),kern[4](k4)
{
kern[0]=(k0);
kern[1]=(k1);
kern[2]=(k2);
kern[3]=(k3);
kern[4]=(k4);
if( !vi.IsYUY2() && !vi.IsRGB32() )
env->ThrowError("Gauss: This color format is not yet supported");
/* ksize=k3x3?3:5;
double sum=0;
for(int i=0;i<ksize;i++)
{
kr[i]=pow(2.71828, -(0.5*(i-ksize/2)*(i-ksize/2))/(sd*sd))/(sd*sqrt(6.2831853));
sum+=kr[i];
}
for(i=0;i<ksize;i++)
kern[i]=1024*kr[i]/sum ; // so that we only do integer multiplications and a final div by bit shift
*/
}
also the compiler gives an error [ if I use the following commented out line in constructor
kern[0](k0),kern[1](k1),kern[2](k2),kern[3](k3),kern[4](k4)
class Gauss : public GenericVideoFilter {
// bool k3x3; // true for 3 X 3 size, false for 5X5 size
// double sd; // standard deviation
bool uu,vv; // whether u and v planes also to be used in yuy2 and yv12 formats.
int kern[5];
int ksize;
public:
//Definition of function
Gauss(PClip _child,
int _ksize, bool _uu, bool _vv,
int k0, int k1, int k2, int k3, int k4,
IScriptEnvironment* env) ;
virtual ~Gauss(){}; //destructor
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};
/*************************************************
* The following is the implementation
* of the defined functions.
*************************************************/
//Here is the acutal constructor code used
Gauss::Gauss(PClip _child,
int _ksize, bool _uu, bool _vv,
int k0, int k1, int k2, int k3, int k4,
IScriptEnvironment* env) :
GenericVideoFilter(_child),ksize(_ksize),uu(_uu),vv(_vv)
// kern[0](k0),kern[1](k1),kern[2](k2),kern[3](k3),kern[4](k4)
{
kern[0]=(k0);
kern[1]=(k1);
kern[2]=(k2);
kern[3]=(k3);
kern[4]=(k4);
if( !vi.IsYUY2() && !vi.IsRGB32() )
env->ThrowError("Gauss: This color format is not yet supported");
/* ksize=k3x3?3:5;
double sum=0;
for(int i=0;i<ksize;i++)
{
kr[i]=pow(2.71828, -(0.5*(i-ksize/2)*(i-ksize/2))/(sd*sd))/(sd*sqrt(6.2831853));
sum+=kr[i];
}
for(i=0;i<ksize;i++)
kern[i]=1024*kr[i]/sum ; // so that we only do integer multiplications and a final div by bit shift
*/
}
also the compiler gives an error [ if I use the following commented out line in constructor
kern[0](k0),kern[1](k1),kern[2](k2),kern[3](k3),kern[4](k4)