Fixed point operation like this:
```
buf[gray_pos] = rshift(1868*raw_img[rgb_pos] + 9617*raw_img[rgb_pos+1] + 4897*raw_img[rgb_pos+2], 14)
```
will give considerable speedup especially on ARM CPUs that lack floating-point hardware. In libk2pdfopt the performance of an image rescale function that use floating point operation has roughly 25% boost up after substituting floating point operation with fixed point operation. But modern CPU in desktop environment may not get benefits from fixed point algorithm.