Fixed point math, take 2 #127

Closed
wants to merge 4 commits into
from
Commits on Feb 7, 2014
  1. @andrebraga

    Parallelised luminance conversion routine and also converted floating…

    andrebraga committed Feb 7, 2014
    … point to integer math. Difference in result from FP math is on average less than 1 level. Decent performance boost =)
Commits on Feb 28, 2014
  1. @andrebraga

    Merge commit '9350ea5510ca9c0c06040af1246e619d604bd67a'

    andrebraga committed Feb 28, 2014
    Conflicts:
    	ZXingObjC/client/ZXCGImageLuminanceSource.m
  2. @andrebraga

    Revert "Revert the "un-premultiplying" code"

    andrebraga committed Feb 28, 2014
    This reverts commit 02e1101.
Commits on Mar 6, 2014
  1. @andrebraga @andrebraga

    Massaged the fixed point code a little bit. It turns out that shiftin…

    andrebraga committed with andrebraga Mar 6, 2014
    …g up the alpha range by 1 and then subtracting 1 to force rounding down was doing more harm than good.
    
    Also, saturating the result to 255 avoids overflows that eventually happen due to some of the liberties taken.
    All in all the absolute difference in result from fixed point and floating point deviate, on average, by less than 0.03.
    The fixed point code can detect a couple more images than the previous code; however it also detects a couple less. Zero sum I suppose? However it's much faster, so still a win ;)