build //mediapipe/render/module/beauty/ios:OlaFaceUnityFramework success

This commit is contained in:
Wang.Renzhu 2022-07-20 19:07:13 +08:00
parent b3bfcb1a3d
commit 5d80df4edb
56 changed files with 6261 additions and 14027 deletions

15
.vscode/settings.json vendored
View File

@ -49,6 +49,19 @@
"typeindex": "cpp", "typeindex": "cpp",
"typeinfo": "cpp", "typeinfo": "cpp",
"utility": "cpp", "utility": "cpp",
"variant": "cpp" "variant": "cpp",
"gpuimagemacros.h": "c",
"math.hpp": "c",
"ref.hpp": "c",
"util.h": "c",
"math_utils.hpp": "c",
"condition_variable": "cpp",
"ctime": "cpp",
"mutex": "cpp",
"ratio": "cpp",
"semaphore": "cpp",
"stop_token": "cpp",
"thread": "cpp",
"target.hpp": "c"
} }
} }

View File

@ -120,7 +120,10 @@ OLARENDER_SRCS = [
"IOSTarget.cpp", "IOSTarget.cpp",
"SourceCamera.cpp", "SourceCamera.cpp",
"TargetView.cpp", "TargetView.cpp",
"FilterGroup.cpp" "FilterGroup.cpp",
"dispatch_queue.cpp",
"GLThreadDispatch.cpp",
"OpipeDispatch.cpp",
] ]
OLARENDER_HDRS = [ OLARENDER_HDRS = [
@ -139,6 +142,9 @@ OLARENDER_HDRS = [
"SourceCamera.hpp", "SourceCamera.hpp",
"TargetView.hpp", "TargetView.hpp",
"FilterGroup.hpp", "FilterGroup.hpp",
"dispatch_queue.h",
"GLThreadDispatch.h",
"OpipeDispatch.hpp",
] ]

View File

@ -21,7 +21,7 @@ CVFramebuffer::CVFramebuffer(Context *context,
int width, int width,
int height, int height,
const TextureAttributes textureAttributes, const TextureAttributes textureAttributes,
GLuint textureId) : QImage::Framebuffer() GLuint textureId) : Opipe::Framebuffer()
{ {
_context = context; _context = context;
useTextureCache = true; useTextureCache = true;
@ -37,7 +37,7 @@ CVFramebuffer::CVFramebuffer(Context *context,
int width, int width,
int height, int height,
bool onlyGenerateTexture/* = false*/, bool onlyGenerateTexture/* = false*/,
const TextureAttributes textureAttributes) : QImage::Framebuffer() const TextureAttributes textureAttributes) : Opipe::Framebuffer()
{ {
_context = context; _context = context;
useTextureCache = true; useTextureCache = true;
@ -57,7 +57,7 @@ CVFramebuffer::CVFramebuffer(Context *context,
CVFramebuffer::CVFramebuffer(Context *context, CVFramebuffer::CVFramebuffer(Context *context,
int width, int height, int width, int height,
GLuint handle, IOSurfaceID surfaceID, GLuint handle, IOSurfaceID surfaceID,
const TextureAttributes textureAttributes) : QImage::Framebuffer() { const TextureAttributes textureAttributes) : Opipe::Framebuffer() {
_context = context; _context = context;
useTextureCache = true; useTextureCache = true;
_width = width; _width = width;
@ -352,7 +352,7 @@ void CVFramebuffer::_bindFramebuffer() {
CHECK_GL(glBindTexture(GL_TEXTURE_2D, 0)); CHECK_GL(glBindTexture(GL_TEXTURE_2D, 0));
CHECK_GL(glBindFramebuffer(GL_FRAMEBUFFER, 0)); CHECK_GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
// QImage::Log("Quaramera", "_generateFramebuffer %d ", _framebuffer); // Opipe::Log("Quaramera", "_generateFramebuffer %d ", _framebuffer);
assert(_framebuffer < 100); assert(_framebuffer < 100);
} }

View File

@ -16,10 +16,10 @@
#include "Ref.hpp" #include "Ref.hpp"
#include "Framebuffer.hpp" #include "Framebuffer.hpp"
namespace QImage { namespace Opipe {
class CVFramebuffer : public QImage::Framebuffer { class CVFramebuffer : public Opipe::Framebuffer {
public: public:
CVFramebuffer(Context *context, int width, int height, CVFramebuffer(Context *context, int width, int height,

View File

@ -344,7 +344,7 @@ void Context::EAGLContext::useAsCurrent()
#endif #endif
const GLfloat * Context::textureCoordinatesForRotation(QImage::RotationMode rotationMode) const GLfloat * Context::textureCoordinatesForRotation(Opipe::RotationMode rotationMode)
{ {
static const GLfloat noRotationTextureCoordinates[] = { static const GLfloat noRotationTextureCoordinates[] = {
0.0f, 0.0f, 0.0f, 0.0f,

View File

@ -53,7 +53,7 @@ public:
void purge(); void purge();
void cleanupFramebuffers(); void cleanupFramebuffers();
const GLfloat *textureCoordinatesForRotation(QImage::RotationMode rotationMode); const GLfloat *textureCoordinatesForRotation(Opipe::RotationMode rotationMode);
enum ContextType enum ContextType
{ {

View File

@ -27,7 +27,7 @@
#define useCVPB defined(__APPLE__) #define useCVPB defined(__APPLE__)
namespace QImage { namespace Opipe {
TextureAttributes Framebuffer::defaultTextureAttribures = TextureAttributes Framebuffer::defaultTextureAttribures =
{ {
.minFilter = GL_LINEAR, .minFilter = GL_LINEAR,
@ -88,7 +88,7 @@ namespace QImage {
if (isDealloc) { if (isDealloc) {
return; return;
} }
QImage::Log("Framebuffer", "delete Framebuffer(%d,%d) ", _width, _height); Opipe::Log("Framebuffer", "delete Framebuffer(%d,%d) ", _width, _height);
bool bDeleteTex = (_texture != -1); bool bDeleteTex = (_texture != -1);
bool bDeleteFB = (_framebuffer != -1); bool bDeleteFB = (_framebuffer != -1);
@ -229,7 +229,7 @@ namespace QImage {
CHECK_GL(glBindTexture(GL_TEXTURE_2D, 0)); CHECK_GL(glBindTexture(GL_TEXTURE_2D, 0));
CHECK_GL(glBindFramebuffer(GL_FRAMEBUFFER, 0)); CHECK_GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
// QImage::Log("QuarameraGL", "_generateFramebuffer %d ", _framebuffer); // Opipe::Log("QuarameraGL", "_generateFramebuffer %d ", _framebuffer);
} }
Context *Framebuffer::getContext() { Context *Framebuffer::getContext() {

View File

@ -29,7 +29,7 @@
#else #else
#define useCVFramebuffer false #define useCVFramebuffer false
#endif #endif
namespace QImage { namespace Opipe {
class Context; class Context;
class FramebufferCache { class FramebufferCache {

View File

@ -21,7 +21,7 @@
#include "Context.hpp" #include "Context.hpp"
#include "GPUImageUtil.h" #include "GPUImageUtil.h"
namespace QImage { namespace Opipe {
//std::vector<GLProgram*> GLProgram::_context->_programs; //std::vector<GLProgram*> GLProgram::_context->_programs;
@ -89,8 +89,8 @@ namespace QImage {
} else if (shaderType == GL_VERTEX_SHADER) { } else if (shaderType == GL_VERTEX_SHADER) {
shaderTypeStr = std::string("GL_VERTEX_SHADER"); shaderTypeStr = std::string("GL_VERTEX_SHADER");
} }
QImage::LogE("GPUImage-x", "LoadShader Could not compile shader type : %s \n because of %s", shaderTypeStr.c_str(), buf); Opipe::LogE("GPUImage-x", "LoadShader Could not compile shader type : %s \n because of %s", shaderTypeStr.c_str(), buf);
QImage::Log("GPUImage-x", "\n%s\n", pSource); Opipe::Log("GPUImage-x", "\n%s\n", pSource);
free(buf); free(buf);
} }
CHECK_GL(glDeleteShader(shader)); CHECK_GL(glDeleteShader(shader));
@ -132,7 +132,7 @@ namespace QImage {
char *buf = (char *) malloc((size_t) bufLength); char *buf = (char *) malloc((size_t) bufLength);
if (buf) { if (buf) {
CHECK_GL(glGetProgramInfoLog(_program, bufLength, NULL, buf)); CHECK_GL(glGetProgramInfoLog(_program, bufLength, NULL, buf));
QImage::LogE("GPUImage-x", "compile gl program error %s", buf); Opipe::LogE("GPUImage-x", "compile gl program error %s", buf);
free(buf); free(buf);
} }
} }

View File

@ -2,15 +2,11 @@
// Created by jormin on 2021/6/23. // Created by jormin on 2021/6/23.
// //
#if defined(__APPLE__)
#include "GLThreadDispatch.h" #include "GLThreadDispatch.h"
#else
#include "QStream/Dispatcher/GLThreadDispatch.h"
#endif
#include <assert.h> #include <assert.h>
using namespace QStream; using namespace Opipe;
GLThreadDispatch::GLThreadDispatch(std::thread::id glThreadId, DispatchAsyncFunction dispatchAsyncFunction) : _glThreadId(glThreadId), _dispatchAsync(dispatchAsyncFunction) { GLThreadDispatch::GLThreadDispatch(std::thread::id glThreadId, DispatchAsyncFunction dispatchAsyncFunction) : _glThreadId(glThreadId), _dispatchAsync(dispatchAsyncFunction) {

View File

@ -0,0 +1,34 @@
//
// Created by jormin on 2021/6/23.
//
#ifndef OPIPE_GLTHREADDISPATCH_H
#define OPIPE_GLTHREADDISPATCH_H
#include "thread"
namespace Opipe {
typedef std::function<void(void *id, std::function<void(void)> &func)> DispatchAsyncFunction;
class GLThreadDispatch {
public:
GLThreadDispatch(std::thread::id glThreadId, DispatchAsyncFunction dispatchAsyncFunction);
void runSync(void *host, std::function<void(void)> func);
void runAsync(void *host, std::function<void(void)> func);
private :
DispatchAsyncFunction _dispatchAsync = nullptr;
std::thread::id _glThreadId;
};
}
#endif //OPIPE_GLTHREADDISPATCH_H

View File

@ -20,9 +20,9 @@
#define GPUImageMacros_h #define GPUImageMacros_h
#define NS_GI_BEGIN namespace QImage { #define NS_GI_BEGIN namespace Opipe {
#define NS_GI_END } #define NS_GI_END }
#define USING_NS_GI using namespace QImage; #define USING_NS_GI using namespace Opipe;
#define STRINGIZE(x) #x #define STRINGIZE(x) #x
@ -53,7 +53,7 @@
case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \ case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \
default: break; \ default: break; \
} \ } \
QImage::Log("QuarameraGL", "GL ERROR 0x%04X %s in %s at line %i\n", e, \ Opipe::Log("QuarameraGL", "GL ERROR 0x%04X %s in %s at line %i\n", e, \
errorString.c_str(), __PRETTY_FUNCTION__, __LINE__); \ errorString.c_str(), __PRETTY_FUNCTION__, __LINE__); \
assert(0);\ assert(0);\
} \ } \

View File

@ -24,7 +24,7 @@
@required @required
- (void)update:(float)frameTime; - (void)update:(float)frameTime;
- (void)setInputFramebuffer:(QImage::Framebuffer*)inputFramebuffer withRotation:(QImage::RotationMode)rotationMode atIndex:(NSInteger)texIdx; - (void)setInputFramebuffer:(Opipe::Framebuffer*)inputFramebuffer withRotation:(Opipe::RotationMode)rotationMode atIndex:(NSInteger)texIdx;
@optional @optional
- (bool)isPrepared; - (bool)isPrepared;
- (void)unPrepared; - (void)unPrepared;

View File

@ -21,7 +21,7 @@
namespace QImage { namespace Opipe {
__attribute__((no_sanitize("address", "memory"))) __attribute__((no_sanitize("address", "memory")))

View File

@ -22,12 +22,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
namespace QImage { namespace Opipe {
std::string str_format(const char *fmt,...); std::string str_format(const char *fmt,...);
void Log(const std::string& tag, const std::string& format, ...); void Log(const std::string& tag, const std::string& format, ...);
void LogE(const std::string& tag, const std::string& format, ...); void LogE(const std::string& tag, const std::string& format, ...);
#define rotationSwapsSize(rotation) ((rotation) == QImage::RotateLeft || (rotation) == QImage::RotateRight || (rotation) == QImage::RotateRightFlipVertical || (rotation) == QImage::RotateRightFlipHorizontal) #define rotationSwapsSize(rotation) ((rotation) == Opipe::RotateLeft || (rotation) == Opipe::RotateRight || (rotation) == Opipe::RotateRightFlipVertical || (rotation) == Opipe::RotateRightFlipHorizontal)
}; };

View File

@ -0,0 +1,157 @@
//
// OpipeDispatch.cpp
// Quaramera
//
// Created by wangrenzhu2021 on 2021/12/14.
// Copyright © 2021 ola. All rights reserved.
//
#define LOG_TAG "OpipeDispatch"
#include "dispatch_queue.h"
#include "OpipeDispatch.hpp"
namespace Opipe {
OpipeDispatch::OpipeDispatch(Opipe::Context *context, void *id, Opipe::GLThreadDispatch *glDispatch) : _context(context) {
_id = id;
_contextQueueIO = new dispatch_queue("quaramera_io");
_contextQueueIO->dispatch_sync([&] {
_context->useAsCurrent(Opipe::Context::IOContext, true);
});
#if defined(__APPLE__)
_contextQueue = new dispatch_queue("com.ola.glContextQueue");
_contextQueue->dispatch_sync([&]
{
_context->useAsCurrent(Opipe::Context::GPUImageContext, true);
});
#endif
_contextQueueOffline = new dispatch_queue("quaramera_offline");
_contextQueueOffline->dispatch_sync([&] {
_context->useAsCurrent(Opipe::Context::OfflineRenderContext, true);
});
_glThreadDispatch = glDispatch;
}
OpipeDispatch::~OpipeDispatch() {
delete _contextQueueIO;
_contextQueueIO = 0;
#if defined(__APPLE__)
delete _contextQueue;
_contextQueue = 0;
#endif
delete _contextQueueOffline;
_contextQueueOffline = 0;
delete _glThreadDispatch;
_glThreadDispatch = 0;
}
void OpipeDispatch::flushSharedInstance() {
this->runSync([&] {});
this->runSync([&] {}, Opipe::Context::OfflineRenderContext);
this->runSync([&] {}, Opipe::Context::IOContext);
}
void OpipeDispatch::runSync(std::function<void(void)> func, Opipe::Context::ContextType type /* = GPUImageContext*/) {
if (type == Opipe::Context::IOContext) {
if (_contextQueueIO->isCurrent()) {
_context->useAsCurrent(type);
func();
} else {
_contextQueueIO->dispatch_sync([=] {
_context->useAsCurrent(type);
func();
});
}
} else if (type == Opipe::Context::OfflineRenderContext) {
if (_contextQueueOffline->isCurrent()) {
_context->useAsCurrent(type);
func();
} else {
_contextQueueOffline->dispatch_sync([=] {
_context->useAsCurrent(type);
func();
});
}
} else {
#if defined(__APPLE__)
if (_contextQueue->isCurrent()) {
_context->useAsCurrent(type);
func();
}
else {
_contextQueue->dispatch_sync([=]{
_context->useAsCurrent(type);
func();
});
}
#else
//优先使用外部注入的实现
if (_glThreadDispatch) {
_glThreadDispatch->runSync(_id, func);
return;
} else {
assert("not init gl_thread_dispatcher");
}
#endif
}
}
void OpipeDispatch::runAsync(std::function<void(void)> func, Opipe::Context::ContextType type /* = GPUImageContext*/, bool async/* = false*/) {
if (type == Opipe::Context::IOContext) {
if (!async && _contextQueueIO->isCurrent()) {
_context->useAsCurrent(type);
func();
} else {
_contextQueueIO->dispatch_async([=] {
_context->useAsCurrent(type);
func();
});
}
} else if (type == Opipe::Context::OfflineRenderContext) {
if (!async && _contextQueueOffline->isCurrent()) {
_context->useAsCurrent(type);
func();
} else {
_contextQueueOffline->dispatch_async([=] {
_context->useAsCurrent(type);
func();
});
}
} else {
#if defined(__APPLE__)
if (!async && _contextQueue->isCurrent())
{
_context->useAsCurrent(type);
func();
}
else
{
_contextQueue->dispatch_async([=]{
_context->useAsCurrent(type);
func();
});
}
#else
//优先使用外部注入的实现
if (_glThreadDispatch) {
_glThreadDispatch->runAsync(_id, func);
return;
} else {
assert("not init gl_thread_dispatcher");
}
#endif
}
}
}

View File

@ -0,0 +1,54 @@
//
// OpipeDispatch.hpp
// Quaramera
//
// Created by wangrenzhu2021 on 2021/12/14.
// Copyright © 2021 ola. All rights reserved.
//
#ifndef OpipeDispatch_hpp
#define OpipeDispatch_hpp
#include <stdio.h>
#include <condition_variable>
#include "Context.hpp"
#include "GLThreadDispatch.h"
class dispatch_queue;
namespace Opipe {
class OpipeDispatch {
public:
void flushSharedInstance();
public:
void runSync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext);
void runAsync(std::function<void(void)> func, Context::ContextType type = Context::GPUImageContext,
bool async = false);
void setGLThreadDispatch(GLThreadDispatch *glDispatch){
_glThreadDispatch = glDispatch;
}
OpipeDispatch(Context *context,
void *id = nullptr,
GLThreadDispatch *glDispatch = nullptr);
~OpipeDispatch();
private:
#if defined(__APPLE__)
dispatch_queue* _contextQueue;
#endif
dispatch_queue* _contextQueueOffline;
dispatch_queue* _contextQueueIO;
GLThreadDispatch* _glThreadDispatch = nullptr;
void* _id ;
public:
Context *_context;
};
}
#endif /* OpipeDispatch_hpp */

View File

@ -81,7 +81,7 @@ void SourceCamera::setIORenderTexture(IOSurfaceID surfaceID,
GLuint texture, GLuint texture,
int width, int width,
int height, int height,
QImage::RotationMode outputRotation, Opipe::RotationMode outputRotation,
SourceType sourceType, SourceType sourceType,
TextureAttributes textureAttributes) { TextureAttributes textureAttributes) {
//纹理发生变化使用新的framebuffer //纹理发生变化使用新的framebuffer

View File

@ -46,17 +46,17 @@ public:
virtual void setRenderTexture(GLuint texture, virtual void setRenderTexture(GLuint texture,
int width, int width,
int height, int height,
QImage::RotationMode outputRotation = QImage::RotationMode::NoRotation, Opipe::RotationMode outputRotation = Opipe::RotationMode::NoRotation,
SourceType sourceType = SourceType_RGBA, SourceType sourceType = SourceType_RGBA,
const QImage::TextureAttributes textureAttributes = QImage::Framebuffer::defaultTextureAttribures); const Opipe::TextureAttributes textureAttributes = Opipe::Framebuffer::defaultTextureAttribures);
#if defined(__APPLE__) #if defined(__APPLE__)
virtual void setIORenderTexture(IOSurfaceID surfaceID, virtual void setIORenderTexture(IOSurfaceID surfaceID,
GLuint texture, GLuint texture,
int width, int width,
int height, int height,
QImage::RotationMode outputRotation = QImage::RotationMode::NoRotation, Opipe::RotationMode outputRotation = Opipe::RotationMode::NoRotation,
SourceType sourceType = SourceType_RGBA, SourceType sourceType = SourceType_RGBA,
const QImage::TextureAttributes textureAttributes = QImage::Framebuffer::defaultTextureAttribures); const Opipe::TextureAttributes textureAttributes = Opipe::Framebuffer::defaultTextureAttribures);
#endif #endif

View File

@ -86,9 +86,6 @@ void Target::unPrepear() {
it != _inputFramebuffers.end(); ++it) { it != _inputFramebuffers.end(); ++it) {
if (!it->second.ignoreForPrepare) { if (!it->second.ignoreForPrepare) {
if (it->second.frameBuffer && !it->second.frameBuffer->isDealloc) { if (it->second.frameBuffer && !it->second.frameBuffer->isDealloc) {
Log("Target", "%s 渲染完毕 准备Unlock InputFramebuffers:%s",
typeid(*this).name(),
it->second.frameBuffer->_hashCode.c_str());
it->second.frameBuffer->unlock(typeid(*this).name()); it->second.frameBuffer->unlock(typeid(*this).name());
it->second.frameBuffer = 0; it->second.frameBuffer = 0;
} }

View File

@ -3,7 +3,7 @@
// //
// //
// Created by wangrenzhu on 2021/1/22. // Created by wangrenzhu on 2021/1/22.
// Copyright © 2021 alibaba. All rights reserved. // Copyright © 2021 ola. All rights reserved.
// //
#import <MetalKit/MetalKit.h> #import <MetalKit/MetalKit.h>
#import <simd/simd.h> #import <simd/simd.h>

View File

@ -3,7 +3,7 @@
// OlaCameraFramework // OlaCameraFramework
// //
// Created by wangrenzhu on 2021/1/21. // Created by wangrenzhu on 2021/1/21.
// Copyright © 2021 alibaba. All rights reserved. // Copyright © 2021 ola. All rights reserved.
// //
#import "OlaShareTexture.h" #import "OlaShareTexture.h"

View File

@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
cc_library( cc_library(
name = "FaceMeshGPULibrary", name = "FaceMeshGPULibrary",
copts = ["-std=c++17"],
srcs = [ srcs = [
"face_mesh_module.cc", "face_mesh_module.cc",
"face_mesh_beauty_render.cc", "face_mesh_beauty_render.cc",
@ -35,6 +34,6 @@ cc_library(
"-x objective-c++", "-x objective-c++",
"-fobjc-arc", # enable reference-counting "-fobjc-arc", # enable reference-counting
], ],
"//conditions:default": [], "//conditions:default": ["-std=c++17"],
}), }),
) )

View File

@ -0,0 +1 @@
#include "face_mesh_beauty_render.h"

View File

@ -0,0 +1,3 @@
namespace Opipe {
}

View File

@ -1,12 +1,24 @@
#include "face_mesh_module.h"
#include "face_mesh_module_imp.h" #include "face_mesh_module_imp.h"
namespace Opipe { namespace Opipe {
FaceMeshModule::FaceMeshModule() {
}
FaceMeshModule::~FaceMeshModule() { FaceMeshModule::~FaceMeshModule() {
} }
FaceMeshModule::FaceMeshModule() {
}
FaceMeshModule* FaceMeshModule::create() {
FaceMeshModuleIMP *instance = new FaceMeshModuleIMP();
return instance;
}
} }

View File

@ -1,9 +1,50 @@
#ifndef OPIPE_FaceMeshModule
#define OPIPE_FaceMeshModule
#include <stdio.h> #include <stdio.h>
#if defined(__APPLE__)
#import <OpenGLES/ES3/gl.h>
#import <OpenGLES/ES3/glext.h>
#import <CoreVideo/CoreVideo.h>
#elif defined(__ANDROID__) || defined(ANDROID)
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
#endif
namespace Opipe {
class FaceMeshModule { namespace Opipe
public: {
class FaceMeshModule
{
public:
FaceMeshModule(); FaceMeshModule();
~FaceMeshModule(); virtual ~FaceMeshModule();
FaceMeshModule* create();
// 暂停渲染
virtual void suspend() = 0;
// 恢复渲染
virtual void resume() = 0;
virtual bool init(void *env, void *binaryData, int size) = 0;
virtual void startModule() = 0;
virtual void stopModule() = 0;
virtual GLuint renderTexture(GLuint textureId, int64_t timeStamp, int width, int height) = 0;
#if defined(__APPLE__)
virtual void processVideoFrame(CVPixelBufferRef pixelbuffer, int64_t timeStamp) = 0;
#endif
virtual void processVideoFrame(char *pixelbuffer,
int width,
int height,
int step,
int64_t timeStamp) = 0;
}; };
} }
#endif

View File

@ -1,12 +1,133 @@
#include "mediapipe/render/core/Filter.hpp" #include "face_mesh_module_imp.h"
#include "face_mesh_module.hpp"
namespace Opipe { namespace Opipe
FaceMeshModuleIMP::FaceMeshModuleIMP() { {
FaceMeshCallFrameDelegate::FaceMeshCallFrameDelegate()
{
} }
FaceMeshModuleIMP::~FaceMeshModuleIMP() { FaceMeshCallFrameDelegate::~FaceMeshCallFrameDelegate()
{
} }
} #if defined(__APPLE__)
void FaceMeshCallFrameDelegate::outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer,
const std::string &streamName, int64_t timstamp)
{
}
#endif
void FaceMeshCallFrameDelegate::outputPacket(OlaGraph *graph, const mediapipe::Packet &packet,
MPPPacketType packetType, const std::string &streamName)
{
}
FaceMeshModuleIMP::FaceMeshModuleIMP()
{
}
FaceMeshModuleIMP::~FaceMeshModuleIMP()
{
}
void FaceMeshModuleIMP::suspend()
{
}
void FaceMeshModuleIMP::resume()
{
}
bool FaceMeshModuleIMP::init(void *env, void *binaryData,
int size)
{
std::string graphName = "face_mesh_mobile_gpu";
_delegate = std::make_shared<FaceMeshCallFrameDelegate>();
mediapipe::CalculatorGraphConfig config;
config.ParseFromArray(binaryData, size);
_context = std::make_unique<Context>();
#if defined(__ANDROID__)
_context->initEGLContext(env);
#endif
_dispatch = std::make_unique<OpipeDispatch>(_context.get(), nullptr, nullptr);
_graph = std::make_unique<OlaGraph>(config);
_graph->setDelegate(_delegate);
return true;
}
void FaceMeshModuleIMP::startModule()
{
if (!_isInit)
{
return;
}
_dispatch->runSync([&] {
_graph->start();
}, Context::IOContext);
}
void FaceMeshModuleIMP::stopModule()
{
if (!_isInit)
{
return;
}
_dispatch->runSync([&] {
_graph->setDelegate(nullptr);
_graph->cancel();
_graph->closeAllInputStreams();
_graph->waitUntilDone();
}, Context::IOContext);
}
#if defined(__APPLE__)
void FaceMeshModuleIMP::processVideoFrame(CVPixelBufferRef pixelbuffer,
int64_t timeStamp)
{
if (!_isInit)
{
return;
}
_dispatch->runAsync([&] {
Timestamp ts(timeStamp);
_graph->sendPixelBuffer(pixelbuffer, "input_video",
MPPPacketTypePixelBuffer,
ts);
}, Context::IOContext);
}
#endif
void FaceMeshModuleIMP::processVideoFrame(char *pixelbuffer,
int width,
int height,
int step,
int64_t timeStamp)
{
if (!_isInit)
{
return;
}
}
GLuint FaceMeshModuleIMP::renderTexture(GLuint textureId,
int64_t timeStamp,
int width, int height)
{
if (!_isInit)
{
return textureId;
}
_dispatch->runAsync([&] {
});
return textureId;
}
}

View File

@ -1,10 +1,62 @@
#include "mediapipe/render/module/common/OlaGraph.hpp" #include "mediapipe/render/module/common/ola_graph.h"
#include "mediapipe/render/module/beauty/face_mesh_module.h" #include "mediapipe/render/core/OpipeDispatch.hpp"
#include "face_mesh_module.h"
namespace Opipe { namespace Opipe
class FaceMeshModuleIMP : public FaceMeshModule { {
public: class FaceMeshCallFrameDelegate : public MPPGraphDelegate
{
public:
FaceMeshCallFrameDelegate();
~FaceMeshCallFrameDelegate();
#if defined(__APPLE__)
void outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer,
const std::string &streamName, int64_t timstamp) override;
#endif
void outputPacket(OlaGraph *graph, const mediapipe::Packet &packet,
MPPPacketType packetType, const std::string &streamName) override;
};
class FaceMeshModuleIMP : public FaceMeshModule
{
public:
FaceMeshModuleIMP(); FaceMeshModuleIMP();
~FaceMeshModuleIMP(); ~FaceMeshModuleIMP();
// 暂停渲染
virtual void suspend() override;
// 恢复渲染
virtual void resume() override;
// env iOS给空
virtual bool init(void *env, void *binaryData, int size) override;
virtual void startModule() override;
virtual void stopModule() override;
#if defined(__APPLE__)
/// 算法流输入
/// @param pixelbuffer pixelbuffer description
/// @param timeStamp timeStamp description
virtual void processVideoFrame(CVPixelBufferRef pixelbuffer, int64_t timeStamp) override;
#endif
virtual void processVideoFrame(char *pixelbuffer,
int width,
int height,
int step,
int64_t timeStamp) override;
virtual GLuint renderTexture(GLuint textureId, int64_t timeStamp, int width, int height) override;
private:
std::unique_ptr<OpipeDispatch> _dispatch;
std::unique_ptr<OlaGraph> _graph;
std::unique_ptr<Context> _context;
bool _isInit = false;
std::shared_ptr<FaceMeshCallFrameDelegate> _delegate;
}; };
} }

View File

@ -19,7 +19,6 @@ objc_library(
srcs = ["OlaFaceUnity.mm"], srcs = ["OlaFaceUnity.mm"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//mediapipe/render/core:core-ios",
"//mediapipe/render/module/beauty:FaceMeshGPULibrary", "//mediapipe/render/module/beauty:FaceMeshGPULibrary",
"@ios_opencv//:OpencvFramework", "@ios_opencv//:OpencvFramework",
], ],

View File

@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
@interface OlaFaceUnity : NSObject
@end

View File

@ -144,15 +144,20 @@ BUILD_SETTINGS = BazelBuildSettings(
'/private/var/tmp/_bazel_wangrenzhu/b244be861f40c753b454f38ce4e943dc', '/private/var/tmp/_bazel_wangrenzhu/b244be861f40c753b454f38ce4e943dc',
'ios_arm64', 'ios_arm64',
{ {
'ios_arm64': [
'--apple_platform_type=ios',
'--cpu=ios_arm64',
'--watchos_cpus=armv7k,arm64_32',
],
'watchos_arm64_32': [
'--apple_platform_type=watchos',
'--watchos_cpus=armv7k,arm64_32',
],
'ios_sim_arm64': [ 'ios_sim_arm64': [
'--apple_platform_type=ios', '--apple_platform_type=ios',
'--cpu=ios_sim_arm64', '--cpu=ios_sim_arm64',
'--watchos_cpus=armv7k', '--watchos_cpus=armv7k',
], ],
'macos_x86_64': [
'--apple_platform_type=macos',
'--cpu=darwin_x86_64',
],
'macos_arm64': [ 'macos_arm64': [
'--apple_platform_type=macos', '--apple_platform_type=macos',
'--cpu=darwin_arm64', '--cpu=darwin_arm64',
@ -161,20 +166,36 @@ BUILD_SETTINGS = BazelBuildSettings(
'--apple_platform_type=watchos', '--apple_platform_type=watchos',
'--watchos_cpus=armv7k,arm64_32', '--watchos_cpus=armv7k,arm64_32',
], ],
'watchos_x86_64': [ 'macos_x86_64': [
'--apple_platform_type=watchos', '--apple_platform_type=macos',
'--watchos_cpus=i386', '--cpu=darwin_x86_64',
],
'ios_arm64': [
'--apple_platform_type=ios',
'--cpu=ios_arm64',
'--watchos_cpus=armv7k,arm64_32',
], ],
'ios_x86_64': [ 'ios_x86_64': [
'--apple_platform_type=ios', '--apple_platform_type=ios',
'--cpu=ios_x86_64', '--cpu=ios_x86_64',
'--watchos_cpus=i386', '--watchos_cpus=i386',
], ],
'macos_arm64e': [
'--apple_platform_type=macos',
'--cpu=darwin_arm64e',
],
'tvos_x86_64': [
'--apple_platform_type=tvos',
'--tvos_cpus=x86_64',
],
'ios_i386': [
'--apple_platform_type=ios',
'--cpu=ios_i386',
'--watchos_cpus=i386',
],
'tvos_arm64': [
'--apple_platform_type=tvos',
'--tvos_cpus=arm64',
],
'watchos_x86_64': [
'--apple_platform_type=watchos',
'--watchos_cpus=i386',
],
'ios_armv7': [ 'ios_armv7': [
'--apple_platform_type=ios', '--apple_platform_type=ios',
'--cpu=ios_armv7', '--cpu=ios_armv7',
@ -184,32 +205,11 @@ BUILD_SETTINGS = BazelBuildSettings(
'--apple_platform_type=watchos', '--apple_platform_type=watchos',
'--watchos_cpus=i386', '--watchos_cpus=i386',
], ],
'watchos_arm64_32': [
'--apple_platform_type=watchos',
'--watchos_cpus=armv7k,arm64_32',
],
'tvos_arm64': [
'--apple_platform_type=tvos',
'--tvos_cpus=arm64',
],
'tvos_x86_64': [
'--apple_platform_type=tvos',
'--tvos_cpus=x86_64',
],
'ios_arm64e': [ 'ios_arm64e': [
'--apple_platform_type=ios', '--apple_platform_type=ios',
'--cpu=ios_arm64e', '--cpu=ios_arm64e',
'--watchos_cpus=armv7k,arm64_32', '--watchos_cpus=armv7k,arm64_32',
], ],
'macos_arm64e': [
'--apple_platform_type=macos',
'--cpu=darwin_arm64e',
],
'ios_i386': [
'--apple_platform_type=ios',
'--cpu=ios_i386',
'--watchos_cpus=i386',
],
}, },
set(), set(),
BazelFlagsSet( BazelFlagsSet(

View File

@ -10,7 +10,5 @@
<true/> <true/>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key> <key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/> <false/>
<key>PreviewsEnabled</key>
<false/>
</dict> </dict>
</plist> </plist>

View File

@ -1,29 +1,29 @@
<Scheme version="1.3" LastUpgradeVersion="1000"> <Scheme LastUpgradeVersion="1000" version="1.3">
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES"> <BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry buildForRunning="YES" buildForArchiving="YES" buildForTesting="YES" buildForAnalyzing="YES" buildForProfiling="YES"> <BuildActionEntry buildForTesting="YES" buildForRunning="YES" buildForProfiling="YES" buildForArchiving="YES" buildForAnalyzing="YES">
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="D807E501965E9F0C00000000" BuildableName="OlaFaceUnityFramework.framework" BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference> <BuildableReference BlueprintIdentifier="D50916B940C1AF2200000000" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BuildableIdentifier="primary" BuildableName="OlaFaceUnityFramework.framework" BlueprintName="OlaFaceUnityFramework"></BuildableReference>
</BuildActionEntry> </BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES" buildConfiguration="__TulsiTestRunner_Debug"> <TestAction shouldUseLaunchSchemeArgsEnv="YES" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="__TulsiTestRunner_Debug">
<Testables></Testables> <Testables></Testables>
<BuildableProductRunnable runnableDebuggingMode="0"> <BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BlueprintIdentifier="D807E501965E9F0C00000000" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BuildableName="OlaFaceUnityFramework.framework" BlueprintName="OlaFaceUnityFramework" BuildableIdentifier="primary"></BuildableReference> <BuildableReference BuildableName="OlaFaceUnityFramework.framework" BuildableIdentifier="primary" BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BlueprintIdentifier="D50916B940C1AF2200000000"></BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</TestAction> </TestAction>
<LaunchAction selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" launchStyle="0" debugServiceExtension="internal" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" ignoresPersistentStateOnLaunch="NO" debugDocumentVersioning="YES" allowLocationSimulation="YES" buildConfiguration="Debug" useCustomWorkingDirectory="NO"> <LaunchAction buildConfiguration="Debug" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" allowLocationSimulation="YES" debugDocumentVersioning="YES" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" ignoresPersistentStateOnLaunch="NO" debugServiceExtension="internal" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB">
<EnvironmentVariables></EnvironmentVariables> <EnvironmentVariables></EnvironmentVariables>
<BuildableProductRunnable runnableDebuggingMode="0"> <BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BuildableIdentifier="primary" BuildableName="OlaFaceUnityFramework.framework" BlueprintIdentifier="D807E501965E9F0C00000000" BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference> <BuildableReference BuildableName="OlaFaceUnityFramework.framework" BuildableIdentifier="primary" BlueprintIdentifier="D50916B940C1AF2200000000" BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</LaunchAction> </LaunchAction>
<ProfileAction debugDocumentVersioning="YES" buildConfiguration="__TulsiTestRunner_Release" shouldUseLaunchSchemeArgsEnv="YES" useCustomWorkingDirectory="NO"> <ProfileAction useCustomWorkingDirectory="NO" buildConfiguration="__TulsiTestRunner_Release" shouldUseLaunchSchemeArgsEnv="YES" debugDocumentVersioning="YES">
<BuildableProductRunnable runnableDebuggingMode="0"> <BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BlueprintIdentifier="D807E501965E9F0C00000000" BuildableName="OlaFaceUnityFramework.framework" BuildableIdentifier="primary"></BuildableReference> <BuildableReference BlueprintName="OlaFaceUnityFramework" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BuildableName="OlaFaceUnityFramework.framework" BlueprintIdentifier="D50916B940C1AF2200000000" BuildableIdentifier="primary"></BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction> <AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>
<ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"></ArchiveAction> <ArchiveAction revealArchiveInOrganizer="YES" buildConfiguration="Release"></ArchiveAction>
</Scheme> </Scheme>

View File

@ -1,27 +1,27 @@
<Scheme version="1.3" LastUpgradeVersion="1000"> <Scheme LastUpgradeVersion="1000" version="1.3">
<BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"> <BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry buildForRunning="YES" buildForArchiving="YES" buildForTesting="YES" buildForAnalyzing="YES" buildForProfiling="YES"> <BuildActionEntry buildForRunning="YES" buildForAnalyzing="YES" buildForArchiving="YES" buildForTesting="YES" buildForProfiling="YES">
<BuildableReference BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" BuildableIdentifier="primary" BlueprintIdentifier="D807E501C284C0CA00000000" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a"></BuildableReference> <BuildableReference BlueprintIdentifier="D50916B9F55B29BE00000000" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BuildableIdentifier="primary" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference>
</BuildActionEntry> </BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction buildConfiguration="__TulsiTestRunner_Debug" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" shouldUseLaunchSchemeArgsEnv="YES" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit"> <TestAction selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv="YES" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="__TulsiTestRunner_Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB">
<Testables></Testables> <Testables></Testables>
<BuildableProductRunnable runnableDebuggingMode="0"> <BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" BuildableIdentifier="primary" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BlueprintIdentifier="D807E501C284C0CA00000000" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference> <BuildableReference ReferencedContainer="container:OlaFaceUnity.xcodeproj" BuildableIdentifier="primary" BlueprintIdentifier="D50916B9F55B29BE00000000" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary"></BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</TestAction> </TestAction>
<LaunchAction customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" buildConfiguration="Debug" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" launchStyle="0" useCustomWorkingDirectory="NO" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" debugDocumentVersioning="YES" ignoresPersistentStateOnLaunch="NO" allowLocationSimulation="YES" debugServiceExtension="internal"> <LaunchAction ignoresPersistentStateOnLaunch="NO" debugServiceExtension="internal" launchStyle="0" customLLDBInitFile="$(PROJECT_FILE_PATH)/.tulsi/Utils/lldbinit" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" debugDocumentVersioning="YES" selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" allowLocationSimulation="YES" useCustomWorkingDirectory="NO" buildConfiguration="Debug">
<EnvironmentVariables></EnvironmentVariables> <EnvironmentVariables></EnvironmentVariables>
<MacroExpansion> <MacroExpansion>
<BuildableReference BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BlueprintIdentifier="D807E501C284C0CA00000000" BuildableIdentifier="primary" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference> <BuildableReference BuildableIdentifier="primary" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" ReferencedContainer="container:OlaFaceUnity.xcodeproj" BlueprintIdentifier="D50916B9F55B29BE00000000"></BuildableReference>
</MacroExpansion> </MacroExpansion>
</LaunchAction> </LaunchAction>
<ProfileAction useCustomWorkingDirectory="NO" debugDocumentVersioning="YES" buildConfiguration="__TulsiTestRunner_Release" shouldUseLaunchSchemeArgsEnv="YES"> <ProfileAction buildConfiguration="__TulsiTestRunner_Release" shouldUseLaunchSchemeArgsEnv="YES" debugDocumentVersioning="YES" useCustomWorkingDirectory="NO">
<MacroExpansion> <MacroExpansion>
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="D807E501C284C0CA00000000" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference> <BuildableReference BlueprintIdentifier="D50916B9F55B29BE00000000" BuildableName="libmediapipe-render-module-beauty-ios-OlaFaceUnityLibrary.a" BuildableIdentifier="primary" BlueprintName="mediapipe-render-module-beauty-ios-OlaFaceUnityLibrary" ReferencedContainer="container:OlaFaceUnity.xcodeproj"></BuildableReference>
</MacroExpansion> </MacroExpansion>
</ProfileAction> </ProfileAction>
<AnalyzeAction buildConfiguration="Debug"></AnalyzeAction> <AnalyzeAction buildConfiguration="Debug"></AnalyzeAction>

View File

@ -29,17 +29,21 @@ namespace Opipe
class MPPGraphDelegate class MPPGraphDelegate
{ {
public: public:
MPPGraphDelegate() {};
~MPPGraphDelegate() {};
#if defined(__APPLE__) #if defined(__APPLE__)
virtual void outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer, virtual void outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer,
const std::string &streamName, const std::string &streamName,
int64_t timstamp); int64_t timstamp) = 0;
#endif #endif
virtual void outputPacket(OlaGraph *graph, virtual void outputPacket(OlaGraph *graph,
const mediapipe::Packet &packet, const mediapipe::Packet &packet,
MPPPacketType packetType, MPPPacketType packetType,
const std::string &streamName); const std::string &streamName) = 0;
}; };
class OlaGraph class OlaGraph

View File

@ -406,7 +406,7 @@ void OLARenderIMP::setCanvasPixels(int width, int height, const void *pixels, in
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, _transformTexture); glBindTexture(GL_TEXTURE_2D, _transformTexture);
Log("OLARender", "transformTexture :%d", _transformTexture); Log("Opipe", "transformTexture :%d", _transformTexture);
glUniform1i(_transformTextureSlot, 0); glUniform1i(_transformTextureSlot, 0);
glUniformMatrix4fv(_transform_mvp, 1, GL_FALSE, (GLfloat * ) & _mvp_matrix); glUniformMatrix4fv(_transform_mvp, 1, GL_FALSE, (GLfloat * ) & _mvp_matrix);

View File

@ -19,7 +19,7 @@
extern "C" extern "C"
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_com_weatherfish_render_RenderJni_create(JNIEnv *env, jobject thiz) { Java_com_weatherfish_render_RenderJni_create(JNIEnv *env, jobject thiz) {
auto *render = OLARender::OlaRender::create(); auto *render = Opipe::OlaRender::create();
return reinterpret_cast<int64_t>(render); return reinterpret_cast<int64_t>(render);
} }
@ -27,8 +27,8 @@ extern "C"
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_com_weatherfish_render_RenderJni_render(JNIEnv *env, jobject thiz, jlong render_context, jint texture_id, Java_com_weatherfish_render_RenderJni_render(JNIEnv *env, jobject thiz, jlong render_context, jint texture_id,
jint width, jint height, jlong timestamp, jboolean exportFlag) { jint width, jint height, jlong timestamp, jboolean exportFlag) {
auto *render = reinterpret_cast<OLARender::OlaRender *>(render_context); auto *render = reinterpret_cast<Opipe::OlaRender *>(render_context);
OLARender::TextureInfo info; Opipe::TextureInfo info;
info.textureId = texture_id; info.textureId = texture_id;
info.width = width; info.width = width;
info.height = height; info.height = height;
@ -40,6 +40,6 @@ Java_com_weatherfish_render_RenderJni_render(JNIEnv *env, jobject thiz, jlong re
extern "C" extern "C"
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_weatherfish_render_RenderJni_release(JNIEnv *env, jobject thiz, jlong renderId) { Java_com_weatherfish_render_RenderJni_release(JNIEnv *env, jobject thiz, jlong renderId) {
auto *render = reinterpret_cast<OLARender::OlaRender *>(renderId); auto *render = reinterpret_cast<Opipe::OlaRender *>(renderId);
render->release(); render->release();
} }

View File

@ -17,9 +17,9 @@
#define PLATFORM PLATFORM_IOS #define PLATFORM PLATFORM_IOS
#endif #endif
#define NS_OLA_BEGIN namespace OLARender { #define NS_OLA_BEGIN namespace Opipe {
#define NS_OLA_END } #define NS_OLA_END }
#define USING_NS_OLA using namespace OLARender; #define USING_NS_OLA using namespace Opipe;
#define STRINGIZE(x) #x #define STRINGIZE(x) #x
@ -47,7 +47,7 @@
case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \ case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; \
default: break; \ default: break; \
} \ } \
OLARender::Log("ERROR", "GL ERROR 0x%04X %s in %s at line %i\n", e, \ Opipe::Log("ERROR", "GL ERROR 0x%04X %s in %s at line %i\n", e, \
errorString.c_str(), __PRETTY_FUNCTION__, __LINE__); \ errorString.c_str(), __PRETTY_FUNCTION__, __LINE__); \
assert(0);\ assert(0);\
} \ } \

View File

@ -1,6 +1,6 @@
// //
// Mat4.cpp // Mat4.cpp
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -15,7 +15,7 @@
#endif #endif
#include <cstring> #include <cstring>
namespace OLARender { namespace Opipe {
static const int MATRIX_SIZE = (sizeof(float) * 16); static const int MATRIX_SIZE = (sizeof(float) * 16);

View File

@ -1,6 +1,6 @@
// //
// mat4.h // mat4.h
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -12,7 +12,7 @@
#include "vec3.hpp" #include "vec3.hpp"
#include "vec4.hpp" #include "vec4.hpp"
namespace OLARender { namespace Opipe {
class Mat4 class Mat4
{ {

View File

@ -8,7 +8,7 @@
#include "mat4.hpp" #include "mat4.hpp"
namespace OLARender { namespace Opipe {
inline Mat4 Mat4::operator+(const Mat4& mat) const inline Mat4 Mat4::operator+(const Mat4& mat) const
{ {

View File

@ -1,6 +1,6 @@
// //
// math_utils.cpp // math_utils.cpp
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -13,7 +13,7 @@
#endif #endif
#include <cstring> #include <cstring>
namespace OLARender { namespace Opipe {
static const int MATRIX_SIZE = (sizeof(float) * 16); static const int MATRIX_SIZE = (sizeof(float) * 16);

View File

@ -1,6 +1,6 @@
// //
// math_utils.h // math_utils.h
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -26,7 +26,7 @@
#define MATH_FLOAT_EQUAL(src, dst) (((src) >= (dst) - MATH_EPSILON) && ((src) <= (dst) + MATH_EPSILON)) #define MATH_FLOAT_EQUAL(src, dst) (((src) >= (dst) - MATH_EPSILON) && ((src) <= (dst) + MATH_EPSILON))
namespace OLARender { namespace Opipe {
class MathUtils class MathUtils
{ {

View File

@ -1,6 +1,6 @@
// //
// vec2.cpp // vec2.cpp
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -13,7 +13,7 @@
#include "vec2.hpp" #include "vec2.hpp"
#include "math_utils.hpp" #include "math_utils.hpp"
#endif #endif
namespace OLARender { namespace Opipe {
float Vec2::angle(const Vec2& v1, const Vec2& v2) float Vec2::angle(const Vec2& v1, const Vec2& v2)
{ {

View File

@ -1,6 +1,6 @@
// //
// vec2.h // vec2.h
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -12,7 +12,7 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
namespace OLARender { namespace Opipe {
inline float clampf(float value, float min_inclusive, float max_inclusive) { inline float clampf(float value, float min_inclusive, float max_inclusive) {
if (min_inclusive > max_inclusive) { if (min_inclusive > max_inclusive) {

View File

@ -8,7 +8,7 @@
#include "vec2.hpp" #include "vec2.hpp"
namespace OLARender { namespace Opipe {
inline Vec2::Vec2() : x(0.0f), y(0.0f) inline Vec2::Vec2() : x(0.0f), y(0.0f)
{ {

View File

@ -1,6 +1,6 @@
// //
// vec3.cpp // vec3.cpp
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -14,7 +14,7 @@
#include "math_utils.hpp" #include "math_utils.hpp"
#endif #endif
namespace OLARender { namespace Opipe {
Vec3::Vec3() : x(0.0f), y(0.0f), z(0.0f) { Vec3::Vec3() : x(0.0f), y(0.0f), z(0.0f) {
} }

View File

@ -1,6 +1,6 @@
// //
// vec3.h // vec3.h
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -9,7 +9,7 @@
#ifndef VEC3_H #ifndef VEC3_H
#define VEC3_H #define VEC3_H
namespace OLARender { namespace Opipe {
class Vec3 class Vec3
{ {

View File

@ -9,7 +9,7 @@
#include "vec3.hpp" #include "vec3.hpp"
#include <cmath> #include <cmath>
namespace OLARender { namespace Opipe {
inline bool Vec3::is_zero() const inline bool Vec3::is_zero() const
{ {

View File

@ -1,6 +1,6 @@
// //
// vec4.cpp // vec4.cpp
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -17,7 +17,7 @@
#endif #endif
#include <cmath> #include <cmath>
namespace OLARender { namespace Opipe {
Vec4::Vec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) Vec4::Vec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f)
{ {

View File

@ -1,6 +1,6 @@
// //
// vec4.h // vec4.h
// OLARender // Opipe
// //
// Created by Wang,Renzhu on 2018/11/20. // Created by Wang,Renzhu on 2018/11/20.
// Copyright © 2018年 Wang,Renzhu. All rights reserved. // Copyright © 2018年 Wang,Renzhu. All rights reserved.
@ -9,7 +9,7 @@
#ifndef VEC4_H #ifndef VEC4_H
#define VEC4_H #define VEC4_H
namespace OLARender { namespace Opipe {
class Vec4 class Vec4
{ {
public: public:

View File

@ -8,7 +8,7 @@
#include "vec4.hpp" #include "vec4.hpp"
namespace OLARender { namespace Opipe {
inline Vec4 Vec4::operator+(const Vec4& v) const inline Vec4 Vec4::operator+(const Vec4& v) const
{ {

View File

@ -12,7 +12,7 @@ NS_OLA_BEGIN
std::string str_format(const char *fmt,...); std::string str_format(const char *fmt,...);
void Log(const std::string& tag, const std::string& format, ...); void Log(const std::string& tag, const std::string& format, ...);
#define rotationSwapsSize(rotation) ((rotation) == OLARender::RotateLeft || (rotation) == OLARender::RotateRight || (rotation) == OLARender::RotateRightFlipVertical || (rotation) == OLARender::RotateRightFlipHorizontal) #define rotationSwapsSize(rotation) ((rotation) == Opipe::RotateLeft || (rotation) == Opipe::RotateRight || (rotation) == Opipe::RotateRightFlipVertical || (rotation) == Opipe::RotateRightFlipHorizontal)
NS_OLA_END NS_OLA_END