MPSImageNormalizedHistogram(3) MetalPerformanceShaders.framework MPSImageNormalizedHistogram(3)

MPSImageNormalizedHistogram

#import <MPSImageHistogram.h>

Inherits MPSKernel.


(nonnull instancetype) - initWithDevice:histogramInfo:
(nullable instancetype) - initWithCoder:device:
(void) - encodeToCommandBuffer:sourceTexture:minmaxTexture:histogram:histogramOffset:
(size_t) - histogramSizeForSourceFormat:


MTLRegion clipRectSource
BOOL zeroHistogram
MPSImageNormalizedHistogramInfo histogramInfo

The MPSImageNormalizedHistogram computes the normalized histogram of an image.

- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(nonnull id< MTLTexture >) source(nonnull id< MTLTexture >) minmaxTexture(nonnull id< MTLBuffer >) histogram(NSUInteger) histogramOffset

Encode the filter to a command buffer using a MTLComputeCommandEncoder. The filter will not begin to execute until after the command buffer has been enqueued and committed.

Parameters:

commandBuffer A valid MTLCommandBuffer.
source A valid MTLTexture containing the source image for the filter
minmaxTexture A valid MTLTexture in which the min/max pixel values from source will be returned
histogram A valid MTLBuffer to receive the histogram results.
histogramOffset Byte offset into histogram buffer at which to write the histogram results. Must be a multiple of 32 bytes. The histogram results / 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 histogramInfo.histogramForAlpha is false and the source image is RGBA then only histogram results for RGB channels are stored.

The histogram results are stored in the histogram buffer as follows:

  • histogram results for the R channel for all bins followed by
  • histogram results for the G channel for all bins followed by
  • histogram results for the B channel for all bins followed by
  • histogram results for the A channel for all bins

- (size_t) histogramSizeForSourceFormat: (MTLPixelFormat) sourceFormat

The amount of space in the output MTLBuffer the histogram will take up. This convenience function calculates the minimum amount of space needed in the output histogram for the results. The MTLBuffer should be at least this length, longer if histogramOffset is non-zero.

Parameters:

sourceFormat The MTLPixelFormat of the source image. This is the source parameter of -encodeToCommandBuffer: sourceTexture:histogram:histogramOffset

Returns:

The number of bytes needed to store the result histograms.

- (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device

NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead.

Parameters:

aDecoder The NSCoder subclass with your serialized MPSKernel
device The MTLDevice on which to make the MPSKernel

Returns:

A new MPSKernel object, or nil if failure.

Reimplemented from MPSKernel.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(const MPSImageNormalizedHistogramInfo *__nonnull) histogramInfo

Specifies information to compute the histogram for channels of an image.

Parameters:

device The device the filter will run on
histogramInfo Pointer to the MPSNormalizedHistogramInfo struct

Returns:

A valid MPSImageNormalizedHistogram object or nil, if failure.

- clipRectSource [read], [write], [nonatomic], [assign]

The source rectangle to use when reading data. A MTLRegion that indicates which part of the source to read. If the clipRectSource does not lie completely within the source image, the intersection of the image bounds and clipRectSource will be used. The clipRectSource replaces the MPSUnaryImageKernel offset parameter for this filter. The latter is ignored. Default: MPSRectNoClip, use the entire source texture.

- histogramInfo [read], [nonatomic], [assign]

Return a structure describing the histogram content Returns a MPSImageNormalizedHistogramInfo structure describing the format of the histogram.

- zeroHistogram [read], [write], [nonatomic], [assign]

Zero-initalize the histogram results Indicates that the memory region in which the histogram results are to be written in the histogram buffer are to be zero-initialized or not. Default: YES.

Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3