Quote:
Originally Posted by MysteryX
Trying to compile AVS+ in VS2015, however, there is this error: redefinition of 'y'.
Code:
static void af_horizontal_yuy2_c(BYTE* p, int height, int pitch, int width, int amount) {
const int center_weight = amount*2;
const int outer_weight = 32768-amount;
for (int y = height; y>0; --y)
{
BYTE yy = p[0];
BYTE uv = p[1];
BYTE vu = p[3];
int x;
for (x = 0; x < width-2; ++x)
{
BYTE y = ScaledPixelClip(p[x*2+0] * center_weight + (yy + p[x*2+2]) * outer_weight);
yy = p[x*2+0];
p[x*2+0] = y;
BYTE w = ScaledPixelClip(p[x*2+1] * center_weight + (uv + p[x*2+5]) * outer_weight);
uv = vu;
vu = p[x*2+1];
p[x*2+1] = w;
}
BYTE y = ScaledPixelClip(p[x*2+0] * center_weight + (yy + p[x*2+2]) * outer_weight);
yy = p[x*2+0];
p[x*2+0] = y;
p[x*2+1] = ScaledPixelClip(p[x*2+1] * center_weight + (uv + p[x*2+1]) * outer_weight);
p[x*2+2] = ScaledPixelClip(p[x*2+2] * center_weight + (yy + p[x*2+2]) * outer_weight);
p[x*2+3] = ScaledPixelClip(p[x*2+3] * center_weight + (vu + p[x*2+3]) * outer_weight);
p += pitch;
}
}
|
Earlier compilers didn't complain about re-definitions if they had a different scope. That led to sloppy programming.
The above function is just horrible, it also defines a variable with different types (BYTE y, int y).