100 Commits
Author SHA1 Message Date
jpark37andRyan Foster 290904c47d obs-filters: Add filter to compose SDR into HDR
Provide ability to use power of 2.4 to simulate BT.1886 for Rec. 709.
2026-05-26 15:16:00 -04:00
jpark37andLain b28bb425bc libobs: Use limited range for R10l output
DeckLink hardware seems to want the values in video range.
2025-02-20 13:44:08 -08:00
jpark37andRyan Foster 689c0094b8 libobs: plugins: Use MAD for sRGB functions
Also fix stray comment about pow behavior.
2025-01-29 14:11:34 -05:00
jpark37andLain a8866fe3fa libobs-d3d11: Remove new/delete replacements
MSVC noticed inline is not allowed, and new/delete replacments also
don't belong in a header file. We're also just leaning on
__STDCPP_DEFAULT_NEW_ALIGNMENT__ being 16 for MSVC x64 now.
2024-01-11 04:02:31 -06:00
jpark37andLain 09ffae07d8 win-capture: Toggle premultiplied alpha for games
Keep straight alpha as default for VTuber applications.
2023-12-16 17:15:18 -06:00
jpark37andLain ea9df85512 graphics-hook: Fix DXGI ref leak for D3D12 capture
Create ID3D11Resource dynamically to avoid reference inflation.
2023-12-16 17:03:43 -06:00
jpark37andLain 263e027938 graphics-hook: Remove unused member variables 2023-12-10 04:45:33 -06:00
jpark37andLain 395ab0fbf5 graphics-hook: Use ID3DDestructionNotifier
Cleaner and more correct than hooking IUnknown::Release.
2023-12-10 04:45:33 -06:00
jpark37andLain a372f3f111 libobs-d3d11: Add display primaries to the log
Can't hurt to know what Windows thinks the mastering primaries are.
2023-12-10 04:45:22 -06:00
jpark37andLain 972e24df79 libobs-d3d11: Use OS D3DCompiler_47.dll
OBS needs Windows 10 minimum these days, so the DLL will be there.
2023-11-18 17:17:25 -06:00
jpark37andLain 35f8481498 obs-filters: Add maxRGB tonemapper for SDR
Preserves saturation better than our Reinhard.
2023-11-11 17:50:34 -06:00
jpark37andLain e79e28598b libobs,obs-filters: Use common straight alpha math
This pattern uses fewer instructions and also avoids using max, which
does not work on infinity.

Also remove unreferenced techniques from scale filters.
2023-11-04 18:12:22 -05:00
jpark37andLain 6aaf0358ca decklink-output-ui: Decouple DeckLink output state
Didn't realize OBS could output both program and preview views at the
same time with multiple devices.

Also remove render callbacks earlier on stop to avoid use-after-free.
2023-10-25 01:11:32 -05:00
jpark37andRyan Foster e11e2133e2 libobs,obs-filters: Fix NAN when tonemapping
Can happen when colors are wider than Rec. 2020.
2023-10-04 19:33:54 -04:00
jpark37andLain 4fd595efe9 decklink: Reset video capture on format change
Fixes black screen when toggling between 4K SDR and HDR on PS5.
2023-08-15 13:15:45 -07:00
jpark37andLain bb12fe9db5 decklink: Add HDR playback support 2023-08-15 13:15:45 -07:00
jpark37andLain 40edda536d libobs/media-io: Relax color space comparison
Allow VIDEO_CS_DEFAULT to avoid slow conversions.
2023-08-15 13:15:45 -07:00
jpark37andLain 3e80fff18e libobs: Add DrawAlphaDivide variant shaders
Useful for future 10-bit HDR DeckLink playback support.
2023-08-15 13:15:45 -07:00
jpark37andLain b5c5f71cee graphics-hook: Handle VkImageViewUsageCreateInfo
Our solution for adding TRANSFER_SRC usage for imageless framebuffers
was triggering validation errors when combined with image view usage
overrides. Add TRANSFER_SRC onto usage overrides for swap chain image
views to fix mismatches.
2023-08-04 03:35:10 -07:00
jpark37andLain f5f7ae3e7f decklink: Support 10-bit RGB capture
Don't drop to YUV if a pure RGB signal is available.
2023-07-29 16:41:31 -07:00
jpark37andLain 7669da1ea8 libobs: Add VIDEO_FORMAT_R10L
Support 10-bit packed format that DeckLink uses.
2023-07-29 16:41:31 -07:00
jpark37andLain 0934e73902 libobs-opengl: Support mad/uint2/uint3/uint4 2023-07-29 16:41:31 -07:00
jpark37andJim 7ff5dd63b9 libobs: Fix luma sampling for packed 4:2:2 sources 2023-05-06 16:31:06 -07:00
jpark37andJim 901986cbf4 libobs,obs-filters: Align HDR to SDR disparity
Adjust colors from BT.1886 to sRGB.
2023-04-23 23:43:09 -07:00
jpark37andJim c977417747 libobs: Improve util_mul_div64 outside MSVC
Use inline assembly for x86_64 speed/accuracy.

