File size: 928 Bytes
7502e01 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | {
"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": []
}
}
|