Core Image: Performance, Prototyping, and Python

WWDC 2018

Posted by Den on September 06, 2018 · 6 mins read
Core Image: Performance, Prototyping, and Python

Core Image: Performance, Prototyping, and Python

WWDC 2018

Core Image: Performance, Prototyping, and Python

WWDC 2018

Core Image Performance APIs

  • Inserting intermediates
  • Kernel language features

Inserting Intermediates

Caching of Intermediates

  • Intermediates are cached by default
  • Can turn off for all renders on a CIContext
    let context = CIContext(options: [.cacheIntermediates : false] );
  • Or turn on for specific intermediates
    image.insertingIntermediate(cache: true);

2 Ways to Write CIKernels

New Features for Better Performance

  • Half float support
    - Faster operations (on A11 devices)
    - Smaller registers increase utilization
  • Group reads
    - 4 single-channel pixels per read
  • Group writes
    - 4 pixels written per kernel execution

Step 1: Convert to Metal

Step2: Use half-float

Step 3: Use Group reads and Write

PyCoreImage

PyObjC

  • Since Mac OS X 10.5 Leopard
  • Python and ObjC bridge
  • Colon → underscore

Python Bindings

PyCoreImage

Core Image for Python

Cheat Sheet

Demo1

Demo 2