Maybe improve grayscale gifv playback performance
This commit is contained in:
parent
08bd78d51b
commit
f447150bbc
|
@ -79,13 +79,12 @@ class GifvController {
|
||||||
#if os(visionOS)
|
#if os(visionOS)
|
||||||
#warning("Use async AVVideoComposition CIFilter initializer")
|
#warning("Use async AVVideoComposition CIFilter initializer")
|
||||||
#else
|
#else
|
||||||
|
let filter = CIFilter(name: "CIColorMonochrome")!
|
||||||
|
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
|
item.videoComposition = AVVideoComposition(asset: asset, applyingCIFiltersWithHandler: { (request) in
|
||||||
let filter = CIFilter(name: "CIColorMonochrome")!
|
|
||||||
|
|
||||||
filter.setValue(request.sourceImage, forKey: "inputImage")
|
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")
|
|
||||||
|
|
||||||
request.finish(with: filter.outputImage!, context: nil)
|
request.finish(with: filter.outputImage!, context: nil)
|
||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue