Commit Graph

2189 Commits

Author SHA1 Message Date
Camillo Lugaresi
1979801a92 Remove GlCalculatorHelperImpl; merge with GlCalculatorHelper
Originally, there were multiple implementations of GlCalculatorHelperImpl, depending on the platform and underlying GL APIs. These have all been refactored into other components, and the remaining code in this class is unified and much reduced in size. We can get rid of this implementation detail now.

PiperOrigin-RevId: 488813220
2022-11-15 18:50:45 -08:00
Camillo Lugaresi
8b319e963a Add comment explaining ViewProvider
This was only documented via examples (e.g. ViewProvider<GlTextureView>), but it's better to explain it properly in the header where the base case is defined.

PiperOrigin-RevId: 488813144
2022-11-15 18:48:54 -08:00
Camillo Lugaresi
a28ccb0964 Remove unnecessary forward declarations
PiperOrigin-RevId: 488813066
2022-11-15 18:43:36 -08:00
Camillo Lugaresi
13b4b825d7 Remove std::shared_ptr<GpuBuffer> argument from GetRead/WriteView
PiperOrigin-RevId: 488813004
2022-11-15 18:41:53 -08:00
Camillo Lugaresi
1c0a1d0aab Remove shared_ptr<GpuBuffer> member from GlTextureView
This only exists to support GlTexture's GetFrame API. It can be moved into GlTexture.

PiperOrigin-RevId: 488812896
2022-11-15 18:40:15 -08:00
Camillo Lugaresi
767cc2ee3c More comments on gpu_buffer_storage
This gives a basic explanation of the role of storages and views, and provides some details on how to implement a new storage type.

PiperOrigin-RevId: 488812807
2022-11-15 18:38:29 -08:00
Camillo Lugaresi
4c874fe4cd Allow conversion of GlTextureBuffer to CVPixelBufferRef
This means that, if an iOS application sends in a GlTextureBuffer but expects a CVPixelBufferRef as output, everything will work even if the graph just forwards the same input. Also, access by Metal calculators will also work transparently.

PiperOrigin-RevId: 488812748
2022-11-15 18:36:45 -08:00
Camillo Lugaresi
fe66de3714 Internal change
PiperOrigin-RevId: 488812677
2022-11-15 18:32:54 -08:00
MediaPipe Team
2f77bf44e3 Use train_data to evaluate accuracy of unit test for gesture_recognizer due to limited dataset size.
PiperOrigin-RevId: 488808942
2022-11-15 18:10:28 -08:00
Camillo Lugaresi
b308c0dd5e Implement CVPixelBufferRef access as a view.
PiperOrigin-RevId: 488798216
2022-11-15 17:18:07 -08:00
Camillo Lugaresi
4bda012bba Factor out gl_texture_util
PiperOrigin-RevId: 488797985
2022-11-15 17:13:22 -08:00
Camillo Lugaresi
77b3edbb67 Internal change
PiperOrigin-RevId: 488797407
2022-11-15 17:09:43 -08:00
Mark McDonald
6702ef3d57 Internal change
PiperOrigin-RevId: 488796090
2022-11-15 17:04:31 -08:00
Camillo Lugaresi
7e19bbe35c Internal change
PiperOrigin-RevId: 488795920
2022-11-15 17:01:33 -08:00
Camillo Lugaresi
1beca61650 Register GlTextureBuffer pool with GpuBuffer
First crack at hooking up pools with the GpuBufferStorage system. Will most likely be superseded later, but for now this works with minimal code impact: just overwrite the factory for a storage type with one that uses the pool.

PiperOrigin-RevId: 488783854
2022-11-15 16:19:48 -08:00
Camillo Lugaresi
583d27636b Factor out ReusablePool
PiperOrigin-RevId: 488783477
2022-11-15 16:18:20 -08:00
Camillo Lugaresi
ab074a579a Internal change
PiperOrigin-RevId: 488783325
2022-11-15 16:17:04 -08:00
Camillo Lugaresi
53d015af08 Generic MultiPool template
PiperOrigin-RevId: 488783176
2022-11-15 16:15:42 -08:00
Camillo Lugaresi
b9fa2e3496 Make it possible to override the SimplePool factory used by MultiPool
This means MultiPool no longer needs a SetFlushPlatformCaches method, which was too specific to the CVPixelBufferPool.

PiperOrigin-RevId: 488783003
2022-11-15 16:14:27 -08:00
Camillo Lugaresi
267476657d MultiPool options header refactoring
Passing MultiPool options to the base pool factories means that we don't have to specialize which options we pass to them.

PiperOrigin-RevId: 488782861
2022-11-15 16:13:05 -08:00
Camillo Lugaresi
7ef3185ecb Allow customizing MultiPool options
These don't need to be constants.

PiperOrigin-RevId: 488782713
2022-11-15 16:11:54 -08:00
Camillo Lugaresi
f13903b7c5 Call SimplePool methods directly
This removes redundant helper functions in GpuBufferMultiPool.

PiperOrigin-RevId: 488782516
2022-11-15 16:10:34 -08:00
Camillo Lugaresi
0c4522cb9f Move flush hook to CvPixelBufferPoolWrapper constructor
This unifies the implementation of GpuBufferMultiPool::GetBufferFromSimplePool.

