Residual coding

This commit is contained in:
Ali
2022-07-29 18:32:51 +02:00
parent 64076541cd
commit f6ad7dc77a
35 changed files with 2784 additions and 498 deletions

View File

@@ -18,7 +18,7 @@ private func roundUp(_ numToRound: Int, multiple: Int) -> Int {
return numToRound + multiple - remainder
}
public func cacheVideoAnimation(path: String, width: Int, height: Int, writer: AnimationCacheItemWriter) {
public func cacheVideoAnimation(path: String, width: Int, height: Int, writer: AnimationCacheItemWriter, firstFrameOnly: Bool) {
writer.queue.async {
guard let frameSource = makeVideoStickerDirectFrameSource(queue: writer.queue, path: path, width: roundUp(width, multiple: 16), height: roundUp(height, multiple: 16), cachePathPrefix: nil, unpremultiplyAlpha: false) else {
return
@@ -45,7 +45,11 @@ public func cacheVideoAnimation(path: String, width: Int, height: Int, writer: A
}
}
return frameDuration
}, proposedWidth: frame.width, proposedHeight: frame.height)
}, proposedWidth: frame.width, proposedHeight: frame.height, insertKeyframe: true)
if firstFrameOnly {
break
}
} else {
break
}