Project import generated by Copybara.
GitOrigin-RevId: d8caa66de45839696f5bd0786ad3bfbcb9cff632
This commit is contained in:
@@ -244,6 +244,7 @@ objc_library(
|
||||
hdrs = ["pixel_buffer_pool_util.h"],
|
||||
copts = [
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Accelerate",
|
||||
@@ -266,6 +267,7 @@ objc_library(
|
||||
copts = [
|
||||
"-x objective-c++",
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
@@ -300,6 +302,7 @@ objc_library(
|
||||
copts = [
|
||||
"-x objective-c++",
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
@@ -581,6 +584,7 @@ objc_library(
|
||||
hdrs = HELPER_COMMON_HDRS,
|
||||
copts = [
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
sdk_frameworks = HELPER_IOS_FRAMEWORKS,
|
||||
visibility = ["//visibility:public"],
|
||||
@@ -604,6 +608,7 @@ objc_library(
|
||||
hdrs = ["MPPMetalHelper.h"],
|
||||
copts = [
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
@@ -816,6 +821,7 @@ mediapipe_cc_proto_library(
|
||||
objc_library(
|
||||
name = "metal_copy_calculator",
|
||||
srcs = ["MetalCopyCalculator.mm"],
|
||||
copts = ["-std=c++17"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -833,6 +839,7 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_rgb_weight_calculator",
|
||||
srcs = ["MetalRgbWeightCalculator.mm"],
|
||||
copts = ["-std=c++17"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -849,6 +856,7 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_sobel_calculator",
|
||||
srcs = ["MetalSobelCalculator.mm"],
|
||||
copts = ["-std=c++17"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -865,6 +873,7 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_sobel_compute_calculator",
|
||||
srcs = ["MetalSobelComputeCalculator.mm"],
|
||||
copts = ["-std=c++17"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -881,6 +890,7 @@ objc_library(
|
||||
objc_library(
|
||||
name = "mps_sobel_calculator",
|
||||
srcs = ["MPSSobelCalculator.mm"],
|
||||
copts = ["-std=c++17"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -915,6 +925,7 @@ objc_library(
|
||||
],
|
||||
copts = [
|
||||
"-Wno-shorten-64-to-32",
|
||||
"-std=c++17",
|
||||
],
|
||||
data = [
|
||||
"//mediapipe/objc:testdata/googlelogo_color_272x92dp.png",
|
||||
|
||||
@@ -94,7 +94,12 @@ GlContext::StatusOrGlContext GlContext::Create(EGLContext share_context,
|
||||
EGL_RENDERABLE_TYPE, gl_version == 3 ? EGL_OPENGL_ES3_BIT_KHR
|
||||
: EGL_OPENGL_ES2_BIT,
|
||||
// Allow rendering to pixel buffers or directly to windows.
|
||||
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
|
||||
EGL_SURFACE_TYPE,
|
||||
#ifdef MEDIAPIPE_OMIT_EGL_WINDOW_BIT
|
||||
EGL_PBUFFER_BIT,
|
||||
#else
|
||||
EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
|
||||
#endif
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
@@ -114,7 +119,7 @@ GlContext::StatusOrGlContext GlContext::Create(EGLContext share_context,
|
||||
<< eglGetError();
|
||||
}
|
||||
if (!num_configs) {
|
||||
return ::mediapipe::UnknownErrorBuilder(MEDIAPIPE_LOC)
|
||||
return mediapipe::UnknownErrorBuilder(MEDIAPIPE_LOC)
|
||||
<< "eglChooseConfig() returned no matching EGL configuration for "
|
||||
<< "RGBA8888 D16 ES" << gl_version << " request. ";
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
|
||||
#include "mediapipe/objc/CFHolder.h"
|
||||
#if !TARGET_OS_OSX
|
||||
#define MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER 1
|
||||
#endif // TARGET_OS_OSX
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
|
||||
@@ -73,12 +73,16 @@ const GlTextureInfo& GlTextureInfoForGpuBufferFormat(GpuBufferFormat format,
|
||||
{GpuBufferFormat::kBGRA32,
|
||||
{
|
||||
// internal_format, format, type, downscale
|
||||
#ifdef __APPLE__
|
||||
// On Apple platforms, the preferred transfer format is BGRA.
|
||||
#if MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
// On Apple platforms, we have different code paths for iOS
|
||||
// (using CVPixelBuffer) and on macOS (using GlTextureBuffer).
|
||||
// When using CVPixelBuffer, the preferred transfer format is
|
||||
// BGRA.
|
||||
// TODO: Check iOS simulator.
|
||||
{GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 1},
|
||||
#else
|
||||
{GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 1},
|
||||
#endif // __APPLE__
|
||||
#endif // MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
}},
|
||||
{GpuBufferFormat::kOneComponent8,
|
||||
{
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
#if !TARGET_OS_OSX
|
||||
#define MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER 1
|
||||
#endif // TARGET_OS_OSX
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#include "mediapipe/framework/formats/image_format.pb.h"
|
||||
|
||||
@@ -147,7 +147,8 @@ class GpuBufferMultiPool {
|
||||
|
||||
#ifdef __APPLE__
|
||||
// Texture caches used with this pool.
|
||||
std::vector<CFHolder<CVTextureCacheType>> texture_caches_ GUARDED_BY(mutex_);
|
||||
std::vector<CFHolder<CVTextureCacheType>> texture_caches_
|
||||
ABSL_GUARDED_BY(mutex_);
|
||||
#endif // defined(__APPLE__)
|
||||
};
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ GpuResources::~GpuResources() {
|
||||
#endif
|
||||
}
|
||||
|
||||
::mediapipe::Status GpuResources::PrepareGpuNode(CalculatorNode* node) {
|
||||
mediapipe::Status GpuResources::PrepareGpuNode(CalculatorNode* node) {
|
||||
CHECK(node->UsesGpu());
|
||||
std::string node_id = node->GetCalculatorState().NodeName();
|
||||
std::string node_type = node->GetCalculatorState().CalculatorType();
|
||||
|
||||
@@ -69,7 +69,7 @@ class GpuResources {
|
||||
MPPGraphGPUData* ios_gpu_data();
|
||||
#endif // defined(__APPLE__)§
|
||||
|
||||
::mediapipe::Status PrepareGpuNode(CalculatorNode* node);
|
||||
mediapipe::Status PrepareGpuNode(CalculatorNode* node);
|
||||
|
||||
// If the node requires custom GPU executors in the current configuration,
|
||||
// returns the executor's names and the executors themselves.
|
||||
|
||||
Reference in New Issue
Block a user