zxingify / zxingify-objc

An Objective-C Port of ZXing
Apache License 2.0
3.07k stars 753 forks source link

Should apply scanRect before rotating for performance #379

Closed dpolivy closed 6 years ago

dpolivy commented 6 years ago

An interesting performance optimization in ZXCapture.m would be to first crop the incoming image with scanRect if it is set, and then rotate it; the cropped image would be smaller, and thus more efficient to rotate.

It's pretty easy to refactor the code for this, although it is a breaking change to the way the scanRect is specified. I can submit a PR, but was curious to get additional input on whether this is a good idea.

Code: https://github.com/TheLevelUp/ZXingObjC/blob/master/ZXingObjC/client/ZXCapture.m#L357

benjohnde commented 6 years ago

Sry for the late answer. I would be very happy to see a PR with those changes.

We are currently using an own implementation as a replacement for ZXCapture, written in Swift. I also planned to do some improvements to the overall project.

So if you have time for that, sure give it a shot :)

benjohnde commented 6 years ago

Related to #222.

dpolivy commented 6 years ago

Hah, totally forgot I filed an issue on this earlier 😄 I did post the changes in that thread. This would be a breaking change, though -- is that acceptable?

benjohnde commented 6 years ago

Ah nice, yeah sure we are using quite the same approach :) I will answer in the thread of the other issue.