Post

Replies

Boosts

Views

Activity

Histogram calculation using vImage
I am getting pixel buffers in BGRA32 format in real time through AVCaptureVideoDataOutput and I am trying to compute Histogram. Following is my code to process pixel buffers to get histogram:CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly); vImage_Error err; vImage_Buffer buffer; buffer.data = (unsigned char *)CVPixelBufferGetBaseAddress( pixelBuffer ); buffer.rowBytes = CVPixelBufferGetBytesPerRow( pixelBuffer ); buffer.width = CVPixelBufferGetWidth( pixelBuffer ); buffer.height = CVPixelBufferGetHeight( pixelBuffer ); vImageCVImageFormatRef vformat = vImageCVImageFormat_CreateWithCVPixelBuffer( pixelBuffer ); vImageBuffer_InitWithCVPixelBuffer(&buffer, NULL, pixelBuffer, vformat, NULL, kvImageNoAllocate); vImagePixelCount alpha[256]; vImagePixelCount red[256]; vImagePixelCount green[256]; vImagePixelCount blue[256]; vImagePixelCount *histogram[4] = {blue, green, red, alpha}; err = vImageHistogramCalculation_ARGB8888(&buffer, histogram, kvImageNoFlags); CVPixelBufferUnlockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);However, I get a warning "Null passed to a callee that requires a non-null argument" for the second argument passed to vImageBuffer_InitWithCVPixelBuffer. All I want is to initialize and process the vImage and compute the histogram with minimal format conversions. Is there a passthrough way to convert pixel buffer to vImage which preserves BGRA32 format?
4
0
1.3k
Feb ’18
AVPlayer bugs in iOS 12
iOS 12 seems to have lot of bugs in AVFoundation code it seems. The latest one seems to be one with AVPlayer:Cannot remove an observer <NSKeyValueObservance 0x280625ce0> for the key path "currentItem.status" from <AVPlayerInternal 0x107626840>, most likely because the value for the key "currentItem" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the AVPlayerInternal class.'Has anyone come across this?
1
0
1.7k
Sep ’18
iOS 13/13.1 Bug with Autorotation
iOS 13/13.1 autorotation seems to be behave differently than iOS 12. For instance, my app allows user to lock interface orientation to portrait or landscape mode in settings.If I have portrait rotation lock on device and return only .landscape mode as supportedInterfaceOrientations, the interface remains in portrait mode only until I disable portrait lock orientation on device. This does not seem to be the case with iOS 12. Infact, supportedInterfaceOrientations is not even called!UIViewController.attemptRotationToDeviceOrientation() also does not work in such cases.The root of the problem is I temporarily return shouldAutorotate to false while the app is initializing and when everything is initialized, I call UIViewController.attemptRotationToDeviceOrientation() to trigger autorotation. It triggers autorotation in iOS 12 but in iOS 13.1 it doesn't works.Looks like a bug in iOS 13.1 I believe. What's a known workaround?
12
0
11k
Sep ’19
AVCaptureMultiCamSession & AVCaptureSession runtime error
I am dynamically switching between AVCaptureMultiCamSession & AVCaptureSession and here is the problem I face. I add back camera to MultiCam session as demonstrated in AVMultiCamPIP sample code and it works. Next I deallocate this session and create an AVCaptureSessio. But when I add the back camera device to AVCaptureSession & set the sessionPreset to 4K (as done in AVCam sample code), I get this error: Capture session runtime error: related decl 'e' for AVError(_nsError: Error Domain=AVFoundationErrorDomain Code=-11873 "Cannot Record" UserInfo={NSLocalizedDescription=Cannot Record, AVErrorDeviceKey=<AVCaptureFigVideoDevice: 0x15d0074f0 [Back Camera][com.apple.avfoundation.avcapturedevice.built-in_video:0]>, NSLocalizedRecoverySuggestion=Reset the camera to a supported active format, then restart the session., NSLocalizedFailureReason=The camera's active format is unsupported by this session.})If on the other hand I set the sessionPreset to 1080p, I get a different error - "Capture session was interrupted (video device is in use by another client)".I even tried to set the activeFormat of device before adding it to session, but no difference. Wondering what could be the problem.
5
0
3.3k
Jun ’20
XCode 12 debugger failed assertion `Viewport Validation viewport.znear(-1) must be between 0.0f and 1.0f
XCode 12 is making debugging application impossible if you have Metal code such as this renderEncoder?.setViewport(MTLViewport(originX: 0, originY: 0, width: Double(destWidth), height: Double(destHeight), znear: -1, zfar: 1)) [MTLDebugRenderCommandEncoder setViewport:]:2667: failed assertion `Viewport Validation viewport.znear(-1) must be between 0.0f and 1.0f This is not a problem when the app is not connected to debugger. How do I fix this?
1
0
630
Jul ’20
iPhone with iOS 14 beta 2 doesn't autorotate when connected to XCode debugger
I have iPhone 11 Pro running iOS 14 beta 2. In one of my projects (and only that project perhaps), the view controller doesn't autorotate when connected to XCode (11 or 12) debugger. When not connected to debugger, there is no issue in autorotation. This happens for only one particular project and it's not clear what could be blocking autorotation. None of the autorotation methods are called. I wonder what could be blocking autorotation. And if I connect any iOS 13 device, autorotation works with the debugger. Is this a known issue with iOS 14/XCode?
12
0
5.2k
Jul ’20
iOS14 Autorotation bug with debugger & AVCaptureSession
I am seeing an unusual autorotation bug in iOS 14 (beta 3). I have an XCode project with some AVFoundation (AVCaptureSession) & Metal code to setup camera and rendering of camera frames. Here is the strange thing about bug. Build the project with XCode 12 and run on iOS 14 device. The view controller doesn't autorotate when connected to debugger. When the app is opened without debugger, autorotation happens, Once Autorotation is blocked in debugger, it gets blocked forever for the XCode project. Meaning, if I change the initial view controller to some dummy view controller, it too fails to autorotate!!! Only way is to make a new XCode project to reproduce the issue. Deleting/Reinstalling the app, clean build, nothing helps. This does not happen on iOS 13 devices. Reproducible test case is very difficult to make as there is lot of code. I tried trimming a lot of code but then it is not reproducible. And even to find the culprit code, I will need to make a new XCode project everytime as the project once dead is dead forever! Is anyone aware of similar issue? Any inputs would be appreciated.
1
0
564
Jul ’20
iOS 14 device autorotation blocked by Metal
Dear Apple Engineers, This is a strange bug of iOS 14 beta 3. The following line added to any UIViewController hangs auto rotation *forever* in XCode debugger. public static let metalDevice:MTLDevice? = MTLCreateSystemDefaultDevice() //Freezes iOS 14 device autorotation forever Now even if you remove this line, nothing happens. The device will never autorotate when connected to XCode debugger. It however autorotates when not connected to debugger. The only way is to remove the line, compress it in zip file, delete the project and uncompress the zip file and build again. What is the known workaround? I shall be filing bug report soon.
1
1
1.2k
Aug ’20