- for (unsigned y = 0; y < 300; ++y) {
- unsigned char *sptr1 = src + (y*2) * 800 * 4;
- unsigned char *sptr2 = src + (y*2+1) * 800 * 4;
- unsigned char *dptr = dst + y * 800 * 4;
-
- for (unsigned x = 0; x < 400; ++x) {
- *dptr++ = (sptr1[0] + sptr1[4] + sptr2[0] + sptr2[4]) >> 2; // red
- *dptr++ = (sptr1[1] + sptr1[5] + sptr2[1] + sptr2[5]) >> 2; // green
- *dptr++ = (sptr1[2] + sptr1[6] + sptr2[2] + sptr2[6]) >> 2; // blue
- *dptr++ = (sptr1[3] + sptr1[7] + sptr2[3] + sptr2[7]) >> 2; // alpha
+ for (unsigned y = 0; y < height/2; ++y) {
+ unsigned char *sptr = src + y * width/2 * 4;
+ unsigned char *dptr = dst + y * width * 4;