@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.1

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 (387) hide show
  1. package/dist/interface/index.html +44 -44
  2. package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
  3. package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
  4. package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
  5. package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
  6. package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
  7. package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
  8. package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
  9. package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
  10. package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
  11. package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
  12. package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
  13. package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
  14. package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
  15. package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
  16. package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
  17. package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
  18. package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
  19. package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
  20. package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
  21. package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
  22. package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.js +1 -0
  23. package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.kxAPXcBy.0.0.50-internal.1.js} +1 -1
  24. package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
  25. package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
  26. package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
  27. package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
  28. package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.js} +1 -1
  29. package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.MmrWYW3K.0.0.50-internal.1.js} +1 -1
  30. package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0aqA_3x.0.0.50-internal.1.js} +2 -2
  31. package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
  32. package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
  33. package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.BQHSWV_g.0.0.50-internal.1.js} +1 -1
  34. package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
  35. package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
  36. package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
  37. package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.BwxOddB_.0.0.50-internal.1.js} +1 -1
  38. package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.Dz96RC_N.0.0.50-internal.1.js} +1 -1
  39. package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.CmcM8OM6.0.0.50-internal.1.js} +1 -1
  40. package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
  41. package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
  42. package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.CTgfs-3p.0.0.50-internal.1.js} +1 -1
  43. package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
  44. package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
  45. package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
  46. package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
  47. package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.CEGHlD-T.0.0.50-internal.1.js} +1 -1
  48. package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.D0keXzBc.0.0.50-internal.1.js} +1 -1
  49. package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
  50. package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.BPcXPAHG.0.0.50-internal.1.js} +1 -1
  51. package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.DSGzrW_l.0.0.50-internal.1.js} +1 -1
  52. package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
  53. package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
  54. package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
  55. package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
  56. package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
  57. package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.DXDZITpf.0.0.50-internal.1.js} +1 -1
  58. package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.BDYaTfbi.0.0.50-internal.1.js} +1 -1
  59. package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
  60. package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
  61. package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
  62. package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
  63. package/dist/interface/sw.js +1 -1
  64. package/dist/server/package.json +1 -1
  65. package/package.json +1 -1
  66. package/.prettierignore +0 -12
  67. package/.prettierrc.json +0 -12
  68. package/artillery.yaml +0 -29
  69. package/bin/cameraui-server.ts +0 -11
  70. package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
  71. package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
  72. package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
  73. package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
  74. package/eslint.config.js +0 -103
  75. package/localdeps.txt +0 -10
  76. package/mypy.ini +0 -30
  77. package/requirements.txt +0 -15
  78. package/ruff.toml +0 -90
  79. package/src/__init__.py +0 -0
  80. package/src/_camera_ui_tools/__init__.py +0 -0
  81. package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
  82. package/src/api/controllers/api.controller.ts +0 -19
  83. package/src/api/controllers/auth.controller.ts +0 -294
  84. package/src/api/controllers/backup.controller.ts +0 -72
  85. package/src/api/controllers/cameras.controller.ts +0 -1029
  86. package/src/api/controllers/config.controller.ts +0 -102
  87. package/src/api/controllers/files.controller.ts +0 -35
  88. package/src/api/controllers/frameWorkers.controller.ts +0 -109
  89. package/src/api/controllers/plugins.controller.ts +0 -1206
  90. package/src/api/controllers/system.controller.ts +0 -273
  91. package/src/api/controllers/users.controller.ts +0 -648
  92. package/src/api/database/checks.ts +0 -268
  93. package/src/api/database/constants.ts +0 -8
  94. package/src/api/database/index.ts +0 -262
  95. package/src/api/database/migration.ts +0 -62
  96. package/src/api/database/selfcheck.ts +0 -492
  97. package/src/api/database/types.ts +0 -104
  98. package/src/api/go2rtc/api/application.ts +0 -48
  99. package/src/api/go2rtc/api/config.ts +0 -61
  100. package/src/api/go2rtc/api/discover.ts +0 -197
  101. package/src/api/go2rtc/api/index.ts +0 -49
  102. package/src/api/go2rtc/api/snapshot.ts +0 -44
  103. package/src/api/go2rtc/api/streams.ts +0 -168
  104. package/src/api/go2rtc/index.ts +0 -43
  105. package/src/api/go2rtc/queue.ts +0 -50
  106. package/src/api/go2rtc/types.ts +0 -174
  107. package/src/api/index.ts +0 -286
  108. package/src/api/middlewares/authPermission.middleware.ts +0 -46
  109. package/src/api/middlewares/authValidation.middleware.ts +0 -160
  110. package/src/api/middlewares/pagination.middleware.ts +0 -67
  111. package/src/api/middlewares/socketAuth.middleware.ts +0 -136
  112. package/src/api/plugins/header.plugin.ts +0 -15
  113. package/src/api/plugins/logger.plugin.ts +0 -44
  114. package/src/api/plugins/proxy.plugin.ts +0 -255
  115. package/src/api/plugins/socket.plugin.ts +0 -28
  116. package/src/api/plugins/system.plugin.ts +0 -48
  117. package/src/api/plugins/useragent.plugin.ts +0 -19
  118. package/src/api/routes/api.routes.ts +0 -10
  119. package/src/api/routes/auth.routes.ts +0 -56
  120. package/src/api/routes/backup.routes.ts +0 -28
  121. package/src/api/routes/cameras.routes.ts +0 -281
  122. package/src/api/routes/config.routes.ts +0 -66
  123. package/src/api/routes/files.routes.ts +0 -15
  124. package/src/api/routes/frameWorkers.routes.ts +0 -39
  125. package/src/api/routes/index.ts +0 -37
  126. package/src/api/routes/plugins.routes.ts +0 -420
  127. package/src/api/routes/system.routes.ts +0 -101
  128. package/src/api/routes/users.routes.ts +0 -167
  129. package/src/api/schemas/backup.schema.ts +0 -112
  130. package/src/api/schemas/cameras.schema.ts +0 -479
  131. package/src/api/schemas/config.schema.ts +0 -38
  132. package/src/api/schemas/go2rtc.schema.ts +0 -189
  133. package/src/api/schemas/plugins.schema.ts +0 -126
  134. package/src/api/schemas/storage.schema.ts +0 -11
  135. package/src/api/schemas/system.schema.ts +0 -45
  136. package/src/api/schemas/users.schema.ts +0 -185
  137. package/src/api/services/auth.service.ts +0 -210
  138. package/src/api/services/backup.service.ts +0 -144
  139. package/src/api/services/cameras.service.ts +0 -671
  140. package/src/api/services/plugins.service.ts +0 -470
  141. package/src/api/services/system.service.ts +0 -85
  142. package/src/api/services/users.service.ts +0 -276
  143. package/src/api/types/index.ts +0 -675
  144. package/src/api/utils/cert.ts +0 -254
  145. package/src/api/utils/constants.ts +0 -17
  146. package/src/api/utils/fetch.ts +0 -21
  147. package/src/api/utils/moveFiles.ts +0 -45
  148. package/src/api/utils/parse.ts +0 -17
  149. package/src/api/websocket/index.ts +0 -110
  150. package/src/api/websocket/nsp/logs.ts +0 -240
  151. package/src/api/websocket/nsp/main.ts +0 -27
  152. package/src/api/websocket/nsp/metrics.ts +0 -301
  153. package/src/api/websocket/nsp/notifications.ts +0 -43
  154. package/src/api/websocket/nsp/plugins.ts +0 -37
  155. package/src/api/websocket/nsp/server.ts +0 -220
  156. package/src/api/websocket/nsp/status.ts +0 -77
  157. package/src/api/websocket/types.ts +0 -55
  158. package/src/api.ts +0 -163
  159. package/src/camera/classes.ts +0 -32
  160. package/src/camera/controller.ts +0 -579
  161. package/src/camera/device.ts +0 -422
  162. package/src/camera/frameWorker.ts +0 -403
  163. package/src/camera/index.ts +0 -679
  164. package/src/camera/interfaces.ts +0 -95
  165. package/src/camera/iou.ts +0 -153
  166. package/src/camera/polygon.ts +0 -226
  167. package/src/camera/python/__init__.py +0 -0
  168. package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
  169. package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
  170. package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
  171. package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
  172. package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
  173. package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
  174. package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
  175. package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
  176. package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
  177. package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
  178. package/src/camera/python/classes.py +0 -41
  179. package/src/camera/python/interfaces.py +0 -130
  180. package/src/camera/python/iou.py +0 -158
  181. package/src/camera/python/polygon.py +0 -230
  182. package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
  183. package/src/camera/python/test/iou_test.py +0 -799
  184. package/src/camera/python/test/polygon.py +0 -238
  185. package/src/camera/python/test/polygon_test.py +0 -256
  186. package/src/camera/python/test/polygon_test2.py +0 -484
  187. package/src/camera/python/typings.py +0 -50
  188. package/src/camera/python/video_frame.py +0 -143
  189. package/src/camera/session.ts +0 -192
  190. package/src/camera/streaming/fmp4-session.ts +0 -390
  191. package/src/camera/streaming/peer-connection.ts +0 -273
  192. package/src/camera/streaming/rtsp-session.ts +0 -331
  193. package/src/camera/streaming/webrtc-connection.ts +0 -260
  194. package/src/camera/streaming/werift-session.ts +0 -317
  195. package/src/camera/test/iou_test.ts +0 -761
  196. package/src/camera/test/polygon.test.ts +0 -611
  197. package/src/camera/test/polygon_test.ts +0 -210
  198. package/src/camera/types.ts +0 -48
  199. package/src/camera/utils.ts +0 -489
  200. package/src/camera/videoFrame.ts +0 -123
  201. package/src/cloud/index.ts +0 -61
  202. package/src/cloud/remote/cloudflare.ts +0 -18
  203. package/src/cloud/remote/upnp.ts +0 -18
  204. package/src/cloud/remote/utils.ts +0 -24
  205. package/src/cloud/types.ts +0 -16
  206. package/src/decoder/child.ts +0 -883
  207. package/src/decoder/imageUtils.ts +0 -275
  208. package/src/decoder/manager.ts +0 -251
  209. package/src/decoder/python/__init__.py +0 -0
  210. package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
  211. package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
  212. package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
  213. package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
  214. package/src/decoder/python/child.py +0 -903
  215. package/src/decoder/python/image_utils.py +0 -196
  216. package/src/decoder/python/pool.py +0 -45
  217. package/src/decoder/python/test/group.py +0 -62
  218. package/src/decoder/python/test/motion.mp4 +0 -0
  219. package/src/decoder/python/test/motion2.mp4 +0 -0
  220. package/src/decoder/python/test/opencl.cl +0 -70
  221. package/src/decoder/python/test/opencl2.cl +0 -130
  222. package/src/decoder/python/test/test.py +0 -427
  223. package/src/decoder/python/test/test1.jpg +0 -0
  224. package/src/decoder/python/test/test1_resized.jpg +0 -0
  225. package/src/decoder/python/test/test2.jpg +0 -0
  226. package/src/decoder/python/test/test2.py +0 -451
  227. package/src/decoder/python/test/test2_resized.jpg +0 -0
  228. package/src/decoder/python/test/test3.jpg +0 -0
  229. package/src/decoder/python/test/utils.py +0 -50
  230. package/src/decoder/python/typings.py +0 -57
  231. package/src/decoder/python/utils.py +0 -70
  232. package/src/decoder/test/child.ts +0 -117
  233. package/src/decoder/test/ffmpeg.ts +0 -371
  234. package/src/decoder/test/test.ts +0 -182
  235. package/src/decoder/types.ts +0 -27
  236. package/src/decoder/utils.ts +0 -64
  237. package/src/decoder/wasm/asconfig.json +0 -28
  238. package/src/decoder/wasm/assembly/console.ts +0 -1
  239. package/src/decoder/wasm/assembly/index.ts +0 -890
  240. package/src/decoder/wasm/build/decoder.d.ts +0 -43
  241. package/src/decoder/wasm/build/decoder.js +0 -108
  242. package/src/decoder/wasm/build/decoder.wasm +0 -0
  243. package/src/decoder/wasm/tsconfig.json +0 -5
  244. package/src/decoder/worker.ts +0 -113
  245. package/src/go2rtc/index.ts +0 -324
  246. package/src/go2rtc/types.ts +0 -88
  247. package/src/main.ts +0 -267
  248. package/src/manager/coreManager.ts +0 -78
  249. package/src/manager/deviceManager.ts +0 -132
  250. package/src/manager/types.ts +0 -17
  251. package/src/plugins/index.ts +0 -443
  252. package/src/plugins/plugin.ts +0 -177
  253. package/src/plugins/runtime/base.ts +0 -282
  254. package/src/plugins/runtime/index.ts +0 -15
  255. package/src/plugins/runtime/node/child.ts +0 -193
  256. package/src/plugins/runtime/node/index.ts +0 -67
  257. package/src/plugins/runtime/node/plugin.ts +0 -122
  258. package/src/plugins/runtime/node/pluginApi.ts +0 -27
  259. package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
  260. package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
  261. package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
  262. package/src/plugins/runtime/node/storage.ts +0 -312
  263. package/src/plugins/runtime/node/storageController.ts +0 -91
  264. package/src/plugins/runtime/python/__init__.py +0 -0
  265. package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
  266. package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
  267. package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
  268. package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
  269. package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
  270. package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
  271. package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
  272. package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
  273. package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
  274. package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
  275. package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
  276. package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
  277. package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
  278. package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
  279. package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
  280. package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
  281. package/src/plugins/runtime/python/child.py +0 -248
  282. package/src/plugins/runtime/python/index.ts +0 -73
  283. package/src/plugins/runtime/python/namespaces.py +0 -101
  284. package/src/plugins/runtime/python/plugin.py +0 -155
  285. package/src/plugins/runtime/python/plugin_api.py +0 -29
  286. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
  287. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
  288. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
  289. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
  290. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
  291. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
  292. package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
  293. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
  294. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
  295. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
  296. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
  297. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
  298. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
  299. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
  300. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
  301. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
  302. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
  303. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
  304. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
  305. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
  306. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
  307. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
  308. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
  309. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
  310. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
  311. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
  312. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
  313. package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
  314. package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
  315. package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
  316. package/src/plugins/runtime/python/schema.py +0 -99
  317. package/src/plugins/runtime/python/storage.py +0 -353
  318. package/src/plugins/runtime/python/storage_controller.py +0 -102
  319. package/src/plugins/runtime/python/typings.py +0 -195
  320. package/src/plugins/schema.ts +0 -472
  321. package/src/plugins/types.ts +0 -60
  322. package/src/plugins/worker.ts +0 -250
  323. package/src/rpc/index.ts +0 -149
  324. package/src/rpc/namespaces.ts +0 -79
  325. package/src/rpc/server.ts +0 -422
  326. package/src/rpc/types.ts +0 -119
  327. package/src/rpc/utils.ts +0 -16
  328. package/src/services/config/constants.ts +0 -47
  329. package/src/services/config/defaults.ts +0 -57
  330. package/src/services/config/index.ts +0 -744
  331. package/src/services/config/types.ts +0 -211
  332. package/src/services/logger/index.ts +0 -96
  333. package/src/types.ts +0 -47
  334. package/src/utils/path.ts +0 -16
  335. package/src/utils/pythonInstaller.ts +0 -597
  336. package/tsconfig.json +0 -37
  337. package/updates.config.js +0 -3
  338. /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.1.css} +0 -0
  339. /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
  340. /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
  341. /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
  342. /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
  343. /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
  344. /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
  345. /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
  346. /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
  347. /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
  348. /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
  349. /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
  350. /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
  351. /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
  352. /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
  353. /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
  354. /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
  355. /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
  356. /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
  357. /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
  358. /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
  359. /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
  360. /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  361. /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
  362. /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
  363. /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
  364. /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
  365. /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
  366. /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
  367. /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
  368. /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
  369. /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  370. /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
  371. /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.js} +0 -0
  372. /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.1.js} +0 -0
  373. /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.js} +0 -0
  374. /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.1.js} +0 -0
  375. /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.1.js} +0 -0
  376. /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  377. /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
  378. /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  379. /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
  380. /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.js} +0 -0
  381. /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.1.js} +0 -0
  382. /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
  383. /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
  384. /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
  385. /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
  386. /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  387. /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
