Maybe improve grayscale gifv playback performance

This commit is contained in:
Shadowfacts 2024-03-31 20:51:51 -04:00
parent 08bd78d51b
commit f447150bbc
1 changed files with 4 additions and 5 deletions

View File

@ -79,13 +79,12 @@ class GifvController {
#if os(visionOS)
#warning("Use async AVVideoComposition CIFilter initializer")
#else
item.videoComposition = AVVideoComposition(asset: asset, applyingCIFiltersWithHandler: { (request) in
let filter = CIFilter(name: "CIColorMonochrome")!
filter.setValue(request.sourceImage, forKey: "inputImage")
filter.setValue(CIColor(red: 0.85, green: 0.85, blue: 0.85), forKey: "inputColor")
filter.setValue(1.0, forKey: "inputIntensity")
item.videoComposition = AVVideoComposition(asset: asset, applyingCIFiltersWithHandler: { (request) in
filter.setValue(request.sourceImage, forKey: "inputImage")
request.finish(with: filter.outputImage!, context: nil)
})
#endif