@masumdev/rn-camera-ai-tflite 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +405 -2
  3. package/lib/commonjs/detector/TFLiteCatAnalyzer.js +609 -0
  4. package/lib/commonjs/detector/TFLiteCatAnalyzer.js.map +1 -0
  5. package/lib/commonjs/detector/TFLiteFaceRecognizer.js +690 -0
  6. package/lib/commonjs/detector/TFLiteFaceRecognizer.js.map +1 -0
  7. package/lib/commonjs/detector/TFLiteObjectDetector.js +392 -0
  8. package/lib/commonjs/detector/TFLiteObjectDetector.js.map +1 -0
  9. package/lib/commonjs/detector/index.js +50 -0
  10. package/lib/commonjs/detector/index.js.map +1 -0
  11. package/lib/commonjs/detector/modelLoader.js +139 -0
  12. package/lib/commonjs/detector/modelLoader.js.map +1 -0
  13. package/lib/commonjs/detector/workletFrameHelper.js +233 -0
  14. package/lib/commonjs/detector/workletFrameHelper.js.map +1 -0
  15. package/lib/commonjs/index.js +39 -0
  16. package/lib/commonjs/index.js.map +1 -0
  17. package/lib/commonjs/package.json +1 -0
  18. package/lib/commonjs/parser/blazeFaceParser.js +771 -0
  19. package/lib/commonjs/parser/blazeFaceParser.js.map +1 -0
  20. package/lib/commonjs/parser/catParser.js +752 -0
  21. package/lib/commonjs/parser/catParser.js.map +1 -0
  22. package/lib/commonjs/parser/index.js +39 -0
  23. package/lib/commonjs/parser/index.js.map +1 -0
  24. package/lib/commonjs/parser/outputParser.js +196 -0
  25. package/lib/commonjs/parser/outputParser.js.map +1 -0
  26. package/lib/commonjs/types/cat.js +6 -0
  27. package/lib/commonjs/types/cat.js.map +1 -0
  28. package/lib/commonjs/types/index.js +28 -0
  29. package/lib/commonjs/types/index.js.map +1 -0
  30. package/lib/commonjs/types/resize-plugin.d.ts +20 -0
  31. package/lib/commonjs/types/tflite.js +6 -0
  32. package/lib/commonjs/types/tflite.js.map +1 -0
  33. package/lib/module/detector/TFLiteCatAnalyzer.js +605 -0
  34. package/lib/module/detector/TFLiteCatAnalyzer.js.map +1 -0
  35. package/lib/module/detector/TFLiteFaceRecognizer.js +684 -0
  36. package/lib/module/detector/TFLiteFaceRecognizer.js.map +1 -0
  37. package/lib/module/detector/TFLiteObjectDetector.js +386 -0
  38. package/lib/module/detector/TFLiteObjectDetector.js.map +1 -0
  39. package/lib/module/detector/index.js +7 -0
  40. package/lib/module/detector/index.js.map +1 -0
  41. package/lib/module/detector/modelLoader.js +133 -0
  42. package/lib/module/detector/modelLoader.js.map +1 -0
  43. package/lib/module/detector/workletFrameHelper.js +226 -0
  44. package/lib/module/detector/workletFrameHelper.js.map +1 -0
  45. package/lib/module/index.js +6 -0
  46. package/lib/module/index.js.map +1 -0
  47. package/lib/module/package.json +1 -0
  48. package/lib/module/parser/blazeFaceParser.js +756 -0
  49. package/lib/module/parser/blazeFaceParser.js.map +1 -0
  50. package/lib/module/parser/catParser.js +739 -0
  51. package/lib/module/parser/catParser.js.map +1 -0
  52. package/lib/module/parser/index.js +6 -0
  53. package/lib/module/parser/index.js.map +1 -0
  54. package/lib/module/parser/outputParser.js +192 -0
  55. package/lib/module/parser/outputParser.js.map +1 -0
  56. package/lib/module/types/cat.js +4 -0
  57. package/lib/module/types/cat.js.map +1 -0
  58. package/lib/module/types/index.js +5 -0
  59. package/lib/module/types/index.js.map +1 -0
  60. package/lib/module/types/resize-plugin.d.ts +20 -0
  61. package/lib/module/types/tflite.js +4 -0
  62. package/lib/module/types/tflite.js.map +1 -0
  63. package/lib/typescript/commonjs/detector/TFLiteCatAnalyzer.d.ts +6 -0
  64. package/lib/typescript/commonjs/detector/TFLiteCatAnalyzer.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/detector/TFLiteFaceRecognizer.d.ts +59 -0
  66. package/lib/typescript/commonjs/detector/TFLiteFaceRecognizer.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/detector/TFLiteObjectDetector.d.ts +41 -0
  68. package/lib/typescript/commonjs/detector/TFLiteObjectDetector.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/detector/index.d.ts +5 -0
  70. package/lib/typescript/commonjs/detector/index.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/detector/modelLoader.d.ts +23 -0
  72. package/lib/typescript/commonjs/detector/modelLoader.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/detector/workletFrameHelper.d.ts +40 -0
  74. package/lib/typescript/commonjs/detector/workletFrameHelper.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/index.d.ts +4 -0
  76. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/package.json +1 -0
  78. package/lib/typescript/commonjs/parser/blazeFaceParser.d.ts +68 -0
  79. package/lib/typescript/commonjs/parser/blazeFaceParser.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/parser/catParser.d.ts +61 -0
  81. package/lib/typescript/commonjs/parser/catParser.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/parser/index.d.ts +4 -0
  83. package/lib/typescript/commonjs/parser/index.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/parser/outputParser.d.ts +17 -0
  85. package/lib/typescript/commonjs/parser/outputParser.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/types/cat.d.ts +109 -0
  87. package/lib/typescript/commonjs/types/cat.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/types/index.d.ts +3 -0
  89. package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/types/tflite.d.ts +233 -0
  91. package/lib/typescript/commonjs/types/tflite.d.ts.map +1 -0
  92. package/lib/typescript/module/detector/TFLiteCatAnalyzer.d.ts +6 -0
  93. package/lib/typescript/module/detector/TFLiteCatAnalyzer.d.ts.map +1 -0
  94. package/lib/typescript/module/detector/TFLiteFaceRecognizer.d.ts +59 -0
  95. package/lib/typescript/module/detector/TFLiteFaceRecognizer.d.ts.map +1 -0
  96. package/lib/typescript/module/detector/TFLiteObjectDetector.d.ts +41 -0
  97. package/lib/typescript/module/detector/TFLiteObjectDetector.d.ts.map +1 -0
  98. package/lib/typescript/module/detector/index.d.ts +5 -0
  99. package/lib/typescript/module/detector/index.d.ts.map +1 -0
  100. package/lib/typescript/module/detector/modelLoader.d.ts +23 -0
  101. package/lib/typescript/module/detector/modelLoader.d.ts.map +1 -0
  102. package/lib/typescript/module/detector/workletFrameHelper.d.ts +40 -0
  103. package/lib/typescript/module/detector/workletFrameHelper.d.ts.map +1 -0
  104. package/lib/typescript/module/index.d.ts +4 -0
  105. package/lib/typescript/module/index.d.ts.map +1 -0
  106. package/lib/typescript/module/package.json +1 -0
  107. package/lib/typescript/module/parser/blazeFaceParser.d.ts +68 -0
  108. package/lib/typescript/module/parser/blazeFaceParser.d.ts.map +1 -0
  109. package/lib/typescript/module/parser/catParser.d.ts +61 -0
  110. package/lib/typescript/module/parser/catParser.d.ts.map +1 -0
  111. package/lib/typescript/module/parser/index.d.ts +4 -0
  112. package/lib/typescript/module/parser/index.d.ts.map +1 -0
  113. package/lib/typescript/module/parser/outputParser.d.ts +17 -0
  114. package/lib/typescript/module/parser/outputParser.d.ts.map +1 -0
  115. package/lib/typescript/module/types/cat.d.ts +109 -0
  116. package/lib/typescript/module/types/cat.d.ts.map +1 -0
  117. package/lib/typescript/module/types/index.d.ts +3 -0
  118. package/lib/typescript/module/types/index.d.ts.map +1 -0
  119. package/lib/typescript/module/types/tflite.d.ts +233 -0
  120. package/lib/typescript/module/types/tflite.d.ts.map +1 -0
  121. package/package.json +116 -4
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getEffectivePlatform = getEffectivePlatform;
7
+ exports.loadModelWithFallback = loadModelWithFallback;
8
+ exports.validateModelSource = validateModelSource;
9
+ var _rnCameraAi = require("@masumdev/rn-camera-ai");
10
+ /**
11
+ * Validates that the provided model source conforms to supported TFLite model source representations.
12
+ * Throws a typed ModelLoadError if the source is invalid or empty.
13
+ */
14
+ function validateModelSource(source) {
15
+ if (source === null || source === undefined) {
16
+ throw new _rnCameraAi.ModelLoadError('Model source cannot be null or undefined', 'MODEL_LOAD_ERROR');
17
+ }
18
+ if (typeof source === 'number') {
19
+ if (!Number.isFinite(source) || source < 0 || !Number.isInteger(source)) {
20
+ throw new _rnCameraAi.ModelLoadError('Invalid model source: asset ID must be a non-negative finite integer', 'MODEL_LOAD_ERROR');
21
+ }
22
+ return source;
23
+ }
24
+ if (typeof source === 'string') {
25
+ if (source.trim().length === 0) {
26
+ throw new _rnCameraAi.ModelLoadError('Invalid model source: model path or URL cannot be empty or whitespace-only', 'MODEL_LOAD_ERROR');
27
+ }
28
+ return source.trim();
29
+ }
30
+ if (typeof source === 'object' && 'url' in source) {
31
+ const url = source.url;
32
+ if (typeof url !== 'string' || url.trim().length === 0) {
33
+ throw new _rnCameraAi.ModelLoadError('Invalid model source: model URL cannot be empty or whitespace-only', 'MODEL_LOAD_ERROR');
34
+ }
35
+ return {
36
+ url: url.trim()
37
+ };
38
+ }
39
+ throw new _rnCameraAi.ModelLoadError('Invalid model source: expected asset ID number, file path string, or { url: string }', 'MODEL_LOAD_ERROR');
40
+ }
41
+
42
+ /**
43
+ * Determines the target operating platform for delegate selection.
44
+ */
45
+ function getEffectivePlatform(platformOverride) {
46
+ if (platformOverride && typeof platformOverride === 'string') {
47
+ return platformOverride.toLowerCase();
48
+ }
49
+ try {
50
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
51
+ const rn = require('react-native');
52
+ if (typeof rn?.Platform?.OS === 'string' && rn.Platform.OS.length > 0) {
53
+ return rn.Platform.OS.toLowerCase();
54
+ }
55
+ } catch {
56
+ // Fallback when react-native is not present
57
+ }
58
+ if (typeof process !== 'undefined' && process.env?.TEST_PLATFORM_OS) {
59
+ return process.env.TEST_PLATFORM_OS.toLowerCase();
60
+ }
61
+ return 'android';
62
+ }
63
+
64
+ /**
65
+ * Resolves the default model loader function using react-native-fast-tflite if available,
66
+ * or provides a fallback runner for headless test environments.
67
+ */
68
+ function resolveDefaultLoader() {
69
+ try {
70
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
71
+ const fastTflite = require('react-native-fast-tflite');
72
+ if (typeof fastTflite?.loadTensorflowModel === 'function') {
73
+ const loadFn = fastTflite.loadTensorflowModel;
74
+ return (s, d) => {
75
+ const normalizedSource = typeof s === 'string' ? {
76
+ url: s.startsWith('file://') || s.startsWith('http://') || s.startsWith('https://') ? s : `file://${s}`
77
+ } : s;
78
+ return loadFn(normalizedSource, d);
79
+ };
80
+ }
81
+ } catch {
82
+ // Native runtime not loaded
83
+ }
84
+ return async (_source, delegates) => {
85
+ if (typeof process !== 'undefined' && process.env?.SIMULATE_GPU_FAILURE === 'true' && delegates.length > 0) {
86
+ throw new Error('GPU delegate initialization failed: OpenCL unavailable');
87
+ }
88
+ return {
89
+ runSync: () => [],
90
+ run: async () => [],
91
+ delegates
92
+ };
93
+ };
94
+ }
95
+
96
+ /**
97
+ * Loads a TensorFlow Lite model with automatic hardware delegate fallback.
98
+ *
99
+ * It attempts to initialize with GPU acceleration ('android-gpu' on Android, 'core-ml' on iOS).
100
+ * If the GPU delegate fails (e.g., unsupported OpenCL/OpenGL ops), it falls back to CPU ([])
101
+ * without throwing or crashing, safely emitting onDelegateFallback.
102
+ *
103
+ * @param source Model bundle ID, file path string, or URL object
104
+ * @param options Loading options including GPU preference and fallback callback
105
+ * @returns Initialized model and active delegate ('gpu' | 'cpu')
106
+ */
107
+ async function loadModelWithFallback(source, options) {
108
+ const validSource = validateModelSource(source);
109
+ const loader = options?.loadModel ?? resolveDefaultLoader();
110
+ const platform = getEffectivePlatform(options?.platform);
111
+ const useGpu = options?.useGpu !== false;
112
+ if (useGpu) {
113
+ const requestedDelegate = platform === 'android' ? 'android-gpu' : 'core-ml';
114
+ try {
115
+ const model = await loader(validSource, [requestedDelegate]);
116
+ return {
117
+ model,
118
+ activeDelegate: 'gpu',
119
+ source: validSource
120
+ };
121
+ } catch {
122
+ // GPU delegate failed to initialize: invoke fallback callback
123
+ options?.onDelegateFallback?.(requestedDelegate, 'cpu');
124
+ }
125
+ }
126
+
127
+ // Graceful CPU fallback
128
+ try {
129
+ const cpuModel = await loader(validSource, []);
130
+ return {
131
+ model: cpuModel,
132
+ activeDelegate: 'cpu',
133
+ source: validSource
134
+ };
135
+ } catch (cpuError) {
136
+ throw new _rnCameraAi.ModelLoadError(cpuError instanceof Error ? cpuError.message : 'Failed to load TFLite model on CPU', 'MODEL_LOAD_ERROR', cpuError);
137
+ }
138
+ }
139
+ //# sourceMappingURL=modelLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_rnCameraAi","require","validateModelSource","source","undefined","ModelLoadError","Number","isFinite","isInteger","trim","length","url","getEffectivePlatform","platformOverride","toLowerCase","rn","Platform","OS","process","env","TEST_PLATFORM_OS","resolveDefaultLoader","fastTflite","loadTensorflowModel","loadFn","s","d","normalizedSource","startsWith","_source","delegates","SIMULATE_GPU_FAILURE","Error","runSync","run","loadModelWithFallback","options","validSource","loader","loadModel","platform","useGpu","requestedDelegate","model","activeDelegate","onDelegateFallback","cpuModel","cpuError","message"],"sourceRoot":"../../../src","sources":["detector/modelLoader.ts"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAACC,MAAe,EAAqB;EACtE,IAAIA,MAAM,KAAK,IAAI,IAAIA,MAAM,KAAKC,SAAS,EAAE;IAC3C,MAAM,IAAIC,0BAAc,CAAC,0CAA0C,EAAE,kBAAkB,CAAC;EAC1F;EAEA,IAAI,OAAOF,MAAM,KAAK,QAAQ,EAAE;IAC9B,IAAI,CAACG,MAAM,CAACC,QAAQ,CAACJ,MAAM,CAAC,IAAIA,MAAM,GAAG,CAAC,IAAI,CAACG,MAAM,CAACE,SAAS,CAACL,MAAM,CAAC,EAAE;MACvE,MAAM,IAAIE,0BAAc,CACt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BA,CACzChC,MAAe,EACfiC,OAA4B,EACA;EAC5B,MAAMC,WAAW,GAAGnC,mBAAmB,CAACC,MAAM,CAAC;EAC/C,MAAMmC,MAAM,GAAGF,OAAO,EAAEG,SAAS,IAAIlB,oBAAoB,CAAC,CAAC;EAC3D,MAAMmB,QAAQ,GAAG5B,oBAAoB,CAACwB,OAAO,EAAEI,QAAQ,CAAC;EACxD,MAAMC,MAAM,GAAGL,OAAO,EAAEK,MAAM,KAAK,KAAK;EAExC,IAAIA,MAAM,EAAE;IACV,MAAMC,iBAAiB,GAAGF,QAAQ,KAAK,SAAS,GAAG,aAAa,GAAG,SAAS;IAC5E,IAAI;MACF,MAAMG,KAAK,GAAG,MAAML,MAAM,CAACD,WAAW,EAAE,CAACK,iBAAiB,CAAC,CAAC;MAC5D,OAAO;QACLC,KAAK;QACLC,cAAc,EAAE,KAAK;QACrBzC,MAAM,EAAEkC;MACV,CAAC;IACH,CAAC,CAAC,MAAM;MACN;MACAD,OAAO,EAAES,kBAAkB,GAAGH,iBAAiB,EAAE,KAAK,CAAC;IACzD;EACF;;EAEA;EACA,IAAI;IACF,MAAMI,QAAQ,GAAG,MAAMR,MAAM,CAACD,WAAW,EAAE,EAAE,CAAC;IAC9C,OAAO;MACLM,KAAK,EAAEG,QAAQ;MACfF,cAAc,EAAE,KAAK;MACrBzC,MAAM,EAAEkC;IACV,CAAC;EACH,CAAC,CAAC,OAAOU,QAAiB,EAAE;IAC1B,MAAM,IAAI1C,0BAAc,CACtB0C,QAAQ,YAAYf,KAAK,GAAGe,QAAQ,CAACC,OAAO,GAAG,oCAAoC,EACnF,kBAAkB,EAClBD,QACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createWorkletSyncRef = createWorkletSyncRef;
7
+ exports.extractRgbUint8Frame = extractRgbUint8Frame;
8
+ exports.getOptionalFrameConverter = getOptionalFrameConverter;
9
+ exports.getOptionalResizePlugin = getOptionalResizePlugin;
10
+ let cachedResizer = undefined;
11
+ let cachedFrameConverter = undefined;
12
+ function getOptionalResizePlugin() {
13
+ if (cachedResizer !== undefined) {
14
+ return cachedResizer;
15
+ }
16
+ try {
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const plugin = require('vision-camera-resize-plugin');
19
+ if (typeof plugin?.resize === 'function') {
20
+ cachedResizer = plugin;
21
+ return plugin;
22
+ }
23
+ } catch {
24
+ // vision-camera-resize-plugin not installed
25
+ }
26
+ cachedResizer = null;
27
+ return null;
28
+ }
29
+ function getOptionalFrameConverter() {
30
+ if (cachedFrameConverter !== undefined) {
31
+ return cachedFrameConverter;
32
+ }
33
+ try {
34
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
35
+ const vc = require('react-native-vision-camera');
36
+ if (typeof vc?.HybridFrameConverter?.convertFrameToImage === 'function') {
37
+ cachedFrameConverter = vc.HybridFrameConverter;
38
+ return cachedFrameConverter;
39
+ }
40
+ } catch {
41
+ // react-native-vision-camera HybridFrameConverter not loaded
42
+ }
43
+ cachedFrameConverter = null;
44
+ return null;
45
+ }
46
+ function createWorkletSyncRef(initial, fixedType = false) {
47
+ try {
48
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
49
+ const worklets = require('react-native-worklets');
50
+ if (typeof worklets?.createSynchronizable === 'function') {
51
+ return fixedType ? worklets.createSynchronizable(initial, {
52
+ fixedType: true
53
+ }) : worklets.createSynchronizable(initial);
54
+ }
55
+ } catch {
56
+ // Fallback outside native runtime
57
+ }
58
+ let val = initial;
59
+ return {
60
+ getBlocking: () => val,
61
+ setBlocking: next => {
62
+ val = next;
63
+ }
64
+ };
65
+ }
66
+ function viewToArrayBuffer(view) {
67
+ 'worklet';
68
+
69
+ const underlying = view.buffer;
70
+ if (view.byteOffset === 0 && view.byteLength === underlying.byteLength) {
71
+ return underlying;
72
+ }
73
+ return underlying.slice(view.byteOffset, view.byteOffset + view.byteLength);
74
+ }
75
+ function normalizeRawPixelsToRgbUint8(buffer, pixelFormat, width, height) {
76
+ 'worklet';
77
+
78
+ const src = new Uint8Array(buffer);
79
+ const expectedPixels = Math.max(0, Math.floor(width) * Math.floor(height));
80
+ if (pixelFormat === 'RGB') {
81
+ const expectedBytes = expectedPixels * 3;
82
+ if (src.byteLength === expectedBytes) {
83
+ return buffer;
84
+ }
85
+ const copyLen = Math.min(src.byteLength, expectedBytes);
86
+ const out = new Uint8Array(expectedBytes);
87
+ out.set(src.subarray(0, copyLen));
88
+ return out.buffer;
89
+ }
90
+ const out = new Uint8Array(expectedPixels * 3);
91
+ const count = Math.min(expectedPixels, Math.floor(src.byteLength / 4));
92
+ const isBgra = pixelFormat === 'BGRA' || pixelFormat === 'BGRX';
93
+ if (isBgra) {
94
+ for (let i = 0; i < count; i++) {
95
+ const s = i * 4;
96
+ const d = i * 3;
97
+ out[d] = src[s + 2];
98
+ out[d + 1] = src[s + 1];
99
+ out[d + 2] = src[s];
100
+ }
101
+ } else {
102
+ for (let i = 0; i < count; i++) {
103
+ const s = i * 4;
104
+ const d = i * 3;
105
+ out[d] = src[s];
106
+ out[d + 1] = src[s + 1];
107
+ out[d + 2] = src[s + 2];
108
+ }
109
+ }
110
+ return out.buffer;
111
+ }
112
+ /**
113
+ * Extracts a contiguous RGB uint8 buffer from VisionCamera v5 Nitro Frame,
114
+ * vision-camera-resize-plugin, or direct ArrayBuffer inputs cleanly on the worklet thread.
115
+ */
116
+ function extractRgbUint8Frame(frame, targetSize, frameConverter, resizePlugin) {
117
+ 'worklet';
118
+
119
+ const frameRecord = typeof frame === 'object' && frame !== null ? frame : null;
120
+ const isVc5Frame = frameRecord !== null && typeof frameRecord.getPixelBuffer === 'function';
121
+ if (!isVc5Frame && resizePlugin && frame) {
122
+ try {
123
+ const resized = resizePlugin.resize(frame, {
124
+ scale: {
125
+ width: targetSize,
126
+ height: targetSize
127
+ },
128
+ pixelFormat: 'rgb',
129
+ dataType: 'uint8'
130
+ });
131
+ if (resized?.buffer instanceof ArrayBuffer) {
132
+ return {
133
+ buffer: resized.buffer,
134
+ width: targetSize,
135
+ height: targetSize,
136
+ needs180Correction: false
137
+ };
138
+ }
139
+ if (resized?.buffer && ArrayBuffer.isView(resized.buffer)) {
140
+ return {
141
+ buffer: viewToArrayBuffer(resized.buffer),
142
+ width: targetSize,
143
+ height: targetSize,
144
+ needs180Correction: false
145
+ };
146
+ }
147
+ if (typeof resized?.toArrayBuffer === 'function') {
148
+ return {
149
+ buffer: resized.toArrayBuffer(),
150
+ width: targetSize,
151
+ height: targetSize,
152
+ needs180Correction: false
153
+ };
154
+ }
155
+ } catch {
156
+ // Continue to VC v5 or raw buffer extraction
157
+ }
158
+ }
159
+ if (isVc5Frame && frameConverter) {
160
+ if (frameRecord?.isValid === false) {
161
+ return null;
162
+ }
163
+ const needs180 = frameRecord?.orientation === 'left' || frameRecord?.orientation === 'right';
164
+ let sourceImage = null;
165
+ let resizedImage = null;
166
+ try {
167
+ sourceImage = frameConverter.convertFrameToImage(frame);
168
+ resizedImage = sourceImage.width !== targetSize || sourceImage.height !== targetSize ? sourceImage.resize(targetSize, targetSize) : sourceImage;
169
+ const rawPixel = resizedImage.toRawPixelData(false);
170
+ const w = rawPixel.width > 0 ? rawPixel.width : targetSize;
171
+ const h = rawPixel.height > 0 ? rawPixel.height : targetSize;
172
+ return {
173
+ buffer: normalizeRawPixelsToRgbUint8(rawPixel.buffer, rawPixel.pixelFormat, w, h),
174
+ width: w,
175
+ height: h,
176
+ needs180Correction: needs180
177
+ };
178
+ } finally {
179
+ if (resizedImage && resizedImage !== sourceImage && typeof resizedImage.dispose === 'function') {
180
+ resizedImage.dispose();
181
+ }
182
+ if (sourceImage && typeof sourceImage.dispose === 'function') {
183
+ sourceImage.dispose();
184
+ }
185
+ }
186
+ }
187
+ if (frame instanceof ArrayBuffer) {
188
+ const inferredW = Math.max(1, Math.round(Math.sqrt(frame.byteLength / 3)));
189
+ return {
190
+ buffer: frame,
191
+ width: inferredW,
192
+ height: inferredW,
193
+ needs180Correction: false
194
+ };
195
+ }
196
+ if (ArrayBuffer.isView(frame)) {
197
+ const buf = viewToArrayBuffer(frame);
198
+ const inferredW = Math.max(1, Math.round(Math.sqrt(buf.byteLength / 3)));
199
+ return {
200
+ buffer: buf,
201
+ width: inferredW,
202
+ height: inferredW,
203
+ needs180Correction: false
204
+ };
205
+ }
206
+ if (frameRecord) {
207
+ let rawBuf = null;
208
+ if (frameRecord.buffer instanceof ArrayBuffer) {
209
+ rawBuf = frameRecord.buffer;
210
+ } else if (frameRecord.buffer && ArrayBuffer.isView(frameRecord.buffer)) {
211
+ rawBuf = viewToArrayBuffer(frameRecord.buffer);
212
+ } else if (typeof frameRecord.toArrayBuffer === 'function') {
213
+ rawBuf = frameRecord.toArrayBuffer();
214
+ }
215
+ if (rawBuf) {
216
+ const w = typeof frameRecord.width === 'number' && frameRecord.width > 0 ? frameRecord.width : targetSize;
217
+ const h = typeof frameRecord.height === 'number' && frameRecord.height > 0 ? frameRecord.height : targetSize;
218
+ return {
219
+ buffer: rawBuf,
220
+ width: w,
221
+ height: h,
222
+ needs180Correction: false
223
+ };
224
+ }
225
+ }
226
+ return {
227
+ buffer: new ArrayBuffer(targetSize * targetSize * 3),
228
+ width: targetSize,
229
+ height: targetSize,
230
+ needs180Correction: false
231
+ };
232
+ }
233
+ //# sourceMappingURL=workletFrameHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cachedResizer","undefined","cachedFrameConverter","getOptionalResizePlugin","plugin","require","resize","getOptionalFrameConverter","vc","HybridFrameConverter","convertFrameToImage","createWorkletSyncRef","initial","fixedType","worklets","createSynchronizable","val","getBlocking","setBlocking","next","viewToArrayBuffer","view","underlying","buffer","byteOffset","byteLength","slice","normalizeRawPixelsToRgbUint8","pixelFormat","width","height","src","Uint8Array","expectedPixels","Math","max","floor","expectedBytes","copyLen","min","out","set","subarray","count","isBgra","i","s","d","extractRgbUint8Frame","frame","targetSize","frameConverter","resizePlugin","frameRecord","isVc5Frame","getPixelBuffer","resized","scale","dataType","ArrayBuffer","needs180Correction","isView","toArrayBuffer","isValid","needs180","orientation","sourceImage","resizedImage","rawPixel","toRawPixelData","w","h","dispose","inferredW","round","sqrt","buf","rawBuf"],"sourceRoot":"../../../src","sources":["detector/workletFrameHelper.ts"],"mappings":";;;;;;;;;AA6BA,IAAIA,aAAmD,GAAGC,SAAS;AACnE,IAAIC,oBAA2D,GAAGD,SAAS;AAEpE,SAASE,uBAAuBA,CAAA,EAA6B;EAClE,IAAIH,aAAa,KAAKC,SAAS,EAAE;IAC/B,OAAOD,aAAa;EACtB;EACA,IAAI;IACF;IACA,MAAMI,MAAM,GAAGC,OAAO,CAAC,6BAA6B,CAAsB;IAC1E,IAAI,OAAOD,MAAM,EAAEE,MAAM,KAAK,UAAU,EAAE;MACxCN,aAAa,GAAGI,MAAM;MACtB,OAAOA,MAAM;IACf;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAEFJ,aAAa,GAAG,IAAI;EACpB,OAAO,IAAI;AACb;AAEO,SAASO,yBAAyBA,CAAA,EAA8B;EACrE,IAAIL,oBAAoB,KAAKD,SAAS,EAAE;IACtC,OAAOC,oBAAoB;EAC7B;EACA,IAAI;IACF;IACA,MAAMM,EAAE,GAAGH,OAAO,CAAC,4BAA4B,CAE9C;IACD,IAAI,OAAOG,EAAE,EAAEC,oBAAoB,EAAEC,mBAAmB,KAAK,UAAU,EAAE;MACvER,oBAAoB,GAAGM,EAAE,CAACC,oBAAoB;MAC9C,OAAOP,oBAAoB;IAC7B;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAEFA,oBAAoB,GAAG,IAAI;EAC3B,OAAO,IAAI;AACb;AAEO,SAASS,oBAAoBA,CAAIC,OAAU,EAAEC,SAAS,GAAG,KAAK,EAAqB;EACxF,IAAI;IACF;IACA,MAAMC,QAAQ,GAAGT,OAAO,CAAC,uBAAuB,CAK/C;IACD,IAAI,OAAOS,QAAQ,EAAEC,oBAA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,MAAM;IAC7B,CAAC,MAAM,IAAI8B,WAAW,CAAC9B,MAAM,IAAIoC,WAAW,CAACE,MAAM,CAACR,WAAW,CAAC9B,MAAM,CAAC,EAAE;MACvEsD,MAAM,GAAGzD,iBAAiB,CAACiC,WAAW,CAAC9B,MAAM,CAAC;IAChD,CAAC,MAAM,IAAI,OAAO8B,WAAW,CAACS,aAAa,KAAK,UAAU,EAAE;MAC1De,MAAM,GAAGxB,WAAW,CAACS,aAAa,CAAC,CAAC;IACtC;IACA,IAAIe,MAAM,EAAE;MACV,MAAMP,CAAC,GACL,OAAOjB,WAAW,CAACxB,KAAK,KAAK,QAAQ,IAAIwB,WAAW,CAACxB,KAAK,GAAG,CAAC,GAC1DwB,WAAW,CAACxB,KAAK,GACjBqB,UAAU;MAChB,MAAMqB,CAAC,GACL,OAAOlB,WAAW,CAACvB,MAAM,KAAK,QAAQ,IAAIuB,WAAW,CAACvB,MAAM,GAAG,CAAC,GAC5DuB,WAAW,CAACvB,MAAM,GAClBoB,UAAU;MAChB,OAAO;QACL3B,MAAM,EAAEsD,MAAM;QACdhD,KAAK,EAAEyC,CAAC;QACRxC,MAAM,EAAEyC,CAAC;QACTX,kBAAkB,EAAE;MACtB,CAAC;IACH;EACF;EAEA,OAAO;IACLrC,MAAM,EAAE,IAAIoC,WAAW,CAACT,UAAU,GAAGA,UAAU,GAAG,CAAC,CAAC;IACpDrB,KAAK,EAAEqB,UAAU;IACjBpB,MAAM,EAAEoB,UAAU;IAClBU,kBAAkB,EAAE;EACtB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _index = require("./types/index.js");
7
+ Object.keys(_index).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _index[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _index[key];
14
+ }
15
+ });
16
+ });
17
+ var _index2 = require("./parser/index.js");
18
+ Object.keys(_index2).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _index2[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _index2[key];
25
+ }
26
+ });
27
+ });
28
+ var _index3 = require("./detector/index.js");
29
+ Object.keys(_index3).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _index3[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _index3[key];
36
+ }
37
+ });
38
+ });
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_index2","_index3"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}