def jpeg.scan.ready

gralha-jpeg-decode@0.1.0.1 · jpeg.bend:547

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

547def jpeg.scan.ready(+xs: List<&2, JPEGComponent>, +start: U32, +end: U32, +high: U32, +quants: List<&2, JPEGQuant>) -> Bool:
548  match xs:
549    case Nil{}: True{}
550    case Con{JPEGComponent{id, h, v, quant, dc, ac, predictor, bw, bh, coefficients, samples}, rest}:
551      U32.is_gt(bw, 0) && (U32.is_eq(start, 0) || U32.is_gt(Bin.bytes.get(samples, 0), 0)) && U32.is_le(dc, 3) && U32.is_le(ac, 3) && Bool.not(jpeg.components.has(rest, id)) && jpeg.quant.valid(64n, 0, jpeg.quant.find(quants, quant)) && jpeg.history.valid(U32.to_nat((end - start + 1 : U32)), start, samples, high) && jpeg.scan.ready(rest, start, end, high, quants)

Uses (19)

Used by (1)