static gboolean gegl_gblur_1d_process (GeglOperation *operation, GeglBuffer *input, GeglBuffer *output, const GeglRectangle *result, gint level) { GeglProperties *o = GEGL_PROPERTIES (operation); const Babl *format = gegl_operation_get_format (operation, "output"); GeglGblur1dFilter filter; GeglAbyssPolicy abyss_policy = to_gegl_policy (o->abyss_policy); filter = filter_disambiguation (o->filter, o->std_dev); if (filter == GEGL_GBLUR_1D_IIR) { gdouble b[4], m[3][3]; iir_young_find_constants (o->std_dev, b, m); if (o->orientation == GEGL_ORIENTATION_HORIZONTAL) iir_young_hor_blur (input, result, output, b, m, abyss_policy, format); else iir_young_ver_blur (input, result, output, b, m, abyss_policy, format); } else { gfloat *cmatrix; gint clen; clen = fir_gen_convolve_matrix (o->std_dev, &cmatrix); /* FIXME: implement others format cases */ if (gegl_operation_use_opencl (operation) && format == babl_format ("RaGaBaA float")) if (fir_cl_process(input, output, result, format, cmatrix, clen, o->orientation, abyss_policy)) return TRUE; if (o->orientation == GEGL_ORIENTATION_HORIZONTAL) fir_hor_blur (input, result, output, cmatrix, clen, abyss_policy, format); else fir_ver_blur (input, result, output, cmatrix, clen, abyss_policy, format); gegl_free (cmatrix); } return TRUE; }
static gboolean process (GeglOperation *operation, GeglBuffer *input, GeglBuffer *output, const GeglRectangle *result) { GeglRectangle rect; GeglBuffer *temp; GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation); GeglChantO *o = GEGL_CHANT_PROPERTIES (operation); GeglRectangle temp_extend; gdouble B, b[4]; gdouble *cmatrix; gint cmatrix_len; gboolean force_iir; gboolean force_fir; rect.x = result->x - op_area->left; rect.width = result->width + op_area->left + op_area->right; rect.y = result->y - op_area->top; rect.height = result->height + op_area->top + op_area->bottom; temp_extend = rect; temp_extend.x = result->x; temp_extend.width = result->width; temp = gegl_buffer_new (&temp_extend, babl_format ("RaGaBaA float")); force_iir = o->filter && !strcmp (o->filter, "iir"); force_fir = o->filter && !strcmp (o->filter, "fir"); if ((force_iir || o->std_dev_x > 1.0) && !force_fir) { iir_young_find_constants (o->std_dev_x, &B, b); iir_young_hor_blur (input, &rect, temp, &temp_extend, B, b); } else { cmatrix_len = fir_gen_convolve_matrix (o->std_dev_x, &cmatrix); fir_hor_blur (input, &rect, temp, &temp_extend, cmatrix, cmatrix_len, op_area->left); g_free (cmatrix); } if ((force_iir || o->std_dev_y > 1.0) && !force_fir) { iir_young_find_constants (o->std_dev_y, &B, b); iir_young_ver_blur (temp, &temp_extend, output, result, B, b); } else { cmatrix_len = fir_gen_convolve_matrix (o->std_dev_y, &cmatrix); fir_ver_blur (temp, &temp_extend, output, result, cmatrix, cmatrix_len, op_area->top); g_free (cmatrix); } g_object_unref (temp); return TRUE; }