Contents

multiply(by:preBias:postBias:destination:)

Multiplies each four channel pixel in a 32-bit multiple-plane pixel buffer by a 4 x 4 matrix to produce a four channel result.

Declaration

func multiply<Matrix, DestFormat>(by matrix: Matrix, preBias: [Float], postBias: [Float], destination: vImage.PixelBuffer<DestFormat>) where Matrix : AccelerateBuffer, DestFormat : MultiplePlanePixelFormat, Matrix.Element == Float, DestFormat.ComponentType == Float

Parameters

  • matrix:

    The 4 x 4 multiplication matrix values in row-major order.

  • preBias:

    Values that the function adds to the source before multiplication.

  • postBias:

    A value that the function adds to the result after multiplication.

  • destination:

    The destination pixel buffer.

Discussion

This function applies the following operation to each pixel:

p = (source.0 + preBias.0) * matrix.0 +
    (source.1 + preBias.1) * matrix.1 +
    (source.2 + preBias.2) * matrix.2 +
    (source.3 + preBias.3) * matrix.3
destination = (p + postBias)

See Also

Matrix Multiplication