lavfi/blockdetect: Fix possible div by 0

Found-by Covererity, CID 1504568, 1504569
This commit is contained in:
Thilo Borgmann 2022-06-04 13:45:30 +02:00
parent 11912f65ef
commit b7cea55730

View File

@ -132,9 +132,11 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
nonblock_count++;
}
}
if (block_count && nonblock_count) {
temp = (block / block_count) / (nonblock / nonblock_count);
ret = FFMAX(ret, temp);
}
}
// vertical blockiness (fixed height)
block_count = 0;
@ -175,9 +177,11 @@ static float calculate_blockiness(BLKContext *s, int w, int h,
nonblock_count++;
}
}
if (block_count && nonblock_count) {
temp = (block / block_count) / (nonblock / nonblock_count);
ret = FFMAX(ret, temp);
}
}
// return highest value of horz||vert
return ret;