mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-05 06:40:03 +00:00
lavfi/blockdetect: Fix possible div by 0
Found-by Covererity, CID 1504568, 1504569
This commit is contained in:
parent
11912f65ef
commit
b7cea55730
@ -132,9 +132,11 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
|
|||||||
nonblock_count++;
|
nonblock_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block_count && nonblock_count) {
|
||||||
temp = (block / block_count) / (nonblock / nonblock_count);
|
temp = (block / block_count) / (nonblock / nonblock_count);
|
||||||
ret = FFMAX(ret, temp);
|
ret = FFMAX(ret, temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// vertical blockiness (fixed height)
|
// vertical blockiness (fixed height)
|
||||||
block_count = 0;
|
block_count = 0;
|
||||||
@ -175,9 +177,11 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
|
|||||||
nonblock_count++;
|
nonblock_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (block_count && nonblock_count) {
|
||||||
temp = (block / block_count) / (nonblock / nonblock_count);
|
temp = (block / block_count) / (nonblock / nonblock_count);
|
||||||
ret = FFMAX(ret, temp);
|
ret = FFMAX(ret, temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// return highest value of horz||vert
|
// return highest value of horz||vert
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user