相机分队列渲染
This commit is contained in:
		
							parent
							
								
									fbf31f0104
								
							
						
					
					
						commit
						673794bea7
					
				| 
						 | 
					@ -50,9 +50,11 @@
 | 
				
			||||||
@property (nonatomic, weak) id<OlaMTLCameraRenderViewDelegate> cameraDelegate;
 | 
					@property (nonatomic, weak) id<OlaMTLCameraRenderViewDelegate> cameraDelegate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@property (nonatomic) dispatch_queue_t displayRenderQueue;
 | 
					@property (nonatomic) dispatch_queue_t displayRenderQueue;
 | 
				
			||||||
 | 
					@property (nonatomic) dispatch_queue_t offlineRenderQueue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// 原始相机纹理 可以快速读取
 | 
					/// 原始相机纹理 可以快速读取
 | 
				
			||||||
@property (nonatomic, readonly, strong) OlaShareTexture *cameraTexture;
 | 
					@property (nonatomic, readonly, strong) OlaShareTexture *cameraTexture;
 | 
				
			||||||
 | 
					@property (nonatomic, readonly, strong) OlaShareTexture *halfCameraTexture;
 | 
				
			||||||
@property (nonatomic, readonly, strong) OlaShareTexture *shareTexture;
 | 
					@property (nonatomic, readonly, strong) OlaShareTexture *shareTexture;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// 不带后处理的相机渲染的原始纹理
 | 
					/// 不带后处理的相机渲染的原始纹理
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
#import <OpenGLES/EAGL.h>
 | 
					#import <OpenGLES/EAGL.h>
 | 
				
			||||||
#import <OpenGLES/ES3/gl.h>
 | 
					#import <OpenGLES/ES3/gl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const NSUInteger MaxFramesInFlight = 3;
 | 
					static const NSUInteger MaxFramesInFlight = 1;
 | 
				
			||||||
static size_t const kOlaDynamicTextureByteAlignment = 16;
 | 
					static size_t const kOlaDynamicTextureByteAlignment = 16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NS_INLINE size_t QAAlignSize(size_t size)
 | 
					NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	_shareTexture = nil;
 | 
						_shareTexture = nil;
 | 
				
			||||||
	_cameraTexture = nil;
 | 
						_cameraTexture = nil;
 | 
				
			||||||
  
 | 
					    _halfCameraTexture = nil;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (instancetype)initWithFrame:(CGRect)frame
 | 
					- (instancetype)initWithFrame:(CGRect)frame
 | 
				
			||||||