@@ -1,890 +0,0 @@
1
- enum WASMImageFormat {
2
- GRAY = 1,
3
- RGB = 2,
4
- RGBA = 3,
5
- }
6
-
7
- enum WASMInputFormat {
8
- YUV = 1,
9
- RGB = 2,
10
- RGBA = 3,
11
- GRAY = 4,
12
- }
13
-
14
- // Konstanten für die Konvertierung als SIMD-Vektoren
15
- const Y_MULTIPLIER = v128.splat<i32>(298);
16
- const R_ADD = v128.splat<i32>(409);
17
- const G_ADD1 = v128.splat<i32>(-100);
18
- const G_ADD2 = v128.splat<i32>(-208);
19
- const B_ADD = v128.splat<i32>(516);
20
- const SHIFT = 8;
21
- const CLAMP_MIN = v128.splat<i32>(0);
22
- const CLAMP_MAX = v128.splat<i32>(255);
23
-
24
- class StackBlurNode {
25
- value: u8 = 0;
26
- next: StackBlurNode | null = null;
27
- }
28
-
29
- const mulTable: i32[] = [
30
- 512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482,
31
- 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482,
32
- 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428,
33
- 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482,
34
- 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309,
35
- 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428,
36
- 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315,
37
- 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
38
- ];
39
-
40
- const shgTable: i32[] = [
41
- 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
42
- 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
43
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
44
- 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
45
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
46
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
47
- 24, 24, 24,
48
- ];
49
-
50
- let stackPool: StackBlurNode[] = [];
51
-
52
- // @ts-ignore: decorator
53
- @inline
54
- function initializeStackPool(radius: i32): void {
55
- if (stackPool.length === 0) {
56
- let div: i32 = radius + radius + 1;
57
- for (let i = 0; i < div; i++) {
58
- stackPool.push(new StackBlurNode());
59
- }
60
- }
61
- }
62
-
63
- // @ts-ignore: decorator
64
- @inline
65
- function clamp(value: i32): u8 {
66
- return <u8>(value < 0 ? 0 : value > 255 ? 255 : value);
67
- }
68
-
69
- // @ts-ignore: decorator
70
- @inline
71
- function clamp3(value: i32, min: i32, max: i32): i32 {
72
- if (value < min) return min;
73
- if (value > max) return max;
74
- return value;
75
- }
76
-
77
- // @ts-ignore: decorator
78
- @inline
79
- function clampSIMD(value: v128): v128 {
80
- let clamped = i32x4.max_s(value, CLAMP_MIN);
81
- clamped = i32x4.min_s(clamped, CLAMP_MAX);
82
- return clamped;
83
- }
84
-
85
- // @ts-ignore: decorator
86
- @inline
87
- function boxBlur(image: Uint8Array, width: i32, height: i32, blurRadius: i32, output: Uint8Array): Uint8Array {
88
- if (blurRadius < 1) return image;
89
-
90
- const diameter: i32 = blurRadius * 2 + 1;
91
- const divisor: i32 = diameter;
92
-
93
- // Temporäres Array für den horizontalen Blur
94
- let tempOutput = new Uint8Array(image.length);
95
-
96
- // Horizontaler Blur
97
- for (let y: i32 = 0; y < height; y++) {
98
- let sum: i32 = 0;
99
- // Initialer Summe für das erste Fenster
100
- for (let i: i32 = -blurRadius; i <= blurRadius; i++) {
101
- let x = clamp3(i, 0, width - 1);
102
- sum += image[y * width + x];
103
- }
104
-
105
- // Erste Pixel im horizontalen Blur
106
- tempOutput[y * width] = <u8>(sum / divisor);
107
-
108
- // Bewegen des Fensters über die Zeile
109
- for (let x: i32 = 1; x < width; x++) {
110
- let removeIdx = x - blurRadius - 1;
111
- let addIdx = x + blurRadius;
112
-
113
- removeIdx = clamp3(removeIdx, 0, width - 1);
114
- addIdx = clamp3(addIdx, 0, width - 1);
115
-
116
- sum = sum - image[y * width + removeIdx] + image[y * width + addIdx];
117
- tempOutput[y * width + x] = <u8>(sum / divisor);
118
- }
119
- }
120
-
121
- // Vertikaler Blur mit SIMD
122
- for (let x: i32 = 0; x < width; x++) {
123
- let sum: i32 = 0;
124
- // Initiale Summe für das erste Fenster
125
- for (let i: i32 = -blurRadius; i <= blurRadius; i++) {
126
- let y = clamp3(i, 0, height - 1);
127
- sum += tempOutput[y * width + x];
128
- }
129
-
130
- // Erste Pixel im vertikalen Blur
131
- output[x] = <u8>(sum / divisor);
132
-
133
- // Bewegen des Fensters über die Spalte
134
- for (let y: i32 = 1; y < height; y++) {
135
- let removeIdx = y - blurRadius - 1;
136
- let addIdx = y + blurRadius;
137
-
138
- removeIdx = clamp3(removeIdx, 0, height - 1);
139
- addIdx = clamp3(addIdx, 0, height - 1);
140
-
141
- sum = sum - tempOutput[removeIdx * width + x] + tempOutput[addIdx * width + x];
142
- output[y * width + x] = <u8>(sum / divisor);
143
- }
144
- }
145
-
146
- return output;
147
- }
148
-
149
- // @ts-ignore: decorator
150
- @inline
151
- function stackBlur(image: Uint8Array, width: i32, height: i32, radius: i32, output: Uint8Array): Uint8Array {
152
- if (radius < 1) return image;
153
-
154
- initializeStackPool(radius);
155
-
156
- let div: i32 = radius + radius + 1;
157
- let widthMinus1: i32 = width - 1;
158
- let heightMinus1: i32 = height - 1;
159
- let radiusPlus1: i32 = radius + 1;
160
- let sumFactor: i32 = (radiusPlus1 * (radiusPlus1 + 1)) / 2;
161
-
162
- let stackStart: StackBlurNode = stackPool[0];
163
- let stack: StackBlurNode = stackStart;
164
- let stackEnd: StackBlurNode | null = null;
165
-
166
- for (let i: i32 = 1; i < div; i++) {
167
- stack.next = stackPool[i];
168
- stack = stack.next!;
169
- if (i == radiusPlus1) stackEnd = stack;
170
- }
171
-
172
- stack.next = stackStart;
173
- let stackIn: StackBlurNode;
174
- let stackOut: StackBlurNode;
175
-
176
- let mulSum: i32 = mulTable[radius];
177
- let shgSum: i32 = shgTable[radius];
178
-
179
- let yi: i32 = 0;
180
- let sum: i32;
181
- let outSum: i32, inSum: i32;
182
-
183
- // Horizontal blur
184
- for (let y: i32 = 0; y < height; y++) {
185
- inSum = sum = 0;
186
- outSum = radiusPlus1 * image[yi];
187
- sum += sumFactor * image[yi];
188
- stack = stackStart;
189
-
190
- for (let i: i32 = 0; i < radiusPlus1; i++) {
191
- stack.value = image[yi];
192
- stack = stack.next!;
193
- }
194
-
195
- for (let i: i32 = 1; i < radiusPlus1; i++) {
196
- let p = yi + (i <= widthMinus1 ? i : widthMinus1);
197
- stack.value = image[p];
198
-
199
- let rbs: i32 = radiusPlus1 - i;
200
- sum += stack.value * rbs;
201
- inSum += stack.value;
202
- stack = stack.next!;
203
- }
204
-
205
- stackIn = stackStart;
206
- stackOut = stackEnd!;
207
-
208
- for (let x: i32 = 0; x < width; x++) {
209
- output[yi + x] = (sum * mulSum) >> shgSum;
210
-
211
- sum -= outSum;
212
- outSum -= stackIn.value;
213
-
214
- let p = yi + (x + radius <= widthMinus1 ? x + radius : widthMinus1);
215
- stackIn.value = image[p];
216
-
217
- inSum += stackIn.value;
218
- sum += inSum;
219
- stackIn = stackIn.next!;
220
- outSum += stackOut.value;
221
- inSum -= stackOut.value;
222
- stackOut = stackOut.next!;
223
- }
224
- yi += width;
225
- }
226
-
227
- // Vertical blur
228
- for (let x: i32 = 0; x < width; x++) {
229
- inSum = sum = 0;
230
- outSum = radiusPlus1 * output[x];
231
- sum += sumFactor * output[x];
232
- stack = stackStart;
233
-
234
- for (let i: i32 = 0; i < radiusPlus1; i++) {
235
- stack.value = output[x];
236
- stack = stack.next!;
237
- }
238
-
239
- for (let i: i32 = 1; i <= radius; i++) {
240
- let p = x + (i < heightMinus1 ? i : heightMinus1) * width;
241
- stack.value = output[p];
242
-
243
- let rbs: i32 = radiusPlus1 - i;
244
- sum += stack.value * rbs;
245
- inSum += stack.value;
246
- stack = stack.next!;
247
- }
248
-
249
- stackIn = stackStart;
250
- stackOut = stackEnd!;
251
-
252
- for (let y: i32 = 0; y < height; y++) {
253
- let p = y * width + x;
254
- image[p] = (sum * mulSum) >> shgSum;
255
-
256
- sum -= outSum;
257
- outSum -= stackIn.value;
258
-
259
- let pp = x + (y + radius < heightMinus1 ? (y + radius) * width : heightMinus1 * width);
260
- stackIn.value = output[pp];
261
- inSum += stackIn.value;
262
- sum += inSum;
263
- stackIn = stackIn.next!;
264
- outSum += stackOut.value;
265
- inSum -= stackOut.value;
266
- stackOut = stackOut.next!;
267
- }
268
- }
269
-
270
- return image;
271
- }
272
-
273
- // @ts-ignore: decorator
274
- @inline
275
- function cropImage(image: Uint8Array, inputWidth: i32, inputHeight: i32, channels: i32, top: i32, left: i32, width: i32, height: i32, output: Uint8Array): Uint8Array {
276
- const rowSize = width * channels;
277
- const simdWidth = 16; // Process 16 bytes at a time
278
-
279
- for (let y = 0; y < height; y++) {
280
- const srcOffset = ((top + y) * inputWidth + left) * channels;
281
- const dstOffset = y * rowSize;
282
- let x = 0;
283
-
284
- // SIMD loop
285
- for (; x <= rowSize - simdWidth; x += simdWidth) {
286
- const srcPtr = changetype<usize>(image.buffer) + srcOffset + x;
287
- const dstPtr = changetype<usize>(output.buffer) + dstOffset + x;
288
-
289
- // Load 16 bytes from source
290
- const pixelData = v128.load(srcPtr);
291
-
292
- // Store 16 bytes to destination
293
- v128.store(dstPtr, pixelData);
294
- }
295
-
296
- // Handle remaining pixels
297
- for (; x < rowSize; x++) {
298
- output[dstOffset + x] = image[srcOffset + x];
299
- }
300
- }
301
-
302
- return output;
303
- }
304
-
305
- // @ts-ignore: decorator
306
- @inline
307
- function resizeImageNearestNeighbor(
308
- image: Uint8Array,
309
- inputWidth: i32,
310
- inputHeight: i32,
311
- channels: i32,
312
- outputWidth: i32,
313
- outputHeight: i32,
314
- output: Uint8Array,
315
- ): Uint8Array {
316
- const xRatio = (((inputWidth - 1) as f64) / outputWidth) as f64;
317
- const yRatio = (((inputHeight - 1) as f64) / outputHeight) as f64;
318
-
319
- const channelCount = channels;
320
- const simdWidth = 16 / channelCount; // Process 16 bytes at a time
321
-
322
- for (let y = 0; y < outputHeight; y++) {
323
- const srcY = <i32>Math.min(Math.floor((y as f64) * yRatio), inputHeight - 1);
324
- const dstY = y * outputWidth * channelCount;
325
- let x = 0;
326
-
327
- // SIMD loop
328
- for (; x <= outputWidth - simdWidth; x += simdWidth) {
329
- const srcX = <i32>Math.min(Math.floor((x as f64) * xRatio), inputWidth - simdWidth);
330
- const dstIdx = dstY + x * channelCount;
331
- const srcIdx = (srcY * inputWidth + srcX) * channelCount;
332
-
333
- // Check if we can use SIMD for the next 16 bytes
334
- if (srcIdx + 16 <= image.length && dstIdx + 16 <= output.length) {
335
- // Load 16 bytes from source
336
- const pixelData = v128.load(changetype<usize>(image.buffer) + <usize>srcIdx);
337
-
338
- // Store 16 bytes to destination
339
- v128.store(changetype<usize>(output.buffer) + <usize>dstIdx, pixelData);
340
- } else {
341
- // Fallback to scalar processing
342
- for (let i = 0; i < simdWidth; i++) {
343
- const srcXI = <i32>Math.min(Math.floor(((x + i) as f64) * xRatio), inputWidth - 1);
344
- const dstIdxI = dstY + (x + i) * channelCount;
345
- const srcIdxI = (srcY * inputWidth + srcXI) * channelCount;
346
-
347
- for (let c = 0; c < channelCount; c++) {
348
- output[dstIdxI + c] = image[srcIdxI + c];
349
- }
350
- }
351
- }
352
- }
353
-
354
- // Handle remaining pixels
355
- for (; x < outputWidth; x++) {
356
- const srcX = <i32>Math.min(Math.floor((x as f64) * xRatio), inputWidth - 1);
357
- const dstIdx = dstY + x * channelCount;
358
- const srcIdx = (srcY * inputWidth + srcX) * channelCount;
359
-
360
- for (let c = 0; c < channelCount; c++) {
361
- output[dstIdx + c] = image[srcIdx + c];
362
- }
363
- }
364
- }
365
-
366
- return output;
367
- }
368
-
369
- // @ts-ignore: decorator
370
- @inline
371
- function convertFormat(input: Uint8Array, width: i32, height: i32, inputChannels: i32, outputFormat: i32, output: Uint8Array): Uint8Array {
372
- if (inputChannels == 1 && outputFormat == WASMImageFormat.RGB) {
373
- return convertGrayscaleToRGB(input, width, height, output);
374
- } else if (inputChannels == 1 && outputFormat == WASMImageFormat.RGBA) {
375
- return convertGrayscaleToRGBA(input, width, height, output);
376
- } else if (inputChannels == 3 && outputFormat == WASMImageFormat.GRAY) {
377
- return convertRGBToGrayscale(input, width, height, output);
378
- } else if (inputChannels == 3 && outputFormat == WASMImageFormat.RGBA) {
379
- return convertRGBToRGBA(input, width, height, output);
380
- } else if (inputChannels == 4 && outputFormat == WASMImageFormat.GRAY) {
381
- return convertRGBAToGrayscale(input, width, height, output);
382
- } else if (inputChannels == 4 && outputFormat == WASMImageFormat.RGB) {
383
- return convertRGBAToRGB(input, width, height, output);
384
- }
385
- return input;
386
- }
387
-
388
- // @ts-ignore: decorator
389
- @inline
390
- function convertYUVToGrayscale(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
391
- const frameSize = width * height;
392
- const yPtr = changetype<usize>(image.buffer);
393
- const outputPtr = changetype<usize>(output.buffer);
394
-
395
- // Copy the Y plane directly as the grayscale image
396
- memory.copy(outputPtr, yPtr, frameSize);
397
-
398
- return output;
399
- }
400
-
401
- // @ts-ignore: decorator
402
- function convertYUVToRGB(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
403
- const frameSize = width * height;
404
- const chromaSize = (width >> 1) * (height >> 1);
405
-
406
- const yPtr = changetype<usize>(image.buffer);
407
- const uPtr = yPtr + frameSize;
408
- const vPtr = uPtr + chromaSize;
409
-
410
- const outputPtr = changetype<usize>(output.buffer);
411
-
412
- for (let j = 0; j < height; j++) {
413
- const yRowOffset = j * width;
414
- const uvRowOffset = (j >> 1) * (width >> 1);
415
-
416
- for (let i = 0; i < width; i += 4) {
417
- // Load U and V values for four pixels
418
- const uvIndex1 = uvRowOffset + (i >> 1);
419
- const u1 = load<u8>(uPtr + uvIndex1);
420
- const v1 = load<u8>(vPtr + uvIndex1);
421
-
422
- const uvIndex2 = uvRowOffset + ((i + 2) >> 1);
423
- const u2 = load<u8>(uPtr + uvIndex2);
424
- const v2 = load<u8>(vPtr + uvIndex2);
425
-
426
- // Load Y values for four pixels
427
- const y1 = load<u8>(yPtr + yRowOffset + i);
428
- const y2 = load<u8>(yPtr + yRowOffset + i + 1);
429
- const y3 = load<u8>(yPtr + yRowOffset + i + 2);
430
- const y4 = load<u8>(yPtr + yRowOffset + i + 3);
431
-
432
- let yVec = i32x4((y1 as i32) + -16, (y2 as i32) + -16, (y3 as i32) + -16, (y4 as i32) + -16);
433
-
434
- let uVec = i32x4((u1 as i32) - 128, (u1 as i32) - 128, (u2 as i32) - 128, (u2 as i32) - 128);
435
-
436
- let vVec = i32x4((v1 as i32) - 128, (v1 as i32) - 128, (v2 as i32) - 128, (v2 as i32) - 128);
437
-
438
- let yScaled = i32x4.mul(yVec, Y_MULTIPLIER);
439
-
440
- // R = (yScaled + 409 * vScaled + 128) >> 8
441
- let r = i32x4.add(i32x4.add(yScaled, i32x4.mul(vVec, R_ADD)), v128.splat<i32>(128));
442
- r = i32x4.shr_s(r, SHIFT);
443
- r = clampSIMD(r);
444
-
445
- // G = (yScaled - 100 * uScaled - 208 * vScaled + 128) >> 8
446
- let g = i32x4.add(i32x4.add(yScaled, i32x4.mul(uVec, G_ADD1)), i32x4.mul(vVec, G_ADD2));
447
- g = i32x4.add(g, v128.splat<i32>(128));
448
- g = i32x4.shr_s(g, SHIFT);
449
- g = clampSIMD(g);
450
-
451
- // B = (yScaled + 516 * uScaled + 128) >> 8
452
- let b = i32x4.add(i32x4.add(yScaled, i32x4.mul(uVec, B_ADD)), v128.splat<i32>(128));
453
- b = i32x4.shr_s(b, SHIFT);
454
- b = clampSIMD(b);
455
-
456
- // Extract R values
457
- let r0 = i32x4.extract_lane(r, 0) as u8;
458
- let r1 = i32x4.extract_lane(r, 1) as u8;
459
- let r2 = i32x4.extract_lane(r, 2) as u8;
460
- let r3 = i32x4.extract_lane(r, 3) as u8;
461
-
462
- // Extract G values
463
- let g0 = i32x4.extract_lane(g, 0) as u8;
464
- let g1 = i32x4.extract_lane(g, 1) as u8;
465
- let g2 = i32x4.extract_lane(g, 2) as u8;
466
- let g3 = i32x4.extract_lane(g, 3) as u8;
467
-
468
- // Extract B values
469
- let b0 = i32x4.extract_lane(b, 0) as u8;
470
- let b1 = i32x4.extract_lane(b, 1) as u8;
471
- let b2 = i32x4.extract_lane(b, 2) as u8;
472
- let b3 = i32x4.extract_lane(b, 3) as u8;
473
-
474
- // Calculate output indices
475
- let outIndex1 = (yRowOffset + i) * 3;
476
- let outIndex2 = (yRowOffset + i + 1) * 3;
477
- let outIndex3 = (yRowOffset + i + 2) * 3;
478
- let outIndex4 = (yRowOffset + i + 3) * 3;
479
-
480
- // Store RGB values
481
- store<u8>(outputPtr + outIndex1, r0);
482
- store<u8>(outputPtr + outIndex1 + 1, g0);
483
- store<u8>(outputPtr + outIndex1 + 2, b0);
484
-
485
- store<u8>(outputPtr + outIndex2, r1);
486
- store<u8>(outputPtr + outIndex2 + 1, g1);
487
- store<u8>(outputPtr + outIndex2 + 2, b1);
488
-
489
- store<u8>(outputPtr + outIndex3, r2);
490
- store<u8>(outputPtr + outIndex3 + 1, g2);
491
- store<u8>(outputPtr + outIndex3 + 2, b2);
492
-
493
- store<u8>(outputPtr + outIndex4, r3);
494
- store<u8>(outputPtr + outIndex4 + 1, g3);
495
- store<u8>(outputPtr + outIndex4 + 2, b3);
496
- }
497
- }
498
-
499
- return output;
500
- }
501
-
502
- // @ts-ignore: decorator
503
- @inline
504
- function convertYUVToRGBA(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
505
- const frameSize = width * height;
506
- const chromaSize = (width >> 1) * (height >> 1);
507
-
508
- const yPtr = changetype<usize>(image.buffer);
509
- const uPtr = yPtr + frameSize;
510
- const vPtr = uPtr + chromaSize;
511
-
512
- let yIndex = 0;
513
- let uvIndex = 0;
514
- let outputIndex = 0;
515
-
516
- for (let j = 0; j < height; j++) {
517
- uvIndex = (j >> 1) * (width >> 1);
518
- for (let i = 0; i < width; i++) {
519
- const y = <i32>load<u8>(yPtr + yIndex++) - 16;
520
- const u = <i32>load<u8>(uPtr + uvIndex) - 128;
521
- const v = <i32>load<u8>(vPtr + uvIndex) - 128;
522
-
523
- if ((i & 1) == 1) {
524
- uvIndex++;
525
- }
526
-
527
- const c = y * 298;
528
- const d = u * 516;
529
- const e = v * 409;
530
- const f = u * 100;
531
- const g = v * 208;
532
-
533
- const r = (c + e) >> 8;
534
- const gVal = (c - f - g) >> 8;
535
- const b = (c + d) >> 8;
536
-
537
- store<u8>(changetype<usize>(output.buffer) + outputIndex++, clamp(r));
538
- store<u8>(changetype<usize>(output.buffer) + outputIndex++, clamp(gVal));
539
- store<u8>(changetype<usize>(output.buffer) + outputIndex++, clamp(b));
540
- store<u8>(changetype<usize>(output.buffer) + outputIndex++, 255);
541
- }
542
- }
543
-
544
- return output;
545
- }
546
-
547
- // @ts-ignore: decorator
548
- @inline
549
- function convertRGBToYUV(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
550
- const frameSize = width * height;
551
- const chromaWidth = width >> 1;
552
- const chromaHeight = height >> 1;
553
- const chromaSize = chromaWidth * chromaHeight;
554
-
555
- const yPtr = changetype<usize>(output.buffer);
556
- const uPtr = yPtr + frameSize;
557
- const vPtr = uPtr + chromaSize;
558
-
559
- let yIndex: i32 = 0;
560
- let uvIndex: i32 = 0;
561
-
562
- // Compute Y values for each pixel
563
- for (let j = 0; j < height; j++) {
564
- for (let i = 0; i < width; i++) {
565
- const rgbIndex = (j * width + i) * 3;
566
- const R = image[rgbIndex];
567
- const G = image[rgbIndex + 1];
568
- const B = image[rgbIndex + 2];
569
-
570
- // Calculate Y component
571
- const Y = ((66 * R + 129 * G + 25 * B + 128) >> 8) + 16;
572
- store<u8>(yPtr + yIndex++, clamp(Y));
573
- }
574
- }
575
-
576
- // Compute U and V values by averaging over 2x2 blocks
577
- for (let j = 0; j < height; j += 2) {
578
- for (let i = 0; i < width; i += 2) {
579
- let sumU: i32 = 0;
580
- let sumV: i32 = 0;
581
-
582
- // Sum U and V values in the 2x2 block
583
- for (let yOffset = 0; yOffset < 2; yOffset++) {
584
- for (let xOffset = 0; xOffset < 2; xOffset++) {
585
- const x = i + xOffset;
586
- const y = j + yOffset;
587
-
588
- if (x >= width || y >= height) {
589
- continue;
590
- }
591
-
592
- const rgbIndex = (y * width + x) * 3;
593
- const R = image[rgbIndex];
594
- const G = image[rgbIndex + 1];
595
- const B = image[rgbIndex + 2];
596
-
597
- // Calculate U and V components
598
- const U = ((-38 * R - 74 * G + 112 * B + 128) >> 8) + 128;
599
- const V = ((112 * R - 94 * G - 18 * B + 128) >> 8) + 128;
600
-
601
- sumU += U;
602
- sumV += V;
603
- }
604
- }
605
-
606
- // Average U and V values and store them
607
- const avgU = (sumU + 2) >> 2;
608
- const avgV = (sumV + 2) >> 2;
609
-
610
- store<u8>(uPtr + uvIndex, clamp(avgU));
611
- store<u8>(vPtr + uvIndex, clamp(avgV));
612
-
613
- uvIndex++;
614
- }
615
- }
616
-
617
- return output;
618
- }
619
-
620
- // @ts-ignore: decorator
621
- @inline
622
- function convertRGBToGrayscale(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
623
- const numPixels = width * height;
624
-
625
- for (let i = 0; i < numPixels; i++) {
626
- const idx = i * 3;
627
- const r = image[idx];
628
- const g = image[idx + 1];
629
- const b = image[idx + 2];
630
- output[i] = ((r * 19595 + g * 38469 + b * 7472) >> 16) as u8;
631
- }
632
-
633
- return output;
634
- }
635
-
636
- // @ts-ignore: decorator
637
- @inline
638
- function convertRGBAToGrayscale(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
639
- const numPixels = width * height;
640
-
641
- for (let i = 0; i < numPixels; i++) {
642
- const idx = i * 4;
643
- const r = image[idx];
644
- const g = image[idx + 1];
645
- const b = image[idx + 2];
646
- output[i] = ((r * 19595 + g * 38469 + b * 7472) >> 16) as u8;
647
- }
648
-
649
- return output;
650
- }
651
-
652
- // @ts-ignore: decorator
653
- @inline
654
- function convertGrayscaleToRGB(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
655
- const numPixels = width * height;
656
- let i: i32 = 0;
657
- const simdWidth = 16; // Process 16 bytes at a time
658
-
659
- // SIMD shuffle masks
660
- const shuffleMask1 = i8x16(0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5);
661
- const shuffleMask2 = i8x16(5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10);
662
- const shuffleMask3 = i8x16(10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15);
663
-
664
- while (i <= numPixels - simdWidth) {
665
- // Load 16 bytes of grayscale values
666
- const grayPtr = changetype<usize>(image.buffer) + i;
667
- const grayVec = v128.load(grayPtr);
668
-
669
- // Swizzle the grayscale values to RGB
670
- const rgbVec1 = v128.swizzle(grayVec, shuffleMask1);
671
- const rgbVec2 = v128.swizzle(grayVec, shuffleMask2);
672
- const rgbVec3 = v128.swizzle(grayVec, shuffleMask3);
673
-
674
- // Store the RGB values
675
- const outputPtr = changetype<usize>(output.buffer) + i * 3;
676
- v128.store(outputPtr, rgbVec1);
677
- v128.store(outputPtr + 16, rgbVec2);
678
- v128.store(outputPtr + 32, rgbVec3);
679
-
680
- i += simdWidth;
681
- }
682
-
683
- // Handle remaining pixels
684
- for (; i < numPixels; i++) {
685
- const gray = image[i];
686
- const idx = i * 3;
687
- output[idx] = gray;
688
- output[idx + 1] = gray;
689
- output[idx + 2] = gray;
690
- }
691
-
692
- return output;
693
- }
694
-
695
- // @ts-ignore: decorator
696
- @inline
697
- function convertGrayscaleToRGBA(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
698
- const numPixels = width * height;
699
- let i: i32 = 0;
700
- const simdWidth = 4; // Process 4 pixels at a time for simplicity
701
-
702
- // SIMD shuffle mask
703
- const shuffleMask = i8x16(0, 0, 0, -1, 1, 1, 1, -1, 2, 2, 2, -1, 3, 3, 3, -1);
704
-
705
- // Alpha value vector (255 only in alpha positions)
706
- const alphaVec = i8x16(0, 0, 0, <i8>255, 0, 0, 0, <i8>255, 0, 0, 0, <i8>255, 0, 0, 0, <i8>255);
707
-
708
- while (i <= numPixels - simdWidth) {
709
- // Load 4 bytes of grayscale values
710
- const grayPtr = changetype<usize>(image.buffer) + i;
711
- const grayVec = v128.load(grayPtr);
712
-
713
- // Swizzle the grayscale values to RGB and add alpha
714
- const rgbaVec = v128.or(i8x16.swizzle(grayVec, shuffleMask), alphaVec);
715
-
716
- // Store the RGBA values
717
- const outputPtr = changetype<usize>(output.buffer) + i * 4;
718
- v128.store(outputPtr, rgbaVec);
719
-
720
- i += simdWidth;
721
- }
722
-
723
- // Handle remaining pixels
724
- for (; i < numPixels; i++) {
725
- const gray = image[i];
726
- const idx = i * 4;
727
- output[idx] = gray;
728
- output[idx + 1] = gray;
729
- output[idx + 2] = gray;
730
- output[idx + 3] = 255; // Alpha channel
731
- }
732
-
733
- return output;
734
- }
735
-
736
- // @ts-ignore: decorator
737
- @inline
738
- function convertRGBToRGBA(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
739
- const numPixels = width * height;
740
- let i: i32 = 0;
741
- const simdWidth = 4; // Process 4 RGB pixels at a time
742
-
743
- // SIMD shuffle mask
744
- const shuffleMask = i8x16(0, 1, 2, -1, 3, 4, 5, -1, 6, 7, 8, -1, 9, 10, 11, -1);
745
-
746
- // Alpha value vector (255 only in alpha positions)
747
- const alphaVec = i8x16(0, 0, 0, <i8>255, 0, 0, 0, <i8>255, 0, 0, 0, <i8>255, 0, 0, 0, <i8>255);
748
-
749
- while (i <= numPixels - simdWidth) {
750
- // Load 12 bytes of RGB values (4 pixels)
751
- const rgbPtr = changetype<usize>(image.buffer) + i * 3;
752
- const rgbVec = v128.load(rgbPtr);
753
-
754
- // Swizzle the RGB values to RGBA
755
- const rgbaVec = v128.or(i8x16.swizzle(rgbVec, shuffleMask), alphaVec);
756
-
757
- // Store the RGBA values
758
- const outputPtr = changetype<usize>(output.buffer) + i * 4;
759
- v128.store(outputPtr, rgbaVec);
760
-
761
- i += simdWidth;
762
- }
763
-
764
- // Handle remaining pixels
765
- for (; i < numPixels; i++) {
766
- const idxRGB = i * 3;
767
- const idxRGBA = i * 4;
768
- output[idxRGBA] = image[idxRGB];
769
- output[idxRGBA + 1] = image[idxRGB + 1];
770
- output[idxRGBA + 2] = image[idxRGB + 2];
771
- output[idxRGBA + 3] = 255; // Alpha channel
772
- }
773
-
774
- return output;
775
- }
776
-
777
- // @ts-ignore: decorator
778
- @inline
779
- function convertRGBAToRGB(image: Uint8Array, width: i32, height: i32, output: Uint8Array): Uint8Array {
780
- const numPixels = width * height;
781
-
782
- for (let i = 0; i < numPixels; i++) {
783
- const idxRGBA = i * 4;
784
- const idxRGB = i * 3;
785
- output[idxRGB] = image[idxRGBA]; // R
786
- output[idxRGB + 1] = image[idxRGBA + 1]; // G
787
- output[idxRGB + 2] = image[idxRGBA + 2]; // B
788
- }
789
-
790
- return output;
791
- }
792
-
793
- export function processImage(
794
- inputFrame: Uint8Array,
795
- inputWidth: i32,
796
- inputHeight: i32,
797
- format: i32, // WASMImageFormat
798
- cropTop: i32, // -1 if not cropping
799
- cropLeft: i32,
800
- cropWidth: i32,
801
- cropHeight: i32,
802
- resizeWidth: i32, // -1 if not resizing
803
- resizeHeight: i32,
804
- blurRadius: i32,
805
- inputFormat: i32, // WASMInputFormat
806
- reconvertYUV: i32, // 1 if reconvert YUV to RGB, 0 otherwise
807
- ): Uint8Array {
808
- let outputPtr: Uint8Array = inputFrame;
809
- let width = inputWidth;
810
- let height = inputHeight;
811
- let channels: i32 = inputFormat == WASMInputFormat.YUV ? 1 : inputFormat == WASMInputFormat.RGB ? 3 : inputFormat == WASMInputFormat.RGBA ? 4 : 1;
812
-
813
- let tempOutput: Uint8Array | null = null;
814
-
815
- let reconvertRGBToYUV = false;
816
- let reconvertRGBToRGBA = false;
817
-
818
- // YUV conversion
819
- if (inputFormat == WASMInputFormat.YUV) {
820
- const frameSize = width * height;
821
- const outputChannels = format == WASMImageFormat.GRAY ? 1 : format == WASMImageFormat.RGB ? 3 : 4;
822
- tempOutput = new Uint8Array(frameSize * outputChannels);
823
-
824
- if (format == WASMImageFormat.GRAY) {
825
- outputPtr = convertYUVToGrayscale(outputPtr, width, height, tempOutput);
826
- channels = 1;
827
- } else if (format == WASMImageFormat.RGB || format == WASMImageFormat.RGBA) {
828
- outputPtr = convertYUVToRGB(outputPtr, width, height, tempOutput);
829
- channels = 3;
830
-
831
- if (format == WASMImageFormat.RGBA) {
832
- reconvertRGBToRGBA = true;
833
- }
834
- }
835
- // else if (format == WASMImageFormat.RGBA) {
836
- // outputPtr = convertYUVToRGBA(outputPtr, width, height, tempOutput);
837
- // channels = 4;
838
- // }
839
- else {
840
- outputPtr = convertYUVToRGB(outputPtr, width, height, tempOutput);
841
- channels = 3;
842
- reconvertRGBToYUV = true;
843
- }
844
- }
845
-
846
- // Cropping
847
- if (cropWidth > 0 && cropHeight > 0) {
848
- tempOutput = new Uint8Array(cropWidth * cropHeight * channels);
849
- outputPtr = cropImage(outputPtr, width, height, channels, cropTop, cropLeft, cropWidth, cropHeight, tempOutput);
850
- width = cropWidth;
851
- height = cropHeight;
852
- }
853
-
854
- // Resizing
855
- if (resizeWidth > 0 && resizeHeight > 0) {
856
- tempOutput = new Uint8Array(resizeWidth * resizeHeight * channels);
857
- outputPtr = resizeImageNearestNeighbor(outputPtr, width, height, channels, resizeWidth, resizeHeight, tempOutput);
858
- width = resizeWidth;
859
- height = resizeHeight;
860
- }
861
-
862
- // Blur
863
- if (blurRadius > 0) {
864
- tempOutput = new Uint8Array(width * height * channels);
865
- outputPtr = stackBlur(outputPtr, width, height, blurRadius, tempOutput);
866
- }
867
-
868
- // Format conversion for non-YUV inputs
869
- if (inputFormat != WASMInputFormat.YUV && format != inputFormat) {
870
- tempOutput = new Uint8Array(width * height * (format == WASMImageFormat.RGBA ? 4 : format == WASMImageFormat.RGB ? 3 : 1));
871
- outputPtr = convertFormat(outputPtr, width, height, channels, format, tempOutput);
872
- channels = format == WASMImageFormat.RGBA ? 4 : format == WASMImageFormat.RGB ? 3 : 1;
873
- }
874
-
875
- // Reconversion to YUV
876
- if (reconvertRGBToYUV && reconvertYUV == 1) {
877
- tempOutput = new Uint8Array(width * height * 2);
878
- outputPtr = convertRGBToYUV(outputPtr, width, height, tempOutput);
879
- }
880
-
881
- // Reconversion to RGBA
882
- if (reconvertRGBToRGBA) {
883
- tempOutput = new Uint8Array(width * height * 4);
884
- outputPtr = convertRGBToRGBA(outputPtr, width, height, tempOutput);
885
- }
886
-
887
- return outputPtr;
888
- }
889
-
890
- export const Uint8Array_ID = idof<Uint8Array>();