Fast two-pass: additional dry-pass simplifications - #5435
Merged
leolzhao merged 1 commit intoSep 25, 2026
Merged
Conversation
yeqing-wu
requested review from
jingninghan,
leolzhao,
urvangjoshi and
yunqingwang1
September 24, 2026 16:23
Contributor
|
What's the run-time savings for cpu-used = 6? @yeqing-wu |
Contributor
Author
I have not tested that since I saw both speed 4 and 5 are within the allowed ratio. |
leolzhao
approved these changes
Sep 24, 2026
yunqingwang1
approved these changes
Sep 24, 2026
yunqingwang1
enabled auto-merge (rebase)
September 24, 2026 18:33
yunqingwang1
disabled auto-merge
September 24, 2026 18:33
Three simplifications to the dry pass of fast two-pass partitions. 1. Skip deblock-aware distortion. The dry pass ranks shapes only, so reconstructing and filtering to nudge distortion by the deblocking delta is wasted precision. 2. Reuse the dry pass's simple motion searches in the wet pass. MVs, sse/var, rate/dist/rdcost and start MVs depend only on source, references and geometry, so recomputing them is redundant. A new preserve_sms_cache flag drives av2_reset_sms_cross_pass_state(), which clears only what must not cross the pass boundary. 3. Cap two transform-side inner loops in search_tx_type, select_tx_partition_type and choose_tx_size_type_from_rd on x->apply_dry_pass_shortcuts: force the (set_idx=0, stx=0) IST/stx baseline, and restrict the tx-partition search to NONE and SPLIT (2 of 8 variants). STATS_CHANGED Anchor: commit c5df831 Speed 4 (cpu-used=4): FG16 CTC (33 frames, class A1 and A2, RA) Speed 5 (cpu-used=5): FG16 CTC (33 frames, class A1 and A2, RA) ``` 1) Speed 4 (cpu-used=4) +------------+------+-------+-------+------+------+------+ | Class | Y | Cb | Cr | wAvg | Enc% | Dec% | +------------+------+-------+-------+------+------+------+ | A1 | 0.27 | -0.23 | -0.21 | 0.23 | 95 | 100 | | A2 | 0.31 | -0.42 | -0.46 | 0.25 | 95 | 100 | | Avg w/o B2 | 0.30 | -0.36 | -0.39 | 0.25 | 95 | 100 | +------------+------+-------+-------+------+------+------+ 2) Speed 5 (cpu-used=5) +------------+------+-------+-------+------+------+------+ | Class | Y | Cb | Cr | wAvg | Enc% | Dec% | +------------+------+-------+-------+------+------+------+ | A1 | 0.39 | 0.01 | 0.13 | 0.37 | 94 | 100 | | A2 | 0.26 | -0.39 | -0.57 | 0.20 | 94 | 100 | | Avg w/o B2 | 0.30 | -0.27 | -0.37 | 0.25 | 94 | 100 | +------------+------+-------+-------+------+------+------+ ```
yeqing-wu
force-pushed
the
sb_tpp_simplify_dry_pass_submission
branch
from
September 25, 2026 16:40
5c0ad72 to
3777003
Compare
leolzhao
enabled auto-merge (squash)
September 25, 2026 16:41
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.
Three simplifications to the dry pass of fast two-pass partitions.
Skip deblock-aware distortion. The dry pass ranks shapes only, so reconstructing and filtering to nudge distortion by the deblocking delta is wasted precision.
Reuse the dry pass's simple motion searches in the wet pass. MVs, sse/var, rate/dist/rdcost and start MVs depend only on source, references and geometry, so recomputing them is redundant. A new preserve_sms_cache flag drives av2_reset_sms_cross_pass_state(), which clears only what must not cross the pass boundary.
Cap two transform-side inner loops in search_tx_type, select_tx_partition_type and choose_tx_size_type_from_rd on x->apply_dry_pass_shortcuts: force the (set_idx=0, stx=0) IST/stx baseline, and restrict the tx-partition search to NONE and SPLIT (2 of 8 variants).
STATS_CHANGED
Anchor: commit c5df831
Speed 4 (cpu-used=4): FG16 CTC (33 frames, class A1 and A2, RA)
Speed 5 (cpu-used=5): FG16 CTC (33 frames, class A1 and A2, RA)