Skip to content
Snippets Groups Projects

New dynamic peak detection (v4, naive blocking)

Closed Niklas Haas requested to merge peak_detection_v4 into master
  1. Feb 21, 2023
    • Niklas Haas's avatar
      tone_mapping: prefer spline over st2094-40 for non-HDR10+ · 7d67887d
      Niklas Haas authored
      When only scene brightness metadata is available, pick the new spline
      instead of HDR10+.
      7d67887d
    • Niklas Haas's avatar
      tone_mapping: refactor pl_tone_map_spline · cdb27e95
      Niklas Haas authored
      Insteaed of using a hard-coded knee point with slope 1, infer the knee
      point from brightness metadata using the st2094 knee point logic. Change
      the parameter to an arbitrary subjective contrast enhancement,
      defaulting to the slope provided by the knee point enhancement.
      cdb27e95
    • Niklas Haas's avatar
      tone_mapping: improve knee point selection · 66f25472
      Niklas Haas authored
      Do this logic in PQ space instead of raw nits, to make it more tunable
      and perceptually accurate. sqrt(A * B) from the nits formula has been
      replaced by mix(A, B, 0.5). This is roughly equivalent because nits were
      linear while PQ is quasi-logarithmic, but more importantly, is more
      easily tunable.
      66f25472
    • Niklas Haas's avatar
      renderer: disable tone-mapping params for overlays · a4b12164
      Niklas Haas authored
      The default BPC is good enough for overlays, no need to generate a full
      LUT here. Inverse tone-mapping of overlays is probably never intended,
      anyway. This will definitely break some sort of HDR anime softsubbed
      signs, but not only is the subbing scene dead, this would require HDR
      subtitle formats to start existing. (And for the love of god, somebody
      just move softsubbed signs to an actual video track already!)
      
      Fixes: https://github.com/mpv-player/mpv/issues/11345
      a4b12164
    • Niklas Haas's avatar
      shaders/colorspace: mark src-dependent shader vars dynamic · a0547c8f
      Niklas Haas authored
      As these can change due to metadata, peak detection, etc.
      a0547c8f
    • Niklas Haas's avatar
      shaders: add SH_FLOAT_DYN etc. helpers · a9e4c236
      Niklas Haas authored
      Parallels to SH_FLOAT for stuff we expect to be dynamic.
      a9e4c236
    • Niklas Haas's avatar
      colorspace: pass scene_max through luma coeffs · 21f2d68c
      Niklas Haas authored
      Instead of just blindly taking the PL_MAX3() of this array. This should
      serve to hopefully fix a disconnect between what we consider to be the
      relevant metric (max luminance) and what HDR10+ thinks is important
      (maximum component).
      
      Arguably, doing it this way is worse for PL_TONE_MAP_RGB, but since we
      default to the BT.2446a-style PL_TONE_MAP_LUMA methods, this should give
      us better results in practice.
      21f2d68c
    • Niklas Haas's avatar
      shaders/colorspace: simplify dynamic LUT generation · 80066e45
      Niklas Haas authored
      Scraps the old 2D LUT design by a naive approach which simply updates
      the detected HDR metadata in real-time based on measured values, before
      feeding it into the tone mapping function.
      
      Also increase the size of tone-mapping LUTs, now that we no longer need
      to generate 2D textures.
      80066e45
    • Niklas Haas's avatar
      shaders/colorspace: simplify tone-map visualization · 70c77bd2
      Niklas Haas authored
      Removes the support for the custom peak detection object, and instead
      merely displays the average brightness from the HDR10+ metadata. This
      will no longer be needed, very soon.
      70c77bd2
    • Niklas Haas's avatar
      tone_mapping: increase default SDR target brightness · 63bf1fbc
      Niklas Haas authored
      Bump this from the current clamped lower bound (implicitly ~6.4) to the
      same default brightness value of 10.0f. This raises the average
      brightness level of most scenes to more visually accurately match
      reference HDR10+ masters.
      63bf1fbc
Loading