Added working gamma correction calculation. Threads and loops routines are missing.