Funny, the question says that it's equal and it seems like it when you test few even and odd values. But that's easy boring math, so nobody check all cases. I was also lazy, and, even if I am more a math guy, I did a quick computer check using few copy-paste:
bool diff = false;
int n = 100;
for(int w = -n; w<n; ++w){
for(int h = -n; h<n; ++h){
int a = (h/2)*w+ ( (h+1)/2-h/2 ) * (w+1)/2 ;
int b = (w * h + 1) / 2;
if (a!=b) diff = true;
}
}
cout << (diff ? "a != b" : "a == b") << endl;
And I found that it's not equal for w = -1 and h =-1, easy to check that then a = 0 and b = 1. This is how "nice simplification" often introduces new bug.
PS: To be fair, I am guessing that w and h are width and height, so they are probably always positive. But that was not specified (and, by experience, some other code may return negative width)