Skip to content
Snippets Groups Projects
  1. Feb 17, 2024
    • Kacper Michajłow's avatar
      utils/libav: add pl_map_avdovi_metadata · a9f57049
      Kacper Michajłow authored
      Convenience function, we don't care about pl_frame here.
      
      Also deprecate pl_frame_map_avdovi_metadata to reduce API surface in
      future, both functions do the same thing. Prefer the one with relaxed
      API.
      a9f57049
  2. Jul 14, 2023
  3. May 08, 2023
    • Niklas Haas's avatar
      utils/libav: add pl_get_mapped_avframe · 2c94c04d
      Niklas Haas authored
      To avoid the trappings of users directly accessing `frame->user_data`,
      which led to the current mess. Fix the problem cleanly by introducing a
      new function.
      
      Also clarify the exact policy here to avoid further misunderstandings.
      2c94c04d
  4. May 07, 2023
  5. Mar 13, 2023
  6. Mar 10, 2023
  7. Mar 02, 2023
  8. Feb 19, 2023
  9. Feb 13, 2023
    • Niklas Haas's avatar
      utils/libav: add `pl_map_hdr_metadata` · c8f52115
      Niklas Haas authored
      This not only exposes the previous logic to users, but also adds support
      for AVDynamicHDRPlus. Use this function internally in place of the
      previous duplicated code, and also get rid of some sanity masking logic
      that was of dubious importance (especially now that `nominal_min/max`
      are decoupled from the HDR metadata).
      
      For HDR10, we only map the fields relevant/interesting for us, ignore
      the rest. (Which is also unused in practice)
      c8f52115
  10. Sep 27, 2022
    • Niklas Haas's avatar
      utils/libav: test for <vulkan.h> dynamically · d1dda09c
      Niklas Haas authored
      Now that we bundle <vulkan.h>, PL_HAVE_VULKAN is no longer a "reliable"
      method of detecting whether vulkan is enabled. To be fair, it never was,
      but this change revealed this bug.
      
      The real issue here is that <vulkan.h> cannot be unconditionally assumed
      to be available, so we need to test for it somehow. Re-introduce the
      dynamic check (works on GCC/clang) and leave a scary note hoping to get
      MSVC users to include <vulkan.h> manually.
      d1dda09c
  11. Sep 08, 2022
    • Niklas Haas's avatar
      shaders/deinterlacing: add deinterlacing GPU shaders · a9fb0af6
      Niklas Haas authored
      Alongside the basic/trivial deinterlacing modes, this contains an
      implementation of the raw yadif deinterlacing kernel, based on
      vf_yadif_cuda.cu by @philipl. Currently only supports fragment shaders,
      with no compute shader speedup (although such a thing is conceptually
      possible, to share duplicate sampling work between adjacent pixels).
      
      Design the API in such a way that it permits field-merging (PAFF) should
      the need should arise in the future. Also adds a few related helpers.
      
      Closes: videolan/libplacebo#20
      a9fb0af6
  12. Jul 16, 2022
  13. Apr 03, 2022
  14. Mar 18, 2022
  15. Jan 05, 2022
    • Niklas Haas's avatar
      utils/libav: add pl_map_avframe_ex · 189d0c2b
      Niklas Haas authored
      Reintroduces dolby vision mapping, in a way that allows users to control
      the process, and also allows us to extend this function in the future
      should we run into anything similar again.
      189d0c2b
  16. Jan 04, 2022
    • Niklas Haas's avatar
      utils/libav: don't auto-map dovi metadata · abad16c7
      Niklas Haas authored
      This is actually a regression for vf_libplacebo. We need to handle this
      in a better way. Naively auto-applying it is nice, but causes too many
      surprises.
      
      I will think up something different. In the meantime, avoid breaking the
      status quo.
      
      Not bothering to bump the API version for this because it's a very
      recent change and doesn't affect the public API.
      abad16c7
    • Niklas Haas's avatar
      utils/libav: add support for AV_FRAME_DATA_DOVI_METADATA · 25560221
      Niklas Haas authored
      pl_map_avframe / pl_unmap_avframe can take care of this automatically,
      but users of the pl_frame_from_avframe or pl_upload_avframe APIs
      unfortunately have to do it themselves the hard way.
      
      That's the price they pay for using old APIs, I suppose.
      25560221
  17. Dec 29, 2021
    • Niklas Haas's avatar
      colorspace: completely refactor pl_color_space · 80ad5179
      Niklas Haas authored
      The old `sig_peak`, `sig_floor` etc. values were getting increasingly
      confusing, useless, and clumsy to interact with. As the tone mapping
      grows in complexity, it's clear that this functionality needs to start
      scaling its complexity.
      
      Accomplish this by merging the full HDR metadata struct into
      `pl_color_space` itself, and removing/deprecating the `sig_peak` etc.
      fields entirely. Since this struct is growing, turn some call-by-value
      functions into call-by-ref, for consistency.
      
      Also simplify everything by removing `light`, and just treating the OOTF
      as (conceptually) part of the EOTF. In addition, fundamentally refactor
      the way SDR curves are handled, by always converting them to
      linear-stretched absolute output scale.
      
      This is a pretty major refactor of the way pretty much all tone mapping
      is done in libplacebo, and the new design should hopefully be more
      robust, more understandable, and generally more useful.
      80ad5179
  18. Dec 14, 2021
    • Niklas Haas's avatar
      utils/libav: drop dynamic include of vulkan.h · 8ea6f51b
      Niklas Haas authored
      This is installed unconditionally on recent enough versions of FFmpeg.
      It just results in runtime link failure if you try using it, which is an
      FFmpeg bug (and not one that can be worked around by the previous
      solution either).
      8ea6f51b
  19. Dec 02, 2021
    • Niklas Haas's avatar
      utils/libav: add hwframe support · 5643b913
      Niklas Haas authored
      Requires a refactor of the API to split up `pl_upload_frame` into
      separate `pl_map_frame` and `pl_unmap_frame` callbacks. Overall, I'm
      happy with the way this API turned out, although I'm starting to rethink
      whether or not we really want `tex` to be provided by the user or just
      create/destroy textures unconditionally every time we map a frame.
      
      VAAPI support is provided by using ffmpeg's own facilities for mapping
      vaapi frames to dmabufs. Could probably be extended to any other format
      FFmpeg can successfully map.
      
      Vulkan support is provided using the new timeline semaphore API, which
      requires a fairly recent version of FFmpeg.
      5643b913
  20. Oct 21, 2021
    • Niklas Haas's avatar
      utils/libav: add pl_frame_copy_stream_props · 8c2c64f0
      Niklas Haas authored
      Apparently FFmpeg does not forward all stream-level properties (in
      particular, side data) to individual AVFrames. This is especially
      noticeable for the displaymatrix side data, which in practice I can
      *only* find as stream-level metadata.
      
      Annoying but necessary.
      8c2c64f0
  21. Oct 18, 2021
    • Niklas Haas's avatar
      shaders/film_grain: move H.274 model values out of struct · e7a2394a
      Niklas Haas authored
      This reduces the sizeof(struct pl_film_grain_data), and anything that
      depends on it (e.g. sizeof(struct pl_frame) or sizeof(struct
      pass_state)) by around 10 kB, bringing pl_frame down to only 512 bytes.
      
      The massive size of these structs was never intended. This change only
      affects the AVFrame utilities, which can simply reference the existing
      side data because the pl_frames generated from them were already
      specified to depend on the lifetime of the corresponding AVFrame.
      e7a2394a
  22. Jul 19, 2021
    • Niklas Haas's avatar
      utils: add pl_swapchain_colors helpers for libav/dav1d · d0aa42b4
      Niklas Haas authored
      These set the exact HDR metadata from the content tagging.
      
      In retrospect, I think I really regret not making these part of
      `pl_frame` to begin with. But oh well, that bullet is swallowed for now.
      I'm not breaking that API for a while.
      d0aa42b4
  23. May 01, 2021
  24. Apr 21, 2021
    • Niklas Haas's avatar
      libplacebo: provide typedefs for all object types · dd755a09
      Niklas Haas authored and Niklas Haas's avatar Niklas Haas committed
      Apart from significantly cutting down amount the typing the user needs
      to perform, I decided the past justification for keeping these as `const
      struct` rather than typedef'd names no longer makes sense due to the way
      libplacebo objects tend to have private parts hidden from the user.
      
      Bite the bullet and refactor all the things. Should be backwards
      compatible, but I decided to bump the major version to signal the
      significance of this API change.
      dd755a09
  25. Apr 12, 2021
    • Niklas Haas's avatar
      utils/libav: add get_buffer2 implementation · 108fa2e2
      Niklas Haas authored
      Similar to Dav1dPicAllocator, this allocates from DMA-visible GPU
      memory. Especially useful on platforms that don't support arbitrary host
      pointer imports.
      
      Make `plplay` use this, for testing purposes.
      Update the CI image to pull in avcodec headers.
      108fa2e2
  26. Apr 06, 2021
  27. Mar 09, 2021
  28. Dec 16, 2020
  29. Dec 02, 2020
    • Niklas Haas's avatar
      utils/libav: sanitize some illegal metadata combinations · 30efeff0
      Niklas Haas authored
      As clarified by @cyanreg, FFmpeg filters are supposed to ignore
      obviously "wrong" combinations, in particular RGB + limited range. We
      also make an effort to clean up broken sig_peak tagging, since this
      exists in practice.
      
      I decided not to sanitize the other paramaters until I encounter a
      broken file that demand it, because it's hard to draw the line
      otherwise, although we could certainly come up with a few more ideas for
      things that are potential candidates. (ICtCp with non-HDR curve? XYZ?)
      
      Also clean up some whitespace because I can't be bothered making a
      separate commit for it.
      30efeff0
    • Niklas Haas's avatar
      renderer: merge pl_image and pl_render_target into pl_frame · 5b508c5b
      Niklas Haas authored
      This is motivated by these two structs, essentially, having
      conglomerated into unity. Drop the deprecated fields from each and just
      go ahead with the big search & replace.
      
      This also allows us to unify a couple of helper functions, quite
      pleasingly. The only really annoying thing is that `target.av1_grain`
      makes zero sense, but whatever.
      
      We also provide a new helper function to bridge the "functionality gap"
      in the `pl_render_target_partial` / `pl_tex_clear` checks.
      
      An attempt was made to preserve backwards compatibility, for what it's
      worth.
      5b508c5b
  30. Nov 18, 2020
    • Niklas Haas's avatar
      utils/libav: fix signature of pl_upload_avframe · 4f1c7d94
      Niklas Haas authored
      An array of pointers to pointers? Complete rubbish and overkill. An
      array of pointers is fine. So what if users have to group their plane
      textures together, big deal. It's way more convenient this way, than
      having to explicitly separate the plane texture by plane and somehow
      provide them separately as an array.
      
      Not even gonna bump the API version for this because 1) nobody uses this
      API yet, and 2) it's single-header garbage anyway, so no risk of ABI
      break.
      4f1c7d94
  31. Nov 16, 2020
    • Niklas Haas's avatar
      utils/libav: add helpers for mangling avframes into libplacebo · f4020606
      Niklas Haas authored
      These structs and enums are designed in not-quite-compatible ways, and
      the mapping is not at all intuitive or obvious. This should hopefully
      make life a billion times easier for people wanting to use libplacebo
      together with FFmpeg/libav* (i.e., basically the default use case).
      
      Also includes an ultra-high-level wrapper that just takes an AVFrame *
      and straight up uploads it to the GPU, in `pl_image` format, ready to be
      consumed by `pl_renderer`.
      
      This entire set of helpers is done as a single-header library to avoid
      depending on libavutil, which would be a *really* terrible idea since
      libavfilter also wants to depend on libplacebo. This single-header
      nonsense is the easiest way to avoid a cyclic dependency. I promise I
      won't make it a habit. Besides, it's annoying having to do things this
      way, because it means I can't re-use any of the fancy logging functions
      from pl_ctx. Oh well. I hope the user knows what they're doing.
      f4020606
Loading