[gegl] buffer: add some branch hints in sampler code
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: add some branch hints in sampler code
- Date: Tue, 17 Aug 2021 19:33:24 +0000 (UTC)
commit 7387e48360d029de633a0ba3842ff84768a8a79f
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Aug 17 21:31:12 2021 +0200
buffer: add some branch hints in sampler code
gegl/buffer/gegl-sampler-linear.c | 4 ++--
gegl/buffer/gegl-sampler.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-linear.c b/gegl/buffer/gegl-sampler-linear.c
index cb4b722cd..9222fbb7e 100644
--- a/gegl/buffer/gegl-sampler-linear.c
+++ b/gegl/buffer/gegl-sampler-linear.c
@@ -186,8 +186,8 @@ gegl_sampler_linear_get ( GeglSampler *self,
void *output,
GeglAbyssPolicy repeat_mode)
{
- if (! _gegl_sampler_box_get (self, absolute_x, absolute_y, scale,
- output, repeat_mode, 4))
+ if (G_LIKELY(! _gegl_sampler_box_get (self, absolute_x, absolute_y, scale,
+ output, repeat_mode, 4)))
{
gfloat result[5];
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index f630cceb0..efdab84ef 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -176,7 +176,7 @@ gegl_sampler_get (GeglSampler *self,
if (G_UNLIKELY(!isfinite (y)))
y = 0.0;
- if (self->lvel)
+ if (G_UNLIKELY (self->lvel))
{
double factor = 1.0 / (1 << self->lvel);
GeglRectangle rect={int_floorf (x * factor), int_floorf (y * factor),1,1};
@@ -184,7 +184,7 @@ gegl_sampler_get (GeglSampler *self,
return;
}
- if (gegl_buffer_ext_flush)
+ if (G_UNLIKELY (gegl_buffer_ext_flush))
{
GeglRectangle rect={x,y,1,1};
gegl_buffer_ext_flush (self->buffer, &rect);
@@ -333,7 +333,7 @@ gegl_sampler_get_from_mipmap (GeglSampler *sampler,
const gint maximum_width = GEGL_SAMPLER_MAXIMUM_WIDTH;
const gint maximum_height = GEGL_SAMPLER_MAXIMUM_HEIGHT;
- if (gegl_buffer_ext_flush)
+ if (G_UNLIKELY (gegl_buffer_ext_flush))
{
GeglRectangle rect = {x, y, 1, 1};
gegl_buffer_ext_flush (sampler->buffer, &rect);
@@ -504,7 +504,7 @@ _gegl_buffer_sample_at_level (GeglBuffer *buffer,
return;
}
- if (!format)
+ if (G_UNLIKELY (!format))
format = buffer->soft_format;
sampler = gegl_buffer_sampler_new_at_level (buffer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]