From 57cd15f9b11e667736df82cd38c2a224a8376c71 Mon Sep 17 00:00:00 2001 From: homm Date: Sat, 25 Oct 2014 04:27:46 +0400 Subject: [PATCH] Use Transpose from geometry. --- libImaging/BoxBlur.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/libImaging/BoxBlur.c b/libImaging/BoxBlur.c index 6a9155390..8be9c77d3 100644 --- a/libImaging/BoxBlur.c +++ b/libImaging/BoxBlur.c @@ -230,42 +230,6 @@ HorizontalBoxBlur(Imaging im, Imaging imOut, float floatRadius) return imOut; } -void -TransposeImage(Imaging im, Imaging imOut) -{ - int x, y, xx, yy, xxsize, yysize; - int size = 64; - - if (im->image8) - { - for (y = 0; y < im->ysize; y += size) { - for (x = 0; x < im->xsize; x += size) { - yysize = MIN(size, im->ysize - y); - xxsize = MIN(size, im->xsize - x); - for (yy = 0; yy < yysize; yy++) { - for (xx = 0; xx < xxsize; xx++) { - imOut->image8[x + xx][y + yy] = im->image8[y + yy][x + xx]; - } - } - } - } - } - else - { - for (y = 0; y < im->ysize; y += size) { - for (x = 0; x < im->xsize; x += size) { - yysize = MIN(size, im->ysize - y); - xxsize = MIN(size, im->xsize - x); - for (yy = 0; yy < yysize; yy++) { - for (xx = 0; xx < xxsize; xx++) { - imOut->image32[x + xx][y + yy] = im->image32[y + yy][x + xx]; - } - } - } - } - } -} - Imaging ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n) @@ -307,7 +271,7 @@ ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n) for (i = 1; i < n; i ++) { HorizontalBoxBlur(imOut, imOut, radius); } - TransposeImage(imOut, temp); + ImagingTranspose(temp, imOut); /* Blur transposed result from previout step in same direction. Reseult will be transposed again. We'll get original image @@ -315,7 +279,7 @@ ImagingBoxBlur(Imaging im, Imaging imOut, float radius, int n) for (i = 0; i < n; i ++) { HorizontalBoxBlur(temp, temp, radius); } - TransposeImage(temp, imOut); + ImagingTranspose(imOut, temp); ImagingDelete(temp);