static void iir_young_ver_blur (GeglBuffer *src, const GeglRectangle *rect, GeglBuffer *dst, const gdouble *b, gdouble (*m)[3], GeglAbyssPolicy policy, const Babl *format) { GeglRectangle cur_col = *rect; const gint nc = babl_format_get_n_components (format); gfloat *col = g_new (gfloat, (3 + rect->height + 3) * nc); gdouble *tmp = g_new (gdouble, (3 + rect->height + 3)); gint i; cur_col.width = 1; for (i = 0; i < rect->width; i++) { cur_col.x = rect->x + i; gegl_buffer_get (src, &cur_col, 1.0, format, &col[3 * nc], GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); iir_young_blur_1D (col, tmp, b, m, rect->height, nc, policy); gegl_buffer_set (dst, &cur_col, 0, format, &col[3 * nc], GEGL_AUTO_ROWSTRIDE); } g_free (tmp); g_free (col); }
static void iir_young_hor_blur (GeglBuffer *src, const GeglRectangle *rect, GeglBuffer *dst, const gdouble *b, gdouble (*m)[3], GeglAbyssPolicy policy, const Babl *format) { GeglRectangle cur_row = *rect; const gint nc = babl_format_get_n_components (format); gfloat *row = g_new (gfloat, (3 + rect->width + 3) * nc); gdouble *tmp = g_new (gdouble, (3 + rect->width + 3)); gint v; cur_row.height = 1; for (v = 0; v < rect->height; v++) { cur_row.y = rect->y + v; gegl_buffer_get (src, &cur_row, 1.0, format, &row[3 * nc], GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE); iir_young_blur_1D (row, tmp, b, m, rect->width, nc, policy); gegl_buffer_set (dst, &cur_row, 0, format, &row[3 * nc], GEGL_AUTO_ROWSTRIDE); } g_free (tmp); g_free (row); }
/* expects src and dst buf to have the same width and no x-offset */ static void iir_young_ver_blur (GeglBuffer *src, const GeglRectangle *src_rect, GeglBuffer *dst, const GeglRectangle *dst_rect, gdouble B, gdouble *b) { gint u; gint c; gint w_len; gfloat *buf; gfloat *w; buf = g_new0 (gfloat, src_rect->height * src_rect->width * 4); w = g_new0 (gfloat, src_rect->height); gegl_buffer_get (src, 1.0, src_rect, babl_format ("RaGaBaA float"), buf, GEGL_AUTO_ROWSTRIDE); w_len = src_rect->height; for (u=0; u<dst_rect->width; u++) { for (c = 0; c < 4; c++) { iir_young_blur_1D (buf, u*4 + c, src_rect->width*4, B, b, w, w_len); } } gegl_buffer_set (dst, src_rect, babl_format ("RaGaBaA float"), buf, GEGL_AUTO_ROWSTRIDE); g_free (buf); g_free (w); }