CI / test (push) Canceled after 0s
- Add chandra-camera-isp.c (C/OpenMP) for Quad-Bayer unpack, CCM, and tone mapping, with a NumPy fallback when it is not built - Add non-blocking contrast-detection VCM autofocus, with lens subdev discovery on the sensor's I2C bus - Tune Quad-Bayer AE: a video-mode vblank cap, damped steps, and full analog gain before extending blanking - Record variable-frame-rate video through a streaming Matroska muxer, and count dropped frames - Ship libcamera IPA tuning files for imx376, imx519, and uncalibrated sensors - Map camera buffers by fd and sync them with dma-buf ioctls
64 lines
1.6 KiB
MoonBit
64 lines
1.6 KiB
MoonBit
///| Wasm font backend: the component has no C rasteriser, so glyphs come from the host's
|
|
/// `chandra:host/font` import (the host draws them from the TTF files it loads).
|
|
|
|
///| Load a TTF file into `slot`.
|
|
fn b_load(slot : Int, path : String) -> Bool {
|
|
@hostfont.load(slot.reinterpret_as_uint(), path)
|
|
}
|
|
|
|
///| Rasterise one glyph.
|
|
fn b_glyph(slot : Int, cp : Int, size : Int) -> RawGlyph {
|
|
let g = @hostfont.rasterise(
|
|
slot.reinterpret_as_uint(),
|
|
cp.reinterpret_as_uint(),
|
|
size.reinterpret_as_uint(),
|
|
)
|
|
{
|
|
w: g.width,
|
|
h: g.height,
|
|
xoff: g.xoff,
|
|
yoff: g.yoff,
|
|
advance: g.advance,
|
|
coverage: Bytes::from_fixedarray(g.coverage),
|
|
}
|
|
}
|
|
|
|
///| Cached `.notdef` glyph (cp 0 at 16 px) per slot for wasm glyph-presence checks.
|
|
let wasm_notdef : Map[Int, RawGlyph] = {}
|
|
|
|
///| Cached `b_has_glyph` results keyed by `slot * 0x110000 + cp`.
|
|
let wasm_has_cache : Map[Int, Bool] = {}
|
|
|
|
///|
|
|
fn raw_glyph_eq(a : RawGlyph, b : RawGlyph) -> Bool {
|
|
a.w == b.w &&
|
|
a.h == b.h &&
|
|
a.xoff == b.xoff &&
|
|
a.yoff == b.yoff &&
|
|
a.advance == b.advance &&
|
|
a.coverage == b.coverage
|
|
}
|
|
|
|
///| Whether `slot` has a glyph for `cp` (not `.notdef`).
|
|
fn b_has_glyph(slot : Int, cp : Int) -> Bool {
|
|
if cp >= 0x1F000 {
|
|
return false
|
|
}
|
|
let key = slot * 0x110000 + cp
|
|
match wasm_has_cache.get(key) {
|
|
Some(v) => return v
|
|
None => ()
|
|
}
|
|
let notdef = match wasm_notdef.get(slot) {
|
|
Some(g) => g
|
|
None => {
|
|
let g = b_glyph(slot, 0, 16)
|
|
wasm_notdef.set(slot, g)
|
|
g
|
|
}
|
|
}
|
|
let has = !raw_glyph_eq(b_glyph(slot, cp, 16), notdef)
|
|
wasm_has_cache.set(key, has)
|
|
has
|
|
}
|