Improved pixel averaging, gamma correction, and removal of certain unneeded calculation