Skip to content
  • Øyvind "pippin" Kolås's avatar
    buffer: make bilinear interpolation from mipmap be default for scaled get · 8dd0bef2
    Øyvind "pippin" Kolås authored
    gegl_buffer_get's last argument the repeat-mode is now a combined bit-field
    flags argument. In addition to choosing the edge repeat behavior for the fetch
    we can now also control the interpolation used when scaling from the nearest
    bigger mipmap level explicitly by oring one of the buffer scaling modes into
    the flags.
    
    The available values that can be | in with the repeat-mode, are, with the
    performance scaling factors relative to the default, GEGL_BUFFER_BILINEAR, note
    that for the range 0-2.0 the default is boxfilter - since it is a nicer
    transition to nearest neighbor.
    
    GEGL_BUFFER_NEAREST     8.0
    GEGL_BUFFER_BILINEAR    1.0
    GEGL_BUFFER_BOXFILTER   0.4
    
    nearest uses nearest neighbor sampling from the next bigger size, bilinear uses
    a bilinear interpolation of the values from the bigger available size, sampling
    2x2 pixels for each output pixel, while boxfilter uses a 3x3 neighbourhood -
    which is sufficient for accurate box-filtering from the next bigger power of
    two scale in a mip-map.
    
    The names for these flags, in particular the prefix, might change, if neither
    of them are passed in GEGL_BUFFER_BILINEAR is assumed, this is slightly lower
    quality than the previoux default boxfilter, but is 5-6 times faster - while
    still being much better than nearest neighbor - and as we are zooming out; the
    more correct mipmap scaling dominates.
    8dd0bef2