Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoder probing performance improvements #2111

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

cgutman
Copy link
Collaborator

@cgutman cgutman commented Feb 6, 2024

Description

Encoder reprobing takes a significant portion of the total time to connect, especially when streaming the desktop. This PR addresses this by avoiding reprobing in cases where we know the GPU hasn't change and improving the performance of reprobing when we do need to do it.

To skip reprobing, we can use IDXGIFactory1::IsCurrent() which will tell us if GPUs or outputs changed state since the factory object was created. This check does catch a bit more than is needed, since some output changes will trigger a reenumeration. However, for desktop streaming and for games where the user just wants to adjust some Moonlight settings and get right back in, this is a major improvement. We can probably do better once #2032 is in.

For reprobing optimizations, we now avoid testing an encoder again with QP rate control when we know that the encoder always supports CBR/VBR. Trying again with QP just wastes time because we already know the encoder isn't present.

Likewise, we now don't bother trying again with an undefined reference frame count if we already found this encoder accepted a specific number of reference frames for H.264. I don't think there are any encoders in the real world that would accept reference frame count for H.264 but not HEVC or AV1.

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

…upport CBR/VBR

It just needlessly slows down encoder probing when the encoder or codec is not supported.
…ceded with ref frame count specified

I don't think there are any encoders out there that support this for some codecs and not others.
@cgutman cgutman merged commit 8373a8b into LizardByte:nightly Feb 7, 2024
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant