def jpeg.mcu
gralha-jpeg-decode@0.1.0.1 · jpeg.bend:441
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
441def jpeg.mcu(+xs: List<&2, JPEGComponent>, +tables: List<&2, JPEGHuff>, +single: Bool, +x: U32, +y: U32, stream: JPEGStream) -> JPEGScan:
442 match xs:
443 case Nil{}: JPEGScan{Nil{}, stream}
444 case Con{component, rest}:
445 JPEGComponent{id, h, v, quant, dc, ac, predictor, bw, bh, coefficients, samples} = component
446 +c = {component : JPEGComponent}
447 +hh = U.choose(U32, single, 1, h)
448 +vv = U.choose(U32, single, 1, v)
449 jpeg.scan.part(jpeg.component.blocks(U32.to_nat((hh * vv : U32)), 0, hh, (x * hh : U32), (y * vv : U32), tables, c, stream), input => jpeg.mcu(rest, tables, single, x, y, input))