def jpeg.frame.misc

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

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-bytes@0.1.0.1/bytes.bend as Bin

576def jpeg.frame.misc(+frame: JPEGFrame, +src: Bin.Bytes, +at: U32, +end: U32, +tag: U32) -> JPEGFrame:
577  JPEGFrame{w, h, hm, vm, progressive, components, quants, huffs, restart, adobe, valid} = frame
578  +dri = U32.is_eq(tag, 221)
579  +app14 = U32.is_eq(tag, 238) && U32.is_ge((end - at : U32), 12) && U32.is_eq(Bin.bytes.be(src, at, 4n, 0), 1097101154) && U32.is_eq(Bin.bytes.get(src, (at + 4 : U32)), 101)
580  JPEGFrame{w, h, hm, vm, progressive, components, quants, huffs, U.choose(U32, dri, Bin.bytes.be(src, at, 2n, 0), restart), U.choose(U32, app14, Bin.bytes.get(src, (at + 11 : U32)), adobe), valid && (Bool.not(dri) || U32.is_eq(end, (at + 2 : U32)))}

Uses (13)

Used by (1)