Project import generated by Copybara.
GitOrigin-RevId: 1138530ad1578c5d6615b3e3d041775c75d310c4
This commit is contained in:
@@ -160,7 +160,6 @@ cc_library(
|
||||
"//conditions:default": [],
|
||||
"//mediapipe:apple": [
|
||||
"-x objective-c++",
|
||||
"-std=c++11",
|
||||
"-fobjc-arc",
|
||||
],
|
||||
}),
|
||||
@@ -245,7 +244,6 @@ objc_library(
|
||||
srcs = ["pixel_buffer_pool_util.mm"],
|
||||
hdrs = ["pixel_buffer_pool_util.h"],
|
||||
copts = [
|
||||
"-std=c++11",
|
||||
"-Wno-shorten-64-to-32",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
@@ -263,7 +261,6 @@ objc_library(
|
||||
hdrs = ["MPPGraphGPUData.h"],
|
||||
copts = [
|
||||
"-x objective-c++",
|
||||
"-std=c++11",
|
||||
"-Wno-shorten-64-to-32",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
@@ -541,7 +538,6 @@ objc_library(
|
||||
srcs = HELPER_COMMON_SRCS + HELPER_IOS_SRCS,
|
||||
hdrs = HELPER_COMMON_HDRS,
|
||||
copts = [
|
||||
"-std=c++11",
|
||||
"-Wno-shorten-64-to-32",
|
||||
],
|
||||
sdk_frameworks = HELPER_IOS_FRAMEWORKS,
|
||||
@@ -565,7 +561,6 @@ objc_library(
|
||||
srcs = ["MPPMetalHelper.mm"],
|
||||
hdrs = ["MPPMetalHelper.h"],
|
||||
copts = [
|
||||
"-std=c++11",
|
||||
"-Wno-shorten-64-to-32",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
@@ -779,7 +774,6 @@ mediapipe_cc_proto_library(
|
||||
objc_library(
|
||||
name = "metal_copy_calculator",
|
||||
srcs = ["MetalCopyCalculator.mm"],
|
||||
copts = ["-std=c++11"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -797,7 +791,6 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_rgb_weight_calculator",
|
||||
srcs = ["MetalRgbWeightCalculator.mm"],
|
||||
copts = ["-std=c++11"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -814,7 +807,6 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_sobel_calculator",
|
||||
srcs = ["MetalSobelCalculator.mm"],
|
||||
copts = ["-std=c++11"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -831,7 +823,6 @@ objc_library(
|
||||
objc_library(
|
||||
name = "metal_sobel_compute_calculator",
|
||||
srcs = ["MetalSobelComputeCalculator.mm"],
|
||||
copts = ["-std=c++11"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -848,7 +839,6 @@ objc_library(
|
||||
objc_library(
|
||||
name = "mps_sobel_calculator",
|
||||
srcs = ["MPSSobelCalculator.mm"],
|
||||
copts = ["-std=c++11"],
|
||||
sdk_frameworks = [
|
||||
"CoreVideo",
|
||||
"Metal",
|
||||
@@ -882,7 +872,6 @@ objc_library(
|
||||
"gl_ios_test.mm",
|
||||
],
|
||||
copts = [
|
||||
"-std=c++11",
|
||||
"-Wno-shorten-64-to-32",
|
||||
],
|
||||
data = [
|
||||
|
||||
@@ -206,7 +206,7 @@ bool GlContext::ParseGlVersion(absl::string_view version_string, GLint* major,
|
||||
::mediapipe::Status GlContext::FinishInitialization(bool create_thread) {
|
||||
if (create_thread) {
|
||||
thread_ = absl::make_unique<GlContext::DedicatedThread>();
|
||||
RETURN_IF_ERROR(thread_->Run([this] { return EnterContext(nullptr); }));
|
||||
MP_RETURN_IF_ERROR(thread_->Run([this] { return EnterContext(nullptr); }));
|
||||
}
|
||||
|
||||
return Run([this]() -> ::mediapipe::Status {
|
||||
@@ -294,7 +294,7 @@ void GlContext::SetProfilingContext(
|
||||
LogUncheckedGlErrors(had_gl_errors);
|
||||
} else {
|
||||
ContextBinding saved_context;
|
||||
RETURN_IF_ERROR(EnterContext(&saved_context));
|
||||
MP_RETURN_IF_ERROR(EnterContext(&saved_context));
|
||||
if (profiling_helper_) {
|
||||
profiling_helper_->MarkTimestamp(node_id, input_timestamp,
|
||||
/*is_finish=*/false);
|
||||
@@ -305,7 +305,7 @@ void GlContext::SetProfilingContext(
|
||||
/*is_finish=*/true);
|
||||
}
|
||||
LogUncheckedGlErrors(CheckForGlErrors());
|
||||
RETURN_IF_ERROR(ExitContext(&saved_context));
|
||||
MP_RETURN_IF_ERROR(ExitContext(&saved_context));
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ std::weak_ptr<GlContext>& GlContext::CurrentContext() {
|
||||
// old one (we may be deliberately trying to exit it).
|
||||
// 2. We need to unset the old context before we unlock the old mutex,
|
||||
// Therefore, we first unset the old one before setting the new one.
|
||||
RETURN_IF_ERROR(SetCurrentContextBinding({}));
|
||||
MP_RETURN_IF_ERROR(SetCurrentContextBinding({}));
|
||||
old_context_obj->context_use_mutex_.Unlock();
|
||||
CurrentContext().reset();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ GlContext::StatusOrGlContext GlContext::Create(EAGLContext* share_context,
|
||||
GlContext::StatusOrGlContext GlContext::Create(EAGLSharegroup* sharegroup,
|
||||
bool create_thread) {
|
||||
std::shared_ptr<GlContext> context(new GlContext());
|
||||
RETURN_IF_ERROR(context->CreateContext(sharegroup));
|
||||
RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
MP_RETURN_IF_ERROR(context->CreateContext(sharegroup));
|
||||
MP_RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
return std::move(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ GlContext::StatusOrGlContext GlContext::Create(const GlContext& share_context,
|
||||
GlContext::StatusOrGlContext GlContext::Create(EGLContext share_context,
|
||||
bool create_thread) {
|
||||
std::shared_ptr<GlContext> context(new GlContext());
|
||||
RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
MP_RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
MP_RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
return std::move(context);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ GlContext::StatusOrGlContext GlContext::Create(EGLContext share_context,
|
||||
LOG(WARNING) << "Fall back on OpenGL ES 2.";
|
||||
status = CreateContextInternal(external_context, 2);
|
||||
}
|
||||
RETURN_IF_ERROR(status);
|
||||
MP_RETURN_IF_ERROR(status);
|
||||
|
||||
EGLint pbuffer_attr[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE};
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ GlContext::StatusOrGlContext GlContext::Create(const GlContext& share_context,
|
||||
GlContext::StatusOrGlContext GlContext::Create(NSOpenGLContext* share_context,
|
||||
bool create_thread) {
|
||||
std::shared_ptr<GlContext> context(new GlContext());
|
||||
RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
MP_RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
MP_RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
return std::move(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ GlContext::StatusOrGlContext GlContext::Create(const GlContext& share_context,
|
||||
GlContext::StatusOrGlContext GlContext::Create(
|
||||
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE share_context, bool create_thread) {
|
||||
std::shared_ptr<GlContext> context(new GlContext());
|
||||
RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
MP_RETURN_IF_ERROR(context->CreateContext(share_context));
|
||||
MP_RETURN_IF_ERROR(context->FinishInitialization(create_thread));
|
||||
return std::move(context);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ GlContext::StatusOrGlContext GlContext::Create(
|
||||
LOG(WARNING) << "Fall back on WebGL 1.";
|
||||
status = CreateContextInternal(external_context, 1);
|
||||
}
|
||||
RETURN_IF_ERROR(status);
|
||||
MP_RETURN_IF_ERROR(status);
|
||||
|
||||
LOG(INFO) << "Successfully created a WebGL Context with major version "
|
||||
<< gl_major_version_ << " and context " << context_;
|
||||
|
||||
@@ -102,7 +102,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
if (cc->Inputs().HasTag("ROTATION")) {
|
||||
cc->Inputs().Tag("ROTATION").Set<int>();
|
||||
}
|
||||
RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
MP_RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
|
||||
if (cc->InputSidePackets().HasTag("OPTIONS")) {
|
||||
cc->InputSidePackets().Tag("OPTIONS").Set<GlScalerCalculatorOptions>();
|
||||
@@ -130,7 +130,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
cc->SetOffset(mediapipe::TimestampDiff(0));
|
||||
|
||||
// Let the helper access the GL context information.
|
||||
RETURN_IF_ERROR(helper_.Open(cc));
|
||||
MP_RETURN_IF_ERROR(helper_.Open(cc));
|
||||
|
||||
int rotation_ccw = 0;
|
||||
const auto& options =
|
||||
@@ -171,7 +171,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
rotation_ccw = cc->InputSidePackets().Tag("ROTATION").Get<int>();
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(FrameRotationFromInt(&rotation_, rotation_ccw));
|
||||
MP_RETURN_IF_ERROR(FrameRotationFromInt(&rotation_, rotation_ccw));
|
||||
|
||||
return ::mediapipe::OkStatus();
|
||||
}
|
||||
@@ -188,7 +188,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
input.format() == GpuBufferFormat::kBiPlanar420YpCbCr8FullRange) {
|
||||
if (!yuv_renderer_) {
|
||||
yuv_renderer_ = absl::make_unique<QuadRenderer>();
|
||||
RETURN_IF_ERROR(yuv_renderer_->GlSetup(
|
||||
MP_RETURN_IF_ERROR(yuv_renderer_->GlSetup(
|
||||
kYUV2TexToRGBFragmentShader, {"video_frame_y", "video_frame_uv"}));
|
||||
}
|
||||
renderer = yuv_renderer_.get();
|
||||
@@ -202,7 +202,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
if (src1.target() == GL_TEXTURE_EXTERNAL_OES) {
|
||||
if (!ext_rgb_renderer_) {
|
||||
ext_rgb_renderer_ = absl::make_unique<QuadRenderer>();
|
||||
RETURN_IF_ERROR(ext_rgb_renderer_->GlSetup(
|
||||
MP_RETURN_IF_ERROR(ext_rgb_renderer_->GlSetup(
|
||||
kBasicTexturedFragmentShaderOES, {"video_frame"}));
|
||||
}
|
||||
renderer = ext_rgb_renderer_.get();
|
||||
@@ -211,7 +211,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
{
|
||||
if (!rgb_renderer_) {
|
||||
rgb_renderer_ = absl::make_unique<QuadRenderer>();
|
||||
RETURN_IF_ERROR(rgb_renderer_->GlSetup());
|
||||
MP_RETURN_IF_ERROR(rgb_renderer_->GlSetup());
|
||||
}
|
||||
renderer = rgb_renderer_.get();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
// Override input side packet if ROTATION input packet is provided.
|
||||
if (cc->Inputs().HasTag("ROTATION")) {
|
||||
int rotation_ccw = cc->Inputs().Tag("ROTATION").Get<int>();
|
||||
RETURN_IF_ERROR(FrameRotationFromInt(&rotation_, rotation_ccw));
|
||||
MP_RETURN_IF_ERROR(FrameRotationFromInt(&rotation_, rotation_ccw));
|
||||
}
|
||||
|
||||
int dst_width;
|
||||
@@ -255,7 +255,7 @@ REGISTER_CALCULATOR(GlScalerCalculator);
|
||||
glBindTexture(src2.target(), src2.name());
|
||||
}
|
||||
|
||||
RETURN_IF_ERROR(renderer->GlRender(
|
||||
MP_RETURN_IF_ERROR(renderer->GlRender(
|
||||
src1.width(), src1.height(), dst.width(), dst.height(), scale_mode_,
|
||||
rotation_, horizontal_flip_output_, vertical_flip_output_,
|
||||
/*flip_texture*/ false));
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace mediapipe {
|
||||
return RunInGlContext([this, cc]() -> ::mediapipe::Status {
|
||||
const auto& input = TagOrIndex(cc->Inputs(), "VIDEO", 0).Get<GpuBuffer>();
|
||||
if (!initialized_) {
|
||||
RETURN_IF_ERROR(GlSetup());
|
||||
MP_RETURN_IF_ERROR(GlSetup());
|
||||
initialized_ = true;
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace mediapipe {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(src.target(), src.name());
|
||||
|
||||
RETURN_IF_ERROR(GlBind());
|
||||
MP_RETURN_IF_ERROR(GlBind());
|
||||
// Run core program.
|
||||
RETURN_IF_ERROR(GlRender(src, dst));
|
||||
MP_RETURN_IF_ERROR(GlRender(src, dst));
|
||||
|
||||
glBindTexture(src.target(), 0);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ REGISTER_CALCULATOR(GlSurfaceSinkCalculator);
|
||||
const auto& input = TagOrIndex(cc->Inputs(), "VIDEO", 0).Get<GpuBuffer>();
|
||||
if (!initialized_) {
|
||||
renderer_ = absl::make_unique<QuadRenderer>();
|
||||
RETURN_IF_ERROR(renderer_->GlSetup());
|
||||
MP_RETURN_IF_ERROR(renderer_->GlSetup());
|
||||
initialized_ = true;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ REGISTER_CALCULATOR(GlSurfaceSinkCalculator);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(src.target(), src.name());
|
||||
|
||||
RETURN_IF_ERROR(
|
||||
MP_RETURN_IF_ERROR(
|
||||
renderer_->GlRender(src.width(), src.height(), dst_width, dst_height,
|
||||
scale_mode_, FrameRotation::kNone,
|
||||
/*flip_horizontal=*/false, /*flip_vertical=*/false,
|
||||
|
||||
@@ -51,7 +51,7 @@ REGISTER_CALCULATOR(GpuBufferToImageFrameCalculator);
|
||||
// Note: we call this method even on platforms where we don't use the helper,
|
||||
// to ensure the calculator's contract is the same. In particular, the helper
|
||||
// enables support for the legacy side packet, which several graphs still use.
|
||||
RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
MP_RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
return ::mediapipe::OkStatus();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ REGISTER_CALCULATOR(GpuBufferToImageFrameCalculator);
|
||||
// as we receive a packet at.
|
||||
cc->SetOffset(TimestampDiff(0));
|
||||
#if !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
RETURN_IF_ERROR(helper_.Open(cc));
|
||||
MP_RETURN_IF_ERROR(helper_.Open(cc));
|
||||
#endif // MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
return ::mediapipe::OkStatus();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ REGISTER_CALCULATOR(ImageFrameToGpuBufferCalculator);
|
||||
// Note: we call this method even on platforms where we don't use the helper,
|
||||
// to ensure the calculator's contract is the same. In particular, the helper
|
||||
// enables support for the legacy side packet, which several graphs still use.
|
||||
RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
MP_RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));
|
||||
return ::mediapipe::OkStatus();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ REGISTER_CALCULATOR(ImageFrameToGpuBufferCalculator);
|
||||
// as we receive a packet at.
|
||||
cc->SetOffset(TimestampDiff(0));
|
||||
#if !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
RETURN_IF_ERROR(helper_.Open(cc));
|
||||
MP_RETURN_IF_ERROR(helper_.Open(cc));
|
||||
#endif // !MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
return ::mediapipe::OkStatus();
|
||||
}
|
||||
@@ -67,7 +67,7 @@ REGISTER_CALCULATOR(ImageFrameToGpuBufferCalculator);
|
||||
CalculatorContext* cc) {
|
||||
#if MEDIAPIPE_GPU_BUFFER_USE_CV_PIXEL_BUFFER
|
||||
CFHolder<CVPixelBufferRef> buffer;
|
||||
RETURN_IF_ERROR(CreateCVPixelBufferForImageFramePacket(
|
||||
MP_RETURN_IF_ERROR(CreateCVPixelBufferForImageFramePacket(
|
||||
cc->Inputs().Index(0).Value(), &buffer));
|
||||
cc->Outputs().Index(0).Add(new GpuBuffer(buffer), cc->InputTimestamp());
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user