Skip to content

Conditionally reduce max DRL ref MVs for speeds >= 2 - #5279

Merged
urvangjoshi merged 4 commits into
AOMediaCodec:av2-encfrom
kslu-aom:av2enc-reddrlmv
Aug 25, 2026
Merged

Conditionally reduce max DRL ref MVs for speeds >= 2#5279
urvangjoshi merged 4 commits into
AOMediaCodec:av2-encfrom
kslu-aom:av2enc-reddrlmv

Conversation

@kslu-aom

@kslu-aom kslu-aom commented Aug 18, 2026

Copy link
Copy Markdown
Contributor
  • Introduce the reduce_max_drl_refmvs speed feature to reduce the default DRL candidate count from 4 to 3 in higher encode speeds.
  • Enable frame-level DRL adaptation (allow_frame_max_drl_bits = 1) when reduce_max_drl_refmvs is active: key, boosted, and low pyramid level frames (<= 2) retain 4 candidates (max_drl_bits = 3) to retain reference quality, while leaf frames use 3 candidates (max_drl_bits = 2).
  • Condition newmv_drl_search_limit on reduce_max_drl_refmvs to ensure both ref_mv_idx 0 and 1 are searched before reusing results, preventing motion predictor diversity collapse.
  • The existing --max-drl-refmvs CLI flag can override this behavior.

Evaluation based on 2abcfff with 33 frames at speed 2:

+---------+--------+--------+--------+--------+----------+----------+
| Summary |   Y    |   U    |   V    |  YUV   | Enc-time | Dec-time |
+---------+--------+--------+--------+--------+----------+----------+
| A1      | +0.05% | -0.05% | +0.10% | +0.05% |  98.1%   | 100.0%   |
| A2      | +0.08% | +0.27% | -0.03% | +0.08% |  97.5%   | 100.5%   |
+---------+--------+--------+--------+--------+----------+----------+

@kslu-aom
kslu-aom marked this pull request as draft August 18, 2026 17:03
@kslu-aom

kslu-aom commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The speedup-loss tradeoff is not good after rebase due to conflicts with recently added speed features. Marked as draft. I will rework this patch.

@yeqing-wu

Copy link
Copy Markdown
Contributor

@kslu-aom, I’ve done this before, and at that time, the tradeoff wasn’t good either. However, it appears to be acceptable after the commit of this PR, but it’s not good again on the latest ToT.

@kslu-aom kslu-aom changed the title Restrict the search of drl idx to 0-2 in speed >= 2 Conditionally reduce max DRL ref MVs for speeds >= 2 Aug 21, 2026
@kslu-aom
kslu-aom marked this pull request as ready for review August 21, 2026 03:35
Comment thread av2/encoder/speed_features.c
Comment thread av2/encoder/speed_features.c
@yunqingwang1

Copy link
Copy Markdown
Contributor

@kslu-aom The code change affects speed 1 as well?

@kslu-aom

Copy link
Copy Markdown
Contributor Author

@kslu-aom The code change affects speed 1 as well?

Some changes intended for speed 1 tests are included by mistake. I will update this PR later.

@kslu-aom

Copy link
Copy Markdown
Contributor Author

@yunqingwang1 I have cleaned up the unintended changes. Please take another look

@yeqing-wu yeqing-wu 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.

Overall LGTM, one minor suggestion to simplify the code

Comment thread av2/encoder/encoder.c Outdated
@yeqing-wu
yeqing-wu enabled auto-merge (squash) August 21, 2026 21:40
- Introduce the reduce_max_drl_refmvs speed feature to reduce the
  default DRL candidate count from 4 to 3 in higher encode speeds.
- Enable frame-level DRL adaptation (allow_frame_max_drl_bits = 1) when
  reduce_max_drl_refmvs is active: key, boosted, and low pyramid level
  frames (<= 2) retain 4 candidates (max_drl_bits = 3) to retain reference
  quality, while leaf frames use 3 candidates (max_drl_bits = 2).
- Condition newmv_drl_search_limit on reduce_max_drl_refmvs to ensure both
  ref_mv_idx 0 and 1 are searched before reusing results, preventing motion
  predictor diversity collapse.
- The existing --max-drl-refmvs CLI flag continues to override this behavior.
…mit settings

- Remove accidental duplicate reduce_max_drl_refmvs = 1 from speed >= 1
  block (it is only enabled for speed >= 2).
- Simplify newmv_drl_search_limit assignment in speed >= 1 to boosted ? 2 : 1.
- In speed >= 2, directly set newmv_drl_search_limit = 2 when
  reduce_max_drl_refmvs is active.

TAG=agy
CONV=47a24228-432f-4ef3-ae5e-68f3663750dc
@urvangjoshi
urvangjoshi disabled auto-merge August 25, 2026 15:50
@urvangjoshi
urvangjoshi merged commit 5cba8ac into AOMediaCodec:av2-enc Aug 25, 2026
2 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.

5 participants