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, generate has been updated via a47b50d43100a1e3314a818f5bcdf37bf560d8d0 (commit) via e62510c49073237e02238eede6c52f04ef9acac3 (commit) from 71f1574977b03a901b7381fb3aca1c6d0c3ed33d (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/a47b50d43100a1e3314a818f5bcdf37bf560d...
commit a47b50d43100a1e3314a818f5bcdf37bf560d8d0 Author: Cyril Hrubis metan@ucw.cz Date: Mon Oct 31 12:17:36 2011 +0100
The 18BPP needs an offset.
diff --git a/include/core/GP_WritePixel.h b/include/core/GP_WritePixel.h index 9295835..26d072c 100644 --- a/include/core/GP_WritePixel.h +++ b/include/core/GP_WritePixel.h @@ -40,10 +40,10 @@ void GP_WritePixels1bpp(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); void GP_WritePixels2bpp(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); void GP_WritePixels4bpp(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); +void GP_WritePixels18bpp(void *start, uint8_t off, size_t count, uint32_t value);
void GP_WritePixels8bpp(void *start, size_t count, uint8_t value); void GP_WritePixels16bpp(void *start, size_t count, uint16_t value); -void GP_WritePixels18bpp(void *start, size_t count, uint32_t value); void GP_WritePixels24bpp(void *start, size_t count, uint32_t value); void GP_WritePixels32bpp(void *start, size_t count, uint32_t value);
diff --git a/libs/core/GP_WritePixel.c b/libs/core/GP_WritePixel.c index 5638ca5..c35b7ec 100644 --- a/libs/core/GP_WritePixel.c +++ b/libs/core/GP_WritePixel.c @@ -162,7 +162,7 @@ void GP_WritePixels16bpp(void *start, size_t count, uint16_t value) } }
-void GP_WritePixels18bpp(void *start, size_t count, uint32_t value) +void GP_WritePixels18bpp(void *start, uint8_t off, size_t count, uint32_t value) { #warning TODO } diff --git a/libs/gfx/GP_HLine.c b/libs/gfx/GP_HLine.c index c249f49..38200d5 100644 --- a/libs/gfx/GP_HLine.c +++ b/libs/gfx/GP_HLine.c @@ -36,10 +36,10 @@ DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_W DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp) DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp) +DEF_HLINE_BU_FN(GP_HLine_Raw_18BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels18bpp)
DEF_HLINE_FN(GP_HLine_Raw_8BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels8bpp) DEF_HLINE_FN(GP_HLine_Raw_16BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels16bpp) -DEF_HLINE_FN(GP_HLine_Raw_18BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels18bpp) DEF_HLINE_FN(GP_HLine_Raw_24BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels24bpp) DEF_HLINE_FN(GP_HLine_Raw_32BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels32bpp)
http://repo.or.cz/w/gfxprim.git/commit/e62510c49073237e02238eede6c52f04ef9ac...
commit e62510c49073237e02238eede6c52f04ef9acac3 Author: Cyril Hrubis metan@ucw.cz Date: Mon Oct 31 12:16:38 2011 +0100
More work on unifying the filter API.
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index beb69e2..27d8ded 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -350,7 +350,7 @@ static GP_RetCode blur(GP_Context **c, const char *params) return GP_EINVAL; }
- GP_FilterGaussianBlur_Raw(*c, *c, progress_callback, sigma_x, sigma_y); + GP_FilterGaussianBlur_Raw(*c, *c, sigma_x, sigma_y, progress_callback);
return GP_ESUCCESS; } diff --git a/include/filters/GP_Linear.h b/include/filters/GP_Linear.h index 3194cb8..ae028fc 100644 --- a/include/filters/GP_Linear.h +++ b/include/filters/GP_Linear.h @@ -26,8 +26,8 @@
*/
-#ifndef GP_LINEAR_H -#define GP_LINEAR_H +#ifndef FILTERS_GP_LINEAR_H +#define FILTERS_GP_LINEAR_H
#include "GP_Filter.h"
@@ -44,13 +44,21 @@ * * GP_FilterGaussianBlur_Raw(context, context, ...); */ -void GP_FilterGaussianBlur_Raw(GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float sigma_x, float sigma_y); - -GP_Context *GP_FilterGaussianBlur(GP_Context *src, - GP_ProgressCallback *callback, - float sigma_x, float sigma_y); +void 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);
/* * Linear convolution. @@ -69,24 +77,26 @@ GP_Context *GP_FilterGaussianBlur(GP_Context *src, * * This function works also in-place. */ -void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kw, uint32_t kh); +void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kw, uint32_t kh, + GP_ProgressCallback *callback);
/* * Special cases for convolution only in horizontal/vertical direction. * * These are about 10-30% faster than the generic implementation (depending on * the kernel size, bigger kernel == more savings). - * + * + * These are two are a base for bilinear filters. + * * Both works also in-place. */ -void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kw); +void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kw, + GP_ProgressCallback *callback);
-void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kh); +void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kh, + GP_ProgressCallback *callback);
-#endif /* GP_LINEAR_H */ +#endif /* FILTERS_GP_LINEAR_H */ diff --git a/libs/filters/GP_Linear.c b/libs/filters/GP_Linear.c index 8f7c2a3..b0148c9 100644 --- a/libs/filters/GP_Linear.c +++ b/libs/filters/GP_Linear.c @@ -59,9 +59,9 @@ static void gaussian_callback_2(GP_ProgressCallback *self) GP_ProgressCallbackReport(self->priv, self->percentage/2 + 50); }
-void GP_FilterGaussianBlur_Raw(GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float sigma_x, float sigma_y) +void GP_FilterGaussianBlur_Raw(const GP_Context *src, GP_Context *dst, + float sigma_x, float sigma_y, + GP_ProgressCallback *callback) { unsigned int size_x = gaussian_kernel_size(sigma_x); unsigned int size_y = gaussian_kernel_size(sigma_y); @@ -84,8 +84,8 @@ void GP_FilterGaussianBlur_Raw(GP_Context *src, GP_Context *res, float kernel_x[size_x]; gaussian_kernel_init(sigma_x, kernel_x); - GP_FilterHLinearConvolution_Raw(src, res, new_callback, - kernel_x, size_x); + GP_FilterHLinearConvolution_Raw(src, dst, kernel_x, size_x, + new_callback); } if (new_callback != NULL) @@ -96,37 +96,41 @@ void GP_FilterGaussianBlur_Raw(GP_Context *src, GP_Context *res, float kernel_y[size_y]; gaussian_kernel_init(sigma_y, kernel_y); - GP_FilterVLinearConvolution_Raw(res, res, new_callback, - kernel_y, size_y); + GP_FilterVLinearConvolution_Raw(dst, dst, kernel_y, size_y, + new_callback); }
GP_ProgressCallbackDone(callback); }
-GP_Context *GP_FilterGaussianBlur(GP_Context *src, - GP_ProgressCallback *callback, - float sigma_x, float sigma_y) +GP_Context *GP_FilterGaussianBlur(const GP_Context *src, GP_Context *dst, + float sigma_x, float sigma_y, + GP_ProgressCallback *callback) { - GP_Context *res; - + /* TODO: templatetize */ if (src->pixel_type != GP_PIXEL_RGB888) return NULL; - - res = GP_ContextCopy(src, 0); - - if (res == NULL) { - GP_DEBUG(1, "Malloc failed :("); - return NULL; + + 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"); }
- GP_FilterGaussianBlur_Raw(src, res, callback, sigma_x, sigma_y); + GP_FilterGaussianBlur_Raw(src, dst, sigma_x, sigma_y, callback);
- return res; + return dst; }
-void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kw) +void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kw, + GP_ProgressCallback *callback) { float kernel_sum = 0; GP_Coord x, y; @@ -140,7 +144,7 @@ void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res, kernel_sum += kernel[i];
/* do linear convolution */ - for (y = 0; y < (GP_Coord)res->h; y++) { + for (y = 0; y < (GP_Coord)dst->h; y++) { GP_Pixel pix; uint32_t R[kw], G[kw], B[kw];
@@ -160,7 +164,7 @@ void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
int idx = kw - 1;
- for (x = 0; x < (GP_Coord)res->w; x++) { + for (x = 0; x < (GP_Coord)dst->w; x++) { float r = 0, g = 0, b = 0;
int cx = x + kw/2; @@ -209,7 +213,7 @@ void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
pix = GP_Pixel_CREATE_RGB888((uint32_t)r, (uint32_t)g, (uint32_t)b);
- GP_PutPixel_Raw_24BPP(res, x, y, pix); + GP_PutPixel_Raw_24BPP(dst, x, y, pix); idx++;
@@ -218,7 +222,7 @@ void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res, } if (callback != NULL && y % 100 == 0) - GP_ProgressCallbackReport(callback, 100.00 * y/res->h); + GP_ProgressCallbackReport(callback, 100.00 * y/dst->h); }
GP_ProgressCallbackDone(callback); @@ -229,9 +233,9 @@ void GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *res, * * Can be used in-place. */ -void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kh) +void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kh, + GP_ProgressCallback *callback) { float kernel_sum = 0; GP_Coord x, y; @@ -245,7 +249,7 @@ void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res, kernel_sum += kernel[i];
/* do linear convolution */ - for (x = 0; x < (GP_Coord)res->w; x++) { + for (x = 0; x < (GP_Coord)dst->w; x++) { GP_Pixel pix; uint32_t R[kh], G[kh], B[kh];
@@ -265,7 +269,7 @@ void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
int idx = kh - 1;
- for (y = 0; y < (GP_Coord)res->h; y++) { + for (y = 0; y < (GP_Coord)dst->h; y++) { float r = 0, g = 0, b = 0;
int cy = y + kh/2; @@ -314,7 +318,7 @@ void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
pix = GP_Pixel_CREATE_RGB888((uint32_t)r, (uint32_t)g, (uint32_t)b);
- GP_PutPixel_Raw_24BPP(res, x, y, pix); + GP_PutPixel_Raw_24BPP(dst, x, y, pix); idx++;
@@ -323,7 +327,7 @@ void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res, } if (callback != NULL && x % 100 == 0) - GP_ProgressCallbackReport(callback, 100.00 * x/res->w); + GP_ProgressCallbackReport(callback, 100.00 * x/dst->w); }
GP_ProgressCallbackDone(callback); @@ -335,9 +339,9 @@ void GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *res, * * Can be used in-place. */ -void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res, - GP_ProgressCallback *callback, - float kernel[], uint32_t kw, uint32_t kh) +void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *dst, + float kernel[], uint32_t kw, uint32_t kh, + GP_ProgressCallback *callback) { float kernel_sum = 0; GP_Coord x, y; @@ -351,7 +355,7 @@ void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res, kernel_sum += kernel[i];
/* do linear convolution */ - for (y = 0; y < (GP_Coord)res->h; y++) { + for (y = 0; y < (GP_Coord)dst->h; y++) { GP_Pixel pix; uint32_t R[kw][kh], G[kw][kh], B[kw][kh];
@@ -380,7 +384,7 @@ void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
int idx = kw - 1;
- for (x = 0; x < (GP_Coord)res->w; x++) { + for (x = 0; x < (GP_Coord)dst->w; x++) { float r = 0, g = 0, b = 0;
for (j = 0; j < kh; j++) { @@ -440,7 +444,7 @@ void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res,
pix = GP_Pixel_CREATE_RGB888((uint32_t)r, (uint32_t)g, (uint32_t)b);
- GP_PutPixel_Raw_24BPP(res, x, y, pix); + GP_PutPixel_Raw_24BPP(dst, x, y, pix); idx++;
@@ -449,7 +453,7 @@ void GP_FilterLinearConvolution_Raw(const GP_Context *src, GP_Context *res, } if (callback != NULL && y % 100 == 0) - GP_ProgressCallbackReport(callback, 100.00 * y/res->h); + GP_ProgressCallbackReport(callback, 100.00 * y/dst->h); }
GP_ProgressCallbackDone(callback);
-----------------------------------------------------------------------
Summary of changes: demos/grinder/grinder.c | 2 +- include/core/GP_WritePixel.h | 2 +- include/filters/GP_Linear.h | 50 ++++++++++++++---------- libs/core/GP_WritePixel.c | 2 +- libs/filters/GP_Linear.c | 86 ++++++++++++++++++++++-------------------- libs/gfx/GP_HLine.c | 2 +- 6 files changed, 79 insertions(+), 65 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.