{ "name": "loop_101", "op_type": "loop_101", "description": "Upscale a pixel buffer by splitting each element into its high and low halves", "tags": [ "simd-loop" ], "axes": { "n": { "type": "var", "description": "axis n" }, "out_len": { "type": "var", "description": "axis out_len" } }, "inputs": { "b": { "shape": [ "n" ], "dtype": "uint8" } }, "outputs": { "a": { "shape": [ "out_len" ], "dtype": "uint8", "description": "Output array" } }, "reference": "import numpy as np\n\ndef run(b):\n n = b.shape[0]\n a = np.zeros(2 * (n - 1), dtype=np.uint8)\n if n >= 2:\n s1 = b[:-1].astype(np.uint16)\n s2 = b[1:].astype(np.uint16)\n a[0::2] = ((3 * s1 + s2 + 2) >> 2).astype(np.uint8)\n a[1::2] = ((3 * s2 + s1 + 2) >> 2).astype(np.uint8)\n return a\n", "simd_loop_meta": { "output_inplace": false, "array_pad": 0, "scratch": [], "axes_order": [ "n" ] } }