2019-06-17 01:03:25 +02:00
|
|
|
# Copyright 2019 The MediaPipe Authors.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2022-03-21 20:07:37 +01:00
|
|
|
load("@bazel_skylib//lib:selects.bzl", "selects")
|
2019-08-17 03:49:25 +02:00
|
|
|
load("//mediapipe/gpu:metal.bzl", "metal_library")
|
|
|
|
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
|
2023-04-03 18:43:05 +02:00
|
|
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_proto_library")
|
2021-02-27 09:21:16 +01:00
|
|
|
load("//mediapipe/framework:mediapipe_cc_test.bzl", "mediapipe_cc_test")
|
2022-03-21 20:07:37 +01:00
|
|
|
load("//mediapipe/framework:more_selects.bzl", "more_selects")
|
2019-06-17 01:03:25 +02:00
|
|
|
|
2020-08-30 05:41:10 +02:00
|
|
|
licenses(["notice"])
|
2020-07-09 02:34:05 +02:00
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
# Disabling GPU support is sometimes useful on desktop Linux because SwiftShader can
|
|
|
|
# interfere with desktop GL. b/73494271
|
|
|
|
config_setting(
|
|
|
|
name = "disable_gpu",
|
|
|
|
define_values = {
|
|
|
|
"MEDIAPIPE_DISABLE_GPU": "1",
|
|
|
|
},
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_service",
|
|
|
|
srcs = ["gpu_service.cc"],
|
|
|
|
hdrs = ["gpu_service.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
2023-05-19 05:17:07 +02:00
|
|
|
deps = [
|
|
|
|
"//mediapipe/framework:graph_service",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
] + select({
|
2022-05-04 00:29:57 +02:00
|
|
|
"//conditions:default": [
|
|
|
|
":gpu_shared_data_internal",
|
|
|
|
],
|
|
|
|
"//mediapipe/gpu:disable_gpu": [],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "graph_support",
|
|
|
|
hdrs = ["graph_support.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2022-06-23 21:35:07 +02:00
|
|
|
cc_library(
|
|
|
|
name = "attachments",
|
|
|
|
hdrs = ["attachments.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
GL_BASE_LINK_OPTS = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:android": [
|
|
|
|
"-lGLESv2",
|
|
|
|
"-lEGL",
|
|
|
|
# Note: on Android, libGLESv3.so is normally a symlink to
|
|
|
|
# libGLESv2.so, so we don't need to link to it. In fact, we
|
|
|
|
# do not _want_ to link to it, or we would be unable to load
|
|
|
|
# on API level < 18, where the symlink is missing entirely.
|
|
|
|
# Note: if we ever find a strange version of Android where the
|
|
|
|
# GLESv3 library is not a symlink, we will have to load it at
|
|
|
|
# runtime. Weak GLESv3 symbols will still be resolved if we
|
|
|
|
# load it early enough.
|
|
|
|
],
|
2020-04-07 04:10:12 +02:00
|
|
|
"//mediapipe:ios": [
|
2019-08-17 03:49:25 +02:00
|
|
|
"-framework OpenGLES",
|
|
|
|
"-framework CoreVideo",
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
"-framework OpenGL",
|
|
|
|
"-framework CoreVideo",
|
|
|
|
],
|
|
|
|
})
|
|
|
|
|
|
|
|
# This is @unused internally.
|
|
|
|
GL_BASE_LINK_OPTS_OSS = GL_BASE_LINK_OPTS + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
# Use GLES/EGL on linux.
|
|
|
|
# Requires support from graphics card driver (nvidia,mesa,etc..)
|
|
|
|
# and libraries to be installed.
|
|
|
|
# Ex: libegl1-mesa-dev libgles2-mesa-dev, or libegl1-nvidia libgles2-nvidia, etc...
|
|
|
|
"-lGLESv2",
|
|
|
|
"-lEGL",
|
|
|
|
],
|
|
|
|
"//mediapipe:android": [],
|
2019-09-30 19:18:09 +02:00
|
|
|
"//mediapipe:ios": [],
|
2019-08-17 03:49:25 +02:00
|
|
|
":disable_gpu": [],
|
|
|
|
})
|
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gl_base",
|
2019-08-17 03:49:25 +02:00
|
|
|
defines = select({
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"GLES_SILENCE_DEPRECATION=1",
|
2019-06-17 01:03:25 +02:00
|
|
|
],
|
2019-08-17 03:49:25 +02:00
|
|
|
"//conditions:default": [],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
2019-08-17 03:49:25 +02:00
|
|
|
features = ["-layering_check"],
|
|
|
|
linkopts = GL_BASE_LINK_OPTS_OSS,
|
2019-06-17 01:03:25 +02:00
|
|
|
textual_hdrs = ["gl_base.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":gl_base_hdr"] + select({
|
|
|
|
"//mediapipe:android": [],
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe:apple": [],
|
2019-06-17 01:03:25 +02:00
|
|
|
"//conditions:default": [
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_base_hdr",
|
|
|
|
hdrs = ["gl_base.h"],
|
|
|
|
features = ["-layering_check"],
|
|
|
|
# Note: need the frameworks on Apple platforms to get the headers.
|
2019-08-17 03:49:25 +02:00
|
|
|
linkopts = select({
|
|
|
|
"//conditions:default": [],
|
2020-04-07 04:10:12 +02:00
|
|
|
"//mediapipe:ios": [
|
2019-08-17 03:49:25 +02:00
|
|
|
"-framework OpenGLES",
|
|
|
|
"-framework CoreVideo",
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
"-framework OpenGL",
|
|
|
|
"-framework CoreVideo",
|
|
|
|
],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = select({
|
|
|
|
"//mediapipe:android": [],
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe:apple": [],
|
2019-06-17 01:03:25 +02:00
|
|
|
"//conditions:default": [
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_thread_collector",
|
|
|
|
hdrs = ["gl_thread_collector.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_context",
|
|
|
|
srcs = [
|
|
|
|
"gl_context.cc",
|
|
|
|
"gl_context_internal.h",
|
|
|
|
] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
"gl_context_egl.cc",
|
|
|
|
],
|
2020-04-07 04:10:12 +02:00
|
|
|
"//mediapipe:ios": [
|
2019-08-17 03:49:25 +02:00
|
|
|
"gl_context_eagl.cc",
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
"gl_context_nsgl.cc",
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
hdrs = ["gl_context.h"],
|
2019-08-17 03:49:25 +02:00
|
|
|
copts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"-x objective-c++",
|
2020-09-16 03:31:50 +02:00
|
|
|
"-fobjc-arc", # enable reference-counting
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
}),
|
2022-11-29 23:12:14 +01:00
|
|
|
linkopts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:ios": [
|
|
|
|
"-framework OpenGLES",
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
"-framework OpenGL",
|
|
|
|
"-framework AppKit",
|
|
|
|
],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2022-06-23 21:35:07 +02:00
|
|
|
":attachments",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gl_base",
|
|
|
|
":gl_thread_collector",
|
2021-02-27 09:21:16 +01:00
|
|
|
":gpu_buffer_format",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework:executor",
|
2023-03-29 21:32:28 +02:00
|
|
|
"//mediapipe/framework:mediapipe_profiling",
|
|
|
|
"//mediapipe/framework:timestamp",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/port:logging",
|
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"//mediapipe/framework/port:status",
|
|
|
|
"//mediapipe/framework/port:statusor",
|
|
|
|
"//mediapipe/framework/port:threadpool",
|
|
|
|
"@com_google_absl//absl/base:dynamic_annotations",
|
|
|
|
"@com_google_absl//absl/debugging:leak_check",
|
|
|
|
"@com_google_absl//absl/memory",
|
2023-03-29 21:32:28 +02:00
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-06-17 01:03:25 +02:00
|
|
|
"@com_google_absl//absl/synchronization",
|
2019-08-17 03:49:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"//mediapipe/objc:CFHolder",
|
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
}) + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
],
|
2022-11-29 23:12:14 +01:00
|
|
|
"//mediapipe:ios": [
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
],
|
2019-08-17 03:49:25 +02:00
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_texture_buffer",
|
|
|
|
srcs = ["gl_texture_buffer.cc"],
|
|
|
|
hdrs = ["gl_texture_buffer.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
2021-10-18 21:39:29 +02:00
|
|
|
":gl_texture_view",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gpu_buffer_format",
|
2021-10-18 21:39:29 +02:00
|
|
|
":gpu_buffer_storage",
|
2022-03-21 20:07:37 +01:00
|
|
|
":gpu_buffer_storage_image_frame",
|
2022-11-16 03:30:58 +01:00
|
|
|
"@com_google_absl//absl/memory",
|
2019-06-17 01:03:25 +02:00
|
|
|
# TODO: remove this dependency. Some other teams' tests
|
|
|
|
# depend on having an indirect image_frame dependency, need to be
|
|
|
|
# fixed first.
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
2022-11-16 03:31:27 +01:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
":platform_ios_with_gpu": [
|
|
|
|
":gl_texture_util",
|
|
|
|
":gpu_buffer_storage_cv_pixel_buffer",
|
|
|
|
],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
)
|
|
|
|
|
2021-10-18 21:39:29 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gl_texture_view",
|
|
|
|
srcs = ["gl_texture_view.cc"],
|
|
|
|
hdrs = ["gl_texture_view.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
2022-03-21 20:07:37 +01:00
|
|
|
":gpu_buffer_storage",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Workaround for "Multiple matches are not allowed unless one is unambiguously more specialized".
|
|
|
|
more_selects.config_setting_negation(
|
|
|
|
name = "not_disable_gpu",
|
|
|
|
negate = ":disable_gpu",
|
|
|
|
)
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
name = "platform_ios_with_gpu",
|
|
|
|
match_all = [
|
|
|
|
":not_disable_gpu",
|
|
|
|
"//mediapipe:ios",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
selects.config_setting_group(
|
|
|
|
name = "platform_macos_with_gpu",
|
|
|
|
match_all = [
|
|
|
|
":not_disable_gpu",
|
|
|
|
"//mediapipe:macos",
|
2021-10-18 21:39:29 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer",
|
2021-10-06 22:44:33 +02:00
|
|
|
srcs = ["gpu_buffer.cc"],
|
2019-06-17 01:03:25 +02:00
|
|
|
hdrs = ["gpu_buffer.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gpu_buffer_format",
|
2021-10-18 21:39:29 +02:00
|
|
|
":gpu_buffer_storage",
|
2023-03-22 15:12:05 +01:00
|
|
|
":gpu_buffer_storage_image_frame",
|
2023-03-29 21:32:28 +02:00
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
"//mediapipe/framework/port:logging",
|
2022-12-07 08:54:11 +01:00
|
|
|
"@com_google_absl//absl/functional:bind_front",
|
2023-05-22 14:01:36 +02:00
|
|
|
"@com_google_absl//absl/log:check",
|
2022-09-28 22:35:30 +02:00
|
|
|
"@com_google_absl//absl/strings",
|
2022-12-07 08:54:11 +01:00
|
|
|
"@com_google_absl//absl/synchronization",
|
2019-06-17 01:03:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
":gl_texture_buffer",
|
2023-03-22 15:12:05 +01:00
|
|
|
":gl_texture_view",
|
2019-06-17 01:03:25 +02:00
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
":platform_ios_with_gpu": [
|
|
|
|
":gl_texture_view",
|
2021-10-18 21:39:29 +02:00
|
|
|
":gpu_buffer_storage_cv_pixel_buffer",
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe/objc:CFHolder",
|
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
":platform_macos_with_gpu": [
|
2019-08-17 03:49:25 +02:00
|
|
|
":gl_texture_buffer",
|
2023-03-22 15:12:05 +01:00
|
|
|
":gl_texture_view",
|
|
|
|
"//mediapipe/objc:CFHolder",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
2023-03-10 01:26:34 +01:00
|
|
|
":disable_gpu": [],
|
|
|
|
}) + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:ios": [
|
2023-03-08 20:30:56 +01:00
|
|
|
"//mediapipe/objc:util",
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_format",
|
|
|
|
srcs = ["gpu_buffer_format.cc"],
|
|
|
|
hdrs = ["gpu_buffer_format.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2022-03-21 20:07:37 +01:00
|
|
|
"//mediapipe/framework/deps:no_destructor",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework/formats:image_format_cc_proto",
|
2022-03-21 20:07:37 +01:00
|
|
|
"//mediapipe/framework/port:logging",
|
2023-03-29 21:32:28 +02:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
2022-03-21 20:07:37 +01:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
":gl_base",
|
|
|
|
],
|
|
|
|
"//mediapipe/gpu:disable_gpu": [],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
)
|
|
|
|
|
2021-10-18 21:39:29 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_storage",
|
2022-03-21 20:07:37 +01:00
|
|
|
srcs = ["gpu_buffer_storage.cc"],
|
2021-10-18 21:39:29 +02:00
|
|
|
hdrs = ["gpu_buffer_storage.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gpu_buffer_format",
|
|
|
|
"//mediapipe/framework/deps:no_destructor",
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
2022-03-21 20:07:37 +01:00
|
|
|
"//mediapipe/framework/tool:type_util",
|
2021-10-18 21:39:29 +02:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_storage_cv_pixel_buffer",
|
|
|
|
srcs = ["gpu_buffer_storage_cv_pixel_buffer.cc"],
|
|
|
|
hdrs = ["gpu_buffer_storage_cv_pixel_buffer.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
|
|
|
":gl_texture_view",
|
|
|
|
":gpu_buffer_storage",
|
2022-03-21 20:07:37 +01:00
|
|
|
":gpu_buffer_storage_image_frame",
|
|
|
|
":image_frame_view",
|
2021-10-18 21:39:29 +02:00
|
|
|
"//mediapipe/objc:CFHolder",
|
|
|
|
"//mediapipe/objc:util",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 03:31:27 +01:00
|
|
|
mediapipe_cc_test(
|
|
|
|
name = "gpu_buffer_storage_cv_pixel_buffer_test",
|
|
|
|
size = "small",
|
|
|
|
timeout = "moderate",
|
|
|
|
srcs = ["gpu_buffer_storage_cv_pixel_buffer_test.cc"],
|
|
|
|
platforms = ["ios"],
|
|
|
|
deps = [
|
|
|
|
":gl_texture_buffer",
|
|
|
|
":gl_texture_util",
|
|
|
|
":gpu_buffer",
|
|
|
|
":gpu_buffer_storage_cv_pixel_buffer",
|
|
|
|
":gpu_test_base",
|
|
|
|
"//mediapipe/framework/port:gtest_main",
|
|
|
|
"//mediapipe/framework/tool:test_util",
|
|
|
|
"//mediapipe/objc:util",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 00:57:43 +01:00
|
|
|
cc_library(
|
|
|
|
name = "cv_texture_cache_manager",
|
|
|
|
srcs = ["cv_texture_cache_manager.cc"],
|
|
|
|
hdrs = ["cv_texture_cache_manager.h"],
|
|
|
|
deps = [
|
|
|
|
":pixel_buffer_pool_util",
|
|
|
|
"//mediapipe/framework/port:logging",
|
|
|
|
"//mediapipe/objc:CFHolder",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 00:58:32 +01:00
|
|
|
cc_library(
|
|
|
|
name = "cv_pixel_buffer_pool_wrapper",
|
|
|
|
srcs = ["cv_pixel_buffer_pool_wrapper.cc"],
|
|
|
|
hdrs = ["cv_pixel_buffer_pool_wrapper.h"],
|
|
|
|
copts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"-x objective-c++",
|
|
|
|
"-fobjc-arc",
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
deps = [
|
2022-11-16 01:03:03 +01:00
|
|
|
":cv_texture_cache_manager",
|
2022-11-16 00:59:01 +01:00
|
|
|
":gpu_buffer_format",
|
2022-11-16 01:02:32 +01:00
|
|
|
":multi_pool",
|
2022-11-16 00:58:32 +01:00
|
|
|
":pixel_buffer_pool_util",
|
|
|
|
"//mediapipe/framework/port:logging",
|
|
|
|
"//mediapipe/objc:CFHolder",
|
2022-11-16 00:59:01 +01:00
|
|
|
"//mediapipe/objc:util",
|
2022-11-16 00:58:32 +01:00
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-03-21 20:07:37 +01:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_storage_image_frame",
|
2023-04-04 10:16:50 +02:00
|
|
|
srcs = ["gpu_buffer_storage_image_frame.cc"],
|
2022-03-21 20:07:37 +01:00
|
|
|
hdrs = ["gpu_buffer_storage_image_frame.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2023-04-04 10:16:50 +02:00
|
|
|
":frame_buffer_view",
|
2022-03-21 20:07:37 +01:00
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage",
|
|
|
|
":image_frame_view",
|
2023-04-04 10:16:50 +02:00
|
|
|
"//mediapipe/framework/formats:frame_buffer",
|
2022-03-21 20:07:37 +01:00
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "image_frame_view",
|
|
|
|
hdrs = ["image_frame_view.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage",
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-02-03 14:55:43 +01:00
|
|
|
cc_library(
|
|
|
|
name = "frame_buffer_view",
|
|
|
|
hdrs = ["frame_buffer_view.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gpu_buffer_storage",
|
|
|
|
"//mediapipe/framework/formats:frame_buffer",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-01-27 17:49:28 +01:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_storage_yuv_image",
|
|
|
|
srcs = ["gpu_buffer_storage_yuv_image.cc"],
|
|
|
|
hdrs = ["gpu_buffer_storage_yuv_image.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2023-02-03 14:55:43 +01:00
|
|
|
":frame_buffer_view",
|
2023-01-27 17:49:28 +01:00
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage",
|
2023-03-06 11:16:07 +01:00
|
|
|
":image_frame_view",
|
2023-02-03 14:55:43 +01:00
|
|
|
"//mediapipe/framework/formats:frame_buffer",
|
2023-03-06 11:16:07 +01:00
|
|
|
"//mediapipe/framework/formats:image_frame",
|
2023-01-27 17:49:28 +01:00
|
|
|
"//mediapipe/framework/formats:yuv_image",
|
2023-03-14 17:28:00 +01:00
|
|
|
"//mediapipe/util/frame_buffer:frame_buffer_util",
|
2023-01-27 17:49:28 +01:00
|
|
|
"//third_party/libyuv",
|
|
|
|
"@com_google_absl//absl/log",
|
|
|
|
"@com_google_absl//absl/log:check",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-09-28 22:35:30 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_storage_ahwb",
|
|
|
|
srcs = ["gpu_buffer_storage_ahwb.cc"],
|
|
|
|
hdrs = ["gpu_buffer_storage_ahwb.h"],
|
|
|
|
linkopts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:android": [
|
|
|
|
"-landroid",
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
deps = [
|
2022-10-18 20:55:19 +02:00
|
|
|
":gl_texture_buffer",
|
2022-09-28 22:35:30 +02:00
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage",
|
2022-10-18 20:55:19 +02:00
|
|
|
":image_frame_view",
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
2022-09-28 22:35:30 +02:00
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-05-05 03:30:15 +02:00
|
|
|
mediapipe_proto_library(
|
|
|
|
name = "gpu_origin_proto",
|
|
|
|
srcs = ["gpu_origin.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
objc_library(
|
|
|
|
name = "pixel_buffer_pool_util",
|
|
|
|
srcs = ["pixel_buffer_pool_util.mm"],
|
|
|
|
hdrs = ["pixel_buffer_pool_util.h"],
|
|
|
|
copts = [
|
|
|
|
"-Wno-shorten-64-to-32",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
2022-12-07 00:16:42 +01:00
|
|
|
deps = [
|
|
|
|
"//mediapipe/objc:util",
|
|
|
|
"//third_party/apple_frameworks:Accelerate",
|
|
|
|
"//third_party/apple_frameworks:CoreGraphics",
|
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
],
|
2019-08-17 03:49:25 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
2022-11-23 19:13:48 +01:00
|
|
|
name = "metal_shared_resources",
|
|
|
|
srcs = ["metal_shared_resources.mm"],
|
|
|
|
hdrs = ["metal_shared_resources.h"],
|
2019-08-17 03:49:25 +02:00
|
|
|
copts = [
|
|
|
|
"-x objective-c++",
|
|
|
|
"-Wno-shorten-64-to-32",
|
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"@google_toolbox_for_mac//:GTM_Defines",
|
2022-09-06 23:29:51 +02:00
|
|
|
] + [
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-09-30 19:18:09 +02:00
|
|
|
objc_library(
|
|
|
|
name = "MPPMetalUtil",
|
|
|
|
srcs = ["MPPMetalUtil.mm"],
|
|
|
|
hdrs = ["MPPMetalUtil.h"],
|
|
|
|
copts = [
|
|
|
|
"-x objective-c++",
|
|
|
|
"-Wno-shorten-64-to-32",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2020-01-10 02:51:05 +01:00
|
|
|
"@com_google_absl//absl/time",
|
2019-09-30 19:18:09 +02:00
|
|
|
"@google_toolbox_for_mac//:GTM_Defines",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-02-14 21:10:56 +01:00
|
|
|
mediapipe_proto_library(
|
2019-06-17 01:03:25 +02:00
|
|
|
name = "gl_context_options_proto",
|
|
|
|
srcs = ["gl_context_options.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
2023-04-03 18:43:05 +02:00
|
|
|
deps = [
|
|
|
|
"//mediapipe/framework:calculator_options_proto",
|
|
|
|
"//mediapipe/framework:calculator_proto",
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# This is a hack needed to work around some issues with strict hdrs_check.
|
|
|
|
# See e.g. b/67524270.
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_shared_data_header",
|
|
|
|
textual_hdrs = [
|
|
|
|
"gpu_shared_data_internal.h",
|
2022-11-23 19:09:42 +01:00
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
alias(
|
2019-06-17 01:03:25 +02:00
|
|
|
name = "gpu_shared_data_internal",
|
2019-08-17 03:49:25 +02:00
|
|
|
actual = select({
|
|
|
|
"//conditions:default": ":gpu_shared_data_internal_actual",
|
|
|
|
":disable_gpu": ":gpu_shared_data_internal_stub",
|
|
|
|
}),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_shared_data_internal_stub",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
deps = [
|
2022-12-21 01:39:52 +01:00
|
|
|
":gl_context_options_cc_proto",
|
2019-08-17 03:49:25 +02:00
|
|
|
":graph_support",
|
|
|
|
"//mediapipe/framework:calculator_context",
|
|
|
|
"//mediapipe/framework:calculator_node",
|
|
|
|
"//mediapipe/framework:executor",
|
2021-02-27 09:21:16 +01:00
|
|
|
"//mediapipe/framework:port",
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe/framework/deps:no_destructor",
|
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_shared_data_internal_actual",
|
2022-11-23 19:13:48 +01:00
|
|
|
srcs = [
|
|
|
|
"gpu_shared_data_internal.cc",
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
hdrs = [
|
|
|
|
"gpu_shared_data_internal.h",
|
|
|
|
],
|
2022-11-23 19:13:48 +01:00
|
|
|
copts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"-x objective-c++",
|
|
|
|
"-fobjc-arc", # enable reference-counting
|
|
|
|
],
|
|
|
|
}),
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:private"],
|
2019-06-17 01:03:25 +02:00
|
|
|
deps = [
|
2023-03-22 15:12:05 +01:00
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
2022-12-21 01:39:52 +01:00
|
|
|
":gl_context_options_cc_proto",
|
2023-03-22 15:12:05 +01:00
|
|
|
":gpu_buffer_multi_pool",
|
|
|
|
":gpu_shared_data_header",
|
2019-06-17 01:03:25 +02:00
|
|
|
":graph_support",
|
|
|
|
"//mediapipe/framework:calculator_context",
|
|
|
|
"//mediapipe/framework:calculator_node",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework:executor",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/deps:no_destructor",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework/port:ret_check",
|
2023-05-19 05:17:07 +02:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2019-06-17 01:03:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe:apple": [
|
2022-11-16 00:57:43 +01:00
|
|
|
":cv_texture_cache_manager",
|
2023-03-22 15:12:05 +01:00
|
|
|
":metal_shared_resources",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2020-09-16 03:31:50 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gl_texture_buffer_pool",
|
|
|
|
srcs = ["gl_texture_buffer_pool.cc"],
|
|
|
|
hdrs = ["gl_texture_buffer_pool.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_texture_buffer",
|
|
|
|
":gpu_buffer",
|
|
|
|
":gpu_shared_data_header",
|
2022-11-16 01:02:32 +01:00
|
|
|
":multi_pool",
|
2022-11-16 01:04:45 +01:00
|
|
|
":reusable_pool",
|
2020-09-16 03:31:50 +02:00
|
|
|
"//mediapipe/framework:calculator_context",
|
|
|
|
"//mediapipe/framework:calculator_node",
|
|
|
|
"//mediapipe/framework/port:logging",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 01:04:45 +01:00
|
|
|
cc_library(
|
|
|
|
name = "reusable_pool",
|
|
|
|
hdrs = ["reusable_pool.h"],
|
|
|
|
deps = [
|
|
|
|
":multi_pool",
|
|
|
|
"@com_google_absl//absl/functional:any_invocable",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 01:02:32 +01:00
|
|
|
cc_library(
|
|
|
|
name = "multi_pool",
|
|
|
|
hdrs = ["multi_pool.h"],
|
2022-11-16 01:03:41 +01:00
|
|
|
deps = ["//mediapipe/util:resource_cache"],
|
2022-11-16 01:02:32 +01:00
|
|
|
)
|
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_multi_pool",
|
2020-09-16 03:31:50 +02:00
|
|
|
srcs = ["gpu_buffer_multi_pool.cc"],
|
2019-06-17 01:03:25 +02:00
|
|
|
hdrs = ["gpu_buffer_multi_pool.h"] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
],
|
2020-04-07 04:10:12 +02:00
|
|
|
"//mediapipe:ios": [
|
2019-08-17 03:49:25 +02:00
|
|
|
# The inclusions check does not see that this is provided by
|
|
|
|
# pixel_buffer_pool_util, so we include it here too. This is
|
|
|
|
# b/28066691.
|
|
|
|
"pixel_buffer_pool_util.h",
|
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
2020-08-13 03:57:56 +02:00
|
|
|
copts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"-x objective-c++",
|
|
|
|
"-fobjc-arc",
|
|
|
|
],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gpu_buffer",
|
|
|
|
":gpu_shared_data_header",
|
2022-11-16 01:02:32 +01:00
|
|
|
":multi_pool",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework:calculator_context",
|
|
|
|
"//mediapipe/framework:calculator_node",
|
|
|
|
"//mediapipe/framework/port:logging",
|
2021-05-05 03:30:15 +02:00
|
|
|
"//mediapipe/util:resource_cache",
|
2023-03-29 21:32:28 +02:00
|
|
|
"@com_google_absl//absl/hash",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2019-06-17 01:03:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
":gl_texture_buffer",
|
2020-09-16 03:31:50 +02:00
|
|
|
":gl_texture_buffer_pool",
|
2019-06-17 01:03:25 +02:00
|
|
|
],
|
2020-04-07 04:10:12 +02:00
|
|
|
"//mediapipe:ios": [
|
2022-11-16 00:58:32 +01:00
|
|
|
":cv_pixel_buffer_pool_wrapper",
|
2022-11-16 00:57:43 +01:00
|
|
|
":cv_texture_cache_manager",
|
2019-08-17 03:49:25 +02:00
|
|
|
":pixel_buffer_pool_util",
|
|
|
|
"//mediapipe/objc:CFHolder",
|
2021-10-06 22:44:33 +02:00
|
|
|
"//mediapipe/objc:util",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
"//mediapipe:macos": [
|
2022-11-16 00:58:32 +01:00
|
|
|
":cv_pixel_buffer_pool_wrapper",
|
2022-11-16 00:57:43 +01:00
|
|
|
":cv_texture_cache_manager",
|
2019-08-17 03:49:25 +02:00
|
|
|
":gl_texture_buffer",
|
2020-09-16 03:31:50 +02:00
|
|
|
":gl_texture_buffer_pool",
|
2023-03-22 15:12:05 +01:00
|
|
|
":pixel_buffer_pool_util",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2022-11-16 02:07:26 +01:00
|
|
|
cc_library(
|
|
|
|
name = "gl_texture_util",
|
|
|
|
srcs = ["gl_texture_util.cc"],
|
|
|
|
hdrs = ["gl_texture_util.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_texture_view",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
cc_library(
|
|
|
|
name = "shader_util",
|
|
|
|
srcs = ["shader_util.cc"],
|
|
|
|
hdrs = ["shader_util.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
"//mediapipe/framework/port:logging",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-10-06 22:44:33 +02:00
|
|
|
cc_library(
|
|
|
|
name = "egl_surface_holder",
|
|
|
|
hdrs = ["egl_surface_holder.h"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
2021-10-06 22:44:33 +02:00
|
|
|
)
|
2019-08-17 03:49:25 +02:00
|
|
|
|
2019-06-17 01:03:25 +02:00
|
|
|
cc_library(
|
|
|
|
name = "gl_calculator_helper",
|
2021-10-06 22:44:33 +02:00
|
|
|
srcs = [
|
|
|
|
"gl_calculator_helper.cc",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"gl_calculator_helper.h",
|
|
|
|
],
|
|
|
|
linkopts = select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": [
|
|
|
|
"-framework AVFoundation",
|
|
|
|
"-framework CoreVideo",
|
|
|
|
"-framework CoreGraphics",
|
|
|
|
"-framework CoreMedia",
|
|
|
|
"-framework GLKit",
|
|
|
|
"-framework QuartzCore",
|
|
|
|
],
|
|
|
|
}) + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:macos": [
|
|
|
|
"-framework AppKit",
|
|
|
|
],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_context",
|
2022-03-21 20:07:37 +01:00
|
|
|
":gl_texture_buffer_pool",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gpu_buffer",
|
2019-09-30 19:18:09 +02:00
|
|
|
":gpu_buffer_format",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gpu_buffer_multi_pool",
|
|
|
|
":gpu_service",
|
2023-03-22 15:12:05 +01:00
|
|
|
":gpu_shared_data_internal",
|
2019-06-17 01:03:25 +02:00
|
|
|
":graph_support",
|
2022-03-21 20:07:37 +01:00
|
|
|
":image_frame_view",
|
2019-06-17 01:03:25 +02:00
|
|
|
":shader_util",
|
|
|
|
"//mediapipe/framework:calculator_context",
|
|
|
|
"//mediapipe/framework:calculator_contract",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework:calculator_framework",
|
|
|
|
"//mediapipe/framework:calculator_node",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework:demangle",
|
|
|
|
"//mediapipe/framework:legacy_calculator_support",
|
|
|
|
"//mediapipe/framework:packet",
|
|
|
|
"//mediapipe/framework:packet_set",
|
|
|
|
"//mediapipe/framework:packet_type",
|
|
|
|
"//mediapipe/framework:timestamp",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework/deps:registration",
|
2021-02-27 09:21:16 +01:00
|
|
|
"//mediapipe/framework/formats:image",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
"//mediapipe/framework/port:logging",
|
2023-03-22 15:12:05 +01:00
|
|
|
"//mediapipe/framework/port:map_util",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"//mediapipe/framework/port:status",
|
2023-03-29 21:32:28 +02:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2019-06-17 01:03:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
],
|
2021-10-06 22:44:33 +02:00
|
|
|
"//mediapipe:apple": [],
|
2019-06-17 01:03:25 +02:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
objc_library(
|
|
|
|
name = "MPPMetalHelper",
|
|
|
|
srcs = ["MPPMetalHelper.mm"],
|
|
|
|
hdrs = ["MPPMetalHelper.h"],
|
|
|
|
copts = [
|
|
|
|
"-Wno-shorten-64-to-32",
|
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2023-03-06 17:40:18 +01:00
|
|
|
":gpu_service",
|
2019-08-17 03:49:25 +02:00
|
|
|
":gpu_shared_data_internal",
|
|
|
|
":graph_support",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2019-08-17 03:49:25 +02:00
|
|
|
"@google_toolbox_for_mac//:GTM_Defines",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-11 01:46:12 +01:00
|
|
|
mediapipe_proto_library(
|
2019-06-17 01:03:25 +02:00
|
|
|
name = "scale_mode_proto",
|
|
|
|
srcs = ["scale_mode.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_quad_renderer",
|
|
|
|
srcs = ["gl_quad_renderer.cc"],
|
|
|
|
hdrs = ["gl_quad_renderer.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
":gl_simple_shaders",
|
2022-12-21 01:39:52 +01:00
|
|
|
":scale_mode_cc_proto",
|
2019-06-17 01:03:25 +02:00
|
|
|
":shader_util",
|
|
|
|
"//mediapipe/framework/port:ret_check",
|
2023-03-27 12:36:47 +02:00
|
|
|
"@com_google_absl//absl/status",
|
2019-06-17 01:03:25 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_simple_shaders",
|
|
|
|
srcs = ["gl_simple_shaders.cc"],
|
|
|
|
hdrs = ["gl_simple_shaders.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_base",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
### General calculator superclasses
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_simple_calculator",
|
|
|
|
srcs = ["gl_simple_calculator.cc"],
|
|
|
|
hdrs = ["gl_simple_calculator.h"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_calculator_helper",
|
|
|
|
"//mediapipe/framework:calculator_framework",
|
|
|
|
"//mediapipe/framework/port:status",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
### Converters
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gpu_buffer_to_image_frame_calculator",
|
|
|
|
srcs = ["gpu_buffer_to_image_frame_calculator.cc"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_calculator_helper",
|
|
|
|
"//mediapipe/framework:calculator_framework",
|
|
|
|
"//mediapipe/framework:timestamp",
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"//mediapipe/framework/port:status",
|
2019-08-17 03:49:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": ["//mediapipe/objc:util"],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "image_frame_to_gpu_buffer_calculator",
|
|
|
|
srcs = ["image_frame_to_gpu_buffer_calculator.cc"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_calculator_helper",
|
|
|
|
"//mediapipe/framework:calculator_framework",
|
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
"//mediapipe/framework/port:status",
|
2021-06-24 23:10:25 +02:00
|
|
|
] + select({
|
|
|
|
"//conditions:default": [],
|
|
|
|
"//mediapipe:apple": ["//mediapipe/objc:util"],
|
|
|
|
}),
|
2019-06-17 01:03:25 +02:00
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2023-01-24 21:11:53 +01:00
|
|
|
### Simple calculators
|
|
|
|
|
|
|
|
mediapipe_proto_library(
|
|
|
|
name = "gl_animation_overlay_calculator_proto",
|
|
|
|
srcs = ["gl_animation_overlay_calculator.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2023-04-03 18:43:05 +02:00
|
|
|
"//mediapipe/framework:calculator_options_proto",
|
2023-01-24 21:11:53 +01:00
|
|
|
"//mediapipe/framework:calculator_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2023-03-10 21:24:51 +01:00
|
|
|
mediapipe_proto_library(
|
2019-06-17 01:03:25 +02:00
|
|
|
name = "gl_scaler_calculator_proto",
|
|
|
|
srcs = ["gl_scaler_calculator.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2022-12-21 01:39:52 +01:00
|
|
|
":scale_mode_proto",
|
2023-04-03 18:43:05 +02:00
|
|
|
"//mediapipe/framework:calculator_options_proto",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework:calculator_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_scaler_calculator",
|
|
|
|
srcs = ["gl_scaler_calculator.cc"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":gl_calculator_helper",
|
|
|
|
":gl_quad_renderer",
|
2022-12-21 01:39:52 +01:00
|
|
|
":gl_scaler_calculator_cc_proto",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gl_simple_shaders",
|
|
|
|
":shader_util",
|
|
|
|
"//mediapipe/framework:calculator_framework",
|
2021-05-11 06:52:16 +02:00
|
|
|
"//mediapipe/framework/formats:image",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"//mediapipe/framework/port:status",
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe/framework/tool:options_util",
|
2019-06-17 01:03:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "gl_surface_sink_calculator",
|
|
|
|
srcs = ["gl_surface_sink_calculator.cc"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-10-06 22:44:33 +02:00
|
|
|
":egl_surface_holder",
|
2019-06-17 01:03:25 +02:00
|
|
|
":gl_calculator_helper",
|
|
|
|
":gl_quad_renderer",
|
2022-12-21 01:39:52 +01:00
|
|
|
":gl_surface_sink_calculator_cc_proto",
|
2021-05-05 03:30:15 +02:00
|
|
|
":gpu_buffer",
|
2019-06-17 01:03:25 +02:00
|
|
|
":shader_util",
|
|
|
|
"//mediapipe/framework:calculator_framework",
|
2021-05-05 03:30:15 +02:00
|
|
|
"//mediapipe/framework/api2:node",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework/port:ret_check",
|
|
|
|
"//mediapipe/framework/port:status",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2023-04-03 18:43:05 +02:00
|
|
|
mediapipe_proto_library(
|
2019-06-17 01:03:25 +02:00
|
|
|
name = "gl_surface_sink_calculator_proto",
|
|
|
|
srcs = ["gl_surface_sink_calculator.proto"],
|
|
|
|
deps = [
|
2022-12-21 01:39:52 +01:00
|
|
|
":scale_mode_proto",
|
2023-04-03 18:43:05 +02:00
|
|
|
"//mediapipe/framework:calculator_options_proto",
|
2019-06-17 01:03:25 +02:00
|
|
|
"//mediapipe/framework:calculator_proto",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
### Metal calculators
|
|
|
|
|
|
|
|
metal_library(
|
|
|
|
name = "simple_shaders_mtl",
|
|
|
|
srcs = ["simple_shaders.metal"],
|
|
|
|
hdrs = ["metal_shader_base.h"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Only needed for cc_library depending on simple_shaders_mtl.
|
|
|
|
objc_library(
|
|
|
|
name = "simple_shaders_for_cc",
|
|
|
|
hdrs = ["metal_shader_base.h"],
|
|
|
|
deps = [":simple_shaders_mtl"],
|
|
|
|
)
|
|
|
|
|
2023-04-03 18:43:05 +02:00
|
|
|
mediapipe_proto_library(
|
2019-08-17 03:49:25 +02:00
|
|
|
name = "copy_calculator_proto",
|
|
|
|
srcs = ["copy_calculator.proto"],
|
|
|
|
visibility = ["//visibility:public"],
|
2023-04-03 18:43:05 +02:00
|
|
|
deps = [
|
|
|
|
"//mediapipe/framework:calculator_options_proto",
|
|
|
|
"//mediapipe/framework:calculator_proto",
|
2023-03-30 02:24:52 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-08-17 03:49:25 +02:00
|
|
|
objc_library(
|
|
|
|
name = "metal_copy_calculator",
|
|
|
|
srcs = ["MetalCopyCalculator.mm"],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
2023-01-12 19:20:09 +01:00
|
|
|
":copy_calculator_cc_proto",
|
2019-08-17 03:49:25 +02:00
|
|
|
":simple_shaders_mtl",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
|
|
|
name = "metal_rgb_weight_calculator",
|
|
|
|
srcs = ["MetalRgbWeightCalculator.mm"],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
|
|
|
":simple_shaders_mtl",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
|
|
|
name = "metal_sobel_calculator",
|
|
|
|
srcs = ["MetalSobelCalculator.mm"],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
|
|
|
":simple_shaders_mtl",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
|
|
|
name = "metal_sobel_compute_calculator",
|
|
|
|
srcs = ["MetalSobelComputeCalculator.mm"],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
|
|
|
":simple_shaders_mtl",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
|
|
|
name = "mps_sobel_calculator",
|
|
|
|
srcs = ["MPSSobelCalculator.mm"],
|
2020-12-10 04:13:05 +01:00
|
|
|
copts = ["-std=c++17"],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
|
|
|
"//third_party/apple_frameworks:MetalPerformanceShaders",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2021-02-27 09:21:16 +01:00
|
|
|
objc_library(
|
|
|
|
name = "mps_threshold_calculator",
|
|
|
|
srcs = ["MPSThresholdCalculator.mm"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":MPPMetalHelper",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
2022-12-07 00:16:42 +01:00
|
|
|
"//third_party/apple_frameworks:CoreVideo",
|
|
|
|
"//third_party/apple_frameworks:Metal",
|
|
|
|
"//third_party/apple_frameworks:MetalPerformanceShaders",
|
2021-02-27 09:21:16 +01:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2023-07-06 23:17:34 +02:00
|
|
|
MIN_IOS_VERSION = "12.0"
|
2019-08-17 03:49:25 +02:00
|
|
|
|
|
|
|
test_suite(
|
|
|
|
name = "ios",
|
|
|
|
tags = ["ios"],
|
|
|
|
)
|
|
|
|
|
|
|
|
test_suite(
|
|
|
|
name = "metal",
|
|
|
|
tags = ["metal"],
|
|
|
|
)
|
|
|
|
|
|
|
|
objc_library(
|
|
|
|
name = "gl_ios_test_lib",
|
|
|
|
testonly = 1,
|
|
|
|
srcs = [
|
|
|
|
"gl_ios_test.mm",
|
2022-11-23 19:13:48 +01:00
|
|
|
"metal_shared_resources_test.mm",
|
2019-08-17 03:49:25 +02:00
|
|
|
],
|
|
|
|
copts = [
|
|
|
|
"-Wno-shorten-64-to-32",
|
|
|
|
],
|
|
|
|
data = [
|
|
|
|
"//mediapipe/objc:testdata/googlelogo_color_272x92dp.png",
|
|
|
|
],
|
2022-03-21 20:07:37 +01:00
|
|
|
features = ["-layering_check"],
|
2019-08-17 03:49:25 +02:00
|
|
|
deps = [
|
|
|
|
":gl_scaler_calculator",
|
|
|
|
":gpu_buffer_to_image_frame_calculator",
|
|
|
|
":gpu_shared_data_internal",
|
|
|
|
":image_frame_to_gpu_buffer_calculator",
|
2023-03-29 21:32:28 +02:00
|
|
|
":metal_shared_resources",
|
|
|
|
"//mediapipe/framework/port:threadpool",
|
|
|
|
"//mediapipe/framework/tool:source",
|
2019-08-17 03:49:25 +02:00
|
|
|
"//mediapipe/objc:MPPGraphTestBase",
|
|
|
|
"//mediapipe/objc:mediapipe_framework_ios",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
] + select({
|
|
|
|
"//mediapipe:ios_i386": [],
|
|
|
|
"//mediapipe:ios_x86_64": [],
|
|
|
|
"//conditions:default": [
|
|
|
|
":metal_rgb_weight_calculator",
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
ios_unit_test(
|
|
|
|
name = "gl_ios_test",
|
|
|
|
minimum_os_version = MIN_IOS_VERSION,
|
2020-10-16 11:40:55 +02:00
|
|
|
runner = "//testing/utp/ios:IOS_LATEST",
|
2019-08-17 03:49:25 +02:00
|
|
|
tags = [
|
|
|
|
"ios",
|
|
|
|
],
|
|
|
|
deps = [":gl_ios_test_lib"],
|
|
|
|
)
|
2022-09-28 22:35:30 +02:00
|
|
|
|
|
|
|
mediapipe_cc_test(
|
|
|
|
name = "gpu_buffer_storage_ahwb_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["gpu_buffer_storage_ahwb_test.cc"],
|
|
|
|
exclude_platforms = [
|
|
|
|
"ios",
|
|
|
|
"wasm",
|
|
|
|
],
|
|
|
|
requires_full_emulation = True,
|
|
|
|
deps = [
|
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage_ahwb",
|
|
|
|
"//mediapipe/framework/port:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
2023-01-27 17:49:28 +01:00
|
|
|
|
|
|
|
mediapipe_cc_test(
|
|
|
|
name = "gpu_buffer_storage_yuv_image_test",
|
|
|
|
size = "small",
|
|
|
|
srcs = ["gpu_buffer_storage_yuv_image_test.cc"],
|
|
|
|
exclude_platforms = [
|
|
|
|
"ios",
|
|
|
|
],
|
|
|
|
deps = [
|
2023-03-06 11:16:07 +01:00
|
|
|
":gpu_buffer",
|
2023-01-27 17:49:28 +01:00
|
|
|
":gpu_buffer_format",
|
|
|
|
":gpu_buffer_storage_yuv_image",
|
2023-03-06 11:16:07 +01:00
|
|
|
"//mediapipe/framework/formats:image_frame",
|
|
|
|
"//mediapipe/framework/formats:yuv_image",
|
2023-01-27 17:49:28 +01:00
|
|
|
"//mediapipe/framework/port:gtest_main",
|
2023-03-06 11:16:07 +01:00
|
|
|
"//third_party/libyuv",
|
2023-01-27 17:49:28 +01:00
|
|
|
],
|
|
|
|
)
|