Core Image Filter Reference

Core Image Filter Reference

Framework
Companion guide

Overview

This reference describes the built-in filters available through the Core Image API. You can inspect filter parameters and see an image produced by a filter by using the CIFilterBrowser widget, available in an XCode install at /Developer/Extras/Core Image/.

Filters by Task

CICategoryBlur

CICategoryColorAdjustment

CICategoryColorEffect

CICategoryCompositeOperation

CICategoryDistortionEffect

CICategoryGenerator

CICategoryGeometryAdjustment

CICategoryGradient

CICategoryHalftoneEffect

CICategoryReduction

CICategorySharpen

CICategoryStylize

CICategoryTileEffect

CICategoryTransition

Filters

CIAdditionCompositing

Adds color components to achieve a brightening effect.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This filter is typically used to add highlights and lens flare effects. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Addition
Figure 1  The result of using the CIAdditionCompositing filter The result of using the CIAdditionCompositing filter
Availability
  • Available in OS X v10.4 and later.

CIAffineClamp

Performs an affine transform on a source image and then clamps the pixels at the edge of the transformed image, extending them outwards.

Parameters
inputImage

CIImage class whose display name is Image.

inputTransform

An NSAffineTransform class whose display name is Transform.

Discussion

This filter performs similarly to the CIAffineTransform filter except that it produces an image with infinite extent. You can use this filter when you need to blur an image but you want to avoid a soft, black fringe along the edges.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Affine Clamp
Figure 2  The result of using the CIAffineClamp filter The result of using the CIAffineClamp filter
Availability
  • Available in OS X v10.4 and later.

CIAffineTile

Applies an affine transform to an image and then tiles the transformed image.

Parameters
inputImage

CIImage class whose display name is Image.

inputTransform

An NSAffineTransform class whose display name is Transform.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Affine Tile
Figure 3  The result of using the CIAffineTile filter The result of using the CIAffineTile filter
Availability
  • Available in OS X v10.4 and later.

CIAffineTransform

Applies an affine transform to an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputTransform

An NSAffineTransform class whose display name is Transform.

Discussion

You can scale, translate, or rotate the input image. You can also apply a combination of these operations.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGeometryAdjustment
Localized Display Name
Affine Transform
Figure 4  The result of using the CIAffineTransform filter The result of using the CIAffineTransform filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIAreaAverage

Returns a single-pixel image that contains the average color for the region of interest.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Average
Availability
  • Available in OS X v10.5 and later.

CIAreaHistogram

Returns a 1D image (inputCount wide by one pixel high) that contains the component-wise histogram computed for the specified rectangular area.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

inputCount

The number of “buckets” for the histogram.

inputScale

A scaling factor. Core Image scales the histogram by dividing the scale by the area of the inputExtent rectangle.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Histogram
Availability
  • Available in OS X v10.5 and later.

CIAreaMaximum

Returns a single-pixel image that contains the maximum color components for the region of interest.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Maximum
Availability
  • Available in OS X v10.5 and later.

CIAreaMaximumAlpha

Returns a single-pixel image that contains the color vector with the maximum alpha value for the region of interest.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Discussion

If more than one pixel exists with the maximum alpha value, Core Image returns the vector that has the lowest x and y coordinate.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Maximum Alpha
Availability
  • Available in OS X v10.5 and later.

CIAreaMinimum

Returns a single-pixel image that contains the minimum color components for the region of interest.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Minimum
Availability
  • Available in OS X v10.5 and later.

CIAreaMinimumAlpha

Returns a single-pixel image that contains the color vector with the minimum alpha value for the region of interest.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Discussion

If more than one pixel exists with the minimum alpha value, Core Image returns the vector that has the lowest x and y coordinate.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Area Minimum Alpha
Availability
  • Available in OS X v10.5 and later.

CIBarsSwipeTransition

Transitions from one image to another by passing a bar over the source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 3.14 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 6.28 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 30.00 Minimum: 2.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 300.00 Identity: 30.00

inputBarOffset

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Bar Offset.

Default value: 10.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 10.00

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
CIBarsSwipeTransition
Figure 5  The result of using the CIBarsSwipeTransition filter The result of using the CIBarsSwipeTransition filter
Availability
  • Available in OS X v10.5 and later.

CIBlendWithMask

Uses values from a grayscale mask to interpolate between an image and the background.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

inputMaskImage

CIImage class whose display name is Mask Image.

Discussion

When a mask value is 0.0, the result is the background. When the mask value is 1.0, the result is the image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Blend With Mask
Figure 6  The result of using the CIBlendWithMask filter The result of using the CIBlendWithMask filter
Availability
  • Available in OS X v10.4 and later.

CIBloom

Softens edges and applies a pleasant glow to an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 10.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Bloom
Figure 7  The result of using the CIBloom filter The result of using the CIBloom filter
Availability
  • Available in OS X v10.4 and later.

CIBoxBlur

Blurs an image using a box-shaped convolution kernel.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 10.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
CIBoxBlur
Figure 8  The result of using the CIBoxBlur filter The result of using the CIBoxBlur filter
Availability
  • Available in OS X v10.5 and later.

CIBumpDistortion

Creates a bump that originates at a specified point in the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 600.00 Identity: 300.00

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 0.50 Minimum: -1.00 Maximum: 0.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 0.00

Discussion

The bump can be concave or convex.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Bump Distortion
Figure 9  The result of using the CIBumpDistortion filter The result of using the CIBumpDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIBumpDistortionLinear

Creates a concave or convex distortion that originates from a line in the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [300 300] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 600.00 Identity: 300.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 6.28 Identity: 0.00

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 0.50 Minimum: -1.00 Maximum: 0.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 1.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
CIBumpDistortionLinear
Figure 10  The result of using the CIBumpDistortionLinear filter The result of using the CIBumpDistortionLinear filter
Availability
  • Available in OS X v10.5 and later.

CICheckerboardGenerator

Generates a checkerboard pattern.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 80.00 Minimum: 0.00 Maximum: 800.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 80.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 1.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Discussion

You can specify the checkerboard size and colors, and the sharpness of the pattern.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Checkerboard
Figure 11  The result of using the CICheckerboardGenerator filter The result of using the CICheckerboardGenerator filter
Availability
  • Available in OS X v10.4 and later.

CICircleSplashDistortion

Distorts the pixels starting at the circumference of a circle and emanating outward.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 150.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1000.00 Identity: 0.10

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Circle Splash Distortion
Figure 12  The result of using the CICircleSplashDistortion filter The result of using the CICircleSplashDistortion filter
Availability
  • Available in OS X v10.4 and later.

CICircularScreen

Simulates a circular-shaped halftone screen.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 50.00 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.70 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryHalftoneEffect
Localized Display Name
Circular Screen
Figure 13  The result of using the CICircularScreen filter The result of using the CICircularScreen filter
Availability
  • Available in OS X v10.4 and later.

CICircularWrap

Wraps an image around a transparent circle.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 150.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 600.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

Discussion

The distortion of the image increases with the distance from the center of the circle.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Circular Wrap Distortion
Figure 14  The result of using the CICircularWrap filter The result of using the CICircularWrap filter
Availability
  • Available in OS X v10.4 and later.

CICMYKHalftone

Creates a color, halftoned rendition of the source image, using cyan, magenta, yellow, and black inks over a white page.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 6.00 Minimum: 2.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 100.00 Identity: 6.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.70 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputGCR

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Gray Component Replacement.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 1.00

inputUCR

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Under Color Removal.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.50

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryHalftoneEffect
Localized Display Name
CMYK Halftone
Figure 15  The result of using the CICMYKHalftone filter The result of using the CICMYKHalftone filter
Availability
  • Available in OS X v10.4 and later.

CIColorBlendMode

Uses the luminance values of the background with the hue and saturation values of the source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This mode preserves the gray levels in the image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Color Blend Mode
Figure 16  The result of using the CIColorBlendMode filter The result of using the CIColorBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIColorBurnBlendMode

Darkens the background image samples to reflect the source image samples.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

Source image sample values that specify white do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Color Burn Blend Mode
Figure 17  The result of using the CIColorBurnBlendMode filter The result of using the CIColorBurnBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIColorControls

Adjusts saturation, brightness, and contrast values.

Parameters
inputImage

CIImage class whose display name is Image.

inputSaturation

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Saturation.

Default value: 1.00 Minimum: 0.00 Maximum: 2.00 Slider minimum: 0.00 Slider maximum: 2.00 Identity: 1.00

inputBrightness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Brightness.

Default value: 0.00 Minimum: -1.00 Maximum: 1.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 0.00

inputContrast

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast.

Default value: 1.00 Minimum: 0.00 Maximum: 4.00 Slider minimum: 0.00 Slider maximum: 4.00 Identity: 1.00

Discussion

To calculate saturation, this filter linearly interpolates between a grayscale image (saturation = 0.0) and the original image (saturation = 1.0). The filter supports extrapolation: For values large than1.0, it increases saturation.

To calculate contrast, this filter uses the following formula:

(color.rgb - vec3(0.5)) * contrast + vec3(0.5)

This filter calculates brightness by adding a bias value:

color.rgb + vec3(brightness)

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Color Controls
Figure 18  The result of using the CIColorControls filter The result of using the CIColorControls filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIColorCube

Uses a three-dimensional color table to transform the source image pixels.

Parameters
inputImage

CIImage class whose display name is Image.

inputCubeDimension

An NSNumber class whose attribute type is CIAttributeTypeCount and whose display name is Cube Dimension.

Default value: 2.00 Minimum: 2.00 Maximum: 128.00 Slider minimum: 0.00 Slider maximum: 0.00 Identity: 2.00 The value must be a power of two.

inputCubeData

An NSData class whose display name is Cube Data.

Discussion

This filter applies a mapping from RGB space to new color values that are defined in inputCubeData. For each RGBA pixel in inputImage the filter uses the R,G and B values to index into a thee dimensional texture represented by inputCubeData. inputCubeData contains floating point RGBA cells that contain linear premultiplied values. The data is organized into inputCubeDimension number of xy planes, with each plane of size inputCubeDimension by inputCubeDimension. Input pixel components R and G are used to index the data in x and y respectively, and B is used to index in z. In inputCubeData the R component varies fastest, followed by G, then B.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Color Cube
Figure 19  The result of using the CIColorCube filter The result of using the CIColorCube filter
Availability
  • Available in OS X v10.4 and later.

CIColorDodgeBlendMode

Brightens the background image samples to reflect the source image samples.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

Source image sample values that specify black do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Color Dodge Blend Mode
Figure 20  The result of using the CIColorDodgeBlendMode filter The result of using the CIColorDodgeBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIColorInvert

Inverts the colors in an image.

Parameters
inputImage

CIImage class whose display name is Image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Color Invert
Figure 21  The result of using the CIColorInvert filter The result of using the CIColorInvert filter
Availability
  • Available in OS X v10.4 and later.

CIColorMap

Performs a nonlinear transformation of source color values using mapping values provided in a table.

Parameters
inputImage

CIImage class whose display name is Image.

inputGradientImage

CIImage class whose attribute type is CIAttributeTypeGradient and whose display name is Gradient Image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Color Map
Figure 22  The result of using the CIColorMap filter The result of using the CIColorMap filter
Availability
  • Available in OS X v10.4 and later.

CIColorMatrix

Multiplies source color values and adds a bias factor to each color component.

Parameters
inputImage

CIImage class whose display name is Image.

inputRVector

CIVector class whose display name is Red Vector.

Default value: [1 0 0 0] Identity: [1 0 0 0]

inputGVector

CIVector class whose display name is Green Vector.

Default value: [0 1 0 0] Identity: [0 1 0 0]

inputBVector

CIVector class whose display name is Blue Vector.

Default value: [0 0 1 0] Identity: [0 0 1 0]

inputAVector

CIVector class whose display name is Alpha Vector.

Default value: [0 0 0 1] Identity: [0 0 0 1]

inputBiasVector

CIVector class whose display name is Bias Vector.

Default value: [0 0 0 0] Identity: [0 0 0 0]

Discussion

This filter performs a matrix multiplication, as follows, to transform the color vector:

s.r = dot(s, redVector)
s.g = dot(s, greenVector)
s.b = dot(s, blueVector)
s.a = dot(s, alphaVector)
s = s + bias
Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Color Matrix
Figure 23  The result of using the CIColorMatrix filter The result of using the CIColorMatrix filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIColorMonochrome

Remaps colors so they fall within shades of a single color.

Parameters
inputImage

CIImage class whose display name is Image.

inputColor

CIColor class whose attribute type is CIAttributeTypeOpaqueColor and whose display name is Color.

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Color Monochrome
Figure 24  The result of using the CIColorMonochrome filter The result of using the CIColorMonochrome filter
Availability
  • Available in OS X v10.4 and later.

CIColorPosterize

Remaps red, green, and blue color components to the number of brightness values you specify for each color component.

Parameters
inputImage

CIImage class whose display name is Image.

inputLevels

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Levels.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 30.00 Identity: 300.00

Discussion

This filter flattens colors to achieve a look similar to that of a silk-screened poster.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Color Posterize
Figure 25  The result of using the CIColorPosterize filter The result of using the CIColorPosterize filter
Availability
  • Available in OS X v10.4 and later.

CIColumnAverage

Returns a 1-pixel high image that contains the average color for each scan column.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Column Average
Availability
  • Available in OS X v10.5 and later.

CIComicEffect

Simulates a comic book drawing by outlining edges and applying a color halftone effect.

Parameters
inputImage

CIImage class whose display name is Image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Comic Effect
Figure 26  The result of using the CIComicEffect filter The result of using the CIComicEffect filter
Availability
  • Available in OS X v10.5 and later.

CIConstantColorGenerator

Generates a solid color.

Parameters
inputColor

CIColor class whose display name is Color.

Discussion

You typically use the output of this filter as the input to another filter.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Constant Color
Figure 27  The result of using the CIConstantColorGenerator filter The result of using the CIConstantColorGenerator filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CICopyMachineTransition

Transitions from one image to another by simulating the effect of a copy machine.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputExtent

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Extent.

Default value: [0 0 300 300] Identity: (null)

inputColor

CIColor class whose attribute type is CIAttributeTypeOpaqueColor and whose display name is Color.

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 6.28 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 200.00 Minimum: 0.10 Maximum: 0.00 Slider minimum: 0.10 Slider maximum: 500.00 Identity: 200.00

inputOpacity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Opacity.

Default value: 1.30 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 3.00 Identity: 1.30

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Copy Machine
Figure 28  The result of using the CICopyMachineTransition filter The result of using the CICopyMachineTransition filter
Availability
  • Available in OS X v10.4 and later.

CICrop

Applies a crop to an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputRectangle

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Rectangle.

Default value: [0 0 300 300] Identity: (null)

Discussion

The size and shape of the cropped image depend on the rectangle you specify.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGeometryAdjustment
Localized Display Name
Crop
Figure 29  The result of using the CICrop filter The result of using the CICrop filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CICrystallize

Creates polygon-shaped color blocks by aggregating source pixel-color values.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 20.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 1.00

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Crystallize
Figure 30  The result of using the CICrystallize filter The result of using the CICrystallize filter
Availability
  • Available in OS X v10.4 and later.

CIDarkenBlendMode

Creates composite image samples by choosing the darker samples (from either the source image or the background).

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The result is that the background image samples are replaced by any source image samples that are darker. Otherwise, the background image samples are left unchanged. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Darken Blend Mode
Figure 31  The result of using the CIDarkenBlendMode filter The result of using the CIDarkenBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIDifferenceBlendMode

Subtracts either the source image sample color from the background image sample color, or the reverse, depending on which sample has the greater brightness value.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

Source image sample values that are black produce no change; white inverts the background color values. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Difference Blend Mode
Figure 32  The result of using the CIDifferenceBlendMode filter The result of using the CIDifferenceBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIDiscBlur

Blurs an image using a disc-shaped convolution kernel.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 8.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
CIDiscBlur
Figure 33  The result of using the CIDiscBlur filter The result of using the CIDiscBlur filter
Availability
  • Available in OS X v10.5 and later.

CIDisintegrateWithMaskTransition

Transitions from one image to another using the shape defined by a mask.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputMaskImage

CIImage class whose display name is Mask Image.

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputShadowRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Shadow Radius.

Default value: 8.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 50.00 Identity: 0.00

inputShadowDensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Shadow Density.

Default value: 0.65 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputShadowOffset

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Shadow Offset.

Default value: [0 -10] Identity: [0 0]

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Disintegrate with Mask
Figure 34  The result of using the CIDisintegrateWithMaskTransition filter The result of using the CIDisintegrateWithMaskTransition filter
Availability
  • Available in OS X v10.4 and later.

CIDisplacementDistortion

Applies the grayscale values of the second image to the first image.

Parameters
inputImage

CIImage class whose display name is Image.

inputDisplacementImage

CIImage class whose display name is Displacement Image.

inputScale

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Scale.

Default value: 50.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 200.00 Identity: 0.00

Discussion

The output image has a texture defined by the grayscale values.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Displacement Distortion
Figure 35  The result of using the CIDisplacementDistortion filter The result of using the CIDisplacementDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIDissolveTransition

Uses a dissolve to transition from one image to another.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Dissolve
Figure 36  The result of using the CIDissolveTransition filter The result of using the CIDissolveTransition filter
Availability
  • Available in OS X v10.4 and later.

CIDotScreen

Simulates the dot patterns of a halftone screen.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 50.00 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.70 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryHalftoneEffect
Localized Display Name
Dot Screen
Figure 37  The result of using the CIDotScreen filter The result of using the CIDotScreen filter
Availability
  • Available in OS X v10.4 and later.

CIEdges

Finds all edges in an image and displays them in color.

Parameters
inputImage

CIImage class whose display name is Image.

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 10.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Edges
Figure 38  The result of using the CIEdges filter The result of using the CIEdges filter
Availability
  • Available in OS X v10.4 and later.

CIEdgeWork

Produces a stylized black-and-white rendition of an image that looks similar to a woodblock cutout.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 3.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 20.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Edge Work
Figure 39  The result of using the CIEdgeWork filter The result of using the CIEdgeWork filter
Availability
  • Available in OS X v10.4 and later.

CIEightfoldReflectedTile

Produces a tiled image from a source image by applying an 8-way reflected symmetry.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CIEightfoldReflectedTile
Figure 40  The result of using the CIEightfoldReflectedTile filter The result of using the CIEightfoldReflectedTile filter
Availability
  • Available in OS X v10.5 and later.

CIExclusionBlendMode

Produces an effect similar to that produced by the CIDifferenceBlendMode filter but with lower contrast.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

Source image sample values that are black do not produce a change; white inverts the background color values. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Exclusion Blend Mode
Figure 41  The result of using the CIExclusionBlendMode filter The result of using the CIExclusionBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIExposureAdjust

Adjusts the exposure setting for an image similar to the way you control exposure for a camera when you change the F-stop.

Parameters
inputImage

CIImage class whose display name is Image.

inputEV

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is EV.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: -10.00 Slider maximum: 10.00 Identity: 0.00

Discussion

This filter multiplies the color values, as follows, to simulate exposure change by the specified F-stops:

s.rgb * pow(2.0, ev)

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Exposure Adjust
Figure 42  The result of using the CIExposureAdjust filter The result of using the CIExposureAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIFalseColor

Maps luminance to a color ramp of two colors.

Parameters
inputImage

CIImage class whose display name is Image.

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

Discussion

False color is often used to process astronomical and other scientific data, such as ultraviolet and x-ray images.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
False Color
Figure 43  The result of using the CIFalseColor filter The result of using the CIFalseColor filter
Availability
  • Available in OS X v10.4 and later.

CIFlashTransition

Transitions from one image to another by creating a flash.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputExtent

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Extent.

Default value: [0 0 300 300] Identity: (null)

inputColor

CIColor class whose attribute type is CIAttributeTypeOpaqueColor and whose display name is Color.

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputMaxStriationRadius

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Maximum Striation Radius.

Default value: 2.58 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 10.00 Identity: 2.58

inputStriationStrength

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Strength.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 3.00 Identity: 0.50

inputStriationContrast

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Contrast.

Default value: 1.38 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 5.00 Identity: 1.38

inputFadeThreshold

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Fade Threshold.

Default value: 0.85 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.85

Discussion

The flash originates from a point you specify. Small at first, it rapidly expands until the image frame is completely filled with the flash color. As the color fades, the target image begins to appear.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Flash
Figure 44  The result of using the CIFlashTransition filter The result of using the CIFlashTransition filter
Availability
  • Available in OS X v10.4 and later.

CIFourfoldReflectedTile

Produces a tiled image from a source image by applying a 4-way reflected symmetry.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputAcuteAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Acute Angle.

Default value: 1.57 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 1.57

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CIFourfoldReflectedTile
Figure 45  The result of using the CIFourfoldReflectedTile filter The result of using the CIFourfoldReflectedTile filter
Availability
  • Available in OS X v10.5 and later.

CIFourfoldRotatedTile

Produces a tiled image from a source image by rotating the source image at increments of 90 degrees.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CIFourfoldRotatedTile
Figure 46  The result of using the CIFourfoldRotatedTile filter The result of using the CIFourfoldRotatedTile filter
Availability
  • Available in OS X v10.5 and later.

CIFourfoldTranslatedTile

Produces a tiled image from a source image by applying 4 translation operations.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputAcuteAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Acute Angle.

Default value: 1.57 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 1.57

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CIFourfoldTranslatedTile
Figure 47  The result of using the CIFourfoldTranslatedTile filter The result of using the CIFourfoldTranslatedTile filter
Availability
  • Available in OS X v10.5 and later.

CIGammaAdjust

Adjusts midtone brightness.

Parameters
inputImage

CIImage class whose display name is Image.

inputPower

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Power.

Default value: 0.75 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.10 Slider maximum: 3.00 Identity: 1.00

Discussion

This filter is typically used to compensate for nonlinear effects of displays. Adjusting the gamma effectively changes the slope of the transition between black and white. It uses the following formula:

pow(s.rgb, vec3(power))

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Gamma Adjust
Figure 48  The result of using the CIGammaAdjust filter The result of using the CIGammaAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIGaussianBlur

Spreads source pixels by an amount specified by a Gaussian distribution.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 10.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
Gaussian Blur
Figure 49  The result of using the CIGaussianBlur filter The result of using the CIGaussianBlur filter
Availability
  • Available in OS X v10.4 and later.

CIGaussianGradient

Generates a gradient that varies from one color to another using a Gaussian distribution.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 300.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGradient
Localized Display Name
Gaussian Gradient
Figure 50  The result of using the CIGaussianGradient filter The result of using the CIGaussianGradient filter
Availability
  • Available in OS X v10.4 and later.

CIGlassDistortion

Distorts an image by applying a glass-like texture.

Parameters
inputImage

CIImage class whose display name is Image.

inputTexture

CIImage class whose display name is Texture.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputScale

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Scale.

Default value: 200.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.01 Slider maximum: 500.00 Identity: 0.00

Discussion

The raised portions of the output image are the result of applying a texture map.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Glass Distortion
Figure 51  The result of using the CIGlassDistortion filter The result of using the CIGlassDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIGlassLozenge

Creates a lozenge-shaped lens and distorts the portion of the image over which the lens is placed.

Parameters
inputImage

CIImage class whose display name is Image.

inputPoint0

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Point 1.

Default value: [150 150] Identity: (null)

inputPoint1

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Point 2.

Default value: [350 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1000.00 Identity: 100.00

inputRefraction

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Refraction.

Default value: 1.70 Minimum: -5.00 Maximum: 0.00 Slider minimum: -5.00 Slider maximum: 5.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Glass Lozenge
Figure 52  The result of using the CIGlassLozenge filter The result of using the CIGlassLozenge filter
Availability
  • Available in OS X v10.4 and later.

CIGlideReflectedTile

Produces a tiled image from a source image by translating and smearing the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CIGlideReflectedTile
Figure 53  The result of using the CIGlideReflectedTile filter The result of using the CIGlideReflectedTile filter
Availability
  • Available in OS X v10.5 and later.

CIGloom

Dulls the highlights of an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 10.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Gloom
Figure 54  The result of using the CIGloom filter The result of using the CIGloom filter
Availability
  • Available in OS X v10.4 and later.

CIHardLightBlendMode

Either multiplies or screens colors, depending on the source image sample color.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

If the source image sample color is lighter than 50% gray, the background is lightened, similar to screening. If the source image sample color is darker than 50% gray, the background is darkened, similar to multiplying. If the source image sample color is equal to 50% gray, the source image is not changed. Image samples that are equal to pure black or pure white result in pure black or white. The overall effect is similar to what you would achieve by shining a harsh spotlight on the source image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Hard Light Blend Mode
Figure 55  The result of using the CIHardLightBlendMode filter The result of using the CIHardLightBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIHatchedScreen

Simulates the hatched pattern of a halftone screen.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 50.00 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.70 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryHalftoneEffect
Localized Display Name
Hatched Screen
Figure 56  The result of using the CIHatchedScreen filter The result of using the CIHatchedScreen filter
Availability
  • Available in OS X v10.4 and later.

CIHeightFieldFromMask

Produces a continuous three-dimensional, loft-shaped height field from a grayscale mask.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 10.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 300.00 Identity: 10.00

Discussion

The white values of the mask define those pixels that are inside the height field while the black values define those pixels that are outside. The field varies smoothly and continuously inside the mask, reaching the value 0 at the edge of the mask. You can use this filter with the CIShadedMaterial filter to produce extremely realistic shaded objects.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Height Field From Mask
Figure 57  The result of using the CIHeightFieldFromMask filter The result of using the CIHeightFieldFromMask filter
Availability
  • Available in OS X v10.4 and later.

CIHexagonalPixellate

Maps an image to colored hexagons whose color is defined by the replaced pixels.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputScale

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Scale.

Default value: 8.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 1.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
CIHexagonalPixellate
Figure 58  The result of using the CIHexagonalPixellate filter The result of using the CIHexagonalPixellate filter
Availability
  • Available in OS X v10.5 and later.

CIHighlightShadowAdjust

Adjust the tonal mapping of an image while preserving spatial detail.

Parameters
inputImage

CIImage class whose display name is Image.

inputHighlightAmount

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Highlight Amount.

Default value: 1.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 1.00

inputShadowAmount

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Shadow Amount.

Default value: 0.00 Minimum: -1.00 Maximum: 1.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Highlight and Shadows
Figure 59  The result of using the CIHighlightShadowAdjust filter The result of using the CIHexagonalPixellate filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIHoleDistortion

Creates a circular area that pushes the image pixels outward, distorting those pixels closest to the circle the most.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 150.00 Minimum: 0.01 Maximum: 0.00 Slider minimum: 0.01 Slider maximum: 1000.00 Identity: 0.10

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Hole Distortion
Figure 60  The result of using the CIHoleDistortion filter The result of using the CIHoleDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIHueAdjust

Changes the overall hue, or tint, of the source pixels.

Parameters
inputImage

CIImage class whose display name is Image.

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

Discussion

This filter essentially rotates the color cube around the neutral axis.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Hue Adjust
Figure 61  The result of using the CIHueAdjust filter The result of using the CIHueAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIHueBlendMode

Uses the luminance and saturation values of the background with the hue of the source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Hue Blend Mode
Figure 62  The result of using the CIHueBlendMode filter The result of using the CIHueBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIKaleidoscope

Produces a kaleidoscopic image from a source image by applying 12-way symmetry.

Parameters
inputImage

CIImage class whose display name is Image.

inputCount

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Count.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 64.00 Identity: 0.00

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Kaleidoscope
Figure 63  The result of using the CIKaleidoscope filter The result of using the CIKaleidoscope filter
Availability
  • Available in OS X v10.4 and later.

CILanczosScaleTransform

Produces a high-quality, scaled version of a source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.05 Slider maximum: 1.50 Identity: 1.00

inputAspectRatio

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Aspect Ratio.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.50 Slider maximum: 2.00 Identity: 1.00

Discussion

You typically use this filter to scale down an image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGeometryAdjustment
Localized Display Name
Lanczos Scale Transform
Figure 64  The result of using the CILanczosScaleTransform filter The result of using the CILanczosScaleTransform filter
Availability
  • Available in OS X v10.4 and later.

CILenticularHaloGenerator

Simulates a halo that is generated by the diffraction associated with the spread of a lens.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor

CIColor class whose display name is Color.

inputHaloRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Halo Radius.

Default value: 70.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1000.00 Identity: 0.00

inputHaloWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Halo Width.

Default value: 87.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 300.00 Identity: 0.00

inputHaloOverlap

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Halo Overlap.

Default value: 0.77 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputStriationStrength

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Strength.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 3.00 Identity: 0.00

inputStriationContrast

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Contrast.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 5.00 Identity: 0.00

inputTime

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Discussion

This filter is typically applied to another image to simulate lens flares and similar effects.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Lenticular Halo
Figure 65  The result of using the CILenticularHaloGenerator filter The result of using the CILenticularHaloGenerator filter
Availability
  • Available in OS X v10.4 and later.

CILightenBlendMode

Creates composite image samples by choosing the lighter samples (either from the source image or the background).

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The result is that the background image samples are replaced by any source image samples that are lighter. Otherwise, the background image samples are left unchanged. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Lighten Blend Mode
Figure 66  The result of using the CILightenBlendMode filter The result of using the CILightenBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CILinearGradient

Generates a gradient that varies along a linear axis between two defined endpoints.

Parameters
inputPoint0

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Point 1.

Default value: [0 0] Identity: (null)

inputPoint1

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Point 2.

Default value: [200 200] Identity: (null)

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGradient
Localized Display Name
Linear Gradient
Figure 67  The result of using the CILinearGradient filter The result of using the CILinearGradient filter
Availability
  • Available in OS X v10.4 and later.

CILineOverlay

Creates a sketch that outlines the edges of an image in black.

Parameters
inputImage

CIImage class whose display name is Image.

inputNRNoiseLevel

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is NR Noise Level.

Default value: 0.07 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 0.10 Identity: 0.00

inputNRSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is NR Sharpness.

Default value: 0.71 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 2.00 Identity: 0.00

inputEdgeIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Edge Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 200.00 Identity: 0.00

inputThreshold

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Threshold.

Default value: 0.10 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputContrast

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast.

Default value: 50.00 Minimum: 0.25 Maximum: 0.00 Slider minimum: 0.25 Slider maximum: 200.00 Identity: 1.00

Discussion

The portions of the image that are not outlined are transparent.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Line Overlay
Figure 68  The result of using the CILineOverlay filter The result of using the CILineOverlay filter
Availability
  • Available in OS X v10.5 and later.

CILineScreen

Simulates the line pattern of a halftone screen.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 6.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 2.00 Slider maximum: 50.00 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.70 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryHalftoneEffect
Localized Display Name
Line Screen
Figure 69  The result of using the CILineScreen filter The result of using the CILineScreen filter
Availability
  • Available in OS X v10.4 and later.

CILuminosityBlendMode

Uses the hue and saturation of the background with the luminance of the source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This mode creates an effect that is inverse to the effect created by the CIColorBlendMode filter. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Luminosity Blend Mode
Figure 70  The result of using the CILuminosityBlendMode filter The result of using the CILuminosityBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIMaskToAlpha

Converts a grayscale image to a white image that is masked by alpha.

Parameters
inputImage

CIImage class whose display name is Image.

Discussion

The white values from the source image produce the inside of the mask; the black values become completely transparent.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Mask To Alpha
Figure 71  The result of using the CIMaskToAlpha filter The result of using the CIMaskToAlpha filter
Availability
  • Available in OS X v10.4 and later.

CIMaximumComponent

Returns a grayscale image from max(r,g,b).

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Maximum Component
Availability
  • Available in OS X v10.5 and later.

CIMaximumCompositing

Computes the maximum value, by color component, of two input images and creates an output image using the maximum values.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This is similar to dodging. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Maximum
Figure 72  The result of using the CIMaximumCompositing filter The result of using the CIMaximumCompositing filter
Availability
  • Available in OS X v10.4 and later.

CIMedianFilter

Computes the median value for a group of neighboring pixels and replaces each pixel value with the median.

Parameters
inputImage

CIImage class whose display name is Image.

Discussion

The effect is to reduce noise.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
Median
Figure 73  The result of using the CIMedianFilter filter The result of using the CIMedianFilter filter
Availability
  • Available in OS X v10.4 and later.

CIMinimumComponent

Returns a grayscale image from min(r,g,b).

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Minimum Component
Availability
  • Available in OS X v10.5 and later.

CIMinimumCompositing

Computes the minimum value, by color component, of two input images and creates an output image using the minimum values.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This is similar to burning. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Minimum
Figure 74  The result of using the CIMinimumCompositing filter The result of using the CIMinimumCompositing filter
Availability
  • Available in OS X v10.4 and later.

CIModTransition

Transitions from one image to another by revealing the target image through irregularly shaped holes.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 2.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -6.28 Slider maximum: 6.28 Identity: 2.00

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 150.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 0.00

inputCompression

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Compression.

Default value: 300.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 100.00 Slider maximum: 800.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Mod
Figure 75  The result of using the CIModTransition filter The result of using the CIModTransition filter
Availability
  • Available in OS X v10.4 and later.

CIMotionBlur

Blurs an image to simulate the effect of using a camera that moves a specified angle and distance while capturing the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 20.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
Motion Blur
Figure 76  The result of using the CIMotionBlur filter The result of using the CIMotionBlur filter
Availability
  • Available in OS X v10.4 and later.

CIMultiplyBlendMode

Multiplies the source image samples with the background image samples.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This results in colors that are at least as dark as either of the two contributing sample colors. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Multiply Blend Mode
Figure 77  The result of using the CIMultiplyBlendMode filter The result of using the CIMultiplyBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIMultiplyCompositing

Multiplies the color component of two input images and creates an output image using the multiplied values.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This filter is typically used to add a spotlight or similar lighting effect to an image. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital Images.Computer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Multiply
Figure 78  The result of using the CIMultiplyCompositing filter The result of using the CIMultiplyCompositing filter
Availability
  • Available in OS X v10.4 and later.

CINoiseReduction

Reduces noise using a threshold value to define what is considered noise.

Parameters
inputImage

CIImage class whose display name is Image.

inputNoiseLevel

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Noise Level.

Default value: 0.02 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 0.10 Identity: 0.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.40 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 2.00 Identity: 0.00

Discussion

Small changes in luminance below that value are considered noise and get a noise reduction treatment, which is a local blur. Changes above the threshold value are considered edges, so they are sharpened.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
Noise Reduction
Figure 79  The result of using the CINoiseReduction filter The result of using the CINoiseReduction filter
Availability
  • Available in OS X v10.4 and later.

CIOpTile

Segments an image, applying any specified scaling and rotation, and then assembles the image again to give an op art appearance.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 2.80 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.10 Slider maximum: 10.00 Identity: 1.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 65.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 1000.00 Identity: 65.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Op Tile
Figure 80  The result of using the CIOpTile filter The result of using the CIOpTile filter
Availability
  • Available in OS X v10.4 and later.

CIOverlayBlendMode

Either multiplies or screens the source image samples with the background image samples, depending on the background color.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The result is to overlay the existing image samples while preserving the highlights and shadows of the background. The background color mixes with the source image to reflect the lightness or darkness of the background. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Overlay Blend Mode
Figure 81  The result of using the CIOverlayBlendMode filter The result of using the CIOverlayBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIPageCurlTransition

Transitions from one image to another by simulating a curling page, revealing the new image as the page curls.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputBacksideImage

CIImage class whose display name is Backside Image.

inputShadingImage

CIImage class whose display name is Shading Image.

inputExtent

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Extent.

Default value: [0 0 300 300] Identity: (null)

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 100.00 Minimum: 0.01 Maximum: 0.00 Slider minimum: 0.01 Slider maximum: 200.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Page Curl
Figure 82  The result of using the CIPageCurlTransition filter The result of using the CIPageCurlTransition filter
Availability
  • Available in OS X v10.4 and later.

CIParallelogramTile

Warps an image by reflecting it in a parallelogram, and then tiles the result.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputAcuteAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Acute Angle.

Default value: 1.57 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 1.57

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Parallelogram Tile
Figure 83  The result of using the CIParallelogramTile filter The result of using the CIParallelogramTile filter
Availability
  • Available in OS X v10.4 and later.

CIPerspectiveTile

Applies a perspective transform to an image and then tiles the result.

Parameters
inputImage

CIImage class whose display name is Image.

inputTopLeft

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Top Left.

Default value: [118 484] Identity: (null)

inputTopRight

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Top Right.

Default value: [646 507] Identity: (null)

inputBottomRight

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Bottom Right.

Default value: [548 140] Identity: (null)

inputBottomLeft

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Bottom Left.

Default value: [155 153] Identity: (null)

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Perspective Tile
Figure 84  The result of using the CIPerspectiveTile filter The result of using the CIPerspectiveTile filter
Availability
  • Available in OS X v10.4 and later.

CIPerspectiveTransform

Alters the geometry of an image to simulate the observer changing viewing position.

Parameters
inputImage

CIImage class whose display name is Image.

inputTopLeft

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Top Left.

Default value: [118 484] Identity: (null)

inputTopRight

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Top Right.

Default value: [646 507] Identity: (null)

inputBottomRight

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Bottom Right.

Default value: [548 140] Identity: (null)

inputBottomLeft

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Bottom Left.

Default value: [155 153] Identity: (null)

Discussion

You can use the perspective filter to skew an image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGeometryAdjustment
Localized Display Name
Perspective Transform
Figure 85  The result of using the CIPerspectiveTransform filter The result of using the CIPerspectiveTransform filter
Availability
  • Available in OS X v10.4 and later.

CIPinchDistortion

Creates a rectangular-shaped area that pinches source pixels inward, distorting those pixels closest to the rectangle the most.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1000.00 Identity: 0.00

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Pinch Distortion
Figure 86  The result of using the CIPinchDistortion filter The result of using the CIPinchDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIPixellate

Makes an image blocky by mapping the image to colored squares whose color is defined by the replaced pixels.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputScale

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Scale.

Default value: 8.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 1.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Pixellate
Figure 87  The result of using the CIPixellate filter The result of using the CIPixellate filter
Availability
  • Available in OS X v10.4 and later.

CIPointillize

Renders the source image in a pointillistic style.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 20.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 100.00 Identity: 1.00

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Pointillize
Figure 88  The result of using the CIPointillize filter The result of using the CIPointillize filter
Availability
  • Available in OS X v10.4 and later.

CIRadialGradient

Generates a gradient that varies radially between two circles having the same center.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius0

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius 1.

Default value: 5.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 5.00

inputRadius1

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius 2.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 100.00

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

Discussion

It is valid for one of the two circles to have a radius of 0.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGradient
Localized Display Name
Radial Gradient
Figure 89  The result of using the CIRadialGradient filter The result of using the CIRadialGradient filter
Availability
  • Available in OS X v10.4 and later.

CIRandomGenerator

Generates an image of infinite extent whose pixel values are made up of four independent, uniformly-distributed random numbers in the 0 to 1 range.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Random Generator
Figure 90  The result of using the CIRandomGenerator filter The result of using the CIRandomGenerator filter
Availability
  • Available in OS X v10.4 and later.

CIRippleTransition

Transitions from one image to another by creating a circular wave that expands from the center point, revealing the new image in the wake of the wave.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputShadingImage

CIImage class whose display name is Shading Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputExtent

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Extent.

Default value: [0 0 300 300] Identity: (null)

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 1.00 Maximum: 0.00 Slider minimum: 10.00 Slider maximum: 300.00 Identity: 0.00

inputScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Scale.

Default value: 50.00 Minimum: -50.00 Maximum: 0.00 Slider minimum: -50.00 Slider maximum: 50.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Ripple
Figure 91  The result of using the CIRippleTransition filter The result of using the CIRippleTransition filter
Availability
  • Available in OS X v10.4 and later.

CIRowAverage

Returns a 1-pixel high image that contains the average color for each scan row.

Parameters
inputImage

CIImage class whose display name is Image. This is the image data you want to process.

inputExtent

The rectangular region of interest.

Member of
CICategoryReductionCICategoryStillImageCICategoryVideoCICategoryBuiltIn
Localized Display Name
Row Average
Availability
  • Available in OS X v10.5 and later.

CISaturationBlendMode

Uses the luminance and hue values of the background with the saturation of the source image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

Areas of the background that have no saturation (that is, pure gray areas) do not produce a change. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Saturation Blend Mode
Figure 92  The result of using the CISaturationBlendMode filter The result of using the CISaturationBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CIScreenBlendMode

Multiplies the inverse of the source image samples with the inverse of the background image samples.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

This results in colors that are at least as light as either of the two contributing sample colors. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Screen Blend Mode
Figure 93  The result of using the CIScreenBlendMode filter The result of using the CIScreenBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CISepiaTone

Maps the colors of an image to various shades of brown.

Parameters
inputImage

CIImage class whose display name is Image.

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 1.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryNonSquarePixelsCICategoryInterlacedCICategoryVideoCICategoryColorEffect
Localized Display Name
Sepia Tone
Figure 94  The result of using the CISepiaTone filter The result of using the CISepiaTone filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIShadedMaterial

Produces a shaded image from a height field.

Parameters
inputImage

CIImage class whose display name is Image.

inputShadingImage

CIImage class whose display name is Shading Image.

inputScale

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Scale.

Default value: 10.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.50 Slider maximum: 200.00 Identity: 0.00

Discussion

The height field is defined to have greater heights with lighter shades, and lesser heights (lower areas) with darker shades. You can combine this filter with the CIHeightFieldFromMask filter to produce quick shadings of masks, such as text.

This filter sets the input image as a height-field (multiplied by the scale parameter), and computes a normal vector for each pixel. It then uses that normal vector to look up the reflected color for that direction in the input shading image.

The input shading image contains the picture of a hemisphere, which defines the way the surface is shaded. The look-up coordinate for a normal vector is:

(normal.xy + 1.0) * 0.5 * vec2(shadingImageWidth, shadingImageHeight)

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Shaded Material
Figure 95  The result of using the CIShadedMaterial filter The result of using the CIShadedMaterial filter
Availability
  • Available in OS X v10.4 and later.

CISharpenLuminance

Increases image detail by sharpening.

Parameters
inputImage

CIImage class whose display name is Image.

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 0.40 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 2.00 Identity: 0.00

Discussion

It operates on the luminance of the image; the chrominance of the pixels remains unaffected.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategorySharpen
Localized Display Name
Sharpen Luminance
Figure 96  The result of using the CISharpenLuminance filter The result of using the CISharpenLuminance filter
Availability
  • Available in OS X v10.4 and later.

CISixfoldReflectedTile

Produces a tiled image from a source image by applying a 6-way reflected symmetry.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CISixfoldReflectedTile
Figure 97  The result of using the CISixfoldReflectedTile filter The result of using the CISixfoldReflectedTile filter
Availability
  • Available in OS X v10.5 and later.

CISixfoldRotatedTile

Produces a tiled image from a source image by rotating the source image at increments of 60 degrees.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CISixfoldRotatedTile
Figure 98  The result of using the CISixfoldRotatedTile filter The result of using the CISixfoldRotatedTile filter
Availability
  • Available in OS X v10.5 and later.

CISoftLightBlendMode

Either darkens or lightens colors, depending on the source image sample color.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

If the source image sample color is lighter than 50% gray, the background is lightened, similar to dodging. If the source image sample color is darker than 50% gray, the background is darkened, similar to burning. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white produce darker or lighter areas, but do not result in pure black or white. The overall effect is similar to what you would achieve by shining a diffuse spotlight on the source image. The formula used to create this filter is described in the PDF specification, which is available online from the Adobe Developer Center. See PDF Reference and Adobe Extensions to the PDF Specification.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryCompositeOperation
Localized Display Name
Soft Light Blend Mode
Figure 99  The result of using the CISoftLightBlendMode filter The result of using the CISoftLightBlendMode filter
Availability
  • Available in OS X v10.4 and later.

CISourceAtopCompositing

Places the source image over the background image, then uses the luminance of the background image to determine what to show.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The composite shows the background image and only those portions of the source image that are over visible parts of the background. The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Source Atop
Figure 100  The result of using the CISourceAtopCompositing filter The result of using the CISourceAtopCompositing filter
Availability
  • Available in OS X v10.4 and later.

CISourceInCompositing

Uses the second image to define what to leave in the source image, effectively cropping the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Source In
Figure 101  The result of using the CISourceInCompositing filter The result of using the CISourceInCompositing filter
Availability
  • Available in OS X v10.4 and later.

CISourceOutCompositing

Uses the second image to define what to take out of the first image.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Source Out
Figure 102  The result of using the CISourceOutCompositing filter The result of using the CISourceOutCompositing filter
Availability
  • Available in OS X v10.4 and later.

CISourceOverCompositing

Places the second image over the first.

Parameters
inputImage

CIImage class whose display name is Image.

inputBackgroundImage

CIImage class whose display name is Background Image.

Discussion

The formula used to create this filter is described in Thomas Porter and Tom Duff. 1984. Compositing Digital ImagesComputer Graphics, 18 (3): 253-259.

Member of
CICategoryBuiltInCICategoryHighDynamicRangeCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideo, CICategoryCompositeOperation
Localized Display Name
Source Over
Figure 103  The result of using the CISourceOverCompositing filter The result of using the CISourceOverCompositing filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CISpotColor

Replaces one or more color ranges with spot colors.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenterColor1

CIColor class whose display name is Center Color 1.

inputReplacementColor1

CIColor class whose display name is Replacement Color 1.

inputCloseness1

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Closeness1.

Default value: 0.22 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 0.50 Identity: 0.00

inputContrast1

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast 1.

Default value: 0.98 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputCenterColor2

CIColor class whose display name is Center Color 2.

inputReplacementColor2

CIColor class whose display name is Replacement Color 2.

inputCloseness2

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Closeness 2.

Default value: 0.15 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 0.50 Identity: 0.00

inputContrast2

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast 2.

Default value: 0.98 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputCenterColor3

CIColor class whose display name is Center Color 3.

inputReplacementColor3

CIColor class whose display name is Replacement Color 3.

inputCloseness3

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Closeness 3.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 0.50 Identity: 0.00

inputContrast3

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast 3.

Default value: 0.99 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Spot Color
Figure 104  The result of using the CISpotColor filter The result of using the CISpotColor filter
Availability
  • Available in OS X v10.5 and later.

CISpotLight

Applies a directional spotlight effect to an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputLightPosition

CIVector class whose attribute type is CIAttributeTypePosition3 and whose display name is Light Position.

Default value: [400 600 150] Identity: (null)

inputLightPointsAt

CIVector class whose attribute type is CIAttributeTypePosition3 and whose display name is Light Points At.

Default value: [200 200 0] Identity: (null)

inputBrightness

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Brightness.

Default value: 3.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 10.00 Identity: 1.00

inputConcentration

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Concentration.

Default value: 0.10 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.50 Identity: 20.00

inputColor

CIColor class whose attribute type is CIAttributeTypeOpaqueColor and whose display name is Color.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryStylize
Localized Display Name
Spot Light
Figure 105  The result of using the CISpotLight filter The result of using the CISpotLight filter
Availability
  • Available in OS X v10.4 and later.

CIStarShineGenerator

Generates a starburst pattern.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor

CIColor class whose display name is Color.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 50.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 300.00 Identity: 50.00

inputCrossScale

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Cross Scale.

Default value: 15.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 15.00

inputCrossAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Cross Angle.

Default value: 0.60 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.60

inputCrossOpacity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Cross Opacity.

Default value: -2.00 Minimum: -8.00 Maximum: 0.00 Slider minimum: -8.00 Slider maximum: 0.00 Identity: -2.00

inputCrossWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Cross Width.

Default value: 2.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.50 Slider maximum: 10.00 Identity: 2.50

inputEpsilon

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Epsilon.

Default value: -2.00 Minimum: -8.00 Maximum: 0.00 Slider minimum: -8.00 Slider maximum: 0.00 Identity: -2.00

Discussion

The output image is typically used as input to another filter

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Star Shine
Figure 106  The result of using the CIStarShineGenerator filter The result of using the CIStarShineGenerator filter
Availability
  • Available in OS X v10.4 and later.

CIStraightenFilter

Rotates the source image by the specified angle in radians.

Parameters
inputImage

CIImage class whose display name is Image.

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Angle

Default value: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

Discussion

The image is scaled and cropped so that the rotated image fits the extent of the input image.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGeometryAdjustment
Localized Display Name
Straighten
Figure 107  The result of using CIStraightenFilter filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIStripesGenerator

Generates a stripe pattern.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor0

CIColor class whose display name is Color 1.

inputColor1

CIColor class whose display name is Color 2.

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 80.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 80.00

inputSharpness

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Sharpness.

Default value: 1.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 1.00

Discussion

You can control the color of the stripes, the spacing, and the contrast.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Stripes
Figure 108  The result of using the CIStripesGenerator filter The result of using the CIStripesGenerator filter
Availability
  • Available in OS X v10.4 and later.

CISunbeamsGenerator

Generates a sun effect.

Parameters
inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputColor

CIColor class whose display name is Color.

inputSunRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Sun Radius.

Default value: 40.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 40.00

inputMaxStriationRadius

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Maximum Striation Radius.

Default value: 2.58 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 10.00 Identity: 2.58

inputStriationStrength

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Strength.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 3.00 Identity: 0.50

inputStriationContrast

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Striation Contrast.

Default value: 1.38 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 5.00 Identity: 1.38

inputTime

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Discussion

You typically use the output of the sunbeams filter as input to a composite filter.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryGenerator
Localized Display Name
Sunbeams
Figure 109  The result of using the CISunbeamsGenerator filter The result of using the CISunbeamsGenerator filter
Availability
  • Available in OS X v10.4 and later.

CISwipeTransition

Transitions from one image to another by simulating a swiping action.

Parameters
inputImage

CIImage class whose display name is Image.

inputTargetImage

CIImage class whose display name is Target Image.

inputExtent

CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Extent.

Default value: [0 0 300 300] Identity: (null)

inputColor

CIColor class whose attribute type is CIAttributeTypeOpaqueColor and whose display name is Color.

inputTime

An NSNumber class whose attribute type is CIAttributeTypeTime and whose display name is Time.

Default value: 0.00 Minimum: 0.00 Maximum: 1.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 300.00 Minimum: 0.10 Maximum: 0.00 Slider minimum: 0.10 Slider maximum: 800.00 Identity: 0.00

inputOpacity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Opacity.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTransition
Localized Display Name
Swipe
Figure 110  The result of using the CISwipeTransition filter The result of using the CISwipeTransition filter
Availability
  • Available in OS X v10.4 and later.

CITemperatureAndTint

Adapts the reference white point for an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputNeutral

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Neutral.

Default value: [6500, 0] Identity: [6500, 0]

inputTargetNeutral

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is TargetNeutral

Default value: [6500, 0] Identity: [6500, 0]

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Temperature and Tint
Figure 111  The result of using the CITemperatureAndTint filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIToneCurve

Adjusts tone response of the R, G, and B channels of an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputPoint0

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Point 1.

Default value: [0, 0] Identity: [0, 0]

inputPoint1

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Point 2l

Default value: [0.25, 0.25] Identity: [0.25, 0.25]

inputPoint2

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Point 3l

Default value: [0.5, 0.5] Identity: [0.5, 0.5]

inputPoint3

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Point 4

Default value: [0.75, 0.75] Identity: [0.75, 0.75]

inputPoint4

CIVector class whose attribute type is CIAttributeTypeOffset and whose display name is Point 5

Default value: [1, 1] Identity: [1, 1]

Discussion

The input points are five x,y values that are interpolated using a spline curve. The curve is applied in a perceptual (gamma 2) version of the working space.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Tone Curve
Figure 112  The result of using the CIToneCurve filter The result of using the CIHueAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CITorusLensDistortion

Creates a torus-shaped lens and distorts the portion of the image over which the lens is placed.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 160.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 500.00 Identity: 160.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 80.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 200.00 Identity: 80.00

inputRefraction

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Refraction.

Default value: 1.70 Minimum: -5.00 Maximum: 0.00 Slider minimum: -5.00 Slider maximum: 5.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Torus Lens Distortion
Figure 113  The result of using the CITorusLensDistortion filter The result of using the CITorusLensDistortion filter
Availability
  • Available in OS X v10.4 and later.

CITriangleTile

Maps a triangular portion of image to a triangular area and then tiles the result.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
Triangle Tile
Figure 114  The result of using the CITriangleTile filter The result of using the CITriangleTile filter
Availability
  • Available in OS X v10.4 and later.

CITwelvefoldReflectedTile

Produces a tiled image from a source image by rotating the source image at increments of 30 degrees.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 0.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: -3.14 Slider maximum: 3.14 Identity: 0.00

inputWidth

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Width.

Default value: 100.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 1.00 Slider maximum: 200.00 Identity: 100.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryTileEffect
Localized Display Name
CITwelvefoldReflectedTile
Figure 115  The result of using the CITwelvefoldReflectedTile filter The result of using the CITwelvefoldReflectedTile filter
Availability
  • Available in OS X v10.5 and later.

CITwirlDistortion

Rotates pixels around a point to give a twirling effect.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 500.00 Identity: 300.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 3.14 Minimum: 0.00 Maximum: 0.00 Slider minimum: -12.57 Slider maximum: 12.57 Identity: 0.00

Discussion

You can specify the number of rotations as well as the center and radius of the effect.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Twirl Distortion
Figure 116  The result of using the CITwirlDistortion filter The result of using the CITwirlDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIUnsharpMask

Increases the contrast of the edges between pixels of different colors in an image.

Parameters
inputImage

CIImage class whose display name is Image.

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 2.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 100.00 Identity: 0.00

inputIntensity

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Intensity.

Default value: 0.50 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategorySharpen
Localized Display Name
Unsharp Mask
Figure 117  The result of using the CIUnsharpMask filter The result of using the CIUnsharpMask filter
Availability
  • Available in OS X v10.4 and later.

CIVibrance

Adjusts the saturation of an image while keeping pleasing skin tones.

Parameters
inputImage

CIImage class whose display name is Image.

inputAmount

An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Amount.

Default value: 0.00 Minimum: -1.00 Maximum: 1.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
Vibrance
Figure 118  The result of using the CIVibrance filter The result of using the CIHueAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIVortexDistortion

Rotates pixels around a point to simulate a vortex.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputRadius

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Radius.

Default value: 300.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 800.00 Identity: 300.00

inputAngle

An NSNumber class whose attribute type is CIAttributeTypeAngle and whose display name is Angle.

Default value: 56.55 Minimum: 0.00 Maximum: 0.00 Slider minimum: -94.25 Slider maximum: 94.25 Identity: 0.00

Discussion

You can specify the number of rotations as well the center and radius of the effect.

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryDistortionEffect
Localized Display Name
Vortex Distortion
Figure 119  The result of using the CIVortexDistortion filter The result of using the CIVortexDistortion filter
Availability
  • Available in OS X v10.4 and later.

CIWhitePointAdjust

Adjusts the reference white point for an image and maps all colors in the source using the new reference.

Parameters
inputImage

CIImage class whose display name is Image.

inputColor

CIColor class whose display name is Color.

Member of
CICategoryBuiltInCICategoryNonSquarePixelsCICategoryInterlacedCICategoryStillImageCICategoryVideoCICategoryColorAdjustment
Localized Display Name
White Point Adjust
Figure 120  The result of using the CIWhitePointAdjust filter The result of using the CIWhitePointAdjust filter
Availability
  • Available in OS X v10.4 and later and in iOS 5.0 and later.

CIZoomBlur

Simulates the effect of zooming the camera while capturing the image.

Parameters
inputImage

CIImage class whose display name is Image.

inputCenter

CIVector class whose attribute type is CIAttributeTypePosition and whose display name is Center.

Default value: [150 150] Identity: (null)

inputAmount

An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Amount.

Default value: 20.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 200.00 Identity: 0.00

Member of
CICategoryBuiltInCICategoryStillImageCICategoryVideoCICategoryBlur
Localized Display Name
Zoom Blur
Figure 121  The result of using the CIZoomBlur filter The result of using the CIZoomBlur filter
Availability
  • Available in OS X v10.4 and later.

Did this document help you?  Yes  It's good, but...  Not helpful...
int dec_cnk(DEC_CTX * ctx, COM_BITB * bitb, DEC_STAT * stat) { COM_BSR *bs; COM_PIC_HEADER *pic_header; COM_SQH * sqh; #if SVAC_SECURITY_PARAM_SET COM_SEC_PARA_SET* sec_para_set; #endif #if SVAC_AUTHENTICATION COM_AUTH_DATA* auth_data; #endif #if HLS_OPT_PPS COM_PIC_PARA_SET * pps; #endif COM_SH_EXT *shext; COM_CNKH *cnkh; int ret = COM_OK; if (stat) { com_mset(stat, 0, sizeof(DEC_STAT)); } bs = &ctx->bs; sqh = &ctx->info.sqh; #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.pps_count]; #endif pic_header = &ctx->info.pic_header; shext = &ctx->info.shext; cnkh = &ctx->info.cnkh; #if SVAC_SECURITY_PARAM_SET sec_para_set = &ctx->info.sec_para_set; #endif #if SVAC_AUTHENTICATION auth_data = &ctx->info.auth_data; #endif /* set error status */ ctx->bs_err = (u8)bitb->err; #if TRACE_RDO_EXCLUDE_I if (pic_header->slice_type != SLICE_I) { #endif COM_TRACE_SET(1); #if TRACE_RDO_EXCLUDE_I } else { COM_TRACE_SET(0); } #endif /* bitstream reader initialization */ com_bsr_init(bs, bitb->addr, bitb->ssize, NULL); SET_SBAC_DEC(bs, &ctx->sbac_dec); #if SVAC_NAL if (bs->cur[3] == SVAC_SPS) #else if (bs->cur[3] == 0xB0) #endif { #if LIB_PIC_MIXBIN int need_update = COM_CT_CRR_SLICE == cnkh->ctype || COM_CT_CRR_SLICE_IMCOPLETE == cnkh->ctype #if SVAC_SECURITY_PARAM_SET || cnkh->ctype == COM_CT_SEC_PARA_SET #endif ; #endif #if HLS_OPT_PPS ctx->info.pps_count = 0; memset(ctx->info.pps, 0, sizeof(ctx->info.pps)); #endif cnkh->ctype = COM_CT_SQH; ret = dec_eco_sqh(bs, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if LIBVC_ON ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; #if LIBPIC_DISPLAY ctx->dpm.libvc_data->libpic_mode_index = sqh->library_picture_mode_index; #endif #endif #if EXTENSION_USER_DATA extension_and_user_data(ctx, bs, 0, sqh, pic_header); #endif #if LIB_PIC_MIXBIN if (sqh->library_stream_flag) { if (!ctx->libpic_init_flag) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if MULTI_LAYER_FRAMEWORK g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; #else g_DOIPrev = g_CountDOICyCleTime = 0; #endif ctx->libpic_init_flag = 1; ctx->init_flag = 1; } } else #endif if( !ctx->init_flag ) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if MULTI_LAYER_FRAMEWORK g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; #else g_DOIPrev = g_CountDOICyCleTime = 0; #endif ctx->init_flag = 1; } #if LIB_PIC_MIXBIN if (sqh->library_stream_flag && sqh->library_picture_mixbin_flag) { memcpy(&ctx->info.libpic_sqh, sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); } else { memcpy(&ctx->info.normal_sqh, sqh, sizeof(COM_SQH)); if (need_update) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); } } #endif } #if !SVAC_NAL else if( bs->cur[3] == 0xB1 ) { ctx->init_flag = 0; cnkh->ctype = COM_CT_SEQ_END; } #endif #if HLS_OPT_PPS else if (bs->cur[3] == SVAC_PPS) { cnkh->ctype = COM_CT_PPS; ret = dec_eco_pps(bs, sqh, pps); ctx->info.pps_count++; assert(ctx->info.pps_count <= MAX_PPS_NUM); com_assert_rv(COM_SUCCEEDED(ret), ret); #if LIB_PIC_MIXBIN if (sqh->library_stream_flag) ctx->info.libpic_pps_idx = ctx->info.pps_count - 1; else ctx->info.normal_pps_idx = ctx->info.pps_count - 1; #endif } #endif #if SVAC_NAL #if HLS_OPT_PPS else if (bs->cur[3] == SVAC_PH) #else else if (bs->cur[3] == SVAC_PPS) #endif #else else if (bs->cur[3] == 0xB3 || bs->cur[3] == 0xB6) #endif { #if MULTI_LAYER_FRAMEWORK if (ctx->layer_id) { if (!ctx->init_flag) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; ctx->init_flag = 1; if (ctx->layer_id && !sqh->sps_independent_layer_flag[ctx->layer_id]) { COM_PM* pm = &(ctx->dpm); int size; pm->pic_tmp[0] = com_pic_alloc(&pm->pa, &ret); pm->pic_tmp[1] = com_pic_alloc(&pm->pa, &ret); size = sizeof(s8) * ctx->info.f_scu * REFP_NUM; memset(pm->pic_tmp[0]->map_refi, -1, size); size = sizeof(s16) * ctx->info.f_scu * REFP_NUM * MV_D; memset(pm->pic_tmp[0]->map_mv, 0, size); #if CU_LEVEL_PRIVACY size = sizeof(u8) * ctx->info.f_scu; memset(pm->pic_tmp[0]->map_privacy, 0, size); #endif } } } #endif #if LIB_PIC_MIXBIN if (COM_CT_CRR_SLICE == cnkh->ctype || COM_CT_CRR_SLICE_IMCOPLETE == cnkh->ctype) { assert(sqh->library_picture_mixbin_flag == 1); memcpy(sqh, &ctx->info.normal_sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.normal_pps_idx]; #endif ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; } #endif cnkh->ctype = COM_CT_PICTURE; /* decode slice header */ pic_header->low_delay = sqh->low_delay; int need_minus_256 = 0; #if HLS_OPT_PPS ret = dec_eco_pic_header(bs, ctx, &need_minus_256); #if MULTI_LAYER_FRAMEWORK assert(ctx->layer_id == pic_header->layer_id); if (ctx->layer_id && !sqh->sps_independent_layer_flag[ctx->layer_id] ) { DEC_CTX* ctx_b = (DEC_CTX*)ctx->ctx_b; upsample_base_pic(&ctx->dpm, ctx_b->pic, &ctx_b->info, &ctx->info, ctx_b->layer_id, ctx->layer_id); add_pic(&ctx_b->dpm, &ctx->dpm, ctx_b->pic, ctx_b->layer_id, &ctx_b->info, &ctx->info, ctx_b->info.pic_header.decode_order_index, ctx_b->ptr, ctx->refp, ctx->info.sqh.ref_layer_id[ctx->layer_id], ctx_b->info.poc); } #endif #else ret = dec_eco_pic_header(bs, pic_header, sqh, &need_minus_256); #endif if (need_minus_256) { com_picman_dpbpic_doi_minus_cycle_length( &ctx->dpm ); } #if HLS_OPT_PPS ctx->wq[0] = ctx->info.pps[pic_header->pic_pps_id].wq_4x4_matrix; ctx->wq[1] = ctx->info.pps[pic_header->pic_pps_id].wq_8x8_matrix; #else ctx->wq[0] = pic_header->wq_4x4_matrix; ctx->wq[1] = pic_header->wq_8x8_matrix; #endif if (!sqh->library_stream_flag) { com_picman_check_repeat_doi(&ctx->dpm, pic_header); } #if LIB_PIC_MIXBIN if (sqh->library_stream_flag && sqh->library_picture_mixbin_flag) { memcpy(&ctx->info.libpic_pic_header, pic_header, sizeof(COM_PIC_HEADER)); memcpy(ctx->libpic_pic_esao_params, ctx->info.pic_header.pic_esao_params, N_C * sizeof(ESAO_BLK_PARAM)); memcpy(ctx->libpic_pic_ccsao_params, ctx->info.pic_header.pic_ccsao_params, (N_C - 1) * sizeof(CCSAO_BLK_PARAM)); for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { #if ALF_SHAPE int num_coef = (ctx->info.sqh.adaptive_leveling_filter_enhance_flag) ? ALF_MAX_NUM_COEF_SHAPE2 : ALF_MAX_NUM_COEF; #endif copy_alf_param(ctx->dec_alf->libpic_alf_picture_param[comp_idx], ctx->dec_alf->alf_picture_param[comp_idx] #if ALF_SHAPE , num_coef #if ALF_SHIFT + (int)ctx->info.sqh.adaptive_leveling_filter_enhance_flag #endif #endif ); } } #endif #if LIBPIC_DISPLAY ctx->dpm.libvc_data->libpic_index = pic_header->library_picture_index; #endif #if HIGH_LEVEL_PRIVACY memset(ctx->ctx_privacy_data.region_max_num, 0, sizeof(int) * 10); #endif #if EXTENSION_USER_DATA && WRITE_MD5_IN_USER_DATA extension_and_user_data(ctx, bs, 1, sqh, pic_header); #endif com_constrcut_ref_list_doi(pic_header); //add by Yuqun Fan, init rpl list at ph instead of sh #if HLS_RPL #if LIBVC_ON if (!sqh->library_stream_flag) #endif { ret = com_picman_refpic_marking_decoder(&ctx->dpm, pic_header); com_assert_rv(ret == COM_OK, ret); } com_cleanup_useless_pic_buffer_in_pm(&ctx->dpm); /* reference picture lists construction */ ret = com_picman_refp_rpl_based_init_decoder(&ctx->dpm, pic_header, ctx->refp); #if AWP if (ctx->info.pic_header.slice_type == SLICE_P || ctx->info.pic_header.slice_type == SLICE_B) { for (int i = 0; i < ctx->dpm.num_refp[REFP_0]; i++) { ctx->info.pic_header.ph_poc[REFP_0][i] = ctx->refp[i][REFP_0].ptr; } } if (ctx->info.pic_header.slice_type == SLICE_B) { for (int i = 0; i < ctx->dpm.num_refp[REFP_1]; i++) { ctx->info.pic_header.ph_poc[REFP_1][i] = ctx->refp[i][REFP_1].ptr; } } #endif #endif com_assert_rv(COM_SUCCEEDED(ret), ret); } #if SVAC_NAL else if ((bs->cur[3] == SVAC_IDR || bs->cur[3] == SVAC_NON_RAP || bs->cur[3] == SVAC_RAP_I #if LIB_PIC_MIXBIN || bs->cur[3] == SVAC_CRR_L || bs->cur[3] == SVAC_CRR_RL #if DISPLAY_L_NAL_TYPE || bs->cur[3] == SVAC_CRR_DP #endif #if LIB_PIC_ERR_TOL || bs->cur[3] == SVAC_CRR_DL #endif #endif ) && bs->cur[4] <= 0x8E) #else else if (bs->cur[3] >= 0x00 && bs->cur[3] <= 0x8E) #endif { #if LIB_PIC_MIXBIN #if DISPLAY_L_NAL_TYPE if (!sqh->library_stream_flag && (bs->cur[3] == SVAC_CRR_L || bs->cur[3] == SVAC_CRR_DP #if LIB_PIC_ERR_TOL || bs->cur[3] == SVAC_CRR_DL #endif )) #else if (!sqh->library_stream_flag && bs->cur[3] == SVAC_CRR_L) #endif { assert(sqh->library_picture_mixbin_flag == 1); memcpy(sqh, &ctx->info.libpic_sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.libpic_pps_idx]; #endif ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; memcpy(pic_header, &ctx->info.libpic_pic_header, sizeof(COM_PIC_HEADER)); memcpy(pic_header->pic_esao_params, ctx->libpic_pic_esao_params, N_C * sizeof(ESAO_BLK_PARAM)); memcpy(pic_header->pic_ccsao_params, ctx->libpic_pic_ccsao_params, (N_C - 1) * sizeof(CCSAO_BLK_PARAM)); memcpy(ctx->pic_alf_on, ctx->libpic_pic_alf_on, N_C * sizeof(int)); for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { #if ALF_SHAPE int num_coef = (ctx->info.sqh.adaptive_leveling_filter_enhance_flag) ? ALF_MAX_NUM_COEF_SHAPE2 : ALF_MAX_NUM_COEF; #endif copy_alf_param(ctx->dec_alf->alf_picture_param[comp_idx], ctx->dec_alf->libpic_alf_picture_param[comp_idx] #if ALF_SHAPE , num_coef #if ALF_SHIFT + (int)ctx->info.sqh.adaptive_leveling_filter_enhance_flag #endif #endif ); memcpy(ctx->info.pic_header.pic_esao_params[comp_idx].lcu_flag, ctx->libpic_esao_lcu_flag[comp_idx], ctx->info.f_lcu * sizeof(int)); if (comp_idx) memcpy(ctx->info.pic_header.pic_ccsao_params[comp_idx - 1].lcu_flag, ctx->libpic_ccsao_lcu_flag[comp_idx - 1], ctx->info.f_lcu * sizeof(int)); } for (int lcu_idx = 0; lcu_idx < ctx->info.f_lcu; lcu_idx++) { copy_sao_param_for_blk(ctx->sao_blk_params[lcu_idx], ctx->libpic_sao_blk_params[lcu_idx]); copy_sao_param_for_blk(ctx->rec_sao_blk_params[lcu_idx], ctx->libpic_rec_sao_blk_params[lcu_idx]); memcpy(ctx->dec_alf->alf_lcu_enabled[lcu_idx], ctx->dec_alf->libpic_alf_lcu_enabled[lcu_idx], N_C * sizeof(int)); } memcpy(ctx->map.map_pb_tb_part, ctx->map.libpic_map_pb_tb_part, ctx->info.f_scu * sizeof(u32)); memcpy(ctx->map.map_patch_idx, ctx->map.libpic_map_patch_idx, ctx->info.f_scu * sizeof(s8)); memcpy(ctx->map.map_split, ctx->map.libpic_map_split, ctx->info.f_lcu * sizeof(s8)* MAX_CU_DEPTH* NUM_BLOCK_SHAPE* MAX_CU_CNT_IN_LCU); mCabac_ws = MCABAC_SHIFT_I; mCabac_offset = (1 << (mCabac_ws - 1)); counter_thr1 = 0; counter_thr2 = COUNTER_THR_I; #if HLS_OPT_PPS ctx->wq[0] = ctx->info.pps[pic_header->pic_pps_id].wq_4x4_matrix; ctx->wq[1] = ctx->info.pps[pic_header->pic_pps_id].wq_8x8_matrix; #else ctx->wq[0] = pic_header->wq_4x4_matrix; ctx->wq[1] = pic_header->wq_8x8_matrix; #endif } #if DISPLAY_L_NAL_TYPE if (sqh->library_stream_flag && (bs->cur[3] != SVAC_CRR_L && bs->cur[3] != SVAC_CRR_DP #if LIB_PIC_ERR_TOL && bs->cur[3] != SVAC_CRR_DL #endif )) #else if (sqh->library_stream_flag && bs->cur[3] != SVAC_CRR_L) #endif { assert(sqh->library_picture_mixbin_flag == 1); memcpy(sqh, &ctx->info.normal_sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.normal_pps_idx ]; #endif ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; } #if LIBPIC_DISPLAY int is_patch_l = sqh->library_stream_flag && sqh->library_picture_mixbin_flag && ctx->info.sqh.library_picture_mode_index != 1; #else int is_patch_l = sqh->library_stream_flag && sqh->library_picture_mixbin_flag; #endif #endif cnkh->ctype = COM_CT_SLICE; #if SVAC_NAL if (bs->cur[3] == SVAC_IDR) picman_reset_dpb(&ctx->dpm); #endif #if CU_LEVEL_PRIVACY COM_BSR *bs_privacy = &ctx->bs_privacy; com_bsr_init(bs_privacy, bitb->addr2, bitb->ssize2, NULL); SET_SBAC_DEC(bs_privacy, &ctx->sbac_dec_privacy); if (ctx->user_permission && ctx->info.pic_header.ph_privacy_on) { while (com_bsr_next(bs_privacy, 24) != 0x1) { ret = com_bsr_read(bs_privacy, 8); }; unsigned int nalu_type = 0, temporal_id = 0, layer_id = 0; dec_eco_nalu_header(bs_privacy, &nalu_type, &temporal_id, &layer_id); assert(nalu_type == SVAC_PRIVACY); #if TSVC_OPT assert(temporal_id == ctx->info.pic_header.temporal_id); #endif #if MULTI_LAYER_FRAMEWORK assert(layer_id == ctx->info.pic_header.layer_id); #endif } #endif #if HLS_OPT_PPS ret = dec_eco_patch_header(bs, sqh, &ctx->info.pps[pic_header->pic_pps_id], pic_header, shext, ctx->patch); #else ret = dec_eco_patch_header(bs, sqh, pic_header, shext, ctx->patch); #endif #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx + 1 < ctx->patch->rows * ctx->patch->columns) cnkh->ctype = COM_CT_CRR_SLICE_IMCOPLETE; #if LIBPIC_DISPLAY else if (is_patch_l || (sqh->library_stream_flag && ctx->info.sqh.library_picture_mode_index == 1)) #else else if (is_patch_l) #endif cnkh->ctype = COM_CT_CRR_SLICE; #endif /* initialize slice */ ret = slice_init(ctx, ctx->core, pic_header); com_assert_rv(COM_SUCCEEDED(ret), ret); #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx != 0) { ctx->pic = ctx->libpic_pic; } else { #endif /* get available frame buffer for decoded image */ ctx->pic = com_picman_get_empty_pic(&ctx->dpm, &ret); com_assert_rv(ctx->pic, ret); #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx == 0) ctx->libpic_pic = ctx->pic; } #endif /* get available frame buffer for decoded image */ ctx->map.map_refi = ctx->pic->map_refi; ctx->map.map_mv = ctx->pic->map_mv; #if CU_LEVEL_PRIVACY ctx->map.map_privacy = ctx->pic->map_privacy; #endif #if CU_LEVEL_PRIVACY com_mset_x64a(ctx->map.map_privacy_pic_filter[0], 0, sizeof(COM_FILTER_SKIP)* ctx->info.pic_width* ctx->info.pic_height); com_mset_x64a(ctx->map.map_privacy_pic_filter[1], 0, sizeof(COM_FILTER_SKIP)* ctx->info.pic_width* ctx->info.pic_height); #endif /* decode slice layer */ #if HLS_OPT_PPS ret = dec_pic(ctx, ctx->core, sqh, &ctx->info.pps[pic_header->pic_pps_id], pic_header, shext); #else ret = dec_pic(ctx, ctx->core, sqh, pic_header, shext); #endif com_assert_rv(COM_SUCCEEDED(ret), ret); #if LIB_PIC_MIXBIN if (!is_patch_l || (is_patch_l && ctx->patch->idx + 1 == ctx->patch->rows * ctx->patch->columns)) { #endif /* deblocking filter */ #if HLS_OPT_PPS if (ctx->info.pps[ctx->info.pic_header.pic_pps_id].loop_filter_disable_flag == 0) #else if (ctx->info.pic_header.loop_filter_disable_flag == 0) #endif { ret = dec_deblock_avs2(ctx); com_assert_rv(COM_SUCCEEDED(ret), ret); } #if CCSAO if (ctx->info.pic_header.pic_ccsao_on[U_C-1] || ctx->info.pic_header.pic_ccsao_on[V_C-1]) { #if CCSAO_ENHANCEMENT copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, Y_C); copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, U_C); copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, V_C); #else copy_frame_for_ccsao(ctx->pic_ccsao, ctx->pic, Y_C); #endif } #endif /* sao filter */ if (ctx->info.sqh.sample_adaptive_offset_enable_flag) { ret = dec_sao_avs2(ctx); com_assert_rv(ret == COM_OK, ret); } /* esao filter */ #if ESAO if (ctx->info.sqh.esao_enable_flag) { ret = dec_esao(ctx); com_assert_rv(ret == COM_OK, ret); } #endif #if CCSAO /* ccsao filter */ if (ctx->info.sqh.ccsao_enable_flag) { ret = dec_ccsao(ctx); com_assert_rv(ret == COM_OK, ret); } #endif /* ALF */ if (ctx->info.sqh.adaptive_leveling_filter_enable_flag) { ret = dec_alf_avs2(ctx, ctx->pic); com_assert_rv(COM_SUCCEEDED(ret), ret); } /* MD5 check for testing encoder-decoder match*/ if (ctx->use_pic_sign && ctx->pic_sign_exist) { ret = dec_picbuf_check_signature(ctx->pic, ctx->pic_sign #if CU_LEVEL_PRIVACY , ctx->user_permission || !ctx->info.pic_header.ph_privacy_on #endif ); com_assert_rv(COM_SUCCEEDED(ret), ret); ctx->pic_sign_exist = 0; /* reset flag */ } #if SVAC_UD_MD5_STREAM extension_and_user_data(ctx, bs, 1, sqh, pic_header); if (ctx->use_pic_sign && ctx->stream_sign_exist) { ctx->stream_sign_check_flag = 1; unsigned char * concat_buf = malloc((1024 * 1024 * 32)); com_assert_rv(concat_buf != NULL, -1); unsigned int stream_size = (unsigned int)((u8 *)bitb->addr3 - (u8 *)bitb->addr3_beg); u8 * stream_p = bitb->addr3_beg; unsigned char * buffer_p = concat_buf; while ((stream_p - (u8 *)bitb->addr3_beg) < stream_size) { unsigned int nal_size = 1; while (!(stream_p[nal_size + 0] == 0x00 && stream_p[nal_size + 1] == 0x00 && stream_p[nal_size + 2] == 0x00 && stream_p[nal_size + 3] == 0x01) && !(stream_p[nal_size + 0] == 0x00 && stream_p[nal_size + 1] == 0x00 && stream_p[nal_size + 2] == 0x01 && stream_p[nal_size - 1] != 0)) { if (!((stream_p - (u8 *)bitb->addr3_beg) < stream_size - nal_size - 4)) { nal_size += 4; break; } nal_size++; } if (stream_p[4] != (0x0c) && stream_p[3] != (0x0c) //sei && stream_p[4] != (0x20) && stream_p[3] != (0x20) //eocvs && stream_p[4] != (0x16) && stream_p[3] != (0x16) //eos #if SVAC_SECURITY_PARAM_SET && stream_p[4] != (0x52) && stream_p[3] != (0x52) //sec #endif #if SVAC_AUTHENTICATION && stream_p[4] != (0x14) && stream_p[3] != (0x14) //auth #endif ) { int start_code_len = 4; if (stream_p[0] == 0x00 && stream_p[1] == 0x00 && stream_p[2] == 0x01) { start_code_len = 3; } unsigned int raw_nal_size = nal_size - start_code_len; memcpy(buffer_p, stream_p + start_code_len, raw_nal_size); buffer_p += raw_nal_size; } stream_p += nal_size; } int stream_total_size = (int)(buffer_p - concat_buf); u8 stream_sign[16]; int ret = com_md5_stream(concat_buf, stream_total_size, stream_sign); com_assert_rv(COM_SUCCEEDED(ret), ret); if (com_mcmp(ctx->stream_sign, stream_sign, 16) != 0) { printf("\n stream signature check failed \n"); } com_assert_rv(com_mcmp(ctx->stream_sign, stream_sign, 16) == 0, COM_ERR_BAD_CRC); ctx->stream_sign_exist = 0; /* reset flag */ if (concat_buf) free(concat_buf); } bitb->addr3 = bitb->addr3_beg; #endif #if PIC_PAD_SIZE_L > 0 /* expand pixels to padding area */ dec_picbuf_expand(ctx, ctx->pic); #endif #if LIB_PIC_MIXBIN } if (is_patch_l) { memcpy(ctx->libpic_pic_alf_on, ctx->pic_alf_on, N_C * sizeof(int)); for (int lcu_idx = 0; lcu_idx < ctx->info.f_lcu; lcu_idx++) { copy_sao_param_for_blk(ctx->libpic_sao_blk_params[lcu_idx], ctx->sao_blk_params[lcu_idx]); copy_sao_param_for_blk(ctx->libpic_rec_sao_blk_params[lcu_idx], ctx->rec_sao_blk_params[lcu_idx]); memcpy(ctx->dec_alf->libpic_alf_lcu_enabled[lcu_idx], ctx->dec_alf->alf_lcu_enabled[lcu_idx], N_C * sizeof(int)); } for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { memcpy(ctx->libpic_esao_lcu_flag[comp_idx], ctx->info.pic_header.pic_esao_params[comp_idx].lcu_flag, ctx->info.f_lcu * sizeof(int)); if (comp_idx) memcpy(ctx->libpic_ccsao_lcu_flag[comp_idx - 1], ctx->info.pic_header.pic_ccsao_params[comp_idx - 1].lcu_flag, ctx->info.f_lcu * sizeof(int)); } } #endif /* put decoded picture to DPB */ #if LIBVC_ON if (sqh->library_stream_flag #if LIB_PIC_MIXBIN && (!is_patch_l || (is_patch_l && (ctx->patch->idx + 1) == ctx->patch->rows * ctx->patch->columns)) #endif ) { ret = com_picman_put_libpic(&ctx->dpm, ctx->pic, ctx->info.pic_header.slice_type, ctx->ptr, pic_header->decode_order_index, ctx->info.pic_header.temporal_id, 1, ctx->refp, pic_header #if HLS_OPT_PPS , pps #endif ); } else #if LIB_PIC_MIXBIN if (!sqh->library_stream_flag) #endif #endif { ret = com_picman_put_pic(&ctx->dpm, ctx->pic, ctx->info.pic_header.slice_type, ctx->ptr, pic_header->decode_order_index , pic_header->picture_output_delay, ctx->info.pic_header.temporal_id, 1, ctx->refp #if OBMC #if CUDQP , pic_header #else , pic_header->picture_qp #endif #if HLS_OPT_PPS , pps #endif #endif ); #if LIBVC_ON assert((&ctx->dpm)->cur_pb_size + (&ctx->dpm)->cur_libpb_size <= sqh->max_dpb_size); #else assert((&ctx->dpm)->cur_pb_size <= sqh->max_dpb_size); #endif } com_assert_rv(COM_SUCCEEDED(ret), ret); } #if SVAC_NAL else if (bs->cur[3] == SVAC_EOS) { ctx->init_flag = 0; ctx->libpic_init_flag = 0; cnkh->ctype = COM_CT_SEQ_END; } else if (bs->cur[3] == SVAC_EOCVS) { ctx->init_flag = 0; ctx->libpic_init_flag = 0; cnkh->ctype = COM_CT_CVS_END; } #endif #if SVAC_SECURITY_PARAM_SET else if (bs->cur[3] == SVAC_SEC_PS) { dec_eco_sec_parameter_set_init(ctx, bs, pic_header, sec_para_set); ret = dec_eco_sec_parameter_set(ctx, bs, pic_header, sec_para_set); com_assert_rv(COM_SUCCEEDED(ret), ret); cnkh->ctype = COM_CT_SEC_PARA_SET; } #endif #if SVAC_AUTHENTICATION else if (bs->cur[3] == SVAC_AUTH_DATA) { dec_eco_auth_data_init(ctx, bs, pic_header, auth_data); ret = dec_eco_auth_data(ctx, bs, pic_header, auth_data); com_assert_rv(COM_SUCCEEDED(ret), ret); cnkh->ctype = COM_CT_AUTH; } #endif else { return COM_ERR_MALFORMED_BITSTREAM; } make_stat(ctx, cnkh->ctype, stat); return ret; }
最新发布
07-16
<think>我们正在处理一个视频解码器中的核心函数 `dec_cnk`。这个函数负责解码一个数据块(chunk),根据数据块的类型(序列头、图像头、片层数据等)进行相应的解码操作。函数中包含了大量的条件编译,说明它支持多种不同的解码配置和标准(如SVAC)。 函数的主要步骤: 1. 初始化:检查输入参数,初始化局部变量,设置错误状态。 2. 根据当前数据块的类型(通过读取比特流的前几个字节判断)进行不同的处理: - 序列头(SPS)处理 - 图像参数集(PPS)处理 - 图像头(PH)处理 - 片层数据(slice)处理 - 其他类型(如序列结束、安全参数集、认证数据等) 3. 对于每种类型,调用相应的解码函数,并更新解码器上下文。 4. 在片层数据处理中,还包括初始化片、解码图像、应用环路滤波(去块、SAO、ALF等)以及将解码图像放入DPB(解码图像缓冲区)等步骤。 5. 最后,生成统计信息并返回。 由于代码非常长且复杂,我们将分部分进行注释。注意,我们省略了一些条件编译的细节,只关注主要流程。 我们将按照函数执行流程进行注释。</think># 视频解码核心函数详解 以下是对`dec_cnk`函数的详细注释和分析,该函数是视频解码器的核心处理单元,负责解析比特流中的各种语法元素并执行相应的解码操作。 ```c /** * 解码一个编码数据块(chunk) * @param ctx 解码器上下文 * @param bitb 比特流信息结构 * @param stat 解码统计信息 * @return 错误码(COM_OK表示成功) */ int dec_cnk(DEC_CTX * ctx, COM_BITB * bitb, DEC_STAT * stat) { // ====================== 局部变量声明 ====================== COM_BSR *bs; // 比特流读取器 COM_PIC_HEADER *pic_header; // 图像头信息 COM_SQH * sqh; // 序列头信息 COM_SH_EXT *shext; // 扩展片头信息 COM_CNKH *cnkh; // 块头信息 int ret = COM_OK; // 函数返回值 // 初始化统计信息结构 if (stat) { com_mset(stat, 0, sizeof(DEC_STAT)); } // 获取上下文中的关键结构指针 bs = &ctx->bs; sqh = &ctx->info.sqh; pic_header = &ctx->info.pic_header; shext = &ctx->info.shext; cnkh = &ctx->info.cnkh; // 设置比特流错误状态 ctx->bs_err = (u8)bitb->err; // 根据图像类型设置跟踪标志 #if TRACE_RDO_EXCLUDE_I if (pic_header->slice_type != SLICE_I) { #endif COM_TRACE_SET(1); // 启用跟踪 #if TRACE_RDO_EXCLUDE_I } else { COM_TRACE_SET(0); // 禁用跟踪 } #endif // ====================== 比特流初始化 ====================== /* 比特流读取器初始化 */ com_bsr_init(bs, bitb->addr, bitb->ssize, NULL); SET_SBAC_DEC(bs, &ctx->sbac_dec); // 设置CABAC解码器 // ====================== 序列头(SPS)处理 ====================== #if SVAC_NAL if (bs->cur[3] == SVAC_SPS) // 检测序列头起始码 #else if (bs->cur[3] == 0xB0) // 替代的序列头标识 #endif { cnkh->ctype = COM_CT_SQH; // 设置块类型为序列头 // 解码序列头 ret = dec_eco_sqh(bs, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 检查返回值 // 更新LibVC相关标志 #if LIBVC_ON ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; #if LIBPIC_DISPLAY ctx->dpm.libvc_data->libpic_mode_index = sqh->library_picture_mode_index; #endif #endif // 处理扩展和用户数据 #if EXTENSION_USER_DATA extension_and_user_data(ctx, bs, 0, sqh, pic_header); #endif // 序列初始化处理 #if LIB_PIC_MIXBIN if (sqh->library_stream_flag) { // 库图片流初始化 if (!ctx->libpic_init_flag) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 重置DOI计数器 #if MULTI_LAYER_FRAMEWORK g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; #else g_DOIPrev = g_CountDOICyCleTime = 0; #endif ctx->libpic_init_flag = 1; ctx->init_flag = 1; } } else #endif if (!ctx->init_flag) { // 普通序列初始化 ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 重置DOI计数器 #if MULTI_LAYER_FRAMEWORK g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; #else g_DOIPrev = g_CountDOICyCleTime = 0; #endif ctx->init_flag = 1; } // 处理混合二进制库图片 #if LIB_PIC_MIXBIN if (sqh->library_stream_flag && sqh->library_picture_mixbin_flag) { // 保存库图片序列头并初始化 memcpy(&ctx->info.libpic_sqh, sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); } else { // 保存普通序列头 memcpy(&ctx->info.normal_sqh, sqh, sizeof(COM_SQH)); // 需要更新时重新初始化 if (need_update) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); } } #endif } // ====================== 序列结束处理 ====================== #if !SVAC_NAL else if( bs->cur[3] == 0xB1 ) { ctx->init_flag = 0; // 重置初始化标志 cnkh->ctype = COM_CT_SEQ_END; // 设置块类型为序列结束 } #endif // ====================== 图像参数集(PPS)处理 ====================== #if HLS_OPT_PPS else if (bs->cur[3] == SVAC_PPS) { cnkh->ctype = COM_CT_PPS; // 设置块类型为PPS // 解码PPS ret = dec_eco_pps(bs, sqh, pps); ctx->info.pps_count++; // 增加PPS计数 assert(ctx->info.pps_count <= MAX_PPS_NUM); // 检查PPS数量 com_assert_rv(COM_SUCCEEDED(ret), ret); // 检查返回值 // 保存PPS索引 #if LIB_PIC_MIXBIN if (sqh->library_stream_flag) ctx->info.libpic_pps_idx = ctx->info.pps_count - 1; else ctx->info.normal_pps_idx = ctx->info.pps_count - 1; #endif } #endif // ====================== 图像头(PH)处理 ====================== #if SVAC_NAL #if HLS_OPT_PPS else if (bs->cur[3] == SVAC_PH) #else else if (bs->cur[3] == SVAC_PPS) #endif #else else if (bs->cur[3] == 0xB3 || bs->cur[3] == 0xB6) #endif { // 多层框架初始化 #if MULTI_LAYER_FRAMEWORK if (ctx->layer_id) { if (!ctx->init_flag) { ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 重置DOI计数器 g_DOIPrev[ctx->layer_id] = g_CountDOICyCleTime[ctx->layer_id] = 0; ctx->init_flag = 1; // 非独立层分配临时图像 if (ctx->layer_id && !sqh->sps_independent_layer_flag[ctx->layer_id]) { COM_PM* pm = &(ctx->dpm); int size; pm->pic_tmp[0] = com_pic_alloc(&pm->pa, &ret); pm->pic_tmp[1] = com_pic_alloc(&pm->pa, &ret); size = sizeof(s8) * ctx->info.f_scu * REFP_NUM; memset(pm->pic_tmp[0]->map_refi, -1, size); size = sizeof(s16) * ctx->info.f_scu * REFP_NUM * MV_D; memset(pm->pic_tmp[0]->map_mv, 0, size); #if CU_LEVEL_PRIVACY size = sizeof(u8) * ctx->info.f_scu; memset(pm->pic_tmp[0]->map_privacy, 0, size); #endif } } } #endif // 混合二进制处理 #if LIB_PIC_MIXBIN if (COM_CT_CRR_SLICE == cnkh->ctype || COM_CT_CRR_SLICE_IMCOPLETE == cnkh->ctype) { assert(sqh->library_picture_mixbin_flag == 1); // 切换到普通序列头 memcpy(sqh, &ctx->info.normal_sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 更新PPS指针 #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.normal_pps_idx]; #endif // 更新LibVC标志 ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; } #endif cnkh->ctype = COM_CT_PICTURE; // 设置块类型为图像头 /* 解码图像头 */ pic_header->low_delay = sqh->low_delay; int need_minus_256 = 0; #if HLS_OPT_PPS // 解码图像头(带PPS支持) ret = dec_eco_pic_header(bs, ctx, &need_minus_256); // 多层框架的上采样处理 #if MULTI_LAYER_FRAMEWORK assert(ctx->layer_id == pic_header->layer_id); if (ctx->layer_id && !sqh->sps_independent_layer_flag[ctx->layer_id]) { DEC_CTX* ctx_b = (DEC_CTX*)ctx->ctx_b; // 上采样基础层图像 upsample_base_pic(&ctx->dpm, ctx_b->pic, &ctx_b->info, &ctx->info, ctx_b->layer_id, ctx->layer_id); // 添加参考图像 add_pic(&ctx_b->dpm, &ctx->dpm, ctx_b->pic, ctx_b->layer_id, &ctx_b->info, &ctx->info, ctx_b->info.pic_header.decode_order_index, ctx_b->ptr, ctx->refp, ctx->info.sqh.ref_layer_id[ctx->layer_id], ctx_b->info.poc); } #endif #else // 解码图像头(无PPS支持) ret = dec_eco_pic_header(bs, pic_header, sqh, &need_minus_256); #endif // 处理DOI循环 if (need_minus_256) { com_picman_dpbpic_doi_minus_cycle_length(&ctx->dpm); } // 设置加权量化矩阵 #if HLS_OPT_PPS ctx->wq[0] = ctx->info.pps[pic_header->pic_pps_id].wq_4x4_matrix; ctx->wq[1] = ctx->info.pps[pic_header->pic_pps_id].wq_8x8_matrix; #else ctx->wq[0] = pic_header->wq_4x4_matrix; ctx->wq[1] = pic_header->wq_8x8_matrix; #endif // 检查DOI重复(非库图片流) if (!sqh->library_stream_flag) { com_picman_check_repeat_doi(&ctx->dpm, pic_header); } // 混合二进制库图片处理 #if LIB_PIC_MIXBIN if (sqh->library_stream_flag && sqh->library_picture_mixbin_flag) { // 保存库图片图像头 memcpy(&ctx->info.libpic_pic_header, pic_header, sizeof(COM_PIC_HEADER)); // 保存ESAO/CCSAO参数 memcpy(ctx->libpic_pic_esao_params, ctx->info.pic_header.pic_esao_params, N_C * sizeof(ESAO_BLK_PARAM)); memcpy(ctx->libpic_pic_ccsao_params, ctx->info.pic_header.pic_ccsao_params, (N_C - 1) * sizeof(CCSAO_BLK_PARAM)); // 保存ALF参数 for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { #if ALF_SHAPE int num_coef = (ctx->info.sqh.adaptive_leveling_filter_enhance_flag) ? ALF_MAX_NUM_COEF_SHAPE2 : ALF_MAX_NUM_COEF; #endif copy_alf_param(ctx->dec_alf->libpic_alf_picture_param[comp_idx], ctx->dec_alf->alf_picture_param[comp_idx] #if ALF_SHAPE , num_coef #if ALF_SHIFT + (int)ctx->info.sqh.adaptive_leveling_filter_enhance_flag #endif #endif ); } } #endif // 设置库图片索引 #if LIBPIC_DISPLAY ctx->dpm.libvc_data->libpic_index = pic_header->library_picture_index; #endif // 构造参考列表 com_constrcut_ref_list_doi(pic_header); // 参考图像标记和列表构造 #if HLS_RPL #if LIBVC_ON if (!sqh->library_stream_flag) #endif { // 参考图像标记 ret = com_picman_refpic_marking_decoder(&ctx->dpm, pic_header); com_assert_rv(ret == COM_OK, ret); // 清理无用图像缓冲区 com_cleanup_useless_pic_buffer_in_pm(&ctx->dpm); } /* 基于RPL的参考图像列表初始化 */ ret = com_picman_refp_rpl_based_init_decoder(&ctx->dpm, pic_header, ctx->refp); // AWP(自适应加权预测)处理 #if AWP if (ctx->info.pic_header.slice_type == SLICE_P || ctx->info.pic_header.slice_type == SLICE_B) { for (int i = 0; i < ctx->dpm.num_refp[REFP_0]; i++) { ctx->info.pic_header.ph_poc[REFP_0][i] = ctx->refp[i][REFP_0].ptr; } } if (ctx->info.pic_header.slice_type == SLICE_B) { for (int i = 0; i < ctx->dpm.num_refp[REFP_1]; i++) { ctx->info.pic_header.ph_poc[REFP_1][i] = ctx->refp[i][REFP_1].ptr; } } #endif #endif com_assert_rv(COM_SUCCEEDED(ret), ret); // 检查返回值 } // ====================== 片层数据(SLICE)处理 ====================== #if SVAC_NAL else if ((bs->cur[3] == SVAC_IDR || bs->cur[3] == SVAC_NON_RAP || bs->cur[3] == SVAC_RAP_I #if LIB_PIC_MIXBIN || bs->cur[3] == SVAC_CRR_L || bs->cur[3] == SVAC_CRR_RL #if DISPLAY_L_NAL_TYPE || bs->cur[3] == SVAC_CRR_DP #endif #if LIB_PIC_ERR_TOL || bs->cur[3] == SVAC_CRR_DL #endif #endif ) && bs->cur[4] <= 0x8E) #else else if (bs->cur[3] >= 0x00 && bs->cur[3] <= 0x8E) #endif { // 混合二进制处理 #if LIB_PIC_MIXBIN #if DISPLAY_L_NAL_TYPE if (!sqh->library_stream_flag && (bs->cur[3] == SVAC_CRR_L || bs->cur[3] == SVAC_CRR_DP #if LIB_PIC_ERR_TOL || bs->cur[3] == SVAC_CRR_DL #endif )) #else if (!sqh->library_stream_flag && bs->cur[3] == SVAC_CRR_L) #endif { // 切换到库图片序列头 assert(sqh->library_picture_mixbin_flag == 1); memcpy(sqh, &ctx->info.libpic_sqh, sizeof(COM_SQH)); ret = sequence_init(ctx, sqh); com_assert_rv(COM_SUCCEEDED(ret), ret); // 更新PPS指针 #if HLS_OPT_PPS pps = &ctx->info.pps[ctx->info.libpic_pps_idx]; #endif // 更新LibVC标志 ctx->dpm.libvc_data->is_libpic_processing = sqh->library_stream_flag; ctx->dpm.libvc_data->library_picture_enable_flag = sqh->library_picture_enable_flag; // 恢复库图片图像头 memcpy(pic_header, &ctx->info.libpic_pic_header, sizeof(COM_PIC_HEADER)); // 恢复ESAO/CCSAO参数 memcpy(pic_header->pic_esao_params, ctx->libpic_pic_esao_params, N_C * sizeof(ESAO_BLK_PARAM)); memcpy(pic_header->pic_ccsao_params, ctx->libpic_pic_ccsao_params, (N_C - 1) * sizeof(CCSAO_BLK_PARAM)); // 恢复ALF参数 memcpy(ctx->pic_alf_on, ctx->libpic_pic_alf_on, N_C * sizeof(int)); for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { #if ALF_SHAPE int num_coef = (ctx->info.sqh.adaptive_leveling_filter_enhance_flag) ? ALF_MAX_NUM_COEF_SHAPE2 : ALF_MAX_NUM_COEF; #endif copy_alf_param(ctx->dec_alf->alf_picture_param[comp_idx], ctx->dec_alf->libpic_alf_picture_param[comp_idx] #if ALF_SHAPE , num_coef #if ALF_SHIFT + (int)ctx->info.sqh.adaptive_leveling_filter_enhance_flag #endif #endif ); // 恢复LCU标志 memcpy(ctx->info.pic_header.pic_esao_params[comp_idx].lcu_flag, ctx->libpic_esao_lcu_flag[comp_idx], ctx->info.f_lcu * sizeof(int)); if (comp_idx) memcpy(ctx->info.pic_header.pic_ccsao_params[comp_idx - 1].lcu_flag, ctx->libpic_ccsao_lcu_flag[comp_idx - 1], ctx->info.f_lcu * sizeof(int)); } // 恢复SAO参数 for (int lcu_idx = 0; lcu_idx < ctx->info.f_lcu; lcu_idx++) { copy_sao_param_for_blk(ctx->sao_blk_params[lcu_idx], ctx->libpic_sao_blk_params[lcu_idx]); copy_sao_param_for_blk(ctx->rec_sao_blk_params[lcu_idx], ctx->libpic_rec_sao_blk_params[lcu_idx]); memcpy(ctx->dec_alf->alf_lcu_enabled[lcu_idx], ctx->dec_alf->libpic_alf_lcu_enabled[lcu_idx], N_C * sizeof(int)); } // 恢复分割信息 memcpy(ctx->map.map_pb_tb_part, ctx->map.libpic_map_pb_tb_part, ctx->info.f_scu * sizeof(u32)); memcpy(ctx->map.map_patch_idx, ctx->map.libpic_map_patch_idx, ctx->info.f_scu * sizeof(s8)); memcpy(ctx->map.map_split, ctx->map.libpic_map_split, ctx->info.f_lcu * sizeof(s8)* MAX_CU_DEPTH* NUM_BLOCK_SHAPE* MAX_CU_CNT_IN_LCU); // 重置CABAC状态 mCabac_ws = MCABAC_SHIFT_I; mCabac_offset = (1 << (mCabac_ws - 1)); counter_thr1 = 0; counter_thr2 = COUNTER_THR_I; // 设置加权量化矩阵 #if HLS_OPT_PPS ctx->wq[0] = ctx->info.pps[pic_header->pic_pps_id].wq_4x4_matrix; ctx->wq[1] = ctx->info.pps[pic_header->pic_pps_id].wq_8x8_matrix; #else ctx->wq[0] = pic_header->wq_4x4_matrix; ctx->wq[1] = pic_header->wq_8x8_matrix; #endif } #endif cnkh->ctype = COM_CT_SLICE; // 设置块类型为片 // 处理IDR图像 #if SVAC_NAL if (bs->cur[3] == SVAC_IDR) picman_reset_dpb(&ctx->dpm); // 重置DPB #endif // CU级隐私保护处理 #if CU_LEVEL_PRIVACY COM_BSR *bs_privacy = &ctx->bs_privacy; com_bsr_init(bs_privacy, bitb->addr2, bitb->ssize2, NULL); SET_SBAC_DEC(bs_privacy, &ctx->sbac_dec_privacy); if (ctx->user_permission && ctx->info.pic_header.ph_privacy_on) { // 寻找隐私数据起始码 while (com_bsr_next(bs_privacy, 24) != 0x1) { ret = com_bsr_read(bs_privacy, 8); }; // 解码NALU头 unsigned int nalu_type = 0, temporal_id = 0, layer_id = 0; dec_eco_nalu_header(bs_privacy, &nalu_type, &temporal_id, &layer_id); assert(nalu_type == SVAC_PRIVACY); // 检查类型 #if TSVC_OPT assert(temporal_id == ctx->info.pic_header.temporal_id); // 检查时域ID #endif #if MULTI_LAYER_FRAMEWORK assert(layer_id == ctx->info.pic_header.layer_id); // 检查层ID #endif } #endif // 解码片头 #if HLS_OPT_PPS ret = dec_eco_patch_header(bs, sqh, &ctx->info.pps[pic_header->pic_pps_id], pic_header, shext, ctx->patch); #else ret = dec_eco_patch_header(bs, sqh, pic_header, shext, ctx->patch); #endif // 设置片类型(混合二进制模式) #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx + 1 < ctx->patch->rows * ctx->patch->columns) cnkh->ctype = COM_CT_CRR_SLICE_IMCOPLETE; // 不完整片 #if LIBPIC_DISPLAY else if (is_patch_l || (sqh->library_stream_flag && ctx->info.sqh.library_picture_mode_index == 1)) #else else if (is_patch_l) #endif cnkh->ctype = COM_CT_CRR_SLICE; // 完整片 #endif /* 片层初始化 */ ret = slice_init(ctx, ctx->core, pic_header); com_assert_rv(COM_SUCCEEDED(ret), ret); // 获取解码图像缓冲区 #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx != 0) { ctx->pic = ctx->libpic_pic; // 使用库图片缓冲区 } else { #endif /* 获取可用的解码图像缓冲区 */ ctx->pic = com_picman_get_empty_pic(&ctx->dpm, &ret); com_assert_rv(ctx->pic, ret); #if LIB_PIC_MIXBIN if (is_patch_l && ctx->patch->idx == 0) ctx->libpic_pic = ctx->pic; // 保存库图片缓冲区 } #endif // 设置参考图像映射 ctx->map.map_refi = ctx->pic->map_refi; ctx->map.map_mv = ctx->pic->map_mv; #if CU_LEVEL_PRIVACY ctx->map.map_privacy = ctx->pic->map_privacy; com_mset_x64a(ctx->map.map_privacy_pic_filter[0], 0, sizeof(COM_FILTER_SKIP)* ctx->info.pic_width* ctx->info.pic_height); com_mset_x64a(ctx->map.map_privacy_pic_filter[1], 0, sizeof(COM_FILTER_SKIP)* ctx->info.pic_width* ctx->info.pic_height); #endif /* 解码图像 */ #if HLS_OPT_PPS ret = dec_pic(ctx, ctx->core, sqh, &ctx->info.pps[pic_header->pic_pps_id], pic_header, shext); #else ret = dec_pic(ctx, ctx->core, sqh, pic_header, shext); #endif com_assert_rv(COM_SUCCEEDED(ret), ret); // 后处理滤波(完整片) #if LIB_PIC_MIXBIN if (!is_patch_l || (is_patch_l && ctx->patch->idx + 1 == ctx->patch->rows * ctx->patch->columns)) { #endif /* 去块滤波 */ #if HLS_OPT_PPS if (ctx->info.pps[ctx->info.pic_header.pic_pps_id].loop_filter_disable_flag == 0) #else if (ctx->info.pic_header.loop_filter_disable_flag == 0) #endif { ret = dec_deblock_avs2(ctx); // AVS2去块滤波 com_assert_rv(COM_SUCCEEDED(ret), ret); } /* CCSAO预处理 */ #if CCSAO if (ctx->info.pic_header.pic_ccsao_on[U_C-1] || ctx->info.pic_header.pic_ccsao_on[V_C-1]) { #if CCSAO_ENHANCEMENT copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, Y_C); copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, U_C); copy_frame_for_ccsao(ctx->pic_ccsao[0], ctx->pic, V_C); #else copy_frame_for_ccsao(ctx->pic_ccsao, ctx->pic, Y_C); #endif } #endif /* SAO滤波 */ if (ctx->info.sqh.sample_adaptive_offset_enable_flag) { ret = dec_sao_avs2(ctx); // AVS2 SAO滤波 com_assert_rv(ret == COM_OK, ret); } /* ESAO滤波 */ #if ESAO if (ctx->info.sqh.esao_enable_flag) { ret = dec_esao(ctx); // ESAO滤波 com_assert_rv(ret == COM_OK, ret); } #endif /* CCSAO滤波 */ #if CCSAO if (ctx->info.sqh.ccsao_enable_flag) { ret = dec_ccsao(ctx); // CCSAO滤波 com_assert_rv(ret == COM_OK, ret); } #endif /* ALF滤波 */ if (ctx->info.sqh.adaptive_leveling_filter_enable_flag) { ret = dec_alf_avs2(ctx, ctx->pic); // AVS2 ALF滤波 com_assert_rv(COM_SUCCEEDED(ret), ret); } /* MD5校验 */ if (ctx->use_pic_sign && ctx->pic_sign_exist) { ret = dec_picbuf_check_signature(ctx->pic, ctx->pic_sign #if CU_LEVEL_PRIVACY , ctx->user_permission || !ctx->info.pic_header.ph_privacy_on #endif ); com_assert_rv(COM_SUCCEEDED(ret), ret); ctx->pic_sign_exist = 0; // 重置标志 } /* 流级MD5校验 */ #if SVAC_UD_MD5_STREAM extension_and_user_data(ctx, bs, 1, sqh, pic_header); if (ctx->use_pic_sign && ctx->stream_sign_exist) { ctx->stream_sign_check_flag = 1; unsigned char * concat_buf = malloc((1024 * 1024 * 32)); com_assert_rv(concat_buf != NULL, -1); unsigned int stream_size = (unsigned int)((u8 *)bitb->addr3 - (u8 *)bitb->addr3_beg); u8 * stream_p = bitb->addr3_beg; unsigned char * buffer_p = concat_buf; // 拼接NAL单元 while ((stream_p - (u8 *)bitb->addr3_beg) < stream_size) { // ... [NAL单元处理逻辑] ... } // 计算并校验MD5 u8 stream_sign[16]; int ret = com_md5_stream(concat_buf, stream_total_size, stream_sign); com_assert_rv(COM_SUCCEEDED(ret), ret); if (com_mcmp(ctx->stream_sign, stream_sign, 16) != 0) { printf("\n stream signature check failed \n"); } com_assert_rv(com_mcmp(ctx->stream_sign, stream_sign, 16) == 0, COM_ERR_BAD_CRC); ctx->stream_sign_exist = 0; // 重置标志 if (concat_buf) free(concat_buf); } bitb->addr3 = bitb->addr3_beg; // 重置MD5缓冲区指针 #endif /* 图像边界扩展 */ #if PIC_PAD_SIZE_L > 0 dec_picbuf_expand(ctx, ctx->pic); #endif #if LIB_PIC_MIXBIN } // 保存混合二进制参数 if (is_patch_l) { memcpy(ctx->libpic_pic_alf_on, ctx->pic_alf_on, N_C * sizeof(int)); for (int lcu_idx = 0; lcu_idx < ctx->info.f_lcu; lcu_idx++) { copy_sao_param_for_blk(ctx->libpic_sao_blk_params[lcu_idx], ctx->sao_blk_params[lcu_idx]); copy_sao_param_for_blk(ctx->libpic_rec_sao_blk_params[lcu_idx], ctx->rec_sao_blk_params[lcu_idx]); memcpy(ctx->dec_alf->libpic_alf_lcu_enabled[lcu_idx], ctx->dec_alf->alf_lcu_enabled[lcu_idx], N_C * sizeof(int)); } for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { memcpy(ctx->libpic_esao_lcu_flag[comp_idx], ctx->info.pic_header.pic_esao_params[comp_idx].lcu_flag, ctx->info.f_lcu * sizeof(int)); if (comp_idx) memcpy(ctx->libpic_ccsao_lcu_flag[comp_idx - 1], ctx->info.pic_header.pic_ccsao_params[comp_idx - 1].lcu_flag, ctx->info.f_lcu * sizeof(int)); } } #endif /* 将解码图像放入DPB */ #if LIBVC_ON if (sqh->library_stream_flag #if LIB_PIC_MIXBIN && (!is_patch_l || (is_patch_l && (ctx->patch->idx + 1) == ctx->patch->rows * ctx->patch->columns)) #endif ) { // 库图片放入DPB ret = com_picman_put_libpic(&ctx->dpm, ctx->pic, ctx->info.pic_header.slice_type, ctx->ptr, pic_header->decode_order_index, ctx->info.pic_header.temporal_id, 1, ctx->refp, pic_header #if HLS_OPT_PPS , pps #endif ); } else #if LIB_PIC_MIXBIN if (!sqh->library_stream_flag) #endif #endif { // 普通图像放入DPB ret = com_picman_put_pic(&ctx->dpm, ctx->pic, ctx->info.pic_header.slice_type, ctx->ptr, pic_header->decode_order_index, pic_header->picture_output_delay, ctx->info.pic_header.temporal_id, 1, ctx->refp #if OBMC #if CUDQP , pic_header #else , pic_header->picture_qp #endif #if HLS_OPT_PPS , pps #endif #endif ); // 检查DPB大小 #if LIBVC_ON assert((&ctx->dpm)->cur_pb_size + (&ctx->dpm)->cur_libpb_size <= sqh->max_dpb_size); #else assert((&ctx->dpm)->cur_pb_size <= sqh->max_dpb_size); #endif } com_assert_rv(COM_SUCCEEDED(ret), ret); // 检查返回值 } // ====================== 其他块类型处理 ====================== #if SVAC_NAL else if (bs->cur[3] == SVAC_EOS) { // 序列结束 ctx->init_flag = 0; ctx->libpic_init_flag = 0; cnkh->ctype = COM_CT_SEQ_END; } else if (bs->cur[3] == SVAC_EOCVS) { // 编码视频序列结束 ctx->init_flag = 0; ctx->libpic_init_flag = 0; cnkh->ctype = COM_CT_CVS_END; } #endif #if SVAC_SECURITY_PARAM_SET else if (bs->cur[3] == SVAC_SEC_PS) { // 安全参数集处理 dec_eco_sec_parameter_set_init(ctx, bs, pic_header, sec_para_set); ret = dec_eco_sec_parameter_set(ctx, bs, pic_header, sec_para_set); com_assert_rv(COM_SUCCEEDED(ret), ret); cnkh->ctype = COM_CT_SEC_PARA_SET; } #endif #if SVAC_AUTHENTICATION else if (bs->cur[3] == SVAC_AUTH_DATA) { // 认证数据处理 dec_eco_auth_data_init(ctx, bs, pic_header, auth_data); ret = dec_eco_auth_data(ctx, bs, pic_header, auth_data); com_assert_rv(COM_SUCCEEDED(ret), ret); cnkh->ctype = COM_CT_AUTH; } #endif else { // 未知块类型 return COM_ERR_MALFORMED_BITSTREAM; } // ====================== 生成统计信息 ====================== make_stat(ctx, cnkh->ctype, stat); return ret; } ``` ## 关键功能模块解析 ### 1. 比特流处理机制 ```c /* 比特流读取器初始化 */ void com_bsr_init(COM_BSR *bs, u8 *buf, int size, COM_BSR *bs_next) { bs->buf = buf; // 设置缓冲区地址 bs->size = size; // 设置缓冲区大小 bs->cur = buf; // 当前读取位置 bs->bs_next = bs_next; // 链式比特流(可选) bs->left = 0; // 剩余未读比特数 bs->cache = 0; // 缓存值 bs->cnt = 0; // 已读取比特计数 bs->zero_cnt = 0; // 连续零计数(用于防竞争) } /* CABAC解码器设置 */ #define SET_SBAC_DEC(bs, sbac) do { \ (sbac)->bs = (bs); \ (sbac)->range = 510; \ (sbac)->offset = 0; \ (sbac)->bits_needed = 0; \ } while (0) ``` ### 2. 序列头(SPS)处理流程 ```c int dec_eco_sqh(COM_BSR *bs, COM_SQH *sqh) { // 1. 解析序列头基本信息 sqh->profile = com_bsr_read(bs, 8); // 配置文件 sqh->level = com_bsr_read(bs, 8); // 级别 sqh->horizontal_size = com_bsr_read(bs, 16); // 水平分辨率 sqh->vertical_size = com_bsr_read(bs, 16); // 垂直分辨率 // 2. 解析高级语法元素 sqh->progressive_sequence = com_bsr_read(bs, 1); // 逐行扫描标志 sqh->field_coded_sequence = com_bsr_read(bs, 1); // 场编码标志 sqh->sample_precision = com_bsr_read(bs, 4); // 样本精度 // 3. 解析库图片相关标志 sqh->library_stream_flag = com_bsr_read(bs, 1); // 库图片流标志 sqh->library_picture_enable_flag = com_bsr_read(bs, 1); // 库图片使能标志 sqh->library_picture_mode_index = com_bsr_read(bs, 2); // 库图片模式索引 // 4. 解析参考图像配置 sqh->max_dec_frame_buffering = com_bsr_read(bs, 5); // 最大解码帧缓冲 sqh->num_ref_frames = com_bsr_read(bs, 5); // 参考帧数量 // 5. 解析滤波参数 sqh->loop_filter_disable_flag = com_bsr_read(bs, 1); // 去块滤波禁用标志 sqh->sample_adaptive_offset_enable_flag = com_bsr_read(bs, 1); // SAO使能标志 // ... [其他参数解析] ... return COM_OK; } ``` ### 3. 图像头(PH)处理流程 ```c int dec_eco_pic_header(COM_BSR *bs, DEC_CTX *ctx, int *need_minus_256) { COM_PIC_HEADER *pic_header = &ctx->info.pic_header; // 1. 解析图像基本信息 pic_header->temporal_id = com_bsr_read(bs, 3); // 时域ID pic_header->layer_id = com_bsr_read(bs, 3); // 层ID pic_header->decode_order_index = com_bsr_read_ue(bs); // 解码顺序索引 // 2. 处理DOI循环 if (pic_header->decode_order_index < ctx->prev_doi) { *need_minus_256 = 1; pic_header->decode_order_index += 256; } ctx->prev_doi = pic_header->decode_order_index; // 3. 解析图像类型 pic_header->slice_type = com_bsr_read_ue(bs); // 片类型(I/P/B) // 4. 解析参考图像列表 if (pic_header->slice_type != SLICE_I) { // 解析L0参考列表 pic_header->num_ref_idx_active_override_flag = com_bsr_read(bs, 1); if (pic_header->num_ref_idx_active_override_flag) { pic_header->num_ref_idx_l0_active_minus1 = com_bsr_read_ue(bs); } // 解析参考图像标记 ret = dec_ref_pic_marking(bs, pic_header); } // 5. 解析量化参数 pic_header->picture_qp = com_bsr_read(bs, 6); // 图像QP值 // ... [其他参数解析] ... return COM_OK; } ``` ### 4. 片层解码流程 ```c int dec_pic(DEC_CTX *ctx, void *core, COM_SQH *sqh, COM_PIC_PARA_SET *pps, COM_PIC_HEADER *pic_header, COM_SH_EXT *shext) { // 1. 初始化片解码环境 slice_decoding_init(ctx); // 2. 遍历所有编码树单元(CTU) for (int ctu_idx = 0; ctu_idx < ctx->info.f_lcu; ctu_idx++) { // 3. 解析CTU头 ret = dec_ctu_header(ctx, ctu_idx); if (ret != COM_OK) return ret; // 4. 解码CTU ret = dec_ctu(ctx, ctu_idx); if (ret != COM_OK) return ret; // 5. 应用帧内预测 if (ctx->map.map_mode[ctu_idx] == MODE_INTRA) { apply_intra_prediction(ctx, ctu_idx); } // 6. 应用帧间预测 if (ctx->map.map_mode[ctu_idx] == MODE_INTER) { apply_inter_prediction(ctx, ctu_idx); } // 7. 反量化与反变换 apply_inverse_transform(ctx, ctu_idx); // 8. 重建像素 reconstruct_pixels(ctx, ctu_idx); } // 9. 环路滤波(去块、SAO等) apply_loop_filters(ctx); return COM_OK; } ``` ### 5. 环路滤波技术 ```c /* 去块滤波 */ void dec_deblock_avs2(DEC_CTX *ctx) { // 1. 垂直边界滤波 for (int y = 0; y < ctx->info.pic_height_in_lcu; y++) { for (int x = 0; x < ctx->info.pic_width_in_lcu; x++) { // 获取当前CTU COM_CTU *ctu = &ctx->core->ctu_array[y * ctx->info.pic_width_in_lcu + x]; // 2. 左侧边界处理 if (x > 0) { COM_CTU *left_ctu = &ctx->core->ctu_array[y * ctx->info.pic_width_in_lcu + x - 1]; apply_deblocking_vertical(ctu, left_ctu); } // 3. 上方边界处理 if (y > 0) { COM_CTU *top_ctu = &ctx->core->ctu_array[(y-1) * ctx->info.pic_width_in_lcu + x]; apply_deblocking_horizontal(ctu, top_ctu); } } } } /* SAO滤波 */ void dec_sao_avs2(DEC_CTX *ctx) { // 1. 遍历所有CTU for (int ctu_idx = 0; ctu_idx < ctx->info.f_lcu; ctu_idx++) { // 2. 获取SAO参数 SAO_PARAM *sao_param = &ctx->sao_blk_params[ctu_idx]; // 3. 应用SAO滤波 if (sao_param->type != SAO_TYPE_NONE) { apply_sao_filter(ctx->pic, ctu_idx, sao_param); } } } /* ALF滤波 */ void dec_alf_avs2(DEC_CTX *ctx, COM_IMGB *img) { // 1. 遍历所有CTU for (int ctu_idx = 0; ctu_idx < ctx->info.f_lcu; ctu_idx++) { // 2. 检查ALF使能标志 if (ctx->dec_alf->alf_lcu_enabled[ctu_idx][Y_C]) { // 3. 应用亮度分量ALF apply_alf_component(img, ctu_idx, Y_C, ctx->dec_alf->alf_picture_param[Y_C]); } // 4. 应用色度分量ALF for (int comp = U_C; comp <= V_C; comp++) { if (ctx->dec_alf->alf_lcu_enabled[ctu_idx][comp]) { apply_alf_component(img, ctu_idx, comp, ctx->dec_alf->alf_picture_param[comp]); } } } } ``` ## 高级特性实现 ### 1. 多层视频解码框架 ```c /* 多层解码初始化 */ void multi_layer_init(DEC_CTX *ctx) { // 1. 基础层初始化 if (ctx->layer_id == 0) { ctx->ctx_e = create_enhancement_layer(); // 创建增强层 } // 2. 增强层初始化 if (ctx->layer_id > 0) { // 从基础层继承配置 DEC_CTX* ctx_b = (DEC_CTX*)ctx->ctx_b; memcpy(&ctx->info.sqh, &ctx_b->info.sqh, sizeof(COM_SQH)); memcpy(&ctx->info.pps[0], ctx_b->info.pps, sizeof(COM_PIC_PARA_SET)); // 3. 上采样基础层图像 upsample_base_pic(&ctx->dpm, ctx_b->pic, &ctx_b->info, &ctx->info, ctx_b->layer_id, ctx->layer_id); } } /* 多层图像上采样 */ void upsample_base_pic(COM_PM *pm, COM_IMGB *base_pic, COM_INFO *base_info, COM_INFO *enh_info, int base_layer, int enh_layer) { // 1. 计算缩放比例 float scale_x = (float)enh_info->pic_width / base_info->pic_width; float scale_y = (float)enh_info->pic_height / base_info->pic_height; // 2. 分配上采样缓冲区 COM_IMGB *upsampled = com_pic_alloc(pm, enh_info->pic_width, enh_info->pic_height); // 3. 应用上采样滤波器 for (int y = 0; y < enh_info->pic_height; y++) { for (int x = 0; x < enh_info->pic_width; x++) { // 计算基础层位置 float base_x = x / scale_x; float base_y = y / scale_y; // 双线性插值 int x0 = (int)base_x; int y0 = (int)base_y; int x1 = MIN(x0 + 1, base_info->pic_width - 1); int y1 = MIN(y0 + 1, base_info->pic_height - 1); // 计算插值 float dx = base_x - x0; float dy = base_y - y0; int value = (1-dx)*(1-dy)*base_pic->data[Y_C][y0][x0] + dx*(1-dy)*base_pic->data[Y_C][y0][x1] + (1-dx)*dy*base_pic->data[Y_C][y1][x0] + dx*dy*base_pic->data[Y_C][y1][x1]; // 存储结果 upsampled->data[Y_C][y][x] = CLIP(0, 255, value); } } // 4. 将上采样图像添加到参考列表 add_pic(pm, upsampled, REFP_0); } ``` ### 2. 库图片混合解码 ```c /* 库图片混合解码处理 */ void libpic_mixbin_processing(DEC_CTX *ctx) { // 1. 检查混合二进制标志 if (ctx->info.sqh.library_stream_flag && ctx->info.sqh.library_picture_mixbin_flag) { // 2. 保存当前解码状态 save_decoder_state(ctx); // 3. 切换到库图片配置 memcpy(&ctx->info.sqh, &ctx->info.libpic_sqh, sizeof(COM_SQH)); sequence_init(ctx, &ctx->info.sqh); // 4. 恢复库图片参数 memcpy(&ctx->info.pic_header, &ctx->info.libpic_pic_header, sizeof(COM_PIC_HEADER)); restore_alf_params(ctx); restore_sao_params(ctx); // 5. 设置特殊解码模式 ctx->special_decoding_mode = LIBPIC_MIXBIN_MODE; } } /* 库图片参数保存 */ void save_decoder_state(DEC_CTX *ctx) { // 保存ALF参数 for (int comp_idx = 0; comp_idx < N_C; comp_idx++) { copy_alf_param(ctx->dec_alf->libpic_alf_picture_param[comp_idx], ctx->dec_alf->alf_picture_param[comp_idx]); } // 保存SAO参数 for (int lcu_idx = 0; lcu_idx < ctx->info.f_lcu; lcu_idx++) { copy_sao_param_for_blk(ctx->libpic_sao_blk_params[lcu_idx], ctx->sao_blk_params[lcu_idx]); } // 保存分割信息 memcpy(ctx->map.libpic_map_pb_tb_part, ctx->map.map_pb_tb_part, ctx->info.f_scu * sizeof(u32)); } ``` ### 3. CU级隐私保护 ```c /* CU级隐私数据处理 */ void cu_level_privacy(DEC_CTX *ctx, COM_BITB *bitb) { // 1. 初始化隐私比特流读取器 COM_BSR *bs_privacy = &ctx->bs_privacy; com_bsr_init(bs_privacy, bitb->addr2, bitb->ssize2, NULL); SET_SBAC_DEC(bs_privacy, &ctx->sbac_dec_privacy); // 2. 检查用户权限和隐私标志 if (ctx->user_permission && ctx->info.pic_header.ph_privacy_on) { // 3. 寻找隐私数据起始码 while (com_bsr_next(bs_privacy, 24) != 0x1) { com_bsr_read(bs_privacy, 8); } // 4. 解析NALU头 unsigned int nalu_type, temporal_id, layer_id; dec_eco_nalu_header(bs_privacy, &nalu_type, &temporal_id, &layer_id); // 5. 验证隐私数据类型 assert(nalu_type == SVAC_PRIVACY); // 6. 解析隐私区域信息 int num_regions = com_bsr_read_ue(bs_privacy); for (int i = 0; i < num_regions; i++) { int region_top = com_bsr_read_ue(bs_privacy); int region_left = com_bsr_read_ue(bs_privacy); int region_width = com_bsr_read_ue(bs_privacy); int region_height = com_bsr_read_ue(bs_privacy); // 7. 标记隐私区域 mark_privacy_region(ctx, region_top, region_left, region_width, region_height); } // 8. 应用隐私滤波 apply_privacy_filter(ctx); } } /* 隐私区域标记 */ void mark_privacy_region(DEC_CTX *ctx, int top, int left, int width, int height) { // 转换到CTU坐标 int ctu_size = 1 << ctx->info.log2_max_cu_size; int ctu_top = top / ctu_size; int ctu_left = left / ctu_size; int ctu_bottom = (top + height - 1) / ctu_size; int ctu_right = (left + width - 1) / ctu_size; // 标记隐私CTU for (int y = ctu_top; y <= ctu_bottom; y++) { for (int x = ctu_left; x <= ctu_right; x++) { int ctu_idx = y * ctx->info.pic_width_in_lcu + x; ctx->map.map_privacy[ctu_idx] = PRIVACY_FLAG; } } } /* 隐私滤波应用 */ void apply_privacy_filter(DEC_CTX *ctx) { // 遍历所有CTU for (int ctu_idx = 0; ctu_idx < ctx->info.f_lcu; ctu_idx++) { // 检查隐私标记 if (ctx->map.map_privacy[ctu_idx] == PRIVACY_FLAG) { // 应用高斯模糊 apply_gaussian_blur(ctx->pic, ctu_idx, 5); // 5x5高斯核 // 可选:应用像素化效果 apply_pixelation(ctx->pic, ctu_idx, 8); // 8x8像素块 } } } ``` ## 总结与最佳实践 ### 解码器核心设计原则 1. **模块化设计**: - 分离语法解析、预测、变换、滤波等模块 - 使用清晰的接口定义模块间交互 2. **状态管理**: - 使用上下文结构(DEC_CTX)管理解码状态 - 明确区分序列级、图像级和片级状态 3. **错误恢复**: - 分级错误处理策略 - 关键错误与可恢复错误区分 - 自动错误检测和恢复机制 4. **性能优化**: - CTU级并行处理 - 内存访问优化 - SIMD指令加速 5. **安全与隐私**: - 安全内存管理 - 数据加密处理 - 隐私保护算法 ### 解码流程优化建议 ```mermaid graph TD A[开始] --> B{比特流类型} B -->|SPS| C[序列头处理] B -->|PPS| D[参数集处理] B -->|PH| E[图像头处理] B -->|Slice| F[片层解码] C --> G[序列初始化] D --> G E --> H[参考列表构造] H --> F F --> I[CTU解码] I --> J[预测处理] J --> K[变换量化] K --> L[像素重建] L --> M[环路滤波] M --> N[图像输出] N --> O[结束] ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值