TSRPass Class Reference

Inherits from NSObject
Declared in TSRPass.h
TSRPass.mm

Overview

The TSRPass class provides methods for performing super-resolution rendering on input images using the Metal framework.

TSRPass is responsible for initializing the super-resolution rendering process with the specified input image size and super-resolution ratio. It also provides a render method that applies the super-resolution process to the input image and returns the processed image as an MTLTexture object.

Usage:

  1. Create a TSRPass instance using the initWithDevice:inputWidth:inputHeight:srRatio: method.
  2. Call the render:commandBuffer: method with the input image’s MTLTexture and an MTLCommandBuffer to perform super-resolution rendering.
  3. Obtain the processed image as an MTLTexture from the return value of the render:commandBuffer: method.

Note: This class uses the Metal framework for performing super-resolution rendering and requires a device that supports Metal.

– initWithDevice:inputWidth:inputHeight:srRatio:

Init TSRPass object for super-resolution.

- (instancetype)initWithDevice:(id<MTLDevice>)device inputWidth:(int32_t)inputWidth inputHeight:(int32_t)inputHeight srRatio:(float_t)srRatio

Parameters

device

The MTLDevice which you are using.

inputWidth

The width of the input image

inputHeight

The height of the input image

srRatio

The magnification factor for super-resolution, ranging from 1 to 2. When srRatio is less than 1, set its value to 1; when srRatio is greater than 2, set its value to 2.

Discussion

Init TSRPass object for super-resolution.

Declared In

TSRPass.h

– render:commandBuffer:

Performs the super-resolution rendering operation on the input image.
This method applies the super-resolution rendering process to the input image, improving its quality. The processed image is rendered onto a MTLTexture within the TSRPass object. And the return is the MTLTexture which has preformed super-resolution 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 super-resolution.

commandBuffer

The MTLCommandBuffer which you are using.

Return Value

The MTLTexture that will be performed super-resolution rendering, which is stored inside the TSRPass object. The size of the output texture is (inputWidth * srRatio, inputHeight * srRatio).

Discussion

Performs the super-resolution rendering operation on the input image.
This method applies the super-resolution rendering process to the input image, improving its quality. The processed image is rendered onto a MTLTexture within the TSRPass object. And the return is the MTLTexture which has preformed super-resolution rendering .

Declared In

TSRPass.h