A codec is a long chain of MMX operations. One wrong lane in one helper does
not crash and does not warn: it comes out as a picture that is subtly wrong,
days later, with nothing to point at. Reading the helpers proves nothing
either -- they all look right, which is the problem. The processor is the
only authority on what they should do, and on any host that can run this
toolkit it is sitting right there.
tests/mmx_integer runs all 41 integer helpers plus the shifts, the shuffle
and the lane insert/extract against the host's own intrinsics on the same
inputs. 4784128 checks. They all agree.
Nothing here is a fix. It is a control: when a decoded frame is wrong, this
says in one run whether MMX semantics are a candidate. That answer was worth
having -- it is how I ruled MMX out of a video frame that decodes to DC
coefficients and no AC.
Points that shaped it:
- Inputs mix edge patterns (all ones, 0x8000..., 0x7FFF...) with random
bits. The saturating and packing helpers only differ from a wrong answer
at the limits, which uniform noise reaches rarely.
- Shift counts run past the lane width, where the answer is not "shift by
the low bits" -- the mistake the C operator invites.
- _mm_shuffle_pi16, _mm_extract_pi16 and _mm_insert_pi16 take their selector
as a literal, so those cases are written out rather than looped.
- x86 hosts only. Elsewhere it reports that it did not run rather than
passing vacuously.
Standalone CMake project like the rest of tests/, so nothing needs wiring up.