Camera: C ISP pipeline, contrast autofocus, and VFR video
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
This commit is contained in:
nandi committed 2026-11-28 19:25:43 -08:00
1 parent 851c39d827
commit 52b42890d6
34 files changed
+2851 -364

No files matched your search

+83
View File
@@ -85,3 +85,86 @@ test "keyboard moves the selection and launches" {
ignore(d.handle(a, FocusLost))
assert_false(d.focused)
}
///|
test "tapping with finger-roll drift launches without dragging or moving icons" {
let d = desk()
let a = apps(12)
let before = d.layout(a)
// 20 px drift inside cell (0,0): stays below the 32 px medium-cell drag threshold.
ignore(d.handle(a, PointerDown({ x: 60, y: 60 })))
ignore(d.handle(a, PointerMove({ x: 80, y: 64 })))
assert_false(d.dragging)
assert_eq(d.handle(a, PointerUp({ x: 80, y: 64 })), (true, Launch("app0")))
assert_eq(d.layout(a), before)
// 15 px drift starting near the right edge of cell (0,0) and crossing into cell (1,0) still
// launches app0 without moving any icon.
ignore(d.handle(a, PointerDown({ x: 110, y: 60 })))
ignore(d.handle(a, PointerMove({ x: 125, y: 60 })))
assert_false(d.dragging)
assert_eq(d.handle(a, PointerUp({ x: 125, y: 60 })), (true, Launch("app0")))
assert_eq(d.layout(a), before)
}
///|
test "launching and reordering apps by recency keeps every icon in its cell" {
let a = apps(12)
// Simulate an app launched from elsewhere (places empty): first-seen order keeps cells stable.
let d_unpinned = desk()
let expected_by_id : Map[String, (Int, Int)] = {}
let initial = d_unpinned.layout(a)
for i, app in a {
expected_by_id.set(app.id, initial[i])
}
let reordered = [a[0], a[1], a[2], a[3], a[4], a[7], a[5], a[6], a[8], a[9], a[10], a[11]]
let after_unpinned = d_unpinned.layout(reordered)
for i, app in reordered {
assert_eq(after_unpinned[i], expected_by_id.get(app.id).unwrap())
}
// Launching app7 on the desktop pins existing cells and keeps stability across recents reorder,
// off-grid rotation/resize fallback, and reload into a fresh Desk.
let d = desk()
ignore(d.layout(a))
// app7 is at cell (1, 2): x = 20 + 96 + 40 = 156, y = 20 + 2 * 96 + 40 = 252.
ignore(d.handle(a, PointerDown({ x: 156, y: 252 })))
assert_eq(d.handle(a, PointerUp({ x: 156, y: 252 })), (true, Launch("app7")))
let after_launch = d.layout(reordered)
for i, app in reordered {
assert_eq(after_launch[i], expected_by_id.get(app.id).unwrap())
}
// Portrait resize where column >= 1 falls off-grid: off-grid apps fall back in seen order,
// not recents order (app5 before app6 before app7).
d.w = 220
d.h = 1200
let portrait = d.layout(reordered)
let p_by_id : Map[String, (Int, Int)] = {}
for i, app in reordered {
p_by_id.set(app.id, portrait[i])
}
assert_true(p_by_id.get("app5").unwrap().1 < p_by_id.get("app6").unwrap().1)
assert_true(p_by_id.get("app6").unwrap().1 < p_by_id.get("app7").unwrap().1)
// Saved places round-trip into a fresh Desk with the reordered catalog.
let saved = d.config_items().filter(c => c.key == "places")[0]
let d2 = desk()
ignore(d2.set_config("places", saved.value))
let reloaded = d2.layout(reordered)
for i, app in reordered {
assert_eq(reloaded[i], expected_by_id.get(app.id).unwrap())
}
}
///|
test "dragging past threshold and dropping on the same cell cancels cleanly" {
let d = desk()
let a = apps(12)
let before = d.layout(a)
let places_val = fn(x : @icondesk.Desk) { x.config_items().filter(c => c.key == "places")[0].value }
assert_eq(places_val(d), "")
// Move 45 px (> 32 px threshold) while staying inside cell (0,0) (20..116).
ignore(d.handle(a, PointerDown({ x: 60, y: 60 })))
ignore(d.handle(a, PointerMove({ x: 105, y: 60 })))
assert_true(d.dragging)
assert_eq(d.handle(a, PointerUp({ x: 105, y: 60 })), (true, NoAction))
assert_eq(d.layout(a), before)
assert_eq(places_val(d), "")
}