obs-studio/libobs
James Park ba21fb947e libobs: Fix various alpha issues
There are cases where alpha is multiplied unnecessarily. This change
attempts to use premultiplied alpha blending for composition.

To keep this change simple, The filter chain will continue to use
straight alpha. Otherwise, every source would need to modified to output
premultiplied, and every filter modified for premultiplied input.

"DrawAlphaDivide" shader techniques have been added to convert from
premultiplied alpha to straight alpha for final output. "DrawMatrix"
techniques ignore alpha, so they do not appear to need changing.

One remaining issue is that scale effects are set up here to use the
same shader logic for both scale filters (straight alpha - incorrectly),
and output composition (premultiplied alpha - correctly). A fix could be
made to add additional shaders for straight alpha, but the "real" fix
may be to eliminate the straight alpha path at some point.

For graphics, SrcBlendAlpha and DestBlendAlpha were both ONE, and could
combine together to form alpha values greater than one. This is not as
noticeable of a problem for UNORM targets because the channels are
clamped, but it will likely become a problem in more situations if FLOAT
targets are used.

This change switches DestBlendAlpha to INVSRCALPHA. The blending
behavior of stacked transparents is preserved without overflowing the
alpha channel.

obs-transitions: Use premultiplied alpha blend, and simplify shaders
because both inputs and outputs use premultiplied alpha now.

Fixes https://obsproject.com/mantis/view.php?id=1108
2019-05-08 20:26:52 -07:00
..
audio-monitoring UI, libobs, text-freetype2: Add missing pragma once in header files 2019-04-01 02:48:28 -05:00
callback libobs/callback: Add signal reference counting 2018-06-03 15:04:03 -07:00
data libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
graphics libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
media-io libobs: Add better default source color range handling 2019-04-25 15:12:08 -07:00
util libobs: Use RTLD_FIRST when loading libraries on macOS 2019-04-27 11:56:53 -07:00
CMakeLists.txt libobs: Add texture-based encoding support 2019-02-07 17:00:46 -08:00
libobs.pc.in libobs: Add pkgconfig support 2018-09-24 14:25:41 -07:00
LibObsConfig.cmake.in cmake: Export plugin data destination 2014-09-27 09:41:32 -07:00
LibObsConfigVersion.cmake.in Export libobs cmake target, so external plugins can be built without ugly hacks 2014-05-08 14:43:16 +02:00
obs-audio-controls.c libobs: Use unaligned store rather than aligned store 2018-05-01 09:26:10 -07:00
obs-audio-controls.h libobs, UI: Add true peak measurements 2018-04-30 03:53:26 -07:00
obs-audio.c libobs: Fix indent 2019-02-12 19:33:13 -08:00
obs-avc.c libobs: Fix bug in AVC encoder packet allocation 2016-12-24 03:44:13 -08:00
obs-avc.h libobs: Add function to extract AVC header/sei 2016-04-19 08:29:24 -07:00
obs-cocoa.c libobs: Add functions to get logical/physical cores 2017-05-06 11:29:27 -07:00
obs-config.h libobs: Update version to 23.1.0 2019-04-04 06:46:51 -07:00
obs-data.c libobs: Add obs_data_array_push_back_array 2018-07-15 17:09:02 -07:00
obs-data.h libobs: Add obs_data_array_push_back_array 2018-07-15 17:09:02 -07:00
obs-defs.h libobs: Add output stop error for "no space left" 2015-09-18 22:04:23 -07:00
obs-display.c libobs: UI: Use graphics debug markers 2019-04-08 02:05:37 -07:00
obs-encoder.c libobs: Add func to get encoder caps by encoder pointer 2019-02-26 08:02:57 -08:00
obs-encoder.h libobs: Add texture-based encoding support 2019-02-07 17:00:46 -08:00
obs-ffmpeg-compat.h libobs: Fix FFmpeg constants 2017-11-16 21:38:37 -08:00
obs-hotkey-name-map.c libobs: Fix warning from mingw 2015-07-11 14:26:48 -07:00
obs-hotkey.c UI: Fix issue where space/esc hotkeys would be blank 2019-03-31 05:10:02 -05:00
obs-hotkey.h UI: Fix issue where space/esc hotkeys would be blank 2019-03-31 05:10:02 -05:00
obs-hotkeys.h libobs: Add <> or \| on RT 102-key as hotkey 2017-06-27 21:35:52 -07:00
obs-interaction.h Add interaction support to libobs 2014-09-15 17:19:37 -05:00
obs-internal.h libobs: Support limited color range for RGB/Y800 sources 2019-04-25 15:13:05 -07:00
obs-module.c libobs: Add texture-based encoding support 2019-02-07 17:00:46 -08:00
obs-module.h libobs: Add post-load module callback 2017-07-21 08:27:31 -07:00
obs-nix.c Merge pull request #1795 from cg2121/f-keys-linux 2019-04-14 10:48:46 -07:00
obs-output-delay.c libobs: Use reference counting for encoder packets 2016-12-08 03:27:39 -08:00
obs-output.c Merge pull request #1672 from derrod/captions-no-throttling 2019-04-14 04:19:07 -07:00
obs-output.h libobs: Add multi-track support to non-encoded outputs 2018-10-04 20:32:35 -07:00
obs-properties.c libobs: Fix crashes from wrong types 2019-05-02 19:09:34 -07:00
obs-properties.h libobs: Add ability to set spinbox property suffix 2019-05-02 08:54:14 -07:00
obs-scene.c libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
obs-scene.h libobs: UI: Fix rotated line scale 2019-04-19 06:35:42 -07:00
obs-service.c libobs: Add ability for service to specify its output type 2017-07-14 12:38:46 -07:00
obs-service.h libobs: Add ability for service to specify its output type 2017-07-14 12:38:46 -07:00
obs-source-deinterlace.c libobs: Simplify YUV conversion 2019-04-11 23:00:03 -07:00
obs-source-transition.c libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
obs-source.c libobs: Support limited color range for RGB/Y800 sources 2019-04-25 15:13:05 -07:00
obs-source.h UI: Implement stereo balancing 2018-09-07 09:27:14 -05:00
obs-ui.h Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
obs-video-gpu-encode.c libobs: Clear all compiler warnings 2019-03-29 06:29:04 -03:00
obs-video.c libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
obs-view.c libobs: Hide sources when an obs_view is destroyed 2015-03-02 12:23:25 -08:00
obs-win-crash-handler.c libobs: Log libobs bitness in crash logs 2018-07-31 11:49:35 -04:00
obs-windows.c libobs: Fix Windows Game Mode detection on newer Windows 10 versions 2018-12-26 23:13:37 +01:00
obs.c libobs: Fix various alpha issues 2019-05-08 20:26:52 -07:00
obs.h libobs: Add better default source color range handling 2019-04-25 15:12:08 -07:00
obs.hpp libobs/callback: Add signal reference counting 2018-06-03 15:04:03 -07:00
obsconfig.h.in cmake: Add release candidate versions/cmake variables 2018-08-13 01:19:23 -07:00