PiperOrigin-RevId: 488782173
2022-11-15 16:07:17 -08:00
Camillo Lugaresi
a4fe3eb094 Add CreateBufferWithoutPool method to base pools
This may not fit exactly in a pool class, but it makes it easy for the multi-pool to find the appropriate method by depending only on the type of the base pool. For the CVPixelBuffer case, the buffer type is CFHolder<CVPixelBufferRef>, and it seems even less appropriate to specialize that template to add such a method there. An alternative would be to allow defining a creation function separately.

PiperOrigin-RevId: 488782054
2022-11-15 16:05:53 -08:00
Camillo Lugaresi
0d273dd11a Factor out CvPixelBufferPoolWrapper
This is platform-specific and does not need to live in the main multi_pool sources.

PiperOrigin-RevId: 488781934
2022-11-15 16:04:27 -08:00
Camillo Lugaresi
ab2dd779e7 Factor out CvTextureCacheManager
This is a platform-specific component that is only used with CVPixelBufferPool.

PiperOrigin-RevId: 488781757
2022-11-15 16:02:53 -08:00
MediaPipe Team
fae55910f4 Enable absl::string_view kCalculatorName
PiperOrigin-RevId: 488781493
2022-11-15 15:59:09 -08:00
Camillo Lugaresi
a520d6cc38 Remove FORCE_CONTIGUOUS_PIXEL_BUFFER_ON_IPHONE_SIMULATOR
This workaround code is no longer necessary, as per the comment.

PiperOrigin-RevId: 488777606
2022-11-15 15:41:53 -08:00
Camillo Lugaresi
3c71c64be1 Remove shared_ptr from SimplePool definition
This makes the types more explicit and will help with factoring out platform-specific code.

PiperOrigin-RevId: 488775470
2022-11-15 15:32:57 -08:00
Camillo Lugaresi
a67069156e Use flat_hash_map in ResourceCache
This is the recommended hashmap in most cases.

PiperOrigin-RevId: 488772031
2022-11-15 15:23:31 -08:00
MediaPipe Team
38b636f7ee Internal change
PiperOrigin-RevId: 488770794
2022-11-15 15:19:48 -08:00
Camillo Lugaresi
7a87546c30 Internal change
PiperOrigin-RevId: 488761646
2022-11-15 14:39:58 -08:00
MediaPipe Team
e65f21e2d8 Update the docstring to make it consistent with the model option update.
PiperOrigin-RevId: 488761331
2022-11-15 14:36:48 -08:00
Sebastian Schmidt
496720308c Migrate remaining MP Tasks Libraries to ts_declarations
PiperOrigin-RevId: 488752799
2022-11-15 14:08:15 -08:00
MediaPipe Team
1689112b23 Improve model_util_test code.
PiperOrigin-RevId: 488752497
2022-11-15 14:04:39 -08:00
Jiuqiang Tang
a94564540b Bump up the dependency library pybind11's version to 2.10.1.
PiperOrigin-RevId: 488718815
2022-11-15 11:51:20 -08:00
MediaPipe Team
f14645cb06 Model maker gesture recognizer test changes
PiperOrigin-RevId: 488702055
2022-11-15 10:50:32 -08:00
MediaPipe Team
ebba119f15 Add Java ImageEmbedder API.
PiperOrigin-RevId: 488588010
2022-11-15 01:26:00 -08:00
Camillo Lugaresi
6f54308c25 Internal change
PiperOrigin-RevId: 488552135
2022-11-14 21:42:41 -08:00
Jiuqiang Tang
87dff8142c Fix a typo.
PiperOrigin-RevId: 488519113
2022-11-14 18:13:50 -08:00
Sebastian Schmidt
9bd8b432c3 Add typings support to d.ts package
PiperOrigin-RevId: 488519074
2022-11-14 18:10:25 -08:00
Jiuqiang Tang
f16e63694e Build embedding tasks into tasks AARs.
PiperOrigin-RevId: 488509942
2022-11-14 17:18:12 -08:00
Sebastian Schmidt
a12bc3fd0e Add IIFE bundles for NPM packages
PiperOrigin-RevId: 488504360
2022-11-14 16:51:58 -08:00
Jiuqiang Tang
794f64db55 Fix the wrong path of "text_embedder_graph_options_java_proto_lite".
PiperOrigin-RevId: 488490050
2022-11-14 15:51:05 -08:00
Jiuqiang Tang
cce1751dbf Expose tasks components API in PyPI packages.
PiperOrigin-RevId: 488487666
2022-11-14 15:41:11 -08:00
Jiuqiang Tang
e714e656fe Update python documentation.
PiperOrigin-RevId: 488482142
2022-11-14 15:18:47 -08:00
Sebastian Schmidt
c027373688 Internal change
PiperOrigin-RevId: 488481286
2022-11-14 15:15:22 -08:00
Sebastian Schmidt
11270d0c93 Image Embedder for Web
PiperOrigin-RevId: 488468214
2022-11-14 14:26:15 -08:00
Jiuqiang Tang
b4fba6fe61 MediaPipe Tasks AudioEmbedder Java API
PiperOrigin-RevId: 488456442
2022-11-14 13:42:55 -08:00
Sebastian Schmidt
ca7b5e9d8b Fix Script loading
PiperOrigin-RevId: 488440736
2022-11-14 12:40:41 -08:00