Skip to content

libobs: Add BLERP, an optimized bicubic scaler#13299

Open
jhnbwrs wants to merge 1 commit intoobsproject:masterfrom
amazon-contributing:jb_bicubic_with_interpolation
Open

libobs: Add BLERP, an optimized bicubic scaler#13299
jhnbwrs wants to merge 1 commit intoobsproject:masterfrom
amazon-contributing:jb_bicubic_with_interpolation

Conversation

@jhnbwrs
Copy link
Copy Markdown
Contributor

@jhnbwrs jhnbwrs commented Apr 7, 2026

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

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

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.
@WizardCM WizardCM added the New Feature New feature or plugin label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Feature New feature or plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants