| Task | #17 |
|---|---|
| Position | 5 |
| Score | 43,629 |
| Best Score | 42,713 |
| Points | 0.979 |
Problem Statement
You have a data stream of uint8 numbers in binary representation sending to
STDIN. The data is a set of pixels in RGBA format (each pixel is presented by
4 bytes).
You need to send only the Blue component of each pixel to STDOUT.
The number of pixels is 125 000 000.
Input Generator
Random Bytes (distcheck doesn’t really matter for this challenge)
Solution Sketch
The verifier has the same kernel as my own solution, but it’s just a load → shuffle → store pipeline. We optimize on declaring multiple masks by just loading the mask at different offsets, which would change where the shuffled bytes are deposited, then ORing them together, similar to Blue from RGB
std::array<int8_t, 44> mask { Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, 2, 6, 10, 14, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, 18, 22, 26, 30, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z };
All other improvements are a result of Memory Access
Thoughts
Same family of problems as Blue from RGB and Count uint8.