BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.68k stars 331 forks source link

front and back camera performance is different #46

Open hyhmaffia opened 4 years ago

hyhmaffia commented 4 years ago

xcode 11 ios 13 iphone 6s plus

xcode 11 have a tool, we can set the device‘s thermal state, when I set the thermal state to critical, the performance is very different between front camera and back camera。 use back camera , the fps is 30, but user front camera, the fps is only 15-20。why?

I use the SimpleVideoFilter example and add some op on it

    override func viewDidLoad() {
        super.viewDidLoad()
        do {
            operation0 = BrightnessAdjustment()
            operation0.brightness = 0

            operation1 = ExposureAdjustment()
            operation1.exposure = 0

            operation2 = OpacityAdjustment()
            operation2.opacity = 0

            operation3 = SaturationAdjustment()
            operation3.saturation = 0.5

            operation4 = GammaAdjustment()
            operation5 = HueAdjustment()
            operation6 = Haze()

            operation7 = GammaAdjustment()
            operation8 = HueAdjustment()
            operation9 = Haze()

            //camera = try Camera(sessionPreset: .hd1280x720, location: .backFacing)
            camera = try Camera(sessionPreset: .hd1280x720, location: .frontFacing)

            camera.runBenchmark = true
            camera.logFPS = true;
            camera --> operation0 --> operation1 --> operation2 --> operation3 --> operation4 --> operation5 --> operation6 --> operation7 --> operation8 --> operation9 --> renderView
            camera.startCapture()
        } catch {
            fatalError("Could not initialize rendering pipeline: \(error)")
        }
    }