Only scan for 2 * maxUnit.
Only allocate when adding a valid code.
Merge branch 'master' into small-optimizations
Define the thresholding kernel size at the top.
Reuse the bitmap between frames.
Merge pull request #20 from LightUpInc/small-optimizations

Small optimizations