Skip to content

Commit 45aab26

Browse files
committed
initial
1 parent 453468a commit 45aab26

29 files changed

+8615
-316
lines changed

.github/workflows/build-pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build CI
1+
name: Lint/Build/Test CI
22

33
permissions:
44
contents: read
@@ -21,9 +21,10 @@ jobs:
2121
- uses: pnpm/action-setup@v4
2222
- uses: actions/setup-node@v6
2323
with:
24-
node-version: "lts/*"
24+
node-version: "24"
2525
cache: "pnpm"
2626
- run: pnpm install --frozen-lockfile
2727

2828
- run: pnpm lint
2929
- run: pnpm build
30+
- run: pnpm test

.github/workflows/changeset-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: pnpm/action-setup@v4
1717
- uses: actions/setup-node@v6
1818
with:
19-
node-version: "lts/*"
19+
node-version: "24"
2020
cache: "pnpm"
2121
- run: pnpm install --frozen-lockfile
2222

.github/workflows/deploy-demo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: pnpm/action-setup@v4
2626
- uses: actions/setup-node@v6
2727
with:
28-
node-version: "lts/*"
28+
node-version: "24"
2929
cache: "pnpm"
3030
- run: pnpm install --frozen-lockfile
3131

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
dist
33
*.local
4+
*.tsbuildinfo
5+
__screenshots__

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.1",
55
"type": "module",
66
"scripts": {
7-
"build": "tsc --build --clean && vite build",
7+
"build": "tsc --build && vite build",
88
"clean": "rm -rfv dist",
99
"dev": "vite"
1010
},

driver/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"version": "0.0.6",
66
"type": "module",
77
"scripts": {
8-
"build": "tsc --build --clean",
8+
"build": "tsc --build",
99
"clean": "rm -rfv dist",
10+
"test": "vitest run --browser.headless",
1011
"prepack": "$npm_execpath run clean && $npm_execpath run build"
1112
},
1213
"files": [

driver/src/camera/deraw/formats.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export const unpackGrayToRgbaFloat16 = (
6161
};
6262

6363
const BAYER_NORMAL = 1 / 255;
64-
const BAYER_NORMAL2 = BAYER_NORMAL * 2;
65-
const BAYER_NORMAL4 = BAYER_NORMAL * 4;
64+
const BAYER_NORMAL2 = 1 / (255 * 2);
65+
const BAYER_NORMAL4 = 1 / (255 * 4);
6666

6767
/**
6868
* Convert Bayer pattern to RGBA float16 format
@@ -172,7 +172,7 @@ const YUV_NORMAL = 1 / 255;
172172
* @param outBuffer Output buffer
173173
* @returns RGBA float16 buffer
174174
*/
175-
export function uyvyToRgbaFloat16(
175+
export function yuvToRgbaFloat16(
176176
uyvyBuffer: ArrayBuffer,
177177
outBuffer = new ArrayBuffer(
178178
uyvyBuffer.byteLength * 2 * Float16Array.BYTES_PER_ELEMENT,

driver/src/camera/deraw/select-format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { selectBpp, selectRes } from "../stream/dimensions.js";
44
import {
55
bayerToRgbaFloat16,
66
unpackGrayToRgbaFloat16,
7-
uyvyToRgbaFloat16,
7+
yuvToRgbaFloat16,
88
} from "./formats.js";
99
import type { RawToRgba } from "./raw-to-rgba.js";
1010

@@ -21,7 +21,7 @@ export const selectRawToRgba = (mode: CamMode): RawToRgba => {
2121
case CamFmtVisible.BAYER_8B:
2222
return bayerToRgbaFloat16.bind(null, selectRes(mode)[0]);
2323
case CamFmtVisible.YUV_16B:
24-
return uyvyToRgbaFloat16.bind(null);
24+
return yuvToRgbaFloat16.bind(null);
2525
}
2626
}
2727
};

driver/src/camera/stream/dimensions.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const irBpp = {
3939
[CamFmtInfrared.IR_10B]: 10,
4040
} as const;
4141

42-
export const selectRes = <M extends CamMode>(mode: M) => {
42+
export const selectRes = <M extends CamMode>(mode: NonNullable<M>) => {
4343
switch (mode?.stream) {
4444
case undefined:
4545
throw new RangeError("Invalid mode", { cause: mode });
@@ -58,10 +58,8 @@ export const selectRes = <M extends CamMode>(mode: M) => {
5858
}
5959
};
6060

61-
export const selectBpp = <M extends CamMode>(mode: M) => {
62-
switch (mode?.stream) {
63-
case undefined:
64-
throw new RangeError("Invalid mode", { cause: mode });
61+
export const selectBpp = <M extends CamMode>(mode: NonNullable<M>) => {
62+
switch (mode.stream) {
6563
case Cam.VISIBLE:
6664
return visibleBpp[mode.format] as M extends CamMode<Cam.VISIBLE>
6765
? (typeof visibleBpp)[M["format"]]
@@ -77,10 +75,8 @@ export const selectBpp = <M extends CamMode>(mode: M) => {
7775
}
7876
};
7977

80-
export const selectFrameSize = (mode: CamMode) => {
81-
switch (mode?.stream) {
82-
case undefined:
83-
throw new RangeError("Invalid mode", { cause: mode });
78+
export const selectFrameSize = (mode: NonNullable<CamMode>) => {
79+
switch (mode.stream) {
8480
case Cam.VISIBLE: {
8581
const [width, height] = visibleRes[mode.res];
8682
const bpp = visibleBpp[mode.format];

driver/src/camera/worker/iso-worker.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)