Skip to content
Snippets Groups Projects

gamut_mapping: greatly simplify perceptual tone mapping

Merged Niklas Haas requested to merge haasn/libplacebo:linear_perceptual into master
  1. Jul 03, 2023
    • Niklas Haas's avatar
      gamut_mapping: soft-clip in RGB after mapping · 17aecaf7
      Niklas Haas authored
      The reason this new curve works so well is because it incorporates a bit
      of hard clipping in RGB space, which is functionally equivalent to
      applying a sort of very soft intensity-dependent rolloff curve. Make
      this clipping soft rather than hard, and also an explicit part of the
      gamut mapping function - so it shows up on the graphs, and also to make
      the function well-behaved.
      
      This does distort hues very slightly, but hopefully in an aesthetically
      pleasing way.
      17aecaf7
    • Niklas Haas's avatar
      gamut_mapping: factor out softclip function · 3042c927
      Niklas Haas authored
      To allow re-using it in other places.
      3042c927
    • Niklas Haas's avatar
      gamut_mapping: add chromaticity margin to perceptual mode · a4ae197a
      Niklas Haas authored
      After rotating hue vectors, strongly saturated colors may exceed the
      source chromaticity bounds at this new hue. Add an extra margin on the
      soft knee peak that and raise it based on this factor.
      a4ae197a
    • Niklas Haas's avatar
      gamut_mapping: greatly simplify perceptual tone mapping · 599ea166
      Niklas Haas authored
      Instead of applying this complicated soft-knee along the gamma axis, as
      inspired by the gamut mapping paper this method was originally based on,
      I found that simply scaling the chromaticity axis by the equivalent knee
      function works *extremely* well, together with hard-clipping for
      out-of-gamut parts of the image.
      599ea166
    • Niklas Haas's avatar
      Revert "gamut_mapping: clip to source gamut in perceptual mode" · ab68ef88
      Niklas Haas authored
      This reverts commit f016363d.
      
      This change had unintended consequences on explosions etc.
      ab68ef88
Loading