Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ac65efd
Added some useful extensions for applying common transformations to a…
frankschlegel Jul 30, 2022
79a9336
Added some useful extensions for convenience access to common color s…
frankschlegel Jul 30, 2022
82d5817
Added some convenience methods for compositing/blending and colorizin…
frankschlegel Jul 31, 2022
a95067d
Added some convenience methods for rendering text into a `CIImage`.
frankschlegel Jul 31, 2022
a8fd07a
Added some useful extensions to `CIColor`.
frankschlegel Jul 31, 2022
860c30b
Added helper for creating images with rounded corners.
frankschlegel Aug 5, 2022
6dfe851
Fixed availability checks.
frankschlegel Aug 5, 2022
aee1af5
Created a first version of a EDR and wide gamut test pattern.
frankschlegel Aug 5, 2022
3d9f704
Added helper for centering an image at a given point.
frankschlegel Aug 5, 2022
519fe06
Added a fancy title label to the pattern.
frankschlegel Aug 5, 2022
5caec8e
Simplified swatch composition.
frankschlegel Aug 5, 2022
6be5f67
Fixed rounded corner compositing.
frankschlegel Aug 5, 2022
e6220cc
Better luminance threshold for contrast color.
frankschlegel Aug 5, 2022
7580275
Added labels for color values to the swatch.
frankschlegel Aug 5, 2022
7705d59
Added an optional label to the pattern.
frankschlegel Aug 6, 2022
586445c
Added tests for generating test patterns in various file formats and …
frankschlegel Aug 6, 2022
d7f0e02
Fixed availability checks.
frankschlegel Aug 6, 2022
e6c2cc8
Added generated test patterns to repo (via LFS) for easy download.
frankschlegel Aug 7, 2022
72eeb51
Added APIs for runtime compilation of Metal CIKernels from source sti…
frankschlegel Aug 7, 2022
0508406
Generate pattern hue gradient with a Metal kernel if possible.
frankschlegel Aug 7, 2022
7791745
Added tests for new color extensions.
frankschlegel Aug 8, 2022
276f2b9
Added tests for new image transformation extensions.
frankschlegel Aug 8, 2022
7f47dff
Better formula for contrast color.
frankschlegel Aug 8, 2022
19b0fdd
Added tests for Metal kernel runtime compilation.
frankschlegel Aug 8, 2022
a351b3a
Updated README with new features.
frankschlegel Aug 8, 2022
c7cdcc8
README formatting fixes.
frankschlegel Aug 8, 2022
cb9b093
Added information about the test pattern images to README.
frankschlegel Aug 8, 2022
e4f7a68
Provided a tone-mapped version of the pattern for illustration purposes.
frankschlegel Aug 8, 2022
70f3c60
Merge branch 'main' of github.com:DigitalMasterpieces/CoreImageExtens…
frankschlegel Aug 9, 2022
d909614
Fixed typos.
frankschlegel Aug 16, 2022
68aaac3
Fixed copy-paste mistake for generating HEIC images.
frankschlegel Sep 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EDR_Wide_Gamut_Test_Patterns/* filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_10bit_BT.2020.heic
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_16bit_BT.2020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_16bit_BT.2100-PQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_Display-P3.heic
Git LFS file not shown
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_Display-P3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_Display-P3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_sRGB.heic
Git LFS file not shown
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_sRGB.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_8bit_sRGB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions EDR_Wide_Gamut_Test_Patterns/TestPattern_tone-mapped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,35 @@ let kernel = try CIKernel.kernel(withMetalString: metalKernelCode, fallbackCIKLS
> This way the compiler can check your sources at build-time, and initializing a CIKernel at runtime from pre-compiled sources is much faster.
> A notable exception might arise when you need a custom kernel inside a Swift package since CI Metal kernels can't be built with Swift packages (yet).
> But this should only be used as a last resort.

## EDR & Wide Gamut Test Pattern
Most Apple devices can capture and display images with colors that are outside of the standard sRGB color gamut and range (_Standard Dynamic Range_, _SDR_).
The Display P3 color space is the de facto standard on Apple platforms now.
Some high-end devices and monitors also have XDR screens that can go even beyond Display P3, and new iPhones can record movies in HDR now.
All those systems (wide color gamut, high display brightness, extended color spaces) are subsumed by Apple under the term _EDR_ (_Extended Dynamic Range_).

To ensure that all parts of our apps can properly process and display EDR media, we designed a test pattern image that
- displays a stripe of tiles with increasing pixel brightness value (up to the XDRs peak brightness of 1600 nits)
- and swatches of various colors in three common color gamuts (sRGB, Display P3, and BT.2020).

![EDR & Wide Gamut Test Pattern](EDR_Wide_Gamut_Test_Patterns/TestPattern_tone-mapped.png)

> **_Note:_**
> The image above is tone-mapped from HDR to SDR to demonstrate what it will roughly look like on a HDR-capable screen (just much dimmer).
> If you want to see the colors in their correct form (and see where you screen has to clip colors), check out the extended range [EXR](EDR_Wide_Gamut_Test_Patterns/TestPattern_16bit_float_extended-linear-sRGB.exr?raw=true) or [TIFF](EDR_Wide_Gamut_Test_Patterns/TestPattern_16bit_float_extended-linear-sRGB.tiff?raw=true) version of the image.
> The tone-mapped PNG version above was chosen so you can better see the intent of the pattern.

The pattern image itself is generated with Core Image compositing techniques.
You can generate it as `CIImage` just like this:
```swift
let testPattern = CIImage.testPattern()
```

> **_Note:_**
> You should use this for testing purposes only!
> This is not meant to be shipped in production code since generating the pattern is slow and potentially error-prone (lots of force-unwraps in the code for convenience).
> If you need a fast-loading version of it, best use the pre-generated [EXR version](EDR_Wide_Gamut_Test_Patterns/TestPattern_16bit_float_extended-linear-sRGB.exr?raw=true).

You can find many pre-generated test pattern images in various file formats, bit depths, and color spaces in the [EDR_Wide_Gamut_Test_Patterns](EDR_Wide_Gamut_Test_Patterns/) folder for download.
Those images can also be generated using the `TestPatternTests`.
The generated images are attached to the test runs and can be found when opening the test result in the Reports navigator.
Loading