Skip to content

Bound the two-pass wet-pass mode search with the dry pass's rd - #5304

Open
yeqing-wu wants to merge 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:sb_two_pass_partition_warm_start_submission_v3
Open

Bound the two-pass wet-pass mode search with the dry pass's rd#5304
yeqing-wu wants to merge 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:sb_two_pass_partition_warm_start_submission_v3

Conversation

@yeqing-wu

Copy link
Copy Markdown
Contributor

The wet pass starts mode search from an unbounded rd limit, so its pruning cannot bite until it finds a good candidate on its own. Start it instead from the dry pass's rd for the same block and size, plus a margin.

The two passes see different contexts, so the bound can be violated. A block left with no valid mode is re-searched once with the original limit.

Anchor: commit c77f169
Speed 4 (cpu-used=4): FG16 CTC (33 frames, class A1 and A2, RA)

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.30 | -0.29 | -0.38 | -0.30 |  100 |  100 |
  | A2         | -0.17 |  0.07 |  0.31 | -0.15 |  101 |  100 |
  | Avg w/o B2 | -0.21 | -0.04 |  0.11 | -0.19 |  100 |  100 |
  +------------+-------+-------+-------+-------+------+------+

STATS_CHANGED

The wet pass starts mode search from an unbounded rd limit, so its
pruning cannot bite until it finds a good candidate on its own. Start it
instead from the dry pass's rd for the same block and size, plus a
margin.

The two passes see different contexts, so the bound can be violated. A
block left with no valid mode is re-searched once with the original
limit.

Anchor: commit c77f169
Speed 4 (cpu-used=4): FG16 CTC (33 frames, class A1 and A2, RA)

```
  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.30 | -0.29 | -0.38 | -0.30 |  100 |  100 |
  | A2         | -0.17 |  0.07 |  0.31 | -0.15 |  101 |  100 |
  | Avg w/o B2 | -0.21 | -0.04 |  0.11 | -0.19 |  100 |  100 |
  +------------+-------+-------+-------+-------+------+------+
```

STATS_CHANGED
@yeqing-wu

yeqing-wu commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

@urvangjoshi, Update on reusing the MV from the dry pass as the starting MV of the wet pass: the gain has dropped from -0.13% to -0.03%. Part of the reason is that the anchor itself increased an additional -2% gain compared to before.

Meanwhile, there have also been a lot of recent commits (several for MV search and DRL), so I'm still going through them to check whether anything was missed, and to see if I can push the gain further. Just let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants