66 Commits

Author SHA1 Message Date
a099ea939f Refactor resource provider (#27)
* These pointers are C++ strings, not C strings

* Create a `DummyResourceManager` as an example

* Hide unsafe APIs

* Oops

* Using a `Span` results in segfaults :(

* Handle exceptions in `provideResource`

* Remove stray comment

* Document the delegates

Co-authored-by: Ayane Satomi <ayane@vignetteapp.org>
0.8.9
2022-03-11 14:52:33 +01:00
ec44eb0673 Fix deleter (#26) 2022-03-04 16:38:37 +01:00
9dcb9c3492 Make Calculator more thread-safe (#25)
* YEP implement @LeNitrous 's suggestion

* lock

* Fix stream handle nullable issue

* Holistic calculators

Co-authored-by: Speykious <speykious@gmail.com>
2022-03-04 16:34:25 +01:00
cc7ed1ebd0 Fix critical memory leak (#22)
* fix examples (or at least try to)

* stuff

* Better dispose that

* Add video input options because I'm selfish

* THIS ONE MOTHERFUCKING FOR LOOP

* Remove unnecessary using

* Fix osu framework example

* Use stable `Google.Protobuf` package

* Add options to osu framework example

* Use same options on all examples

* Add framerate option

* Use framerate option

Co-authored-by: Speykious <speykious@gmail.com>
2022-02-21 17:07:15 +01:00
d0bbbe4895 Let examples use the new safe constructor 2022-02-02 17:19:56 +01:00
ce85bd59a4 Add a safe overload for ImageFrame() (#20)
* Add a safe overload for ImageFrame()

Signed-off-by: GitHub <noreply@github.com>

* Reduce code dup by wrapping into the unsafe overload instead

Signed-off-by: GitHub <noreply@github.com>

* dotnet format

Signed-off-by: GitHub <noreply@github.com>

* Le unhaskellize

🖑Hey🖐 buddy,👬 I think🤔 you've 👉got the 🛇wrong🚫 door🚪 the 🐄leather🐄 club's ♴two♴ blocks down☟. 🖕Fuck🖕↗You↘.Oh, Fuck♂You 🐄leather🐄 man Maybe 👬you and I👬 should settle it💪 👇right here👇 on the 💍ring💍 if you think🤔 your so 💪tough💪. Oh yea?😡 I'll kick👣 your ass!👊 Ha!😂 Yeah right👍 man. Let's go!✔ Why don't you🤔 get out of that 🐄leather stuff?🐄 I'll strip👙 down☟ out of this and we'll settle👪 it right here👇 in the ring. What do you say? 🤐Yeah⁉ no problem buddy👬 You got it. 🖒Get out of that uh, jabroni outfit👕👔👖. Yeah, smart🤔 ass. I'll show😡you who's the ☝boss☝ of this 🏋gym.🏋

Signed-off-by: GitHub <noreply@github.com>

* I'll let this Le pass this time

Co-authored-by: Speykious <speykious@gmail.com>
2022-02-02 16:36:42 +01:00
ff98083149 No reason for it to be like that 2022-02-02 11:21:45 +01:00
73cd0429f8 Create README.md
Signed-off-by: Ayane Satomi <chinodesuuu@gmail.com>
2022-01-29 12:37:39 +00:00
7777028aec The Vignette Authors™️ 2022-01-28 12:07:37 +01:00
0a65d1e5eb Useless changes or something idk 2022-01-28 11:48:47 +01:00
1ab4a85643 Remove duplicate style check on CI 2022-01-28 10:57:17 +01:00
3371a2e745 Replace slow Marshal operations with unsafe (#13)
* Remove this bool marshal

* Literally remove all bool marshals

* Remove CharSet.Unicode warning

* Remove most FunctionPtr marshals

* Remove `[return: MarshalAs(...)]`

* Replace all `IntPtr`s with `void*`s

* Replace all `void*.Zero`s with `null`s

* Make native method classes unsafe

* U N S A F E

* Replace `PtrToStructure` with pointer arithmetic

* Run `dotnet format`

* Temp ugly Activator fix

* Remove `.ToPointer()`

* Use `byte` to return a `bool`

* Backwards compatibility with `Activator`

Yeah that sucks :(

* Replace `Marshal.Copy` by pointer arithmetic

* Replace `PtrToStringAnsi()` with `new string()`

* Remove unnecessary usings

* Explicitly type string pointers as `sbyte*`

* It actually doesn't hang?

* `MediaPipeException` -> `MediapipeException`

* Simplify `for` loops

* Remove unnecessary `float*` cast

* Some more explicit types for `ImageFrame`

* Remove unnecessary cast

* Looks like we forgor a `using` 💀

* Create `SafeArrayCopy` helper method

* Document `SafeArrayCopy`
2022-01-28 10:53:30 +01:00
b56693a010 #pragma warning disable IDE0051 2022-01-27 17:13:13 +01:00
858d9d145c Add abstracted graphs + examples (#10)
* yep

* yep fix namespaces

* add gpu face mesh

* include path

* add example

* Configure VSCode debugging for the example

* Runtime arguments are overkill it seems

* Fix linting

* Fix linting (and my brain)

* fix issue

* yeppers

* You think it's funny to take screenshots of people's NFTs, huh?

Property theft is a joke to you? I'll have you know that the blockchain doesn't lie. I own it. Even if you save it, it's my property. You are mad that you don't own the art that I own.  Delete that screenshot.

* add BlazePose

* fix tiny skill issue

* fix using issue

* add hand and holistic calculators

* fix hand graph issue

* stuff

* Format all the stuff

* Create `CpuCalculator`

While leaving a kind of mess lol

* Create `GpuCalculator`

Poggers, but in parallel

* More graphs

* yep example

* Create new o!f visual tests example project

* Use the Superior target framework

* questioning the use of a questionable question mark

* pls halp

* Ignore `mediapipe/` folder for tests and examples

* Add GPU example to VSCode

* property

* change null frame exception message

Co-authored-by: Ayane <ayane@vignetteapp.org>

* `SupportedOSPlatform`: Case consistency

* Fix file encoding

* visual test

* Actuall close the graphs when disposing

* Fix `.csproj` file consistency

* Fix formatting and linting on `MediapipeDrawable`

* Fix `MediapipeDrawable` not showing

* Use a span instead of copying

* At least it disposes now...

* Round the corners of `MediapipeDrawable`

* remove unnecessary check

* increase drawable size and fill mode

* use consistent spacing

* oops

* Just a bit of formatting

and use `using` for the output image frame

* GPU WORKSWITH THIS ONE SIMPLE TRICK

LEARN HOW HE MADE BILLIONS OF DOLLARS WITH ONLY ONE LINE OF CODE

* dispose everywhere then

* add basic xmldoc

* fix lagnguage

* remove unnecessary nullable

* fix issue

* add new constructor

* Cleanup constructors

* fix xmldoc

* This is a better way to do it

* Create base `Calculator` class

* Delete `ICalculator` interface

* Polish XML doc

Also fix the stupid 💀

* Make all child calculators sealed

* Add `SupportedOSPlatform`

Can't add "Android" because some `Console` methods are unsupported

* Remove tmate debug from CI

* Polish examples more

I'm a perfectionist...?

Co-authored-by: Speykious <speykious@gmail.com>
Co-authored-by: Ayane <ayane@vignetteapp.org>
2022-01-24 18:01:22 +01:00
54b990081f Replace methods with C# getters/setters (#11)
* timestamp

* ImageFrame + tests

* whitespace

* stream poller

* fix issue

* gpu

* core

* status
2022-01-23 02:17:36 +08:00
de5c153e2a Tiny refactorization 2022-01-21 11:22:22 +01:00
4d85f1aae9 Add C# solution file
Silly me * facepalms *
2022-01-21 11:20:26 +01:00
0eaa724270 Port all tests from MediaPipeUnityPlugin (#3)
* Port test attributes

* Add necessary references

* Port `TimestampTest`

* Port `CalculatorGraphTest`

* Port all `Framework.Tool` tests

* Port all `Framework.Port` tests

* Fix encoding

* Use `CharSet.Ansi` and disable warning CA2101

* Make CI run MediaPipe.NET tests

* Make `#region` names consistent

* Port all `Framework.Packet` tests

* Allow unsafe blocks

* Port `ImageFrameTest`

* Fix linting errors

* Port all `Gpu` tests

* Fix region name inconsistencies

* Fix the only GPU-side error in existence

* GPU works like a charm! (We'll have to find a way to correctly separate CPU and GPU tests.)

* `GpuOnly`: when they forgor 💀

* CI: Add tmate session for debugging

* Use corresponding runtime on tests

* Setup tmate session *after* tests

* Only setup the tmate session if previous step failed

* Fix `failure` word

* Ignore SignalAbort tests on Windows

* Circumvent OS differences for `DebugTypeName()` (Not even sure it's fine to do but anyway)

* Label some throw-exception tests as `SignalAbort`

* Maybe that's why...

* Install FFmpeg on MacOS to fix undefined symbols

* Remove MacOS test from CI

* Fix test result path
2022-01-21 08:46:28 +01:00
ea5b6e0b8f Port all bindings from MediaPipeUnityPlugin (#2)
* Putting unused usings as warning

As per our latest .NET template fix

* Port `ResourceManager`

Will be very useful to avoir having to have a `mediapipe` folder
every time

* Port `ImageFrame`

We'll really need to review this one in particular

* Port remaining classes of `Mediapipe.Net.Gpu`

* Port `Timestamp`

* Port `Packet`

* Add `Mediapipe.Net.Framework.Protobuf` dependency

* Port `OutputStreamPoller`

* Port the whole `Mediapipe.Net.Framework.Port`

* Port the whole `Mediapipe.Net.Framework.Packet`

* Port the whole `Mediapipe.Net.Framework.Tool`

* Port `CalculatorGraph`

* Port `CalculatorGraphConfigExtension`

And with that, the whole `Mediapipe.Net` port is finished!
Time to port all the tests.

* Fix imports ordering

* Update comment on ImageFrame ctor

Also remove redundant `unsafe`
2022-01-20 09:22:48 +08:00
a12e48e8b1 Merge pull request #1 from Speykious/native-methods
Port all native methods from MediaPipeUnityPlugin
2022-01-16 18:36:52 +01:00
d990ca217e The warning was specified a few lines below... 2022-01-16 08:41:29 +01:00
5fa4ac3663 Write all enum field names in PascalCase 2022-01-16 08:06:08 +01:00
ff13083284 Put GpuBufferFormatExtension in its own file 2022-01-16 08:04:20 +01:00
f04c84ba97 Yay, linting works now :D 2022-01-16 07:58:16 +01:00
2fc67ca4ad Trying to make the linter work
Not really related to the native methods, but it does't help that this
fails everytime :/
2022-01-16 07:52:32 +01:00
e03ae233a9 Replace preprocs with SupportedOSPlatform attributes
Such a nice feature that we have here :D
2022-01-16 07:46:14 +01:00
f305fd1495 Fix some commented preproc names 2022-01-16 07:28:56 +01:00
84d5fdc5ca Port the whole Gpu native methods
With additionnally ported necessary classes in `Mediapipe.Net.Gpu`
to make the types check
2022-01-15 13:33:59 +01:00
d4f028d52f Warn about general naming style 2022-01-15 13:29:00 +01:00
f074059bd3 Port InstantMotionTracking 2022-01-15 07:27:03 +01:00
feb19f3127 Port Protobuf 2022-01-15 07:21:14 +01:00
0f0ed91495 Use Glog.Severity 2022-01-15 07:20:58 +01:00
13ba342293 Port the whole Mediapipe.Net.External 2022-01-15 07:19:22 +01:00
d63938ab94 Allow unsafe blocks 2022-01-15 07:18:51 +01:00
b7443763f1 Port Glog 2022-01-15 07:02:39 +01:00
c53aef189f Port Absl 2022-01-15 06:56:24 +01:00
daf116835c Port ResourceUtil 2022-01-15 06:15:29 +01:00
b6d52c13a0 Port ImageFormat 2022-01-15 06:06:42 +01:00
60c12c9395 Format .editorconfig manually 2022-01-15 05:48:50 +01:00
e8df625168 Convert namespace declarations to block-scoped 2022-01-15 05:43:39 +01:00
7c638e8c59 Enforce block-scoped namespace declarations 2022-01-15 05:42:14 +01:00
e4e2a1af47 Port Timestamp 2022-01-15 05:40:22 +01:00
c15a800ce6 Packet was in the wrong folder 2022-01-15 05:33:22 +01:00
8f50a081b6 Port OutputStreamPoller 2022-01-15 05:24:30 +01:00
7b67225fdf Port Packet 2022-01-15 04:58:01 +01:00
253edf8361 Actually port unsafe part of CalculatorGraph 2022-01-15 04:50:53 +01:00
f43ccffdd3 That was Calculator, not CalculatorGraph 2022-01-15 04:45:11 +01:00
533c37d690 Fix missing using 2022-01-15 04:41:21 +01:00
38844436c9 Port unsafe part of CalculatorGraph 2022-01-15 04:40:17 +01:00
c62661b575 Port SerializedProto 2022-01-15 04:39:47 +01:00