fix: Use compressed buffer format as default format as well (#1884)
* fix: Use compressed buffer format as default format as well * chore: Format Swift
This commit is contained in:
parent
902dc634a4
commit
9d02f5141d
@ -140,7 +140,20 @@ extension CameraView {
|
||||
*/
|
||||
private func getPixelFormat(videoOutput: AVCaptureVideoDataOutput) -> OSType {
|
||||
// as per documentation, the first value is always the most efficient format
|
||||
let defaultFormat = videoOutput.availableVideoPixelFormatTypes.first!
|
||||
var defaultFormat = videoOutput.availableVideoPixelFormatTypes.first!
|
||||
if enableBufferCompression {
|
||||
// use compressed format instead if we enabled buffer compression
|
||||
if defaultFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange &&
|
||||
videoOutput.availableVideoPixelFormatTypes.contains(kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange) {
|
||||
// YUV 4:2:0 8-bit (limited video colors; compressed)
|
||||
defaultFormat = kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange
|
||||
}
|
||||
if defaultFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange &&
|
||||
videoOutput.availableVideoPixelFormatTypes.contains(kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarFullRange) {
|
||||
// YUV 4:2:0 8-bit (full video colors; compressed)
|
||||
defaultFormat = kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarFullRange
|
||||
}
|
||||
}
|
||||
|
||||
// If the user enabled HDR, we can only use the YUV 4:2:0 10-bit pixel format.
|
||||
if hdr == true {
|
||||
|
Loading…
Reference in New Issue
Block a user