def jpeg.components.allocate
gralha-jpeg-decode@0.1.0.1 · jpeg.bend:220
import gralha-jpeg-decode@0.1.0.1/jpeg.bend as Jpeg
import Base
import gralha-bytes@0.1.0.1/bytes.bend as Bin
220def jpeg.components.allocate(xs: List<&2, JPEGComponent>, +cols: U32, +rows: U32) -> List<&2, JPEGComponent>:
221 match xs:
222 case Nil{}: Nil{}
223 case Con{JPEGComponent{id, h, v, quant, dc, ac, predictor, bw, bh, coefficients, samples}, rest}:
224 +hh = h
225 +vv = v
226 Con{JPEGComponent{id, hh, vv, quant, dc, ac, predictor, (cols * hh : U32), (rows * vv : U32), Bin.bytes.zero((cols * hh * rows * vv * 64 : U32)), Bin.bytes.zero(64)}, jpeg.components.allocate(rest, cols, rows)}