Log in

View Full Version : Wrong value with ThrowError- is this a bug?


vcmohan
21st July 2008, 10:51
While trying to print some values for debugging one of my plugins, I noted after hours of wasting time a problem. The values reported for nv[1] are different in the two statements !

// copy values
for( int sh = 0; sh < currentheight; sh ++)

newVseammap[wremoved * bht + sh] = seammap[wseamindex + sh * bwd ];

int *nv = newVseammap + wremoved * bht, *nv1 = seammap + wseamindex;
if ( n == - test1 && wremoved == -test2) env->ThrowError("%d %d",nv[1], nv1[bwd]);

env->ThrowError("n =%d seam =%d last:- %d %d %d %d %d %d %d %d %d %d * new:- %d %d %d %d %d %d %d %d %d %d",n,-wremoved,
nv[0],nv[1],nv[2],nv[3],nv[4],nv[5],nv[6],nv[7],nv[8],nv[9],
nv1[0],nv1[bwd],nv1[2*bwd],nv1[3*bwd],nv1[4*bwd],nv1[5*bwd],nv1[6*bwd],nv1[7*bwd],nv1[8*bwd],nv1[9*bwd]);


If i comment out the first ThrowError statement, the print for nv[1] is one less than actual value. (in my case it shows 62 instead of the correct value 63)

Is this a problem with vc6 or within Avisynth?

Gavino
21st July 2008, 11:34
Is this a problem with vc6 or within Avisynth?
It certainly could be.

But often when a program behaves differently when adding or deleting a line, it's an indication of a memory corruption. Are you quite sure you are not exceeding the bounds of your arrays (here, or even possibly somewhere else)?

Gavino
21st July 2008, 20:42
Looking at your code again, and reading between the lines, I wonder if wremoved has a negative value. Then your assigments to newVseammap in the loop would go wrong (unless bht is also negative). Just a hunch.

vcmohan
22nd July 2008, 02:53
I check these values again and again in a loop. I am copying the values into a buffer and checking them with old values.I am sure that the value copied is correct one while only in the particular print statement a wrong value is reported. I am also sure that wremoved starts with a value of zero and incremented may be a couple of hundred times. As can be seen the frame number n is being compared with -test1, and I need to input a negative number for test1 to activate this statement. I am pretty sure about this.