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

View File

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

View File

@ -6,7 +6,7 @@
//
#include "OlaRenderIMP.hpp"
#include "OlaRenderIMP.h"
#include "image_queue.h"
#if USE_OLARENDER
@ -564,13 +564,13 @@ void OLARenderIMP::_setROI(Vec4 roi) {
_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(roiAdjusted.x, -roiAdjusted.y, 0.0);
#else
_mvp_matrix.translate(-realXOffset, -realYOffset, 0.0);
_mvp_matrix.translate(roiAdjusted.x, roiAdjusted.y, 0.0);
#endif
// #else
// _mvp_matrix.translate(-realXOffset, -realYOffset, 0.0);
// _mvp_matrix.translate(roiAdjusted.x, roiAdjusted.y, 0.0);
// #endif
}
GLuint OLARenderIMP::_loadShader(GLenum shaderType, const std::string &shaderString) {

View File

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

View File

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

View File

@ -9,6 +9,8 @@
#include "mediapipe/modules/render_queue/OlaRender.hpp"
#include "mediapipe/modules/render_queue/image_queue.h"
#include "mediapipe/modules/render_queue/image.h"
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
{
[self resume];

View File

@ -35,7 +35,13 @@ void addImageCache(const uint8_t *img, int len, double startX, double startY, do
startT, beforeFFi, exportFlag);
}
extern "C" __attribute__((visibility("default"))) __attribute__((used))
void dispose() {
void disposeImage() {
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 <stdint.h>
#ifdef __cplusplus
// #ifdef __cplusplus
extern "C"
{
#endif
// #endif
__attribute__((visibility("default"))) __attribute__((used))
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);
__attribute__((visibility("default"))) __attribute__((used))
void dispose();
#ifdef __cplusplus
void disposeImage();
__attribute__((visibility("default"))) __attribute__((used))
void test();
// #ifdef __cplusplus
}
#endif
// #endif
#endif