Add superblock source SAD speed feature for RTC partitioning - #5367
Merged
Merged
Conversation
jianj-g
marked this pull request as draft
September 3, 2026 23:37
jianj-g
force-pushed
the
rtc-source-sad
branch
3 times, most recently
from
September 17, 2026 18:45
dad1133 to
040d4af
Compare
jianj-g
marked this pull request as ready for review
September 17, 2026 20:52
marpan-max
approved these changes
Sep 17, 2026
…ioning
Computes superblock source SAD (between current source and collocated
previous source block) and incorporates it into variance-based
partitioning (VBP) for real-time (RTC) encoding mode (speed >= 6).
Key changes:
1. Superblock source SAD metrics:
- Added SOURCE_SAD classification enum (kZeroSad, kVeryLowSad,
kLowSad, kMedSad, kHighSad) and tracking fields in MACROBLOCK.
- Gated under sf->rt_sf.source_metrics_sb (enabled at speed >= 6).
- Computed per-SB source SAD in encode_rd_sb via cpi->fn_ptr[sb_size].sdf
and normalized to 64x64 scale, including area-normalized visible-region
SAD calculation for border superblocks.
2. Variance-based partition tuning:
- Early exit fast path for static superblocks (source_sad == 0 && y_sad == 0,
or y_sad < block_width * block_height * 2 for screen content), directly
selecting the whole superblock size without evaluating sub-block quadtrees.
- Resolution- and content-adaptive quant_base and partition threshold scaling
(thresholds[1]..thresholds[4]) for low-motion superblocks across <= 240p,
288p, and > 288p resolutions as well as screen content.
Benchmark results (9-QP constant-QP sweep, speed 6):
- rtc (28 clips): Overall PSNR BD-rate: -1.26%, Speedup: +6.13%
- rtc_derf (20 clips): Overall PSNR BD-rate: +0.13%, Speedup: +1.84%
- rtc_screen (9 clips): Overall PSNR BD-rate: -4.42%, Speedup: +18.04%
STATS_CHANGED for RTC mode
TAG=agy
CONV=64216da8-b0fa-4a3a-9988-d7f9322228c1
urvangjoshi
force-pushed
the
rtc-source-sad
branch
from
September 18, 2026 15:40
040d4af to
1a873a6
Compare
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.
Computes superblock source SAD (between current source and collocated previous source block) and incorporates it into variance-based partitioning (VBP) for real-time (RTC) encoding mode (speed >= 6).
Key changes:
Superblock source SAD metrics:
Variance-based partition tuning:
STATS_CHANGED for RTC mode:
rtc_derf: 0.019% bdrate loss, 0.3% speed up
rtc: -0.38% bdrate gain, 3.4% speed up
rtc_screen: -5.8% bdrate gain, 3.2% speed up
TAG=agy
CONV=9425edb0-f25c-4ea7-b0c5-9c5c7ed895c0