-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
scan: Not scanning every picture #1065
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @M123-dev, I have a minor request change, feel free to ignore it and merge.
if (frameCounter < 10) { | ||
frameCounter++; | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I would start immediately: here the very first scan is after 1/3 seconds.
- I would use a
static const
with an explicit name, likestatic const int _SKIPPED_FRAMES = 10;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
if (framCounter++ % 10 != 0) {
return;
}
and if we have fears of it reaching MAX_INT then:
if (framCounter++ % 10 != 0) {
return;
}
frameCounter=1;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @monsieurtanuki. Otherwise LG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://stackoverflow.com/a/50429767/14517119
In Dart 2 int is limited to 64 bit
I think we're safe before we reach MAX_INT then ;)
@jasmeet0817 Your modulo suggestion does not work because once we decide to work we don't know how much time it will take - if it takes more than 1/3 seconds it's not good.
@M123-dev I see that you also use a bool
, isBusy
. I suggest that you use a 3-state bool?
instead:
isBusy == false
means that you're ready to compute immediatelyisBusy == true
means that you're workingisBusy == null
means that you're done with working and that you'll wait 10 frames before working again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://stackoverflow.com/a/50429767/14517119
In Dart 2 int is limited to 64 bit
I think we're safe before we reach MAX_INT then ;)
@jasmeet0817 Your modulo suggestion does not work because once we decide to work we don't know how much time it will take - if it takes more than 1/3 seconds it's not good.
@M123-dev I see that you also use a
bool
,isBusy
. I suggest that you use a 3-statebool?
instead:
isBusy == false
means that you're ready to compute immediatelyisBusy == true
means that you're workingisBusy == null
means that you're done with working and that you'll wait 10 frames before working again
An enum would be better if we want more than 2 states:)
General questions:
- If the processing takes more than 1/3rd sec, do we want to process next frame directly or wait 9 frames and then process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm against waiting until the latest I'd done and then counting, this could lead to very long waiting times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M123-dev Both @jasmeet0817 and I agreed on most of your code: please just add a TODO
about this frame skipping algorithm and merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added the const var for the skipped frames and the todo
No description provided.