def jpeg.decode.frame

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

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-image@0.1.0.1/image.bend as Img

742def jpeg.decode.frame(+frame: JPEGFrame) -> Img.Picture:
743  JPEGFrame{w, h, hm, vm, progressive, components, quants, huffs, restart, adobe, valid} = frame
744  +depth = Img.picture.depth(U.choose(U32, U32.is_gt(w, h), w, h), 1, 0n)
745  U.branch(Img.Picture, valid && U32.is_gt(w, 0) && U32.is_gt(h, 0) && jpeg.components.complete(components),
746    _ => Img.Picture{w, h, depth, jpeg.paint(U32.to_nat((w * h : U32)), 0, w, h, hm, vm, jpeg.idct.components(components, quants), U.choose(U32, U32.is_eq(adobe, 255) && jpeg.rgb.ids(components), 0, adobe), depth, Img.Flat{Img.clear()})}, _ => Img.picture.blank())

Uses (18)

Used by (1)