TIEPass Class Reference
+ + +Inherits from | +NSObject | +
---|---|
Declared in | +TIEPass.h TIEPass.mm |
+
Overview
+TIEPass is a class responsible for performing image enhance rendering on input images using the Metal framework.
+ +TIEPass is responsible for initializing the image enhance rendering process with the specified input image size. It also provides a render method that applies the image enhance process to the input image and returns the processed image as an MTLTexture object.
+ +Note:
+ + +-
+
- Only available on iOS 15.0 or newer. +
- This class uses the Metal framework for performing image enhance rendering and requires a device that supports Metal. +
- All methods of TSRPass must be called within the same thread. +
- The render:commandBuffer: and renderWithPixelBuffer: method should not be called before the initWithDevice:inputWidth:inputHeight: method, and it should not be called after the deInit method. +
Usage:
+ + +-
+
- Create a TIEPass instance using the initWithDevice:inputWidth:inputHeight: method. +
- Call the render:commandBuffer: method with the input image’s MTLTexture and an MTLCommandBuffer to perform image enhance rendering. +
- Obtain the processed image as an MTLTexture from the return value of the render:commandBuffer: method. +
- deInit method should be called when the TIEPass object is no longer needed, to free up the memory and other resources. +
– initWithDevice:inputWidth:inputHeight:algorithmType:
+
+
+ Init TIEPass object for image enhance.
+- (instancetype)initWithDevice:(id<MTLDevice>)device inputWidth:(int32_t)inputWidth inputHeight:(int32_t)inputHeight algorithmType:(TIEAlgorithmType)algorithmType
Parameters
+device |
+ The MTLDevice which you are using. |
+
---|---|
inputWidth |
+ The width of the input image |
+
inputHeight |
+ The height of the input image |
+
Discussion
+Init TIEPass object for image enhance.
+Declared In
+TIEPass.h
– render:commandBuffer:
+
+
+ Performs the image enhance rendering operation on the input image.
+
+This method applies the image enhance rendering process to the input image, improving its quality. The processed image is rendered onto a MTLTexture within
+the TIEPass object. And the return is the MTLTexture which has preformed image enhance rendering .
+
- (id<MTLTexture>)render:(id<MTLTexture>)texture commandBuffer:(id<MTLCommandBuffer>)commandBuffer
Parameters
+texture |
+ The MTLTexture of the input image that needs to be processed for image enhance. The format of the texture is BGRA. |
+
---|---|
commandBuffer |
+ The MTLCommandBuffer which you are using. |
+
Return Value
+The MTLTexture that will be performed image enhance rendering, which is stored inside the TIEPass +object.
+Discussion
+Performs the image enhance rendering operation on the input image.
+
+This method applies the image enhance rendering process to the input image, improving its quality. The processed image is rendered onto a MTLTexture within
+the TIEPass object. And the return is the MTLTexture which has preformed image enhance rendering .
+
Declared In
+TIEPass.h
– renderWithPixelBuffer:
+
+
+ Performs the image enhance rendering operation on the input pixel buffer.
+- (CVPixelBufferRef)renderWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
Parameters
+pixelBuffer |
+ The CVPixelBufferRef of the input image that needs to be processed for image enhance. The width and height of the pixel buffer must match the inputWidth and inputHeight set during initialization, and the pixel format must be BGRA. |
+
---|
Return Value
+The CVPixelBufferRef that has been performed image enhance rendering. The size of the output pixel buffer is (inputWidth, inputHeight).
+Discussion
+Performs the image enhance rendering operation on the input pixel buffer.
+ +This method applies the image enhance rendering process to the input pixel buffer, improving its quality. The processed pixel buffer is created and returned as a new CVPixelBufferRef.
Note: The SDK internally handles the lifecycle of the returned CVPixelBufferRef, therefore, the caller absolutely should not attempt to manually release the returned CVPixelBufferRef.
Declared In
+TIEPass.h
– deInit
+
+
+ 将CVMat转为CGImage
+- (void)deInit
Discussion
+将CVMat转为CGImage
+Declared In
+TIEPass.mm