Skip to content

Commit

Permalink
v2.2.3 GPU 指令优化
Browse files Browse the repository at this point in the history
  • Loading branch information
uu-code007 committed Aug 12, 2023
1 parent c842e62 commit 7fcdf10
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 8 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

#### 项目介绍

**pixelFree** 是基于个人几年对图形学习,总结开发的SDK, 主要用于直播,短视频领域.....
**pixelFree** 是基于个人几年对图形学习,总结开发的SDK, 轻量级高性能,主要用于直播,短视频领域.....

主要功能包含:美白,红润,磨皮,锐化,大眼,瘦脸…….

集成接入参考 *pixelFreeEffects* 演示**DEMO**

注:演示所有素材均来源于网络,如有侵权邮件告知 [email protected],将第一时间删除

#### 美颜效果 :
#### 美颜效果

磨皮的同时,保留更多细节,美化与真实并存

Expand All @@ -22,6 +22,10 @@

![aaa](./res/lvmuCom.png)

#### 美颜全开性能

![aaa](./res/option.png)

#### 支持的平台系统

| 平台 | 系统 |
Expand All @@ -43,7 +47,6 @@
pod 'PixelFree'
```



#### 接入使用

Expand Down Expand Up @@ -82,10 +85,14 @@
[_mPixelFree processWithBuffer:pixbuffer];
```




#### 更新日志
**2023-08-12 日更新** v2.3.3
伟大优化,性能提升 30%
- 磨皮优化
- GPU 指令优化

**2023-07-20 日更新** v2.3.2

- 优化美型效果,美型形变显得更加真实
Expand Down
Binary file modified SMBeautyEngine_andriod/libs/arm64-v8a/libPixelFree.so
Binary file not shown.
Binary file not shown.
Binary file modified SMBeautyEngine_iOS/.DS_Store
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions SMBeautyEngine_iOS/PixelFree.framework/Headers/SMPixelFree.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#import <OpenGLES/ES2/glext.h>
#import "pixelFree_c.hpp"
//#import "SMFilterModel.h"

NS_ASSUME_NONNULL_BEGIN

__attribute__((visibility("default"))) @interface SMPixelFree : NSObject
Expand Down Expand Up @@ -64,7 +63,6 @@ __attribute__((visibility("default"))) @interface SMPixelFree : NSObject
// 加载美颜bundle
- (void)createBeautyItemFormBundle:(void*)data size:(int)sz;


@end

NS_ASSUME_NONNULL_END
Binary file modified SMBeautyEngine_iOS/PixelFree.framework/PixelFree
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion SMBeautyEngine_iOS/SMBeautyEngine_iOS/PFCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ - (instancetype)init
{
if (self = [super init]) {
self.cameraPosition = AVCaptureDevicePositionFront;
self.captureFormat = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;//kCVPixelFormatType_32BGRA;//
self.captureFormat = kCVPixelFormatType_32BGRA;// kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;//kCVPixelFormatType_32BGRA;//
videoHDREnabled = YES;
}
return self;
Expand Down
2 changes: 2 additions & 0 deletions SMBeautyEngine_iOS/SMBeautyEngine_iOS/PFOpenGLView.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ typedef NS_ENUM(NSInteger, PFOpenGLViewContentMode) {
/* 同步渲染 */
- (void)displaySyncPixelBuffer:(CVPixelBufferRef)pixelBuffer;

- (void)displaySyncTexture:(int)texture withSize:(CGSize)size;

@end
50 changes: 50 additions & 0 deletions SMBeautyEngine_iOS/SMBeautyEngine_iOS/PFOpenGLView.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,56 @@ - (void)displayImageData:(void *)imageData withSize:(CGSize)size{
[self presentFramebuffer];
}

- (void)displaySyncTexture:(int)texture withSize:(CGSize)size{
frameWidth = (int)size.width;
frameHeight = (int)size.height;

if ([EAGLContext currentContext] != self.glContext) {
if (![EAGLContext setCurrentContext:self.glContext]) {
NSLog(@"fail to setCurrentContext");
}
}
[self setDisplayFramebuffer];
if (!rgbaProgram) {
[self loadShadersRGBA];
}

glBindTexture(GL_TEXTURE_2D, texture);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glUseProgram(rgbaProgram);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture);
glUniform1i(displayInputTextureUniform, 1);

[self updateVertices];

// 更新顶点数据
glVertexAttribPointer(furgbaPositionAttribute, 2, GL_FLOAT, 0, 0, vertices);
glEnableVertexAttribArray(furgbaPositionAttribute);

GLfloat quadTextureData[] = {
0.0f, 1.0f,
1.0f, 1.0f,
0.0f, 0.0f,
1.0f, 0.0f,
};

glVertexAttribPointer(furgbaTextureCoordinateAttribute, 2, GL_FLOAT, 0, 0, quadTextureData);
glEnableVertexAttribArray(furgbaTextureCoordinateAttribute);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

[self presentFramebuffer];
}



- (void)displayImageData:(void *)imageData withSize:(CGSize)size Center:(CGPoint)center Landmarks:(float *)landmarks count:(int)count {

frameWidth = (int)size.width;
Expand Down
2 changes: 1 addition & 1 deletion SMBeautyEngine_iOS/SMBeautyEngine_iOS/PFVideoController.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ - (void)viewDidLoad {
-(void)didOutputVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer{
CVPixelBufferRef pixbuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(pixbuffer, 0);

if(pixbuffer){
[self.mPixelFree processWithBuffer:pixbuffer rotationMode:PFRotationMode0];
}
Expand Down
Binary file added res/option.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7fcdf10

Please sign in to comment.