Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+added gamma conversion to refactored code