             return
         }
         
-        let options : [CIContextOption : Any] = [.outputColorSpace : CGColorSpaceCreateDeviceRGB(),
-                                                 .outputPremultiplied : true,
-                                                 .useSoftwareRenderer : NSNumber(booleanLiteral: false)]
-        self._ciContext = CIContext(mtlDevice: device, options: options)
-    }
-    
-    internal func setupPixelBufferPoolIfNecessary(_ pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation) {
+        self._ciContext = CIContext.createDefaultCIContext(device)
+    }
+    
+    fileprivate func setupPixelBufferPoolIfNecessary(_ pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation) {
         let formatType = CVPixelBufferGetPixelFormatType(pixelBuffer)
         let width = CVPixelBufferGetWidth(pixelBuffer)
         let height = CVPixelBufferGetHeight(pixelBuffer)

        }
        
        let orientation: CGImagePropertyOrientation = .downMirrored
        self.setupPixelBufferPoolIfNecessary(pixelBuffer, orientation: orientation)
        if let pixelBufferPool = self._pixelBufferPool, let texture = self._texture {
            if let pixelBufferOutput = self.createPixelBufferOutput(withPixelBuffer: pixelBuffer,
                                                                    orientation: orientation,
                                                                    pixelBufferPool: pixelBufferPool,
                                                                    texture: texture) {
                self._videoBufferOutput = pixelBufferOutput
            }
        }

        self._device = nil
        self._library = nil
        self._commandQueue = nil
        self._texture = nil
        
        #if USE_ARKIT
        self._renderer?.scene = nil
        self._renderer = nil
        self._arView = nil
        #endif
    
        self._ciContext = nil
        self._pixelBufferPool = nil
        self._videoBufferOutput = nil
    }
    
}
