1. 24 May, 2019 2 commits
  2. 19 May, 2019 1 commit
    • Ell's avatar
      buffer: in swap backend, fix queued compressed-tile cost · a79978a4
      Ell authored
      In GeglTileBackendSwap, when compressing a queued tile while
      waiting for sufficient queue space, we allocate a tile-sized buffer
      to hold the compressed data (since we don't know the compressed
      data size in advance), hence the cost of the compressed tile in the
      queue is equal to the full tile size.  However, we would previously
      take its cost to be the compressed data size, which can be much
      lower, causing us to over-fill the queue.  Use the full tile size
      as the cost of queued compressed tiles to fix that.
      
      Furthermore, don't compress cloned queued tiles, whose cost is less
      than their data size, since this would increase their cost (these
      tiles will still be compressed upon writing.)
      a79978a4
  3. 17 May, 2019 1 commit
    • Øyvind "pippin" Kolås's avatar
      buffer: use internal floorf/ceilf implementations · f1be6fb4
      Øyvind "pippin" Kolås authored
      This avoids both function call overhead and extra checks for values that
      are outside MININT/MAXINT range, for the uses inside GeglBuffer we only
      care about coordinates that are representable as integers - thus these
      inline-able shortcut versions are good enough for us.
      
      The speedup seems to consistently make all samplers about 10% faster
      according to the tests in perf/
      f1be6fb4
  4. 15 May, 2019 1 commit
  5. 13 May, 2019 1 commit
  6. 11 May, 2019 1 commit
  7. 09 May, 2019 1 commit
  8. 07 May, 2019 5 commits
    • Ell's avatar
      buffer: use tile/scratch allocators in the swap backend · 96b06cf3
      Ell authored
      in GeglTileBackendSwap, use the tile- and scratch-allocators for
      temporary compression buffers, to improve performance.
      96b06cf3
    • Ell's avatar
      buffer: use tile allocator for tile data · f956830b
      Ell authored
      In GeglTile, use gegl-tile-alloc for tile data, instead of the
      normal allocator.
      
      Note that the tile allocator guarantees that allocated buffers are
      preceeded by sufficient room for the n_clones array, which
      simplifies the allocation of a shared n_clones+data buffer.
      f956830b
    • Ell's avatar
      buffer: add dedicated allocator for tile data · 137e66e4
      Ell authored
      Add gegl-tile-alloc -- a dedicated allocator for tile data.  The
      allocator amortizes the cost of memory allocation, which is
      especially high on Windows, over multiple tiles, by allocating
      tiles in bulk, in groups called blocks (currently, each block is
      roughly 1% of the tile-cache size.)
      
      The allocator is currently limited to tiles whose size is a power
      of 2, possibly multiplied by 3 or 5 (to support tiles whose
      dimensions are powers of 2, with up to 5 components).  The rest of
      the tiles are allocated using the normal allocator.
      
      Move the call to malloc_trim() from GeglBuffer's destructor to
      gegl-tile-alloc.  We call it whenever tile data equivalent to ~10%
      of the tile-cache size is freed.
      
      Add a tile-alloc-total stat, which reports the total amount of
      memory currently used by the tile allocator.
      137e66e4
    • Ell's avatar
      buffer: in gegl-scratch, don't rely on struct layout · e99622d8
      Ell authored
      In gegl-scratch, avoid relying on exact struct layout to guarantee
      data alignment, and rather use explicit pointer arithmetic instead.
      e99622d8
    • Ell's avatar
      buffer: rename GEGL_ALIGN => GEGL_ALIGNMENT; add GEGL_ALIGN() macro · 9efef7f6
      Ell authored
      Rename the GEGL_ALIGN constant (specifying allocated data
      alignment) to GEGL_ALIGNMENT, and add a GEGL_ALIGN() macro, which
      takes a size/address value and aligns it to GEGL_ALIGN.
      9efef7f6
  9. 05 May, 2019 3 commits
    • Ell's avatar
      buffer: fix gegl_tile_handler_cache_copy() for GeglTileBackendBuffer backends · bffe6191
      Ell authored
      In gegl_tile_handler_cache_copy(), when the source cache doesn't
      have the requested tile, remove the tile from the destination cache
      *before* letting the backend copy the tile, since it might copy it
      into the destination cache as well, as happens with
      GeglTileBackendBuffer.  Previously, this would happen *after* the
      backend copied the tile, erroneously invalidating the copied tile
      in this case.  See issue #157.
      
      Also, don't invalidate the destination tile in this case, since
      gegl_buffer_copy() invalidates the entire affected region in bulk.
      bffe6191
    • Ell's avatar
      operation, transform: use indirect input buffer on main thread as well · 8a5dd582
      Ell authored
      In the various GeglOperation subclasses that use a per-thread
      indirect input-buffer, backed by the actual input buffer, during
      multithreaded processing, use an indirect buffer for the main
      thread as well, instead of using the input buffer directly
      (unless the main thread processes the entire output).
      
      This avoids a deadlock when multiple threads gegl_buffer_copy()
      from their input buffer to the output buffer concurrently: if a
      worker thread acquires both the (indirect) input-buffer and output-
      buffer locks, while the main thread acquires the (direct) input-
      buffer lock and waits on the output-buffer lock, as soon as the
      GeglTileBackendBuffer of the worker-thread's input buffer forwards
      a command to the underlying input buffer, it will deadlock while
      waiting for the input-buffer's lock (which is held by the main
      thread).  See issue #157.
      
      Furthermore, this should reduce contention over the underlying
      input buffer between the main thread and the worker threads.
      8a5dd582
    • Ell's avatar
      buffer: improve deadlock prevention in gegl_buffer_copy() · b3b9a943
      Ell authored
      In gegl_buffer_copy(), when using COW, sort the locks by the tile-
      storage pointers, instead of the buffer pointers, to avoid the
      possibility of a deadlock when different buffers use the same
      underlying storage in concurrent calls to the function.
      b3b9a943
  10. 27 Apr, 2019 1 commit
  11. 26 Apr, 2019 1 commit
  12. 15 Apr, 2019 1 commit
  13. 14 Apr, 2019 1 commit
  14. 10 Apr, 2019 1 commit
    • Øyvind "pippin" Kolås's avatar
      buffer: swap cubic and catmull rom coefficients · bdd2bb8f
      Øyvind "pippin" Kolås authored
      Fixing Issue #145, comments in the code indicate that the code has been left in
      an experimental state - and even then the divergence from what the coefficients
      are used for which named cubic variant and what they should be are documented.
      
      This patch removes the extra needed comments about things are not right, making
      the cubic sampler as sharp as is commonly expected - while keeping the smoother
      cubic variant catmull-rom optional (inaccesible in GIMP - but other samplers
      available probably fill the same niche)
      bdd2bb8f
  15. 08 Apr, 2019 2 commits
  16. 04 Apr, 2019 6 commits
  17. 28 Mar, 2019 2 commits
  18. 08 Mar, 2019 1 commit
  19. 27 Feb, 2019 2 commits
    • Ell's avatar
      Issue #38 - gegl-sampler sometimes crashes for absurd coordinates. · 15a61d51
      Ell authored
      In gegl_sampler_get_ptr(), clamp/wrap the input coordinates based
      on the buffer's abyss and the sampler's context rect, so that the
      coordinates are never farther away from the abyss than necessary,
      avoiding overflowing in gegl_buffer_get() due to extreme coordinate
      values.
      15a61d51
    • Ell's avatar
      buffer: fix incorrect interpoaltion format in linear/cubic samplers box filtering · 535ceb02
      Ell authored
      Add a GeglSampler::interpolate() function, which subclasses should
      implement if they use the generic box-filter algorithm.  This
      function is similar to GeglSampler::get(), except that it always
      performs point sampling (and therefore doesn't take a scale
      matrix), and, in particular, should return its result using the
      sampler's premultiplied interpolation format, rather than its
      output format.
      
      Use interpolate(), instead of get(), in _gegl_sampler_box_get(),
      to avoid erroneously performing box filtering using the sampler's
      output format.
      
      Implement interpolate() in the linear and cubic samplers.
      535ceb02
  20. 22 Feb, 2019 2 commits
  21. 21 Feb, 2019 3 commits
    • Ell's avatar
      operation: fix typo in gegl-operation-private.h · 001b9a88
      Ell authored
      001b9a88
    • Ell's avatar
      operation: don't explicitly prevent caching of point ops · 36c7ebba
      Ell authored
      Don't explicitly set the GeglOperationClass::no_cache field of
      point operations to TRUE, since the AUTO cache policy should
      implictly prevent them from being cached, as point ops don't
      generally implement get_cached_region().
      36c7ebba
    • Ell's avatar
      operation, graph: add {GeglOperationClass,GeglNode}::cache-policy · 7f24430c
      Ell authored
      Caching of operation output is currently controlled by the
      GeglOperationClass::no_cache field on a per-operation-class basis,
      and by the GeglNode::dont-cache property on a per-node basis.
      However, since these fields are boolean, they prevent us from
      automating the decision of whether an op should be cached, or,
      altenatively, they don't provide sufficient control over this
      decision.
      
      Instead, add a ternary GeglCachePolicy enum, which can be one of
      AUTO, NEVER, or ALWAYS, and add a GeglOperationClass::cache_policy
      field, and a GeglNode::cache-policy property, which use this type.
      When the cache-policy property of a node in NEVER or ALWAYS, its
      result isn't/is cached, respectively; when it's AUTO, the deicision
      depends on the operation:  When the cache_policy field of the
      operation class is NEVER or ALWAYS, the result isn't/is cached,
      respectively; when it's AUTO, the result is cached only if the
      operation implements get_cached_region().  Both of these field are
      set to AUTO by default -- the idea is that we generally don't want
      to implicitly cache results, unless they correspond to a different
      region than the ROI.
      
      The existing dont-cache/no_cache fields are deprecated, but are
      still used for now: when GeglNode::cache-policy is AUTO and
      GeglNode::dont-cache is TRUE, the node isn't cached; when
      GeglOperationClass::cache_policy is AUTO and
      GeglOperationClass::no_cache is TRUE, the operation isn't cached.
      
      Like GeglNode::dont-cache, GeglNode::cache-policy is inherited by
      the node's children.
      7f24430c
  22. 18 Feb, 2019 1 commit