GPUImage3 icon indicating copy to clipboard operation
GPUImage3 copied to clipboard

CPU & Memory usage exceed than GPUImage2 ?

Open dito010 opened this issue 5 years ago • 2 comments

Hello there!

I try to compare the CPU & Memory usage between GPUImage2 and GPUImage3 on filters group, my device is iPhone XR in HongKong, iOS system is 12.1.4. Here is my code:

    var videoCamera:GPUImageVideoCamera?
    var filter1 = GPUImageLuminanceThresholdFilter()
    let filter2 = GPUImagePixellateFilter()
    let filter3 = GPUImagePolarPixellateFilter()
    let filter4 = GPUImageAmatorkaFilter()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        videoCamera = GPUImageVideoCamera(sessionPreset: AVCaptureSession.Preset.high.rawValue, cameraPosition: .back)
        videoCamera!.outputImageOrientation = .portrait;
        videoCamera?.addTarget(filter1)
        filter1.addTarget(filter2)
        filter2.addTarget(filter3)
        filter3.addTarget(filter4)
        filter4.addTarget(self.view as! GPUImageView)
        videoCamera?.startCapture()
    }

On GPUImage2 the CPU usage between 16% ~ 20%, Memory usage between 90 - 100 MB. On GPUImage3 the CPU usage between 46% ~ 52%, Memory usage between 190 - 200 MB.

Why GPUImage3 performance worst than GPUImage2 ?

dito010 avatar Feb 27 '19 05:02 dito010

GPUImage 3 is still just getting built out, so we don't have the same optimizations in place that I did in GPUImage 2. This is especially true about the inputs and outputs, and I'm pretty sure something's wrong in the current camera setup.

We still have a lot of work to do on the inputs and outputs to get this to be ready for regular use.

BradLarson avatar Feb 27 '19 16:02 BradLarson

Thank u for your reply, and could u provide some optimization ideas ?

dito010 avatar Feb 28 '19 04:02 dito010