static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result)
{
  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
  guint       channel_bits [4];

  channel_bits [0] = o->red_bits;
  channel_bits [1] = o->green_bits;
  channel_bits [2] = o->blue_bits;
  channel_bits [3] = o->alpha_bits;

  if (!o->dither_type)
    process_no_dither (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "random"))
    process_random (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "random-covariant"))
    process_random_covariant (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "bayer"))
    process_bayer (input, output, result, channel_bits);
  else if (!strcasecmp (o->dither_type, "floyd-steinberg"))
    process_floyd_steinberg (input, output, result, channel_bits);
  else
    process_no_dither (input, output, result, channel_bits);

  return TRUE;
}
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
    GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
    guint       channel_bits [4];

    channel_bits [0] = o->red_bits;
    channel_bits [1] = o->green_bits;
    channel_bits [2] = o->blue_bits;
    channel_bits [3] = o->alpha_bits;

    switch (o->dither_strategy)
    {
    case GEGL_DITHER_NONE:
        process_no_dither (input, output, result, channel_bits);
        break;
    case GEGL_DITHER_RANDOM:
        process_random (input, output, result, channel_bits);
        break;
    case GEGL_DITHER_RANDOM_COVARIANT:
        process_random_covariant (input, output, result,
                                  channel_bits);
        break;
    case GEGL_DITHER_FLOYD_STEINBERG:
        process_floyd_steinberg (input, output, result,
                                 channel_bits);
        break;
    case GEGL_DITHER_BAYER:
        process_bayer (input, output, result, channel_bits);
        break;
    default:
        process_no_dither (input, output, result, channel_bits);
    }

    return TRUE;
}
Exemple #3
0
void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid,
             void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
{
  dt_iop_hotpixels_gui_data_t *g = (dt_iop_hotpixels_gui_data_t *)self->gui_data;
  const dt_iop_hotpixels_data_t *data = (dt_iop_hotpixels_data_t *)piece->data;

  // The processing loop should output only a few pixels, so just copy everything first
  memcpy(ovoid, ivoid, (size_t)roi_out->width * roi_out->height * sizeof(float));

  int fixed;
  if(piece->pipe->filters == 9u)
  {
    fixed = process_xtrans(data, ivoid, ovoid, roi_out, (const uint8_t(*const)[6])piece->pipe->xtrans);
  }
  else
  {
    fixed = process_bayer(data, ivoid, ovoid, roi_out);
  }

  if(g != NULL && self->dev->gui_attached && piece->pipe->type == DT_DEV_PIXELPIPE_FULL)
  {
    g->pixels_fixed = fixed;
  }
}