| { | |
| "name": "loop_108", | |
| "op_type": "loop_108", | |
| "description": "Deinterleave RGBA pixel data and accumulate channel values with bit shifts", | |
| "tags": [ | |
| "simd-loop" | |
| ], | |
| "axes": { | |
| "N": { | |
| "type": "var", | |
| "description": "Array length" | |
| } | |
| }, | |
| "inputs": { | |
| "rgba": { | |
| "shape": [ | |
| "N" | |
| ], | |
| "dtype": "uint32" | |
| } | |
| }, | |
| "outputs": { | |
| "y": { | |
| "shape": [ | |
| "N" | |
| ], | |
| "dtype": "uint8", | |
| "description": "Output array" | |
| } | |
| }, | |
| "reference": "import numpy as np\n\ndef run(rgba):\n u = rgba.view(np.uint32)\n y = (u >> 26).astype(np.uint16)\n y += ((u >> 17) & np.uint32(0x7f)).astype(np.uint16)\n y += ((u >> 19) & np.uint32(0x1f)).astype(np.uint16)\n y += ((u >> 11) & np.uint32(0x1f)).astype(np.uint16)\n return y.astype(np.uint8)\n", | |
| "simd_loop_meta": { | |
| "output_inplace": false, | |
| "array_pad": 0, | |
| "scratch": [] | |
| } | |
| } | |