Encoding trajectory optimization based on the pixel variance using graphics processing units