libobs: Add BLERP, an optimized bicubic scaler#13299
Open
jhnbwrs wants to merge 1 commit intoobsproject:masterfrom
Open
libobs: Add BLERP, an optimized bicubic scaler#13299jhnbwrs wants to merge 1 commit intoobsproject:masterfrom
jhnbwrs wants to merge 1 commit intoobsproject:masterfrom
Conversation
This commit adds a new scaler that can be selected for multi-track configs. It is an optimization of the existing bicubic and does not change the algorithm. It instead interpolates 4 of the 9 datapoints used in the algorithm to achieve better performance. This scaler is is integrated as a parameterized path in the existing bicubic_scale.effect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Add OBS_SCALE_BLERP, a bicubic scaling variant that reduces
texture reads from 9 to 5 per output pixel. It loads only the
4 corner texels and 1 center sample, then computes edge
midpoints via linear interpolation instead of additional
texture fetches. No aspects of the bicubic algorithm were
changed. The same kernel is used and all math operations
are the same.
BLERP is integrated as a parameterized path in the existing
bicubic_scale.effect via a uniform bool use_blerp toggle
rather than a separate effect file.
This commit wires BLERP through the core pipeline, scene
item serialization, and multitrack video config only. UI
integration was not done, as the primary motivation is
improving multi-track scaling performance.
Motivation and Context
This is scaler is particularly useful for multi-track video encoding
where multiple renditions must be scaled simultaneously. Each
rendition competes for the same GPU scaling resources, so
reducing per-pixel texture read cost has a multiplied effect
across the full set of encoder outputs. Testing showed a 30-45%
improvement in performance which is in line with expectations from
a reduction from 9 to 5 texture reads.
The original motivation for this change was to find an optimization
that would provide better quality than bilinear but could potentially
be a bit worse than the existing bicubic. A middle ground to use
for some lower end GPUs to unlock better quality for multi-track
scenarios. VMAF generally prefers this over the original bicubic
implementation though (a pleasant surprise). While PSNR scores
absolutely did fall in between bilinear and bicubic.
How Has This Been Tested?
I have done VMAF comparisons and PSNR comparisons which for
almost all clips are comparable to bicubic with VMAF usually being
slightly higher and PSNR being very slightly lower.
We have had this the Twitch Portable Build for a few weeks now. Our
client configuration endpoint prefers it over bicubic, so all TEB users
of this build have been getting BLERP. Additionally it was exposed in
the UI in this build to allow other to inspect the results more easily.
There have been0 complaints, and in fact a few comments suggesting
that the output of BLERP was preferred over bicubic which suggest the
quality bar has been maintained well enough while at the same time
improving performance.
Types of changes
Checklist: