[gegl] gegl/buffer: make nearest sampler able to use memcpy
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl/buffer: make nearest sampler able to use memcpy
- Date: Tue, 9 Jan 2018 16:55:09 +0000 (UTC)
commit c0d3ce82a2e74343179ae4e6a4ef4a257ca7a5ef
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Jan 9 16:53:52 2018 +0100
gegl/buffer: make nearest sampler able to use memcpy
Using memcpy directly should be lower overhead than invoking a fish for a
single pixel when pixelformats match.
gegl/buffer/gegl-sampler-nearest.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index ccd0a94..eb496a7 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -184,9 +184,12 @@ gegl_sampler_get_pixel (GeglSampler *sampler,
gint offsetx = tiledx - tile_origin_x;
gint offsety = tiledy - tile_origin_y;
- guchar *tp = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) *
nearest_sampler->buffer_bpp;
+ guchar *tp = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) *
nearest_sampler->buffer_bpp;
- babl_process (sampler->fish, tp, buf, 1);
+ if (sampler->fish)
+ babl_process (sampler->fish, tp, buf, 1);
+ else
+ memcpy (buf, tp, nearest_sampler->buffer_bpp);
}
}
@@ -237,13 +240,11 @@ gegl_sampler_nearest_prepare (GeglSampler* restrict sampler)
return;
GEGL_SAMPLER_NEAREST (sampler)->buffer_bpp = babl_format_get_bytes_per_pixel (sampler->buffer->format);
-#if 0 // maybe re-enable; when certain result is correct
if (sampler->format == sampler->buffer->soft_format)
{
- sampler->get = gegl_sampler_nearest_get_same_format;
+ sampler->fish = NULL;
}
else
-#endif
{
sampler->fish = babl_fish (sampler->buffer->soft_format, sampler->format);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]