gegl r2377 - in trunk: . gegl/buffer gegl/operation
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2377 - in trunk: . gegl/buffer gegl/operation
- Date: Tue, 3 Jun 2008 22:43:17 +0000 (UTC)
Author: ok
Date: Tue Jun 3 22:43:17 2008
New Revision: 2377
URL: http://svn.gnome.org/viewvc/gegl?rev=2377&view=rev
Log:
* gegl/buffer/gegl-buffer-access.c:
(gegl_buffer_scan_iterator_init), (gegl_buffer_scan_iterator_next):
made the locking of the buffer when using the scan iterator for write
access implicit.
(gegl_buffer_copy): removed unneeded lock/unlcok.
* gegl/operation/gegl-operation-point-composer.c: ..
* gegl/operation/gegl-operation-point-filter.c: ..
* gegl/operation/gegl-operation-point-render.c: removed unneeded
lock/unlock pair.
Modified:
trunk/ChangeLog
trunk/gegl/buffer/gegl-buffer-access.c
trunk/gegl/operation/gegl-operation-point-composer.c
trunk/gegl/operation/gegl-operation-point-filter.c
trunk/gegl/operation/gegl-operation-point-render.c
Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c (original)
+++ trunk/gegl/buffer/gegl-buffer-access.c Tue Jun 3 22:43:17 2008
@@ -85,6 +85,8 @@
tile_i->buffer->tile_storage->tile_height *
tile_i->buffer->format->format.bytes_per_pixel;
i->real_row = 0;
+ if (write)
+ gegl_buffer_lock (buffer);
}
GeglBufferScanIterator *gegl_buffer_scan_iterator_new (GeglBuffer *buffer,
@@ -144,6 +146,9 @@
goto gulp;
}
+ if (tile_i->write)
+ gegl_buffer_unlock (tile_i->buffer);
+
return FALSE;
}
@@ -1467,8 +1472,6 @@
gegl_buffer_scan_iterator_init (&read, src, *dst_rect, FALSE);
gegl_buffer_scan_iterator_init (&write, dst, *dst_rect, TRUE);
- gegl_buffer_lock (dst);
-
while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
(b = gegl_buffer_scan_iterator_next (&write)))
{
@@ -1486,8 +1489,6 @@
if (b)
while (gegl_buffer_scan_iterator_next (&write));
- gegl_buffer_unlock (dst);
-
return;
}
Modified: trunk/gegl/operation/gegl-operation-point-composer.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-composer.c (original)
+++ trunk/gegl/operation/gegl-operation-point-composer.c Tue Jun 3 22:43:17 2008
@@ -220,45 +220,112 @@
infish = babl_fish (input->format, in_format);
outfish = babl_fish (out_format, output->format);
- gegl_buffer_lock (output);
-
- /* FIXME use direct access when possible */
+ /* FIXME use direct access when possible (avoid conversions and buffers)
+ */
{
GeglRectangle roi;
- in_buf = gegl_malloc (input_bpp * read.max_size);
- out_buf = gegl_malloc (output_bpp * write.max_size);
if (aux)
aux_buf = gegl_malloc (aux_bpp * write.max_size);
- while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
- (b = gegl_buffer_scan_iterator_next (&write)))
+
+ if (input->format == in_format &&
+ output->format == out_format)
{
- gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
- if (read.length != write.length)
+ while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
+ (b = gegl_buffer_scan_iterator_next (&write)))
{
- g_print ("%i != %i\n", read.length, write.length);
+ gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
+
+ g_assert (read.length == write.length);
+
+ if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+ GEGL_AUTO_ROWSTRIDE);
+
+ GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
+ operation,
+ read.data,
+ aux_buf, /* can be NULL */
+ write.data,
+ write.length);
}
- g_assert (read.length == write.length);
- babl_process (infish, read.data, in_buf, read.length);
+ }
+ else if (input->format == in_format &&
+ output->format != out_format)
+ {
+ out_buf = gegl_malloc (output_bpp * write.max_size);
+ while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
+ (b = gegl_buffer_scan_iterator_next (&write)))
+ {
+ gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
+
+ g_assert (read.length == write.length);
+
+ if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+ GEGL_AUTO_ROWSTRIDE);
- if (aux)
+ GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
+ operation,
+ read.data,
+ aux_buf, /* can be NULL */
+ out_buf,
+ write.length);
+ babl_process (outfish, out_buf, write.data, write.length);
+ }
+ gegl_free (out_buf);
+ }
+ else if (input->format != in_format &&
+ output->format == out_format)
+ {
+ in_buf = gegl_malloc (input_bpp * read.max_size);
+ while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
+ (b = gegl_buffer_scan_iterator_next (&write)))
{
- gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
+ g_assert (read.length == write.length);
+ babl_process (infish, read.data, in_buf, read.length);
+
+ if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+ GEGL_AUTO_ROWSTRIDE);
+
+ GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
+ operation,
+ in_buf,
+ aux_buf, /* can be NULL */
+ write.data,
+ write.length);
}
- GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
- operation,
- in_buf,
- aux_buf, /* can be NULL */
- out_buf,
- write.length);
- babl_process (outfish, out_buf, write.data, write.length);
+ gegl_free (in_buf);
}
- }
+ else if (input->format != in_format &&
+ output->format != out_format)
+ {
+ in_buf = gegl_malloc (input_bpp * read.max_size);
+ out_buf = gegl_malloc (output_bpp * write.max_size);
+ while ( (a = gegl_buffer_scan_iterator_next (&read)) &&
+ (b = gegl_buffer_scan_iterator_next (&write)))
+ {
+ gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
+
+ g_assert (read.length == write.length);
+ babl_process (infish, read.data, in_buf, read.length);
- gegl_buffer_unlock (output);
+ if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+ GEGL_AUTO_ROWSTRIDE);
+
+ GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
+ operation,
+ in_buf,
+ aux_buf, /* can be NULL */
+ out_buf,
+ write.length);
+ babl_process (outfish, out_buf, write.data, write.length);
+ }
+ gegl_free (in_buf);
+ gegl_free (out_buf);
+ }
+
+ }
- gegl_free (in_buf);
- gegl_free (out_buf);
if (aux)
gegl_free (aux_buf);
return TRUE;
Modified: trunk/gegl/operation/gegl-operation-point-filter.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-filter.c (original)
+++ trunk/gegl/operation/gegl-operation-point-filter.c Tue Jun 3 22:43:17 2008
@@ -100,7 +100,6 @@
infish = babl_fish (input->format, in_format);
outfish = babl_fish (out_format, output->format);
- gegl_buffer_lock (output);
{
gboolean a = FALSE, b = FALSE;
if (in_format == input->format &&
@@ -172,7 +171,6 @@
gegl_free (in_buf);
if (out_buf)
gegl_free (out_buf);
- gegl_buffer_unlock (output);
}
#if 0
else
Modified: trunk/gegl/operation/gegl-operation-point-render.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-render.c (original)
+++ trunk/gegl/operation/gegl-operation-point-render.c Tue Jun 3 22:43:17 2008
@@ -103,7 +103,6 @@
outfish = babl_fish (out_format, output->format);
- gegl_buffer_lock (output);
out_buf = gegl_malloc (output_bpp * write.max_size);
while (gegl_buffer_scan_iterator_next (&write))
@@ -121,7 +120,6 @@
if (out_buf)
gegl_free (out_buf);
- gegl_buffer_unlock (output);
}
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]