This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CVPixelBufferRef createCroppedPixelBufferBiPlanar(CVPixelBufferRef srcPixelBuffer, CGRect croppingRect, CGSize scaleSize) { | |
OSType inputPixelFormat = CVPixelBufferGetPixelFormatType(srcPixelBuffer); | |
assert(inputPixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange | |
|| inputPixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); | |
size_t inputWidth = CVPixelBufferGetWidth(srcPixelBuffer); | |
size_t inputHeight = CVPixelBufferGetHeight(srcPixelBuffer); | |
assert(CGRectGetMinX(croppingRect) >= 0); |