libobs: Add OBS_ENCODER_CAP_SCALING
cap
#10951
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a new encoder cap which tells libobs that rather than scaling video frames in software, the encoder is capable of scaling them via its own (presumably more efficient) means.
An encoder may implement this cap by comparing the VOI of its assigned
video_t
and the results ofobs_encoder_get_width/height()
. If the width/height values differ, then the encoder is being asked by libobs to self-scale, and the resolution in VOI will be the raw frame size, with the...get_width/height()
being the intended output resolution of the encoder.It is important to note that GPU rescaling mode will take priority over self-scaling. If GPU rescaling is enabled, the encoder will never be asked to self-scale.
Motivation and Context
This is useful for discrete hardware encoders, where they might have fixed-function video scaling logic that is highly efficient and fast. Additionally, this feature allows a hardware device which is encoding a full ABR ladder of tracks to be smart and only copy a video frame from GPU -> Host -> Device once for the entire ladder, rather than once for every track.
How Has This Been Tested?
Tested with a plugin of mine for the MA35D card. Frames received by the encoder are the normal output resolution of OBS, regardless of what the "scaled" size is (this change does not make the UI aware of self-scaling, so this requires custom encoder management).
Ubuntu 22.04
Types of changes
Checklist: