---
title: "calculateHDRStats(for:)"
framework: coreimage
role: symbol
role_heading: Instance Method
path: "coreimage/cicontext/calculatehdrstats(for:)-6lwmz"
---

# calculateHDRStats(for:)

Given an IOSurface, use the receiving Core Image context to calculate its HDR statistics (content headroom and content average light level) and then update the surface’s attachments to store the values.

## Declaration

```swift
func calculateHDRStats(for surface: IOSurfaceRef)
```

## Parameters

- `surface`: A mutable IOSurfaceRef for which to calculate and attach statistics.

## Discussion

Discussion If the IOSurface has a Clean Aperture rectangle then only pixels within that rectangle are considered.
