mirror of
https://github.com/Motion-Project/motion.git
synced 2026-04-29 02:13:52 -04:00
Revise alg diff to use same calc for standard and fast
This commit is contained in:
@@ -1232,7 +1232,7 @@ int alg_diff_standard(struct context *cnt, unsigned char *new)
|
||||
*/
|
||||
|
||||
for (; i > 0; i--) {
|
||||
register unsigned char curdiff = (int)(abs(*ref - *new)); /* Using a temp variable is 12% faster. */
|
||||
int curdiff = abs((char)*ref - (char)*new);
|
||||
/* Apply fixed mask */
|
||||
if (mask) {
|
||||
curdiff = ((int)(curdiff * *mask++) / 255);
|
||||
@@ -1290,7 +1290,7 @@ static char alg_diff_fast(struct context *cnt, int max_n_changes, unsigned char
|
||||
i = imgs->motionsize;
|
||||
|
||||
for (; i > 0; i -= step) {
|
||||
register unsigned char curdiff = (int)(abs(*ref - *new)); /* Using a temp variable is 12% faster. */
|
||||
int curdiff = abs((char)*ref - (char)*new);
|
||||
if (curdiff > noise) {
|
||||
diffs++;
|
||||
if (diffs > max_n_changes) {
|
||||
|
||||
Reference in New Issue
Block a user