1. 29 Jan, 2019 1 commit
    • Niklas Haas's avatar
      swapchain: add resizing API · ad242535
      Niklas Haas authored
      This is used both for updating the size and querying the size. I don't
      want to make these separate functions because it should be painfully
      obvious that the size you get may not be the size you request.
      
      This allows libplacebo to work on wayland, which mediates the concept of
      swapchain resizing to protocols like xdg_shell that mesa/vulkan can't
      know anything about (by design).
      ad242535
  2. 28 Jan, 2019 1 commit
  3. 11 Jan, 2019 3 commits
    • Niklas Haas's avatar
      gpu: allow attaching arbitrary user data to tex/buf · eec7dbc5
      Niklas Haas authored
      Not implemented for the other types of objects, because the chances of a
      user needing to associate unique data for objects is much less likely.
      It helps for buf/tex in particular since the user can use this to e.g.
      hold extra state that needs to be tracked for synchronization / external
      API usage.
      
      It's also motivated by the `pl_tex_dummy_create`, which can benefit from
      allowing users to attach their own objects to dummy textures so they
      know which one corresponds to what.
      eec7dbc5
    • Niklas Haas's avatar
      gpu: add dummy pl_gpu backend · 5d0c1f8d
      Niklas Haas authored
      This is basically a software emulated `pl_gpu`, which does all
      texture/buffer operations in host memory using CPU instructions.
      
      Attempting to somehow soft-emulate shaders or rasterize is _way_ out of
      scope for this dumb thing, so we don't support `pl_tex_blit` or
      `pl_pass` at all. Literally the only point is to let users generate
      "faux" shaders, while keeping track of the generated LUTs etc.
      5d0c1f8d
    • Niklas Haas's avatar
      shaders: hide `uint8_t ident` from `pl_shader_reset` · 21d079b8
      Niklas Haas authored
      This was accidentally left exposed from a previous version of the API.
      It makes no sense in the public-facing code, so move it to the private
      `pl_shader_reset_ex`.
      
      Also swap the order of parameters for consistency.
      21d079b8
  4. 05 Jan, 2019 4 commits
    • Niklas Haas's avatar
      renderer: implement new peak detection · 10670ff8
      Niklas Haas authored
      This also allows us to finally separate peak detection from color
      management. The current place in the code actually has almost no
      drawbacks, since it's effectively free unless FBOs are disabled.
      
      One annoying consequence is that this means we will now always perform
      peak detection at the source resolution, even if the display is smaller.
      In the relatively common case of 4K video on 1080p displays, this is a
      performance regression. To fix it, we could try investigating whether to
      do the analysis after up/downscaling, but then we have more special
      cases to think about, so I think I'll live with the status quo for now.
      Peak detection isn't the end of the world even at 4K.
      
      Closes #40.
      10670ff8
    • Niklas Haas's avatar
      shaders/colorspace: completely refactor HDR peak detection · 9b4aecb1
      Niklas Haas authored
      The previous approach of using an FIR with tunable hard threshold for
      scene changes had several problems:
      
      - the FIR involved annoying dynamic buffer sizes, high VRAM usage,
        and the FIR sum was prone to numerical overflow which limited the
        number of frames we could average over.
      
      - the hard scene change detection was prone to both false positives and
        false negatives, each with their own (annoying) issues.
      
      Scrap this entirely and switch to a dual approach of using a simple
      single-pole IIR low pass filter to smooth out noise, while using a
      softer scene change curve (with tunable low and high thresholds), based
      on `smoothstep`. The IIR filter is extremely simple in its
      implementation and has an arbitrarily user-tunable cutoff frequency,
      while the smoothstep-based scene change curve provides a good, tunable
      tradeoff between adaptation speed and stability - without exhibiting
      either of the traditional issues associated with the hard cutoff.
      
      Another way to think about the new options is that the "low threshold"
      provides a margin of error within which we don't care about small
      fluctuations in the scene (which will therefore be smoothed out by the
      IIR filter).
      
      While redesigning the algorithm, I also redesigned the API - so that
      peak detection and tone mapping are separate, discrete steps that can be
      done as part of two different shaders. (Or as part of the same shader)
      This is required for #40, and in particular, means that issue is now
      within reach.
      
      cf. https://github.com/mpv-player/mpv/pull/6415
      9b4aecb1
    • Niklas Haas's avatar
      gpu: add pl_var_int · 238e2f02
      Niklas Haas authored
      No reason not to have this, and it's useful.
      238e2f02
    • Niklas Haas's avatar
      shaders/colorspace: redesign tone mapping algorithm · 65ddefba
      Niklas Haas authored
      Instead of hackily desaturating towards white, we instead perform tone
      mapping in per-channel ("desaturating") mode, and then desaturate
      towards that result. This helps significantly for very over-mastered
      content like Mad Max, and also makes sanely mastered content feel
      slightly more realistic/natural. More importantly, it's closer to what
      the mastering engineers expect TVs to do.
      
      We also allow the user to configure a bit of over-exposure for dark
      scenes, which can help with extremely dark movies like Annihilation.
      
      cf. https://github.com/mpv-player/mpv/issues/6405 and
          https://github.com/mpv-player/mpv/issues/6415
      65ddefba
  5. 22 Dec, 2018 1 commit
  6. 21 Dec, 2018 1 commit
    • Niklas Haas's avatar
      colorspace: add a sig_scale field to pl_color_space · 08566a4c
      Niklas Haas authored
      This can be used to reinterpret what the brightness range of values
      mean. A typical use case is for linear-light content which is
      technically encoded as 0.0 - 1.0, but practically supposed to extend to
      HDR values far beyond the typical SDR brightness. OpenEXR files in
      integer mode are encoded like this, for example.
      
      This also unifies/replaces the hacky old "hdr emulation" mode with the
      new concept, it being simply applied to the target csp in this mode of
      operation.
      08566a4c
  7. 04 Dec, 2018 1 commit
    • Niklas Haas's avatar
      3rdparty: use meson subprojects instead · 195f28ea
      Niklas Haas authored
      Major refactor of the source code structure. Now uses meson subprojects
      for "third party" dependencies (including bstr and talloc), and moves a
      lot of the meson boilerplate from src/meson.build to the top-level
      meson.build.
      
      We choose the name 'xtalloc' to make sure we don't collide with samba
      libtalloc, and to reflect the fact that our wrappers abort on OOM.
      195f28ea
  8. 28 Sep, 2018 1 commit
  9. 20 Jun, 2018 1 commit
    • Niklas Haas's avatar
      spirv: add support for glslang · 654a6d3f
      Niklas Haas authored
      We can now use glslang directly instead of relying on libshaderc for
      everything. This requires a bit of bending over backwards, but it's
      doable.
      
      Fixes #36
      654a6d3f
  10. 07 Oct, 2017 1 commit
    • Niklas Haas's avatar
      libplacebo: initial commit · bc39890e
      Niklas Haas authored
      Code shamelessly stolen from mpv, except without all the awful parts.
      (Just kidding, I still love mpv)
      bc39890e