Sacrifice speed for accuracy on other processors.

Continue to use original implementation for ARM on Windows.
2023-04-15 17:08:04 -07:00
jpark37andJim bad13c90e0 decklink-output-ui: Don't crash on missing device
Noticed OBS crashing after I removed DeckLink hardware that I enabled
auto-start output against.
2023-04-09 11:53:12 -07:00
jpark37andJim 5adcd51a68 decklink: Ignore "default" output device
obs_get_output_properties leads to a callback with an empty settings
object, so ignore it to avoid adding a dummy entry to the device list.
2023-04-09 11:53:12 -07:00
jpark37andRodney 5a46c1e513 libobs: Fix v210 display name 2023-04-05 21:54:25 +02:00
jpark37andRodney 504cc76e93 libobs: Ensure v210 preserves precision 2023-04-05 21:54:25 +02:00
jpark37andJim b2a83a3145 decklink: Pass frames between threads using queues
Eliminates the stalls that have been seen when waiting for frame copies.

We shouldn't be copying at all ideally, but that would break the API.
2023-04-01 16:49:12 -07:00
jpark37andJim 7a3beec87b decklink: Avoid swscale for color space
Any color space adjustments should be done on the GPU.
2023-04-01 16:08:54 -07:00
jpark37andJim e4a80d0396 decklink: Query for preroll frame count
Three is recommended though, so use at least that many.
2023-04-01 16:08:54 -07:00
jpark37andJim ac87106f03 decklink: Schedule video frames for playback
DisplayVideoFrameSync is unusable at 4K, over 20 milliseconds per call.
ScheduleVideoFrame is probably what we should have been using all along.
2023-03-28 11:19:43 -07:00
jpark37andJim ccb2c06540 decklink: Add HDR capture support
Also add true 10-bit support.
2023-03-26 01:52:44 -07:00
jpark37andJim 97843dd7d7 libobs: Add VIDEO_FORMAT_V210
Support 10-bit packed format that DeckLink uses.
2023-03-26 01:52:44 -07:00
jpark37andJim 8f3bf0a0e3 libobs: Keep output as premultiplied alpha
Simplify code until someone needs straight alpha.
2023-03-25 03:19:26 -07:00
jpark37andJim ddee7ff6fe decklink-output-ui: Align render output paths
Use the render path that preview uses for non-preview rendering, which
uses the GPU to rescale rather than the CPU and pulls the image from the
GPU before pixel format conversion happens. This means it's no longer
necessary to select BGRA to use the keyer anymore.
2023-03-24 15:18:45 -07:00
jpark37andJim e32c2c1427 libobs: Add callback for main texture rendered
Useful for redirecting main texture to DeckLink output for example.
2023-03-24 15:18:45 -07:00
jpark37andJim feae65c472 graphics-hook: Handle VK_KHR_imageless_framebuffer
Applications that use this Vulkan extension would have image usage
mismatches because we add VK_IMAGE_USAGE_TRANSFER_SRC_BIT to
VkSwapchainCreateInfoKHR::imageUsage, so make the same modification to
VkFramebufferAttachmentImageInfo::usage.
2023-03-24 15:17:43 -07:00
jpark37andJim c2afa58125 libobs: Enable fast clear on Windows always
NVIDIA driver 527.37 fixes flickering when multiple GPUs are installed.
2023-03-20 01:41:47 -07:00
jpark37andPatrick Heyer 09c2a321ce mac-videotoolbox: Add ProRes 4444 (XQ) support
Also leverage P216/P416 pixel formats to retain precision.
2023-02-21 18:48:44 +01:00
jpark37andPatrick Heyer 463bf0dff5 libobs,UI: Add P216/P416 pixel formats
Will be useful for ProRes.
2023-02-21 18:48:44 +01:00
jpark37andPatrick Heyer 0efaf88caf libobs: Add PQ/HLG support for I210/I412 formats
Seen when playing back ProRes files.
2023-02-21 18:48:44 +01:00
jpark37 593a0f034c decklink-output-ui: Move preview rescale to GPU
Internal keyer computes with straight alpha, so use DrawAlphaDivide.
2023-02-19 11:46:20 -08:00
jpark37 06b8cef665 decklink: Set video conversion earlier
Owner needs this info set sooner to move rescale from CPU to GPU.
2023-02-19 11:46:20 -08:00
jpark37 9ee97bba1a libobs: Add obs_output_get_video_conversion
Need post-convert size to avoid CPU rescale.
2023-02-19 11:46:20 -08:00
jpark37 695f476553 win-capture: Add logging for Force SDR checkbox 2023-02-19 11:40:32 -08:00
jpark37 7bf3015864 win-capture: Add Force SDR for DXGI duplicator
Also plumb support for wide SDR although DXGI chooses narrow anyway?
2023-02-19 11:40:32 -08:00
jpark37 7bfde66578 libobs-d3d11: Support color spaces for duplicator
Need this plumbing to make decisions about duplicator colors.
2023-02-19 11:40:32 -08:00
jpark37andJim 6734167bf1 win-capture: Log display ids 2023-02-11 15:05:28 -08:00
jpark37andJim 35ee1b2ed1 libobs-d3d11: Log display ids 2023-02-11 15:05:28 -08:00
jpark37andJim 148122f5aa graphics-hook: Stop trying to connect early
It never works, and leaves a confusing message behind.
2023-02-04 15:44:16 -08:00
jpark37andRyan Foster 0b30ff1deb win-capture: Support EnumDisplayDevices failure
Seeing EnumDisplayDevices fail in the wild, so use GetMonitorInfo name
when the persistent name is unavailable.
2023-01-25 10:44:10 -05:00
jpark37andJim 792f8473ee libobs: Fix SDR async video on non-SDR targets
Bug was seen when projecting SDR video capture on WCG displays.
2023-01-24 19:39:42 -08:00
jpark37andJim 2e7f7acfeb libobs-d3d11: Log monitor color depth 2023-01-24 19:39:42 -08:00
jpark37andJim 3462ea3fda obs-ffmpeg: Tell FFmpeg that BGRA uses alpha
Prevents alpha from getting dropped with custom encoders.
2023-01-24 18:39:12 -08:00
jpark37andJim 22ea8f4e1f libobs-winrt,win-capture: Add Force SDR for WGC display
Leverage existing window capture support for display capture.
2023-01-14 15:49:43 -08:00
jpark37andJim fb58f60ae4 win-capture: Show Force SDR setting on Windows 10
Was using wrong bool for visibility.
2023-01-14 15:49:43 -08:00
jpark37andJim b7b7f0ae88 obs-ffmpeg: Set chroma location for VA-API 2022-12-11 14:12:36 -08:00
jpark37andJim 2a816c5fa7 obs-qsv11: Put mastering primaries in GBR order 2022-12-10 21:53:04 -08:00
jpark37andJim 0fc3cb1962 mac-videotoolbox: Add HDR metadata 2022-12-10 21:43:50 -08:00
jpark37andJim 6c8028a849 mac-videotoolbox: Don't parse HEVC as AVC 2022-12-03 15:31:41 -08:00
jpark37andJim e8792ac791 obs-ffmpeg: Improve chroma location decision
The chroma location doesn't just depend on pixel format, but we're just
trying to pick something reasonable for now.
2022-12-03 15:24:18 -08:00
jpark37andJim 47f4c18a95 win-dshow: Ignore FFmpeg colorspace if overridden
Verified MJPEG devices are no longer locked to Rec. 601.
2022-12-01 14:14:25 -08:00
jpark37andJim 0c4e7c4142 decklink: Always output BGRA 2022-11-19 15:24:26 -08:00
jpark37andJim 34a43aa4f1 UI: Clarify that RGB output format is BGRA 2022-11-19 15:20:03 -08:00
jpark37andRyan Foster 803fcc4c3e win-capture,UI: Look up display by id, not index
The index is not reliable. The id persists better, so use that.

