Skip to content

Single-ref NEWMV DRL search speed features#5101

Merged
leolzhao merged 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:inter_newmv_one_commit_submission
Jul 15, 2026
Merged

Single-ref NEWMV DRL search speed features#5101
leolzhao merged 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:inter_newmv_one_commit_submission

Conversation

@yeqing-wu

Copy link
Copy Markdown
Contributor

Adds three single-ref NEWMV DRL search speed features, enabled at speed >= 1:

  • mv_sf.skip_second_best_subpel: the subpel search normally refines both the best and the second-best full-pel candidate and keeps the lower-variance result; with this feature set, only the best full-pel candidate is refined.

  • mv_sf.predict_repeated_newmv: when a previously searched ref_mv_idx has a reference MV within one full pel of the current one, reuse the cached NEWMV result and only recompute the MV rate, avoiding the full-pel and subpel search entirely.

  • mv_sf.newmv_drl_search_limit: once ref_mv_idx reaches the limit, reuse the nearest already-searched result regardless of ref-MV distance instead of running a fresh search. Enabled with a cap of 2. Shares the same search-loop pass as the predict_repeated_newmv reuse.

STATS_CHANGED

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

1) Speed 1

  a) Overall performance (all three features combined)

  +------------+------+-------+-------+------+------+------+
  | Class      |    Y |    Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+-------+------+------+------+
  | A1         | 0.04 | -0.08 | -0.36 | 0.00 |   99 |  101 |
  | A2         | 0.04 | -0.04 | -0.18 | 0.03 |   98 |  100 |
  | Avg w/o B2 | 0.04 | -0.05 | -0.23 | 0.02 |   98 |  100 |
  +------------+------+-------+-------+------+------+------+

  b) Performance of skip_second_best_subpel only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.10 | -0.32 |  0.09 | -0.11 | 99.5 |  101 |
  | A2         | -0.01 | -0.09 | -0.34 | -0.02 | 99.5 |  100 |
  | Avg w/o B2 | -0.04 | -0.16 | -0.21 | -0.05 | 99.5 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  c) Performance of predict_repeated_newmv only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         |  0.00 | -0.08 |  0.08 |  0.00 |  100 |  100 |
  | A2         | -0.03 | -0.04 | -0.04 | -0.03 |  100 |  100 |
  | Avg w/o B2 | -0.02 | -0.05 | -0.00 | -0.02 |  100 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  d) Performance of newmv_drl_search_limit only

  +------------+------+-------+------+------+------+------+
  | Class      |    Y |    Cb |   Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+------+------+------+------+
  | A1         | 0.05 | -0.17 | 0.09 | 0.03 |   99 |  101 |
  | A2         | 0.00 |  0.36 | 0.01 | 0.02 |   99 |  100 |
  | Avg w/o B2 | 0.01 |  0.20 | 0.03 | 0.02 |   99 |  100 |
  +------------+------+-------+------+------+------+------+

2) Speed 4

  Overall performance (all three features combined)

  +------------+------+-------+-------+------+------+------+
  | Class      |    Y |    Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+-------+------+------+------+
  | A1         | 0.01 | -0.13 |  0.07 | 0.00 |   96 |  101 |
  | A2         | 0.05 | -0.13 | -0.25 | 0.03 |   96 |  100 |
  | Avg w/o B2 | 0.04 | -0.13 | -0.15 | 0.02 |   96 |  100 |
  +------------+------+-------+-------+------+------+------+

@yeqing-wu

Copy link
Copy Markdown
Contributor Author

Hello all,

Could you please review this PR?

Thanks
Yeqing

@yeqing-wu
yeqing-wu force-pushed the inter_newmv_one_commit_submission branch from d0d00df to e10357e Compare July 14, 2026 16:54

@leolzhao leolzhao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread av2/encoder/rdopt.c Outdated
Adds three single-ref NEWMV DRL search speed features, enabled at
speed >= 1:

* mv_sf.skip_second_best_subpel: the subpel search normally refines
  both the best and the second-best full-pel candidate and keeps the
  lower-variance result; with this feature set, only the best full-pel
  candidate is refined.

* mv_sf.predict_repeated_newmv: when a previously searched ref_mv_idx
  has a reference MV within one full pel of the current one, reuse the
  cached NEWMV result and only recompute the MV rate, avoiding the
  full-pel and subpel search entirely.

* mv_sf.newmv_drl_search_limit: once ref_mv_idx reaches the limit,
  reuse the nearest already-searched result regardless of ref-MV
  distance instead of running a fresh search. Enabled with a cap of 2.
  Shares the same search-loop pass as the predict_repeated_newmv
  reuse.

STATS_CHANGED

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

```
1) Speed 1

  a) Overall performance (all three features combined)

  +------------+------+-------+-------+------+------+------+
  | Class      |    Y |    Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+-------+------+------+------+
  | A1         | 0.04 | -0.08 | -0.36 | 0.00 |   99 |  101 |
  | A2         | 0.04 | -0.04 | -0.18 | 0.03 |   98 |  100 |
  | Avg w/o B2 | 0.04 | -0.05 | -0.23 | 0.02 |   98 |  100 |
  +------------+------+-------+-------+------+------+------+

  b) Performance of skip_second_best_subpel only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.10 | -0.32 |  0.09 | -0.11 | 99.5 |  101 |
  | A2         | -0.01 | -0.09 | -0.34 | -0.02 | 99.5 |  100 |
  | Avg w/o B2 | -0.04 | -0.16 | -0.21 | -0.05 | 99.5 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  c) Performance of predict_repeated_newmv only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         |  0.00 | -0.08 |  0.08 |  0.00 |  100 |  100 |
  | A2         | -0.03 | -0.04 | -0.04 | -0.03 |  100 |  100 |
  | Avg w/o B2 | -0.02 | -0.05 | -0.00 | -0.02 |  100 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  d) Performance of newmv_drl_search_limit only

  +------------+------+-------+------+------+------+------+
  | Class      |    Y |    Cb |   Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+------+------+------+------+
  | A1         | 0.05 | -0.17 | 0.09 | 0.03 |   99 |  101 |
  | A2         | 0.00 |  0.36 | 0.01 | 0.02 |   99 |  100 |
  | Avg w/o B2 | 0.01 |  0.20 | 0.03 | 0.02 |   99 |  100 |
  +------------+------+-------+------+------+------+------+

2) Speed 4

  Overall performance (all three features combined)

  +------------+------+-------+-------+------+------+------+
  | Class      |    Y |    Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+-------+------+------+------+
  | A1         | 0.01 | -0.13 |  0.07 | 0.00 |   96 |  101 |
  | A2         | 0.05 | -0.13 | -0.25 | 0.03 |   96 |  100 |
  | Avg w/o B2 | 0.04 | -0.13 | -0.15 | 0.02 |   96 |  100 |
  +------------+------+-------+-------+------+------+------+
```
@yeqing-wu
yeqing-wu force-pushed the inter_newmv_one_commit_submission branch from e10357e to 7e35a39 Compare July 15, 2026 19:26
@leolzhao
leolzhao merged commit 6a7f50c into AOMediaCodec:av2-enc Jul 15, 2026
109 checks passed
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.

3 participants