Contents

encodeTransform(to:sourceTexture:sourceHistogram:sourceHistogramOffset:desiredHistogram:desiredHistogramOffset:)

Encodes the transform function to a command buffer using a compute command encoder. The transform function computes the equalization lookup table.

Declaration

func encodeTransform(to commandBuffer: any MTLCommandBuffer, sourceTexture source: any MTLTexture, sourceHistogram: any MTLBuffer, sourceHistogramOffset: Int, desiredHistogram: any MTLBuffer, desiredHistogramOffset: Int)

Parameters

  • commandBuffer:

    A valid command buffer.

  • source:

    A valid texture containing the source image for the filter.

  • sourceHistogram:

    A valid buffer containing the histogram results for the source image. This filter will use these histogram results to generate the cumulative histogram for equalizing the image. The histogram results per channel are stored together. The number of channels for which histogram results are stored is determined by the number of channels in the image. If the histogramForAlpha value of the Histograminfo property is False and the source image is RGBA, then only histogram results for RGB channels are stored.

  • sourceHistogramOffset:

    The byte offset into the source histogram buffer where the histogram starts. Must conform to alignment requirements for the offset parameter of the Setbuffer(_:offset:index:) method.

  • desiredHistogram:

    A valid buffer containing the desired histogram results for the source image. The histogram results per channel are stored together. The number of channels for which histogram results are stored is determined by the number of channels in the image. If the histogramForAlpha value of the Histograminfo property is False and the source image is RGBA, then only histogram results for RGB channels are stored.

  • desiredHistogramOffset:

    The byte offset into the desired histogram buffer where the histogram starts. Must conform to alignment requirements for the offset parameter of the Setbuffer(_:offset:index:) method.

Discussion

The transform function will not begin to execute until after the command buffer has been enqueued and committed. This step will need to be repeated with the new MPSKernel object if the copy(with:device:) or copy(with:) method is called.

See Also

Related Documentation

Methods