Cache converted blur kernel

After converting from struct conv to xorg format, cache the result to
save CPU time.

And remove an unused function.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-02-20 16:43:42 +00:00
parent ed9c7064de
commit 9ec298305a
6 changed files with 61 additions and 74 deletions

View File

@@ -121,24 +121,4 @@ void sum_kernel_preprocess(conv *map) {
}
}
/**
* Normalize a convolution kernel.
*
* @param[in,out] kern the kernel
*/
void normalize_conv_kern(conv *kern) {
double sum = 0.0;
for (int i = 0; i < kern->w * kern->h; i++) {
sum += kern->data[i];
}
double factor = 1.0 / sum;
for (int i = 0; i < kern->w * kern->h; i++) {
kern->data[i] *= factor;
}
if (kern->rsum) {
free(kern->rsum);
kern->rsum = NULL;
}
}
// vim: set noet sw=8 ts=8 :