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

# calculateHDRStats(for:)

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

## Declaration

```swift
func calculateHDRStats(for buffer: CVPixelBuffer)
```

## Parameters

- `buffer`: A mutable CVPixelBuffer for which to calculate and attach statistics.

## Discussion

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