def jpeg.idct.pixels
gralha-jpeg-decode@0.1.0.1 · jpeg.bend:644
import gralha-jpeg-decode@0.1.0.1/jpeg.bend as Jpeg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-bytes@0.1.0.1/bytes.bend as Bin
644def jpeg.idct.pixels(n: Nat, +index: U32, +x: U32, +y: U32, +stride: U32, +rows: List<&2, F32>, out: Bin.Bytes) -> Bin.Bytes:
645 match n:
646 case 0n: out
647 case 1n+d:
648 +xx = (index % 8 : U32)
649 +yy = (index / 8 : U32)
650 jpeg.idct.pixels(d, U32.inc(index), x, y, stride, rows, Bin.bytes.set(out, ((y + yy) * stride + x + xx : U32), F32.to_u32(U.clamp(F32.floor((jpeg.idct.vertical(8n, 0, xx, yy, rows, 0.0) + 128.5 : F32)), 0.0, 255.0))))