Also remove matching against the first monitor if the expected monitor
is not available. That feature seems like a good way to get doxxed by
accident.
2022-11-18 15:15:13 -05:00
jpark37andJim 3d36ba5579 libobs: Fix SRGB to SCRGB async video rendering
SDR source projectors are no longer blown out on HDR displays.
2022-11-17 02:16:48 -08:00
jpark37andJim d9fe6977a6 libobs-d3d11: Support advanced SDR window preview
Displays more than 8 bpc if monitor is configured to be higher.
2022-11-09 22:35:24 -08:00
jpark37andJim d84a9dad8a mac-capture: Support P3 for HDR recordings 2022-11-09 22:34:50 -08:00
jpark37andJim e709797d80 libobs: Add P3 shaders for Mac 2022-11-09 22:34:50 -08:00
jpark37andJim 37cc894333 libobs-opengl: Support l10r IOSurface 2022-11-09 22:34:50 -08:00
jpark37andJim 4a108a6935 decklink-output-ui: Pipeline GPU data for preview
Mapping a GPU resource for CPU read immediately after GPU write creates
a large stall on the graphics thread. Use a small circular buffer, and
read the oldest frame instead.
2022-11-09 18:49:38 -08:00
jpark37andJim 6306c8de74 libobs: Move async filtering from render to tick
Fixes frame/texture size mismatch crash that can happen at render time.
2022-11-08 05:37:47 -08:00
jpark37andJim 080095786f libobs: Force SRGB conversion for tonemapped video
Fixes case where video capture is darkened when both luma wipe and scale
filtering are set.
2022-10-31 14:05:04 -07:00
jpark37andJim 3d985f7c60 libobs: Fix blend method in studio mode
Property was not being copied over.
2022-10-29 16:15:58 -07:00
jpark37andJim e119a7024d libobs: Sample video at default chroma location
Expect left for 4:2:0 SDR and 4:2:2, and top-left for 4:2:0 HDR.

