This commit is contained in:
WangQiang 2022-07-19 14:14:59 +08:00
parent 7846d90c8e
commit bc5220ea6e
10 changed files with 62 additions and 30 deletions

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"files.associations": {
"chrono": "cpp",
"ios": "cpp"
}
}

View File

@ -15,10 +15,11 @@ cc_library(
"image_queue.h", "image_queue.h",
"image.h", "image.h",
"LockFreeQueue.h", "LockFreeQueue.h",
"OlaRender.hpp", "OlaRender.h",
"OlaRenderIMP.hpp", "OlaRenderIMP.h",
], ],
# Use -Dverbose=-1 to turn off zlib's trace logging. (#3280) # Use -Dverbose=-1 to turn off zlib's trace logging. (#3280)
linkstatic = True,
includes = ["."], includes = ["."],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -31,23 +32,13 @@ cc_library(
], ],
"//conditions:default": [], "//conditions:default": [],
}), }),
alwayslink = True,
) )
objc_library( objc_library(
name = "OlaRenderLibrary", name = "OlaRenderLibrary",
srcs = [
"OlaRenderManager.mm",
"image_queue.cpp",
"image.cpp",
],
hdrs = [
"OlaRenderManager.h",
"image_queue.h",
"image.h",
"LockFreeQueue.h",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//mediapipe/modules/render_queue:ios_olarender", "//mediapipe/modules/render_queue:ios_olarender",
@ -69,21 +60,26 @@ objc_library(
"Foundation", "Foundation",
"UIKit", "UIKit",
], ],
alwayslink = True,
) )
ios_framework( ios_framework(
name = "OlaRenderFramework", name = "OlaRenderFramework",
hdrs = [ hdrs = [
"OlaRenderManager.h",
"image.h", "image.h",
"image_queue.h", "image_queue.h",
"LockFreeQueue.h", "LockFreeQueue.h",
"util.h",
"macros.h",
"OlaRender.h",
"OlaRenderIMP.h",
], ],
# alwayslink=True,
infoplists = ["Info.plist"], infoplists = ["Info.plist"],
bundle_id = "com.ola.dartrenderplugin", bundle_id = "com.ola.dartrenderplugin",
families = ["iphone", "ipad"], families = ["iphone", "ipad"],
minimum_os_version = "11.0", minimum_os_version = "10.0",
deps = [ deps = [
"//mediapipe/modules/render_queue:OlaRenderLibrary", "//mediapipe/modules/render_queue:OlaRenderLibrary",
], ],

View File

@ -5,12 +5,12 @@
// Created by 王韧竹 on 2022/6/17. // Created by 王韧竹 on 2022/6/17.
// //
#include "OlaRender.hpp" #include "OlaRender.h"
#if USE_OLARENDER #if USE_OLARENDER
#include <Context.hpp> #include <Context.hpp>
#include <OlaDispatch.hpp> #include <OlaDispatch.hpp>
#endif #endif
#include "OlaRenderIMP.hpp" #include "OlaRenderIMP.h"

View File

@ -6,7 +6,7 @@
// //
#include "OlaRenderIMP.hpp" #include "OlaRenderIMP.h"
#include "image_queue.h" #include "image_queue.h"
#if USE_OLARENDER #if USE_OLARENDER
@ -564,13 +564,13 @@ void OLARenderIMP::_setROI(Vec4 roi) {
_mvp_matrix.scale(_roi.z, _roi.w, 1.0); _mvp_matrix.scale(_roi.z, _roi.w, 1.0);
#if defined(__ANDROID__) || defined(ANDROID) // #if defined(__ANDROID__) || defined(ANDROID)
_mvp_matrix.translate(-realXOffset, realYOffset, 0.0); _mvp_matrix.translate(-realXOffset, realYOffset, 0.0);
_mvp_matrix.translate(roiAdjusted.x, -roiAdjusted.y, 0.0); _mvp_matrix.translate(roiAdjusted.x, -roiAdjusted.y, 0.0);
#else // #else
_mvp_matrix.translate(-realXOffset, -realYOffset, 0.0); // _mvp_matrix.translate(-realXOffset, -realYOffset, 0.0);
_mvp_matrix.translate(roiAdjusted.x, roiAdjusted.y, 0.0); // _mvp_matrix.translate(roiAdjusted.x, roiAdjusted.y, 0.0);
#endif // #endif
} }
GLuint OLARenderIMP::_loadShader(GLenum shaderType, const std::string &shaderString) { GLuint OLARenderIMP::_loadShader(GLenum shaderType, const std::string &shaderString) {

View File

@ -10,7 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include "macros.h" #include "macros.h"
#include "OlaRender.hpp" #include "OlaRender.h"
#include <math/math_utils.hpp> #include <math/math_utils.hpp>
#if USE_OLARENDER #if USE_OLARENDER

View File

@ -22,6 +22,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setRenderView:(UIView *)renderView; - (void)setRenderView:(UIView *)renderView;
+ (void) addImg;
+(void) disposeImg;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -9,6 +9,8 @@
#include "mediapipe/modules/render_queue/OlaRender.hpp" #include "mediapipe/modules/render_queue/OlaRender.hpp"
#include "mediapipe/modules/render_queue/image_queue.h" #include "mediapipe/modules/render_queue/image_queue.h"
#include "mediapipe/modules/render_queue/image.h"
USING_NS_OLA USING_NS_OLA
@ -51,6 +53,18 @@ USING_NS_OLA
} }
// void addImageCache(const uint8_t *img, int len, double startX, double startY, double normalWidth, double normalHeight,
// int width, int height, uint64_t javaTime, uint64_t startT, uint64_t beforeFFi, bool exportFlag);
+(void)addImg
{
addImageCache(nullptr, 0, 0.0, 0.0, 0.0, 0.0, 0,0,0,0,0, false);
}
+(void)disposeImg
{
disposeImage();
}
- (int)render:(int64_t)frameTime textureId:(NSUInteger)inputTexture renderSize:(CGSize)size - (int)render:(int64_t)frameTime textureId:(NSUInteger)inputTexture renderSize:(CGSize)size
{ {
[self resume]; [self resume];

View File

@ -35,7 +35,13 @@ void addImageCache(const uint8_t *img, int len, double startX, double startY, do
startT, beforeFFi, exportFlag); startT, beforeFFi, exportFlag);
} }
extern "C" __attribute__((visibility("default"))) __attribute__((used)) extern "C" __attribute__((visibility("default"))) __attribute__((used))
void dispose() { void disposeImage() {
ImageQueue::getInstance()->dispose(); ImageQueue::getInstance()->dispose();
}
extern "C" __attribute__((visibility("default"))) __attribute__((used))
void test() {
} }

View File

@ -4,19 +4,25 @@
#include "image_queue.h" #include "image_queue.h"
#include "image_queue.h" #include "image_queue.h"
#include <stdint.h>
#ifdef __cplusplus // #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif // #endif
__attribute__((visibility("default"))) __attribute__((used)) __attribute__((visibility("default"))) __attribute__((used))
void addImageCache(const uint8_t *img, int len, double startX, double startY, double normalWidth, double normalHeight, void addImageCache(const uint8_t *img, int len, double startX, double startY, double normalWidth, double normalHeight,
int width, int height, uint64_t javaTime, uint64_t startT, uint64_t beforeFFi, bool exportFlag); int width, int height, uint64_t javaTime, uint64_t startT, uint64_t beforeFFi, bool exportFlag);
__attribute__((visibility("default"))) __attribute__((used)) __attribute__((visibility("default"))) __attribute__((used))
void dispose(); void disposeImage();
#ifdef __cplusplus
__attribute__((visibility("default"))) __attribute__((used))
void test();
// #ifdef __cplusplus
} }
#endif // #endif
#endif #endif