pshufb — shuffling bytes based on a mask

Shuffle (permute) — per the lesson, arguably the most important instruction in video processing. Each mask byte is an index: "which source byte goes here". Press "Step" or click the result cells.

m0 — source (before pshufb): letter bytes, so you can see who moved where
m1 — mask: source indices, −1 = "zero out"
m0 — result (after pshufb) — click the cells

    
Left to right: pshufb m0, m1 handles all 16 result positions at once — but we will walk through them one by one. Press "Step".
source filled result index −1 → byte is zeroed current triple "index → source → result"
The same thing in C — except in SIMD all 16 iterations happen in parallel
uint8_t tmp[16];
memcpy(tmp, dst, 16);
for (int i = 0; i < 16; i++) {
    if (src[i] & 0x80)      /* MSB of the index is set (−1) */
        dst[i] = 0;
    else
        dst[i] = tmp[src[i]];
}