| 
						 | 
					@ -104,6 +104,11 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
                                                       metalPixelFormat:self.colorPixelFormat
 | 
					                                                       metalPixelFormat:self.colorPixelFormat
 | 
				
			||||||
                                                                   size:textureSize];
 | 
					                                                                   size:textureSize];
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    _halfCameraTexture = [[OlaShareTexture alloc] initWithMetalDevice:self.device
 | 
				
			||||||
 | 
					                                                        openGLContext:self.openGLContext
 | 
				
			||||||
 | 
					                                                     metalPixelFormat:self.colorPixelFormat
 | 
				
			||||||
 | 
					                                                                 size:CGSizeMake(textureSize.width * 0.25, textureSize.height * 0.25)];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    _mtlRender = [[OlaMTLCameraRender alloc] initWithRenderSize:textureSize
 | 
					    _mtlRender = [[OlaMTLCameraRender alloc] initWithRenderSize:textureSize
 | 
				
			||||||
                                                               device:self.device
 | 
					                                                               device:self.device
 | 
				
			||||||
                                                        cameraTexture:self.cameraTexture
 | 
					                                                        cameraTexture:self.cameraTexture
 | 
				
			||||||
| 
						 | 
					@ -118,6 +123,7 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
    self.displayFrameRenderingSemaphore = dispatch_semaphore_create(MaxFramesInFlight);
 | 
					    self.displayFrameRenderingSemaphore = dispatch_semaphore_create(MaxFramesInFlight);
 | 
				
			||||||
    self.displayRenderQueue = dispatch_queue_create("Ola.ios.displayRenderQueue",
 | 
					    self.displayRenderQueue = dispatch_queue_create("Ola.ios.displayRenderQueue",
 | 
				
			||||||
                                                    interactive);
 | 
					                                                    interactive);
 | 
				
			||||||
 | 
					    self.offlineRenderQueue = dispatch_queue_create("Ola.ios.offlineRenderQueue", interactive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    self.cameraFrameRenderingSemaphore = dispatch_semaphore_create(1);
 | 
					    self.cameraFrameRenderingSemaphore = dispatch_semaphore_create(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -209,6 +215,10 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
		[strongSelf.mtlRender renderToShareTexture:strongSelf.shareTexture.metalTexture
 | 
							[strongSelf.mtlRender renderToShareTexture:strongSelf.shareTexture.metalTexture
 | 
				
			||||||
									 commandBuffer:commandBuffer
 | 
														 commandBuffer:commandBuffer
 | 
				
			||||||
										 frameTime:strongSelf.frameTime];
 | 
															 frameTime:strongSelf.frameTime];
 | 
				
			||||||
 | 
					        [strongSelf.mtlRender renderToTexture:strongSelf.halfCameraTexture.metalTexture
 | 
				
			||||||
 | 
					                                         from:strongSelf.cameraTexture.metalTexture commandBuffer:commandBuffer
 | 
				
			||||||
 | 
					                            textureCoordinate:strongSelf.mtlRender.noRotationBuffer];
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
		[commandBuffer commit];
 | 
							[commandBuffer commit];
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        commandBuffer = [strongSelf.mtlRender.commandQueue commandBuffer];
 | 
					        commandBuffer = [strongSelf.mtlRender.commandQueue commandBuffer];
 | 
				
			||||||
| 
						 | 
					@ -235,13 +245,12 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                [strongSelf.cameraDelegate draw:strongSelf.frameTime];
 | 
					                [strongSelf.cameraDelegate draw:strongSelf.frameTime];
 | 
				
			||||||
               
 | 
					               
 | 
				
			||||||
                [strongSelf.cameraDelegate bgraCameraTextureReady:strongSelf.cameraTexture
 | 
					 | 
				
			||||||
                                                  onScreenTexture:strongSelf.shareTexture
 | 
					 | 
				
			||||||
                                                      frameTime:strongSelf.frameTime * 1000];
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                IOSurfaceID surfaceId = [strongSelf.cameraDelegate externalRender:strongSelf.frameTime
 | 
					                IOSurfaceID surfaceId = [strongSelf.cameraDelegate externalRender:strongSelf.frameTime
 | 
				
			||||||
                                            targetTexture:strongSelf.cameraTexture
 | 
					                                            targetTexture:strongSelf.cameraTexture
 | 
				
			||||||
                                            commandBuffer:commandBuffer];
 | 
					                                            commandBuffer:commandBuffer];
 | 
				
			||||||
 | 
					                [strongSelf.cameraDelegate bgraCameraTextureReady:strongSelf.halfCameraTexture
 | 
				
			||||||
 | 
					                                                  onScreenTexture:strongSelf.shareTexture
 | 
				
			||||||
 | 
					                                                        frameTime:strongSelf.frameTime * 1000];
 | 
				
			||||||
                if (surfaceId != -1) {
 | 
					                if (surfaceId != -1) {
 | 
				
			||||||
                    //这里渲染surfaceId
 | 
					                    //这里渲染surfaceId
 | 
				
			||||||
                    IOSurfaceRef ioSurface = IOSurfaceLookup(surfaceId);
 | 
					                    IOSurfaceRef ioSurface = IOSurfaceLookup(surfaceId);
 | 
				
			||||||
| 
						 | 
					@ -320,7 +329,7 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    CFRetain(pixelbuffer);
 | 
					    CFRetain(pixelbuffer);
 | 
				
			||||||
    dispatch_async(self.displayRenderQueue, ^{
 | 
					    dispatch_async(self.offlineRenderQueue, ^{
 | 
				
			||||||
        if (weakSelf == nil) {
 | 
					        if (weakSelf == nil) {
 | 
				
			||||||
            CFRelease(pixelbuffer);
 | 
					            CFRelease(pixelbuffer);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
| 
						 | 
					@ -351,7 +360,7 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    CFRetain(sampleBuffer);
 | 
					    CFRetain(sampleBuffer);
 | 
				
			||||||
    dispatch_async(self.displayRenderQueue, ^{
 | 
					    dispatch_async(self.offlineRenderQueue, ^{
 | 
				
			||||||
        if (weakSelf == nil) {
 | 
					        if (weakSelf == nil) {
 | 
				
			||||||
            CFRelease(sampleBuffer);
 | 
					            CFRelease(sampleBuffer);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
| 
						 | 
					@ -361,6 +370,7 @@ NS_INLINE size_t QAAlignSize(size_t size)
 | 
				
			||||||
        [strongSelf.mtlRender renderToCameraTextureWithPixelBuffer:pixelBuffer completedHandler:renderCompleted];
 | 
					        [strongSelf.mtlRender renderToCameraTextureWithPixelBuffer:pixelBuffer completedHandler:renderCompleted];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        CFRelease(sampleBuffer);
 | 
					        CFRelease(sampleBuffer);
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,11 +25,11 @@ namespace Opipe
 | 
				
			||||||
    void FaceMeshCallFrameDelegate::outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer,
 | 
					    void FaceMeshCallFrameDelegate::outputPixelbuffer(OlaGraph *graph, CVPixelBufferRef pixelbuffer,
 | 
				
			||||||
                                                      const std::string &streamName, int64_t timestamp)
 | 
					                                                      const std::string &streamName, int64_t timestamp)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        _imp->currentDispatch()->runSync([&] {
 | 
					//        _imp->currentDispatch()->runSync([&] {
 | 
				
			||||||
            IOSurfaceRef surface = CVPixelBufferGetIOSurface(pixelbuffer);
 | 
					//            IOSurfaceRef surface = CVPixelBufferGetIOSurface(pixelbuffer);
 | 
				
			||||||
            IOSurfaceID surfaceId = IOSurfaceGetID(surface);
 | 
					//            IOSurfaceID surfaceId = IOSurfaceGetID(surface);
 | 
				
			||||||
            Log("Opipe", "streamName %s timeStamp:%ld iosurfaceid:%d", streamName.c_str(), timestamp, surfaceId);
 | 
					//            Log("Opipe", "streamName %s timeStamp:%ld iosurfaceid:%d", streamName.c_str(), timestamp, surfaceId);
 | 
				
			||||||
        });
 | 
					//        });
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ namespace Opipe
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Vector2 point1 = _positionAt(362);
 | 
					                Vector2 point1 = _positionAt(362);
 | 
				
			||||||
                Vector2 point2 = _positionAt(263);
 | 
					                Vector2 point2 = _positionAt(263);
 | 
				
			||||||
                Vector2 point3 = _positionAt(417);
 | 
					                Vector2 point3 = _positionAt(168);
 | 
				
			||||||
                Vector2 center = point1.getCenter(point2);
 | 
					                Vector2 center = point1.getCenter(point2);
 | 
				
			||||||
                float distance = center.distance(point3);
 | 
					                float distance = center.distance(point3);
 | 
				
			||||||
                addPoint(center, distance / 2, distance / 2, 0.3, 1, 0.0f, 0.0f, 1);
 | 
					                addPoint(center, distance / 2, distance / 2, 0.3, 1, 0.0f, 0.0f, 1);
 | 
				
			||||||
| 
						 | 
					@ -259,7 +259,7 @@ namespace Opipe
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Vector2 point1 = _positionAt(33);
 | 
					                Vector2 point1 = _positionAt(33);
 | 
				
			||||||
                Vector2 point2 = _positionAt(133);
 | 
					                Vector2 point2 = _positionAt(133);
 | 
				
			||||||
                Vector2 point3 = _positionAt(193);
 | 
					                Vector2 point3 = _positionAt(168);
 | 
				
			||||||
                Vector2 center = point1.getCenter(point2);
 | 
					                Vector2 center = point1.getCenter(point2);
 | 
				
			||||||
                float distance = center.distance(point3);
 | 
					                float distance = center.distance(point3);
 | 
				
			||||||
                addPoint(center, distance / 2, distance / 2, 0.3, 1, 0.0f, 0.0f, 1);
 | 
					                addPoint(center, distance / 2, distance / 2, 0.3, 1, 0.0f, 0.0f, 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,19 +67,28 @@ namespace Opipe {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        _lutFilter = LUTFilter::create(context);
 | 
					        _lutFilter = LUTFilter::create(context);
 | 
				
			||||||
        _unSharpMaskFilter = UnSharpMaskFilter::create(context);
 | 
					        _unSharpMaskFilter = UnSharpMaskFilter::create(context);
 | 
				
			||||||
        _unSharpMaskFilter->addTarget(_lutFilter, 0);
 | 
					        
 | 
				
			||||||
        _faceDistortFilter = FaceDistortionFilter::create(context);
 | 
					        _faceDistortFilter = FaceDistortionFilter::create(context);
 | 
				
			||||||
        _bilateralAdjustFilter = BilateralAdjustFilter::create(context);
 | 
					        _bilateralAdjustFilter = BilateralAdjustFilter::create(context);
 | 
				
			||||||
        addFilter(_bilateralAdjustFilter);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _lookUpGroupFilter = FilterGroup::create(context);
 | 
					 | 
				
			||||||
        _lookUpGroupFilter->addFilter(_unSharpMaskFilter);
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        _alphaBlendFilter = AlphaBlendFilter::create(context);
 | 
					        _alphaBlendFilter = AlphaBlendFilter::create(context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _bilateralFilter = BilateralFilter::create(context);
 | 
					        _bilateralFilter = BilateralFilter::create(context);
 | 
				
			||||||
 | 
					        _lookUpGroupFilter = FilterGroup::create(context);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        addFilter(_bilateralAdjustFilter);
 | 
				
			||||||
        addFilter(_bilateralFilter);
 | 
					        addFilter(_bilateralFilter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        _unSharpMaskFilter->addTarget(_lutFilter, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        _lookUpGroupFilter->addFilter(_unSharpMaskFilter);
 | 
				
			||||||
 | 
					        _lookUpGroupFilter->setTerminalFilter(_lutFilter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _bilateralAdjustFilter->addTarget(_lookUpGroupFilter)->addTarget(_alphaBlendFilter, 1);
 | 
					        _bilateralAdjustFilter->addTarget(_lookUpGroupFilter)->addTarget(_alphaBlendFilter, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _bilateralFilter->addTarget(_bilateralAdjustFilter, 1)->addTarget(_alphaBlendFilter, 0);
 | 
					        _bilateralFilter->addTarget(_bilateralAdjustFilter, 1)->addTarget(_alphaBlendFilter, 0);
 | 
				
			||||||
| 
						 | 
					@ -120,12 +129,7 @@ namespace Opipe {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        registerProperty("skin", 0.0f, "磨皮 0.0 - 1.0",
 | 
					        registerProperty("skin", 0.0f, "磨皮 0.0 - 1.0",
 | 
				
			||||||
                         [this](float skin) {
 | 
					                         [this](float skin) {
 | 
				
			||||||
            if (skin == 0.0) {
 | 
					 | 
				
			||||||
                _bilateralAdjustFilter->setEnable(false);
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                _bilateralAdjustFilter->setEnable(true);
 | 
					 | 
				
			||||||
            _bilateralAdjustFilter->setOpacityLimit(skin);
 | 
					            _bilateralAdjustFilter->setOpacityLimit(skin);
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        registerProperty("whiten", 0.0f, "美白 0.0 - 1.0",
 | 
					        registerProperty("whiten", 0.0f, "美白 0.0 - 1.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -18,7 +18,7 @@
 | 
				
			||||||
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
 | 
					                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
 | 
				
			||||||
                        <subviews>
 | 
					                        <subviews>
 | 
				
			||||||
                            <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="vhS-oS-Fej">
 | 
					                            <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="vhS-oS-Fej">
 | 
				
			||||||
                                <rect key="frame" x="55" y="632" width="304" height="31"/>
 | 
					                                <rect key="frame" x="55" y="532" width="304" height="31"/>
 | 
				
			||||||
                                <constraints>
 | 
					                                <constraints>
 | 
				
			||||||
                                    <constraint firstAttribute="width" constant="300" id="YLm-AJ-oyY"/>
 | 
					                                    <constraint firstAttribute="width" constant="300" id="YLm-AJ-oyY"/>
 | 
				
			||||||
                                </constraints>
 | 
					                                </constraints>
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@
 | 
				
			||||||
                                </connections>
 | 
					                                </connections>
 | 
				
			||||||
                            </slider>
 | 
					                            </slider>
 | 
				
			||||||
                            <slider opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Qqv-lK-sGM">
 | 
					                            <slider opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Qqv-lK-sGM">
 | 
				
			||||||
                                <rect key="frame" x="55" y="703" width="304" height="31"/>
 | 
					                                <rect key="frame" x="55" y="603" width="304" height="31"/>
 | 
				
			||||||
                                <constraints>
 | 
					                                <constraints>
 | 
				
			||||||
                                    <constraint firstAttribute="width" constant="300" id="RfD-NJ-btk"/>
 | 
					                                    <constraint firstAttribute="width" constant="300" id="RfD-NJ-btk"/>
 | 
				
			||||||
                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="YrT-Ue-dTy"/>
 | 
					                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="YrT-Ue-dTy"/>
 | 
				
			||||||
| 
						 | 
					@ -37,31 +37,31 @@
 | 
				
			||||||
                                </connections>
 | 
					                                </connections>
 | 
				
			||||||
                            </slider>
 | 
					                            </slider>
 | 
				
			||||||
                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="美白磨皮" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S8B-AB-YC8">
 | 
					                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="美白磨皮" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S8B-AB-YC8">
 | 
				
			||||||
                                <rect key="frame" x="172" y="601" width="70" height="21"/>
 | 
					                                <rect key="frame" x="172" y="501" width="70" height="21"/>
 | 
				
			||||||
                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
					                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
				
			||||||
                                <nil key="textColor"/>
 | 
					                                <nil key="textColor"/>
 | 
				
			||||||
                                <nil key="highlightedColor"/>
 | 
					                                <nil key="highlightedColor"/>
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="瘦脸" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xqq-mI-Nvq">
 | 
					                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="瘦脸" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xqq-mI-Nvq">
 | 
				
			||||||
                                <rect key="frame" x="189.5" y="672" width="35" height="21"/>
 | 
					                                <rect key="frame" x="189.5" y="572" width="35" height="21"/>
 | 
				
			||||||
                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
					                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
				
			||||||
                                <nil key="textColor"/>
 | 
					                                <nil key="textColor"/>
 | 
				
			||||||
                                <nil key="highlightedColor"/>
 | 
					                                <nil key="highlightedColor"/>
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="大眼" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vgF-XJ-zVO">
 | 
					                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="大眼" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vgF-XJ-zVO">
 | 
				
			||||||
                                <rect key="frame" x="189.5" y="743" width="35" height="21"/>
 | 
					                                <rect key="frame" x="189.5" y="643" width="35" height="21"/>
 | 
				
			||||||
                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
					                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
				
			||||||
                                <nil key="textColor"/>
 | 
					                                <nil key="textColor"/>
 | 
				
			||||||
                                <nil key="highlightedColor"/>
 | 
					                                <nil key="highlightedColor"/>
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="整形-缩鼻翼" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mom-9E-xEB">
 | 
					                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="整形-缩鼻翼" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mom-9E-xEB">
 | 
				
			||||||
                                <rect key="frame" x="159.5" y="814" width="95" height="20.5"/>
 | 
					                                <rect key="frame" x="159.5" y="714" width="95" height="20.5"/>
 | 
				
			||||||
                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
					                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
 | 
				
			||||||
                                <nil key="textColor"/>
 | 
					                                <nil key="textColor"/>
 | 
				
			||||||
                                <nil key="highlightedColor"/>
 | 
					                                <nil key="highlightedColor"/>
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                            <slider opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="wEp-us-rWn">
 | 
					                            <slider opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="wEp-us-rWn">
 | 
				
			||||||
                                <rect key="frame" x="55" y="774" width="304" height="31"/>
 | 
					                                <rect key="frame" x="55" y="674" width="304" height="31"/>
 | 
				
			||||||
                                <constraints>
 | 
					                                <constraints>
 | 
				
			||||||
                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="SU3-lS-UVj"/>
 | 
					                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="SU3-lS-UVj"/>
 | 
				
			||||||
                                    <constraint firstAttribute="width" constant="300" id="d1T-V2-Y4S"/>
 | 
					                                    <constraint firstAttribute="width" constant="300" id="d1T-V2-Y4S"/>
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@
 | 
				
			||||||
                                </connections>
 | 
					                                </connections>
 | 
				
			||||||
                            </slider>
 | 
					                            </slider>
 | 
				
			||||||
                            <slider opaque="NO" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="axw-O5-vck">
 | 
					                            <slider opaque="NO" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="axw-O5-vck">
 | 
				
			||||||
                                <rect key="frame" x="55" y="844.5" width="304" height="31"/>
 | 
					                                <rect key="frame" x="55" y="744.5" width="304" height="31"/>
 | 
				
			||||||
                                <constraints>
 | 
					                                <constraints>
 | 
				
			||||||
                                    <constraint firstAttribute="width" relation="lessThanOrEqual" constant="300" id="cWo-IZ-VC0"/>
 | 
					                                    <constraint firstAttribute="width" relation="lessThanOrEqual" constant="300" id="cWo-IZ-VC0"/>
 | 
				
			||||||
                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="goO-a8-B8f"/>
 | 
					                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="goO-a8-B8f"/>
 | 
				
			||||||
| 
						 | 
					@ -93,7 +93,7 @@
 | 
				
			||||||
                            <constraint firstItem="Mom-9E-xEB" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="TYW-Gr-uFp"/>
 | 
					                            <constraint firstItem="Mom-9E-xEB" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="TYW-Gr-uFp"/>
 | 
				
			||||||
                            <constraint firstItem="vgF-XJ-zVO" firstAttribute="top" secondItem="Qqv-lK-sGM" secondAttribute="bottom" constant="10" id="VIL-NW-R20"/>
 | 
					                            <constraint firstItem="vgF-XJ-zVO" firstAttribute="top" secondItem="Qqv-lK-sGM" secondAttribute="bottom" constant="10" id="VIL-NW-R20"/>
 | 
				
			||||||
                            <constraint firstItem="axw-O5-vck" firstAttribute="top" secondItem="Mom-9E-xEB" secondAttribute="bottom" constant="10" id="Vcm-Ek-dn6"/>
 | 
					                            <constraint firstItem="axw-O5-vck" firstAttribute="top" secondItem="Mom-9E-xEB" secondAttribute="bottom" constant="10" id="Vcm-Ek-dn6"/>
 | 
				
			||||||
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="vhS-oS-Fej" secondAttribute="bottom" constant="200" id="cTV-Ue-aqY"/>
 | 
					                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="vhS-oS-Fej" secondAttribute="bottom" constant="300" id="cTV-Ue-aqY"/>
 | 
				
			||||||
                            <constraint firstItem="Xqq-mI-Nvq" firstAttribute="top" secondItem="vhS-oS-Fej" secondAttribute="bottom" constant="10" id="d5V-Bk-AdN"/>
 | 
					                            <constraint firstItem="Xqq-mI-Nvq" firstAttribute="top" secondItem="vhS-oS-Fej" secondAttribute="bottom" constant="10" id="d5V-Bk-AdN"/>
 | 
				
			||||||
                            <constraint firstItem="axw-O5-vck" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="dS4-8m-TsB"/>
 | 
					                            <constraint firstItem="axw-O5-vck" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="dS4-8m-TsB"/>
 | 
				
			||||||
                            <constraint firstItem="Xqq-mI-Nvq" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="elq-CK-DpX"/>
 | 
					                            <constraint firstItem="Xqq-mI-Nvq" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="elq-CK-DpX"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -269,6 +269,7 @@ AVCaptureAudioDataOutputSampleBufferDelegate> {
 | 
				
			||||||
         targetTexture:(OlaShareTexture *)targetTexture
 | 
					         targetTexture:(OlaShareTexture *)targetTexture
 | 
				
			||||||
         commandBuffer:(id<MTLCommandBuffer>)buffer
 | 
					         commandBuffer:(id<MTLCommandBuffer>)buffer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					//    [[OlaFaceUnity sharedInstance] processVideoFrame:targetTexture.renderTarget timeStamp:frameTime];
 | 
				
			||||||
    FaceTextureInfo inputTexture;
 | 
					    FaceTextureInfo inputTexture;
 | 
				
			||||||
    inputTexture.width = targetTexture.size.width;
 | 
					    inputTexture.width = targetTexture.size.width;
 | 
				
			||||||
    inputTexture.height = targetTexture.size.height;
 | 
					    inputTexture.height = targetTexture.size.height;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,9 +50,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (FaceTextureInfo)render:(FaceTextureInfo)inputTexture
 | 
					- (FaceTextureInfo)render:(FaceTextureInfo)inputTexture
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    @autoreleasepool {
 | 
					 | 
				
			||||||
    TextureInfo rs;
 | 
					    TextureInfo rs;
 | 
				
			||||||
    rs.ioSurfaceId = inputTexture.ioSurfaceId;
 | 
					    rs.ioSurfaceId = inputTexture.ioSurfaceId;
 | 
				
			||||||
 | 
					    rs.width = inputTexture.width;
 | 
				
			||||||
 | 
					    rs.height = inputTexture.height;
 | 
				
			||||||
 | 
					    rs.textureId = inputTexture.textureId;
 | 
				
			||||||
 | 
					    rs.frameTime = inputTexture.frameTime;
 | 
				
			||||||
    if (_face_module) {
 | 
					    if (_face_module) {
 | 
				
			||||||
        TextureInfo input;
 | 
					        TextureInfo input;
 | 
				
			||||||
        input.width = inputTexture.width;
 | 
					        input.width = inputTexture.width;
 | 
				
			||||||
| 
						 | 
					@ -71,7 +74,6 @@
 | 
				
			||||||
    result.frameTime = rs.frameTime;
 | 
					    result.frameTime = rs.frameTime;
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,9 @@ namespace Opipe
 | 
				
			||||||
                           const mediapipe::Packet &packet)
 | 
					                           const mediapipe::Packet &packet)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        OlaGraph *graph = (OlaGraph *)wrapperVoid;
 | 
					        OlaGraph *graph = (OlaGraph *)wrapperVoid;
 | 
				
			||||||
 | 
					#if defined(__APPLE__)
 | 
				
			||||||
 | 
					        @autoreleasepool {
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
            if (graph->_delegate.expired())
 | 
					            if (graph->_delegate.expired())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
| 
						 | 
					@ -29,6 +32,8 @@ namespace Opipe
 | 
				
			||||||
            if (packetType == MPPPacketTypeRaw)
 | 
					            if (packetType == MPPPacketTypeRaw)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                graph->_delegate.lock()->outputPacket(graph, packet, packetType, streamName);
 | 
					                graph->_delegate.lock()->outputPacket(graph, packet, packetType, streamName);
 | 
				
			||||||
 | 
					            } else if (packetType == MPPPacketTypeImageFrame) {
 | 
				
			||||||
 | 
					                graph->_framesInFlight--;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
    #if defined(__APPLE__)
 | 
					    #if defined(__APPLE__)
 | 
				
			||||||
            else if (packetType == MPPPacketTypePixelBuffer ||
 | 
					            else if (packetType == MPPPacketTypePixelBuffer ||
 | 
				
			||||||
| 
						 | 
					@ -43,6 +48,7 @@ namespace Opipe
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                graph->_delegate.lock()->outputPixelbuffer(graph, pixelBuffer, streamName, packet.Timestamp().Value());
 | 
					                graph->_delegate.lock()->outputPixelbuffer(graph, pixelBuffer, streamName, packet.Timestamp().Value());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user