-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple readback operations can be made faster. #459
Comments
Thank you for filing an issue! Please be patient. :-) |
I haven't ever seen that, and had no idea of it's existence.
It does look like getImageData is used every frame grab, which might perhaps make a difference there, though it might be rather hard to quantify. My guess would be that either that option didn't exist when this code was originally written, was not known by the original author, or was determined to not be helpful? i real quick traced out the probably relevant getImageData triggering that to frame_grabber_browser .. not sure exactly where the relevant getContext('2d') call is though. I'll try to take a deeper look at it next time i've got some time to work on this, i always like easy performance improvements :) |
Thanks |
I'm seeing the same warning on chrome |
Curious, I haven't seen it, but I also don't do a lot of chrome debugging with the camera, since my USB cameras don't read barcodes, so I'm usually doing things with my phone, which is a lot harder to hit with the dev tools. Does it seem like there's any particular operation that causes it? When does the message occur? I'm thinking it should be easy to just add a config flag, and have that passed along to getImageData, which would allow us to experiment with it without necessarily breaking anything. |
It shows up when you open the video stream. This is the error stack while using V 1.7.7 downloaded from here: https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.7.7/dist/quagga.js this is the quagga.ts:223 line of code : frame_grabber_browser.js:107 Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently |
ooh! fantastic, thanks for the backtrace. I'll try to grab a few minutes this weekend to thread a setting you can put in init to toggle that, then, and we shall see what happens! |
did not get to this when i wanted to, have been super busy with work and family having covid :( but will try over the US holiday weekend :) |
working on threading this through... at least in the spot it occurs as mentioned above. There are other places where getContext is used, but they don't seem to have access to a configuration object easily... but in frame_grabber_browser should cover most of the usage, i think |
- this option passes willReadFrequently directly to getContext('2d') in frame_Grabber_browser per MDN: willReadFrequently Optional A Boolean indicating whether or not this canvas uses software acceleration (instead of hardware acceleration) to support frequent read-back operations via getImageData().
implement #459 add InputStream option willReadFrequently
1.8.1 appears to correctly thread this through to the spots where it's used in most instances. Added willReadFrequently: boolean options to QuaggaJSResultCollector, QuaggaJSConfigObject.inputStream and QuaggaJSConfigObject.locator . I'm pretty sure you want to add it to inputStream config, possibly also locator. Probably in 2.0, it'll just be made the standard operation, but I don't want to break 1.x in unexpected fashions |
fwiw, it seems to work fine for my application, on my mobile. I saw a few other settings in that function that i'll probably wire up similarly |
Hi there, just working on a Quagga2-based product, and came across this warning in the dev tools. Is there a reason that this is not changed/implemented for performance?
The text was updated successfully, but these errors were encountered: