This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 34512b0be720afdd2179f65d590881cbd91a14a3 (commit) via e99b93446df5bad8ebf42bfb46ed23f5cbb980f0 (commit) via fb950db4458c54107cd6244ca6f99c330f426bad (commit) via 3fcb9b04082fb71ce8494a0e2bf880ea3c328d74 (commit) via 842760824adccff8aef5abac186b0abd8bcda9a7 (commit) via 3ee0312626982fff7b66086dbe903b6874819b71 (commit) via ccaf2748930ef9e255019c50b94961f93ff29f69 (commit) via dc222028aaf265293940f1df9dfd2d65215289a0 (commit) from 99e04dcfb4af842f3a3be19e62fb52b9ce2ff725 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/34512b0be720afdd2179f65d590881cbd91a1...
commit 34512b0be720afdd2179f65d590881cbd91a14a3 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:42:32 2012 +0200
pywrap: Update filters.i.
diff --git a/pylib/gfxprim/filters/filters.i b/pylib/gfxprim/filters/filters.i index e321b1a..dec3bba 100644 --- a/pylib/gfxprim/filters/filters.i +++ b/pylib/gfxprim/filters/filters.i @@ -38,7 +38,6 @@ %newobject GP_FilterSymmetry_Alloc; %include "GP_Rotate.h"
- %newobject GP_FilterFloydSteinberg_RGB888_Alloc; %newobject GP_FilterHilbertPeano_RGB888_Alloc; %include "GP_Dither.h" @@ -49,3 +48,11 @@ %newobject GP_FilterMaxAlloc; %newobject GP_FilterMinAlloc; %include "GP_Arithmetic.h" + +%newobject GP_FilterConvolutionAlloc; +%newobject GP_FilterConvolutionExAlloc; +%include "GP_Convolution.h" + +%newobject GP_FilterBlurAlloc; +%newobject GP_FilterBlurExAlloc; +%include "GP_Blur.h"
http://repo.or.cz/w/gfxprim.git/commit/e99b93446df5bad8ebf42bfb46ed23f5cbb98...
commit e99b93446df5bad8ebf42bfb46ed23f5cbb980f0 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:42:16 2012 +0200
demos: blur.py a minor fix.
diff --git a/demos/py_simple/blur.py b/demos/py_simple/blur.py index ca50658..36d9c5b 100755 --- a/demos/py_simple/blur.py +++ b/demos/py_simple/blur.py @@ -10,7 +10,7 @@ def main(): print("usage: blur blur-radii image") sys.exit(1)
- radii = int(sys.argv[1]) + radii = float(sys.argv[1])
# Load Image img = loaders.LoadImage(sys.argv[2], None)
http://repo.or.cz/w/gfxprim.git/commit/fb950db4458c54107cd6244ca6f99c330f426...
commit fb950db4458c54107cd6244ca6f99c330f426bad Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:41:44 2012 +0200
core: Add GP_Threads.h into the GP_Core.h.
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h index 987196e..cd5555d 100644 --- a/include/core/GP_Core.h +++ b/include/core/GP_Core.h @@ -68,6 +68,9 @@ /* Progress callback */ #include "core/GP_ProgressCallback.h"
+/* Threads utils */ +#include "core/GP_Threads.h" + /* Debug counters */ #include "core/GP_Counter.h"
http://repo.or.cz/w/gfxprim.git/commit/3fcb9b04082fb71ce8494a0e2bf880ea3c328...
commit 3fcb9b04082fb71ce8494a0e2bf880ea3c328d74 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:31:41 2012 +0200
doc: Update gaussian filter docs.
diff --git a/doc/filters.txt b/doc/filters.txt index d9ac4fe..68d7180 100644 --- a/doc/filters.txt +++ b/doc/filters.txt @@ -537,7 +537,7 @@ The dst coordinates defines offset into the dst context. The kernel is two-dimensional array of a size kw * kh indexed as kernel[x + y*kw].
-The kern_div is a coeficient that is used to divide the resuting values often +The kern_div is a coefficient that is used to divide the resulting values often used to normalize the result.
This filter works 'in-place'. @@ -611,7 +611,7 @@ The dst coordinates are offset into the dst.
The kernel is one-dimensional array of floats of size kw or kh.
-The kern_div is a coeficient that is used to divide the resuting values. +The kern_div is a coefficient that is used to divide the resulting values.
The last function does both vertical and horizontal convolution and takes care of correct progress callback. @@ -699,14 +699,14 @@ GP_Context *GP_FilterConvolutionAlloc(const GP_Context *src, void GP_FilterKernel2DPrint(const GP_FilterKernel2D *kernel); -------------------------------------------------------------------------------
-Linear convolution filters, you should prefferably use this API over the _Raw +Linear convolution filters, you should preferably use this API over the _Raw variants.
The Ex variants takes a rectangle on which the filter should operate as well as offset into the destination. The destination must be large enough so that starting with offset there is at least w_dst and h_dst pixels.
-The kernel is a pointer to a structure initalized with the kernel size, divider +The kernel is a pointer to a structure initialized with the kernel size, divider and array of kernel values.
The last function prints convolution kernel in human-readable format into the @@ -832,19 +832,42 @@ Gaussian Blur
[source,c] ------------------------------------------------------------------------------- -#include <GP_Filters.h> +#include <filters/GP_Blur.h> +/* or */ +#include <GP.h>
-GP_Context *GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, - float sigma_x, float sigma_y, - GP_ProgressCallback *callback); -------------------------------------------------------------------------------- +int GP_FilterGaussianBlurEx(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + GP_Context *dst, + GP_Coord x_dst, GP_Coord y_dst, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback);
-Gaussian blur filter. +GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback);
-Works 'in-place'. +int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback)
-'TODO:' this filter is implemented for RGB888 only. +GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback) +------------------------------------------------------------------------------- + +Gaussian blur (low pass) filters implemented as bilinear separable +convolution. + +The sigma denotes amount of the blur (the radius is computed accordingly +automatically).
+The sigma values can be set for vertical and horizontal direction +independently which may be useful when Gaussian blur is used as a low pass +filter before image is resampled non proportionally.
Interpolation filters ~~~~~~~~~~~~~~~~~~~~~ @@ -892,7 +915,7 @@ Bilinear Interpolation ^^^^^^^^^^^^^^^^^^^^^^
Bilinear is faster than bicubic interpolation and produces quite good results -expecially the low pass variant doesn't need additional filter on downsampling. +especially the low pass variant doesn't need additional filter on down-sampling.
Bicubic Interpolation ^^^^^^^^^^^^^^^^^^^^^
http://repo.or.cz/w/gfxprim.git/commit/842760824adccff8aef5abac186b0abd8bcda...
commit 842760824adccff8aef5abac186b0abd8bcda9a7 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:09:08 2012 +0200
examples: Minor fixes in convolution.c
diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c index e0399e3..bfbd06a 100644 --- a/demos/c_simple/convolution.c +++ b/demos/c_simple/convolution.c @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) img = GP_LoadImage(argv[1], &callback);
if (img == NULL) { - fprintf(stderr, "Failed to load image '%s':%sn", argv[1], + fprintf(stderr, "Failed to load image '%s': %sn", argv[1], strerror(errno)); return 1; } @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) priv.name = "out.png";
if (GP_SavePNG(img, "out.png", &callback)) { - fprintf(stderr, "Failed to save image %s", strerror(errno)); + fprintf(stderr, "Failed to save image: %s", strerror(errno)); return 1; }
http://repo.or.cz/w/gfxprim.git/commit/3ee0312626982fff7b66086dbe903b6874819...
commit 3ee0312626982fff7b66086dbe903b6874819b71 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:08:44 2012 +0200
filters: Fix Gaussian Blur API.
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 1bc7360..a2192b7 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -420,7 +420,7 @@ static GP_RetCode blur(GP_Context **c, const char *params) return GP_EINVAL; }
- GP_FilterGaussianBlur_Raw(*c, *c, sigma_x, sigma_y, progress_callback); + GP_FilterGaussianBlur(*c, *c, sigma_x, sigma_y, progress_callback);
return GP_ESUCCESS; } diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 176fa56..aad96a9 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -314,9 +314,9 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size cpu_timer_start(&timer, "Blur"); callback.priv = "Blurring Image"; - res = GP_FilterGaussianBlur(img, NULL, - 0.3/params->rat, 0.3/params->rat, - &callback); + res = GP_FilterGaussianBlurAlloc(img, 0.3/params->rat, + 0.3/params->rat, &callback); + if (res == NULL) return NULL; @@ -335,6 +335,8 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size // img = GP_FilterDifferenceAlloc(i2, i1, NULL); // img = GP_FilterInvert(img, NULL, NULL); img = i1; +// if (params->resampling_method == GP_INTERP_CUBIC_INT) +// GP_FilterEdgeSharpening(img, img, 0.2, NULL); cpu_timer_stop(&timer);
/* Free low passed context if needed */ diff --git a/include/filters/GP_Blur.h b/include/filters/GP_Blur.h index 22694bc..fb0ac26 100644 --- a/include/filters/GP_Blur.h +++ b/include/filters/GP_Blur.h @@ -32,33 +32,40 @@ #include "GP_Filter.h"
/* - * Gaussian blur - * - * The sigma parameters defines the blur radii in horizontal and vertical - * direction. - * - * Internaly this is implemented as separable linear filter (calls vertical and - * horizontal convolution with generated gaussian kernel). - * - * This variant could work in-place so it's perectly okay to call - * - * GP_FilterGaussianBlur_Raw(context, context, ...); + * Gaussian blur implemented using linear separable convolution. + * + * The x_sigma defines the blur size in horizontal direction and y_sigma + * defines blur on vertical direction. */ -int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, - float sigma_x, float sigma_y, - GP_ProgressCallback *callback);
-/* - * Gaussian blur. - * - * If dst is NULL, new bitmap is allocated. - * - * This variant could work in-place. - * - * Returns pointer to destination bitmap or NULL if allocation failed. - */ -GP_Context *GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, - float sigma_x, float sigma_y, - GP_ProgressCallback *callback); +int GP_FilterGaussianBlurEx(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + GP_Context *dst, + GP_Coord x_dst, GP_Coord y_dst, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback); + +GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback); + +static inline int GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback) +{ + return GP_FilterGaussianBlurEx(src, 0, 0, src->w, src->h, dst, 0, 0, + x_sigma, y_sigma, callback); +} + +static inline GP_Context *GP_FilterGaussianBlurAlloc(const GP_Context *src, + float x_sigma, float y_sigma, + GP_ProgressCallback *callback) +{ + return GP_FilterGaussianBlurExAlloc(src, 0, 0, src->w, src->h, + x_sigma, y_sigma, callback); +}
#endif /* FILTERS_GP_BLUR_H */ diff --git a/libs/filters/GP_Blur.c b/libs/filters/GP_Blur.c index 21aa315..420073e 100644 --- a/libs/filters/GP_Blur.c +++ b/libs/filters/GP_Blur.c @@ -69,7 +69,11 @@ static int gaussian_callback_vert(GP_ProgressCallback *self) return callback->callback(callback); }
-int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, +int GP_FilterGaussianBlur_Raw(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + GP_Context *dst, + GP_Coord x_dst, GP_Coord y_dst, float sigma_x, float sigma_y, GP_ProgressCallback *callback) { @@ -77,7 +81,7 @@ int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, unsigned int size_y = gaussian_kernel_size(sigma_y); GP_DEBUG(1, "Gaussian blur sigma_x=%2.3f sigma_y=%2.3f kernel %ix%i image %ux%u", - sigma_x, sigma_y, size_x, size_y, src->w, src->h); + sigma_x, sigma_y, size_x, size_y, w_src, h_src); GP_ProgressCallback *new_callback = NULL;
@@ -96,13 +100,13 @@ int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst,
GP_ConvolutionParams params = { .src = src, - .x_src = 0, - .y_src = 0, - .w_src = src->w, - .h_src = src->h, + .x_src = x_src, + .y_src = y_src, + .w_src = w_src, + .h_src = h_src, .dst = dst, - .x_dst = 0, - .y_dst = 0, + .x_dst = x_dst, + .y_dst = y_dst, .kernel = kernel_x, .kw = size_x, .kh = 1, @@ -124,13 +128,13 @@ int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, GP_ConvolutionParams params = { .src = src, - .x_src = 0, - .y_src = 0, - .w_src = src->w, - .h_src = src->h, + .x_src = x_src, + .y_src = y_src, + .w_src = w_src, + .h_src = h_src, .dst = dst, - .x_dst = 0, - .y_dst = 0, + .x_dst = x_dst, + .y_dst = y_dst, .kernel = kernel_y, .kw = 1, .kh = size_y, @@ -146,27 +150,41 @@ int GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, return 0; }
-GP_Context *GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, - float sigma_x, float sigma_y, - GP_ProgressCallback *callback) +int GP_FilterGaussianBlurEx(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + GP_Context *dst, + GP_Coord x_dst, GP_Coord y_dst, + float sigma_x, float sigma_y, + GP_ProgressCallback *callback) { - /* TODO: templatetize */ - if (src->pixel_type != GP_PIXEL_RGB888) - return NULL; + GP_CHECK(src->pixel_type == dst->pixel_type); - if (dst == NULL) { - dst = GP_ContextCopy(src, 0); - - if (dst == NULL) - return NULL; - } else { - GP_ASSERT(src->pixel_type == dst->pixel_type, - "The src and dst pixel types must match"); - GP_ASSERT(src->w <= dst->w && src->h <= dst->h, - "Destination is not big enough"); - } + /* Check that destination is large enough */ + GP_CHECK(x_dst + (GP_Coord)w_src <= (GP_Coord)dst->w); + GP_CHECK(y_dst + (GP_Coord)h_src <= (GP_Coord)dst->h); + + return GP_FilterGaussianBlur_Raw(src, x_src, y_src, w_src, h_src, + dst, x_dst, y_dst, + sigma_x, sigma_y, callback); +} + +GP_Context *GP_FilterGaussianBlurExAlloc(const GP_Context *src, + GP_Coord x_src, GP_Coord y_src, + GP_Size w_src, GP_Size h_src, + float sigma_x, float sigma_y, + GP_ProgressCallback *callback) +{ + GP_Context *dst = GP_ContextAlloc(w_src, h_src, src->pixel_type); + + if (dst == NULL) + return NULL;
- GP_FilterGaussianBlur_Raw(src, dst, sigma_x, sigma_y, callback); + if (GP_FilterGaussianBlur_Raw(src, x_src, y_src, w_src, h_src, dst, + 0, 0, sigma_x, sigma_y, callback)) { + GP_ContextFree(dst); + return NULL; + }
return dst; }
http://repo.or.cz/w/gfxprim.git/commit/ccaf2748930ef9e255019c50b94961f93ff29...
commit ccaf2748930ef9e255019c50b94961f93ff29f69 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 13:00:57 2012 +0200
filters: Fix convolution return value.
diff --git a/libs/filters/GP_Convolution.c b/libs/filters/GP_Convolution.c index b628cba..7ee3b62 100644 --- a/libs/filters/GP_Convolution.c +++ b/libs/filters/GP_Convolution.c @@ -71,5 +71,5 @@ GP_Context *GP_FilterConvolutionExAlloc(const GP_Context *src, return NULL; }
- return 0; + return ret; }
http://repo.or.cz/w/gfxprim.git/commit/dc222028aaf265293940f1df9dfd2d6521528...
commit dc222028aaf265293940f1df9dfd2d65215289a0 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 9 11:19:39 2012 +0200
doc: A few typo corrections.
diff --git a/doc/context.txt b/doc/context.txt index 7c812cc..0d1d18b 100644 --- a/doc/context.txt +++ b/doc/context.txt @@ -1,8 +1,8 @@ Drawing Context ---------------
-The 'GP_Context' structure describes an 'in memory' memory. It contains all -metadata needed for drawing into a bitmap. +The 'GP_Context' structure describes an 'in memory' pixmap. It contains all +metadata needed for drawing and filters.
Data Structure ~~~~~~~~~~~~~~
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/convolution.c | 4 +- demos/grinder/grinder.c | 2 +- demos/py_simple/blur.py | 2 +- demos/spiv/spiv.c | 8 ++- doc/context.txt | 4 +- doc/filters.txt | 49 +++++++++++++++++------ include/core/GP_Core.h | 3 + include/filters/GP_Blur.h | 59 ++++++++++++++++------------ libs/filters/GP_Blur.c | 82 +++++++++++++++++++++++--------------- libs/filters/GP_Convolution.c | 2 +- pylib/gfxprim/filters/filters.i | 9 ++++- 11 files changed, 142 insertions(+), 82 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.