|
|
@@ -35,6 +35,7 @@ static pipi_image_t *pipi_convolution_separable(pipi_image_t *src, |
|
|
|
|
|
|
|
pipi_image_t *pipi_convolution(pipi_image_t *src, int m, int n, double mat[]) |
|
|
|
{ |
|
|
|
pipi_image_t *ret; |
|
|
|
double tmp; |
|
|
|
double *hvec, *vvec; |
|
|
|
int i, j, besti = -1, bestj = -1; |
|
|
@@ -75,7 +76,6 @@ pipi_image_t *pipi_convolution(pipi_image_t *src, int m, int n, double mat[]) |
|
|
|
} |
|
|
|
|
|
|
|
/* Matrix rank is 1! Separate the filter */ |
|
|
|
/* FIXME: memleak */ |
|
|
|
hvec = malloc(m * sizeof(double)); |
|
|
|
vvec = malloc(n * sizeof(double)); |
|
|
|
|
|
|
@@ -85,7 +85,12 @@ pipi_image_t *pipi_convolution(pipi_image_t *src, int m, int n, double mat[]) |
|
|
|
for(j = 0; j < n; j++) |
|
|
|
vvec[j] = mat[j * m + besti] / tmp; |
|
|
|
|
|
|
|
return pipi_convolution_separable(src, m, hvec, n, vvec); |
|
|
|
ret = pipi_convolution_separable(src, m, hvec, n, vvec); |
|
|
|
|
|
|
|
free(hvec); |
|
|
|
free(vvec); |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
static pipi_image_t *pipi_convolution_standard(pipi_image_t *src, |
|
|
|