obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

libobs: Use floating point textures when loading floating point image files

Open Lain-B opened this issue 3 months ago • 1 comments

Description

Allows the ability to open image files with floating point precision as floating point textures without unnecessarily downsampling to unsigned 8bit integer precision.

Motivation and Context

Someone told me that they were trying to load an image file with 32bit floating point precision per channel to do some sort of advanced shader stuff, and that important precision information was being lost. They didn't know why. I noticed that they were being converted away to 8bit unsigned integer RGBA unnecessarily despite the fact that we supported the texture format natively, so I just fixed it in like 5 minutes.

How Has This Been Tested?

Tested it with a .tiff file containing 32bit floating point precision RGBA file, opened it with an image source, checked the debugger to make sure the code path was being executed, checked the visible result, everything checked out.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Lain-B avatar Apr 26 '24 06:04 Lain-B

Use of AV_PIX_FMT_RGBAF32LE and AV_PIX_FMT_RGBAF16LE need to be guarded behind libavutil version from FFmpeg 6.0

tytan652 avatar May 04 '24 23:05 tytan652