alg_noise_tune: add optimized SSE2 routine
alg_update_reference_frame: factor out existing function
alg_update_reference_frame: add test harness
alg_update_reference_frame: factor test masks out of branch condition

Taking the tests out of the branch condition results in a 50% speedup
with GCC when compiled with -O3.
alg_update_reference_frame: add SSE2 algorithm demo/test

This file implements the masking algorithm we will use in the SSE2 code.
It demonstrates identical output when compared to the plain function.
It's a lot slower than the regular routine when used on individual
pixels, but is speedier when vectorized.

Instead of branching, we use masks to composite the output values. The
masks were found by breaking down the branch conditions into boolean
operations, and repeatedly applying De Morgan's laws to simplify them.
Since SSE has the 'andnot' operator, optimize for that form.
cnt->imgs.ref_dyn: specify type as uint16_t, not generic int

To convert the algorithms to SSE2, we need to know exactly which width
and type of int we're dealing with. Make this an uint16_t; the type
looks large enough for a counter that updates every frame. At 10 hz, it
will take almost 2 hours for the counter to saturate; enough time to
finally accept a static object.
alg_update_reference_frame: add optimized SSE2 routine
alg_update_reference_frame: test harness: directly compare functions

Directly run two functions on the same input and check whether they give
the same output; don't just rely on printing a few numbers to the screen
and eyeballing the results.