MJPEG will be a half-pixel off, but we'll live with that for now.
2022-10-09 16:15:16 -07:00
jpark37andJim 2a76ffaf02 libobs/graphics: Precompute more accurate matrix
This is generated with .NET BigInteger fractions, and late divide.
2022-10-05 08:36:29 -07:00
jpark37andJim 51c452e937 libobs: Precompute more accurate matrices
These are generated with .NET BigInteger fractions, and late divide.
2022-10-05 08:36:29 -07:00
jpark37andJim 39183c76b5 win-wasapi: Fix Stop hang
Fix hang when audio capture is active in the background and stopped by
either closing OBS, or switching scene collections.
2022-10-01 10:36:08 -07:00
jpark37andJim cbb910a99c win-wasapi: Don't reconnect when inactive
Unnecessary reconnect attempts may cause noticeable hitches.
2022-10-01 07:06:56 -07:00
jpark37andJim 3dd0f895f8 libobs/media-io: Restore color range conversion
FFmpeg needs color range during context init to handle conversions.
sws_setColorspaceDetails after the fact is too late.
2022-09-26 21:26:01 -07:00
jpark37andJim 5af9c87e1b libobs/media-io: Avoid scaler for range diff
Green tint appears when using converting full NV12 to limited NV12 with
swscale, so just avoid creating scaler by color range for now.
2022-09-24 16:45:01 -07:00
jpark37andJim a34fae0327 libobs,UI: Swap red/blue render/output channels
Don't need to unswizzle channels for DeckLink output in the future.
2022-09-24 16:06:34 -07:00
jpark37andJim bb02620169 libobs: Add support for reading NV12/YUY2 PQ/HLG
8-bit HDR shouldn't exist, but OBS looks broken, so just support it.
2022-09-17 16:36:31 -07:00
jpark37andJim 1a7e5babc2 libobs: Add support for reading I420 HLG
Sony cameras can create 8-bit HLG videos for some reason.
2022-09-16 03:04:23 -07:00
jpark37andJim afeb78e022 graphics-hook: Print DXGI swap chain desc 2022-09-10 15:36:53 -07:00
jpark37andJim 5fd22f3dfd graphics-hook: Remove unused code 2022-09-10 15:36:53 -07:00
jpark37andJim 70f8e83353 libobs/media-io: Create scaler in more cases
Check for other data mismatches the scaler can fix up.
2022-09-10 15:36:27 -07:00
jpark37andJim 6a29cc5876 decklink: Set output range and color space 2022-09-10 15:36:27 -07:00
jpark37andJim cfd8f06122 decklink-output-ui: Set preview color range 2022-09-10 15:36:27 -07:00
jpark37andJim 1ddabc5c7c libobs: Remove unnecessary branch
Fast path for output texture shouldn't care what the effect is.
2022-09-10 15:34:29 -07:00
jpark37andJim a45cb71f6e win-capture: Remove unused wildcard code 2022-09-10 15:34:09 -07:00
jpark37andJim 894e37d0e1 libobs-winrt,win-capture: Allow forcing SDR
We don't know if there's a way to get window color space, so we've been
using the monitor color space of the window. This toggle forces OBS to
ignore the monitor color space, and assume the window is SDR.
2022-09-04 17:16:07 -07:00
jpark37andJim e583e86b35 image-source: Add JXR HDR support to slide show
Only supported on Windows.
2022-09-04 16:15:05 -07:00
jpark37andJim 8f6f761631 obs-ffmpeg: Rename NVENC type for clarity 2022-08-29 20:41:42 -07:00
jpark37andJim 26fce825a7 obs-ffmpeg: Fix NVENC HEVC regression
Forgot to switch enableEncodeAsync to 0.
2022-08-29 20:41:42 -07:00
jpark37andJim 5c85f8ae17 obs-ffmpeg: Add AVContentLightMetadata to MPEG-TS 2022-08-29 10:02:49 -07:00
jpark37andJim b4cc32c4c9 libobs: Extend NVIDIA anti-flicker to desktops 2022-08-29 10:02:32 -07:00
jpark37andJim 29be9bff7a obs-ffmpeg: Don't use NVENC async mode
Fixes hang on stop presumably because header read failed from being too
early?

Our buffering scheme makes async mode moot anyway.
2022-08-29 10:01:57 -07:00