def jpeg.progressive.decode

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

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

353def jpeg.progressive.decode(+component: JPEGComponent, +tables: List<&2, JPEGHuff>, +offset: U32, +stream: JPEGStream) -> JPEGBlock:
354  JPEGComponent{id, h, v, quant, dc, ac, predictor, bw, bh, coefficients, samples} = component
355  JPEGStream{data, position, word, count, JPEGSpectral{start, end, high, low, eob}, valid} = stream
356  +p1 = U32.shln(1, U32.to_nat(low))
357  U.branch(JPEGBlock, U32.is_eq(start, 0),
358    _ => U.branch(JPEGBlock, U32.is_eq(high, 0), _ => jpeg.progressive.dc.first(jpeg.huff.read(jpeg.huff.find(tables, dc, False{}), stream), coefficients, predictor, offset, low), _ => jpeg.progressive.dc.refine(jpeg.bits(stream, 1), coefficients, predictor, offset, low)),
359    _ => U.branch(JPEGBlock, U32.is_gt(eob, 0),
360      _ => U.branch(JPEGBlock, U32.is_eq(high, 0), _ => JPEGBlock{jpeg.stream.eob(stream, (eob - 1 : U32)), coefficients, predictor},
361        _ => jpeg.refined.block(jpeg.progressive.walk(start, end, 64, 0, offset, p1, JPEGBlock{jpeg.stream.eob(stream, (eob - 1 : U32)), coefficients, predictor}))),
362      _ => U.branch(JPEGBlock, U32.is_eq(high, 0), _ => jpeg.progressive.first(start, end, offset, low, jpeg.huff.find(tables, ac, True{}), JPEGBlock{stream, coefficients, predictor}),
363        _ => jpeg.progressive.refine(start, end, offset, p1, jpeg.huff.find(tables, ac, True{}), JPEGBlock{stream, coefficients, predictor}))))

Uses (24)

Used by (1)