Skip to content

Add pruning for refinemv, INTERINTRA, and WARP_DELTA#5102

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

Add pruning for refinemv, INTERINTRA, and WARP_DELTA#5102
leolzhao merged 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:refinemv_interintra_warp_delta_opt

Conversation

@yeqing-wu

Copy link
Copy Markdown
Contributor

Enables three ref-index based pruning speed features at speed >= 1:

  • prune_refinemv_by_ref_idx: skip refinemv_loop == 1 for ref-pairs other than (0, 1).
  • prune_interintra_by_ref_idx: skip INTERINTRA motion mode when ref_frame[0] > 1.
  • prune_warp_delta_by_ref_idx: skip WARP_DELTA motion mode when ref_frame[0] > 2.

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.02 | -0.15 |  0.05 | 0.01 |   93 |  101 |
  | A2         | 0.12 |  0.36 | -0.03 | 0.12 |   93 |  100 |
  | Avg w/o B2 | 0.09 |  0.21 | -0.00 | 0.09 |   93 |  100 |
  +------------+------+-------+-------+------+------+------+

  b) Performance of prune_refinemv_by_ref_idx only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.01 | -0.14 | -0.34 | -0.04 |   99 |  101 |
  | A2         |  0.04 |  0.06 | -0.25 |  0.02 |   99 |  100 |
  | Avg w/o B2 |  0.02 |  0.00 | -0.28 |  0.00 |   99 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  c) Performance of prune_interintra_by_ref_idx only

  +------------+------+-------+------+------+------+------+
  | Class      |    Y |    Cb |   Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+------+------+------+------+
  | A1         | 0.04 | -0.02 | 0.04 | 0.04 |   98 |  100 |
  | A2         | 0.02 |  0.27 | 0.08 | 0.03 |   98 |  100 |
  | Avg w/o B2 | 0.03 |  0.18 | 0.07 | 0.03 |   98 |  100 |
  +------------+------+-------+------+------+------+------+

  d) Performance of prune_warp_delta_by_ref_idx only

  +------------+------+------+-------+------+------+------+
  | Class      |    Y |   Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+------+-------+------+------+------+
  | A1         | 0.03 | 0.00 |  0.12 | 0.03 |   95 |  101 |
  | A2         | 0.07 | 0.11 | -0.07 | 0.07 |   96 |  100 |
  | Avg w/o B2 | 0.06 | 0.08 | -0.01 | 0.06 |   96 |  100 |
  +------------+------+------+-------+------+------+------+

2) Speed 4

  Overall performance (all three features combined)

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.01 | -0.09 | -0.01 | -0.02 |   90 |  101 |
  | A2         |  0.14 |  0.33 |  0.18 |  0.14 |   89 |  101 |
  | Avg w/o B2 |  0.09 |  0.20 |  0.12 |  0.09 |   89 |  101 |
  +------------+------+-------+-------+-------+------+------+

@yeqing-wu

yeqing-wu commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Hello all,

Could you please review this PR? The code has been rebased on top of av2enc branch, which includes the PR #5114.

Thanks
Yeqing

@yeqing-wu
yeqing-wu force-pushed the refinemv_interintra_warp_delta_opt branch 2 times, most recently from d8fdaa4 to 24140a0 Compare July 14, 2026 20:19
@yeqing-wu yeqing-wu changed the title Add pruning for refinemv, INTERINTRA, and WARP_DELTA DRAFT: Add pruning for refinemv, INTERINTRA, and WARP_DELTA Jul 14, 2026
@yeqing-wu
yeqing-wu force-pushed the refinemv_interintra_warp_delta_opt branch 2 times, most recently from 537006a to b5e8749 Compare July 14, 2026 22:16
@yeqing-wu yeqing-wu changed the title DRAFT: Add pruning for refinemv, INTERINTRA, and WARP_DELTA Add pruning for refinemv, INTERINTRA, and WARP_DELTA Jul 15, 2026
@yeqing-wu
yeqing-wu force-pushed the refinemv_interintra_warp_delta_opt branch from b5e8749 to ffac155 Compare July 15, 2026 17:51

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

Enables three ref-index based pruning speed features at speed >= 1:
 - prune_refinemv_by_ref_idx: skip refinemv_loop == 1 for ref-pairs
   other than (0, 1).
 - prune_interintra_by_ref_idx: skip INTERINTRA motion mode when
   ref_frame[0] > 1.
 - prune_warp_delta_by_ref_idx: skip WARP_DELTA motion mode when
   ref_frame[0] > 2.

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.02 | -0.15 |  0.05 | 0.01 |   93 |  101 |
  | A2         | 0.12 |  0.36 | -0.03 | 0.12 |   93 |  100 |
  | Avg w/o B2 | 0.09 |  0.21 | -0.00 | 0.09 |   93 |  100 |
  +------------+------+-------+-------+------+------+------+

  b) Performance of prune_refinemv_by_ref_idx only

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.01 | -0.14 | -0.34 | -0.04 |   99 |  101 |
  | A2         |  0.04 |  0.06 | -0.25 |  0.02 |   99 |  100 |
  | Avg w/o B2 |  0.02 |  0.00 | -0.28 |  0.00 |   99 |  100 |
  +------------+-------+-------+-------+-------+------+------+

  c) Performance of prune_interintra_by_ref_idx only

  +------------+------+-------+------+------+------+------+
  | Class      |    Y |    Cb |   Cr | wAvg | Enc% | Dec% |
  +------------+------+-------+------+------+------+------+
  | A1         | 0.04 | -0.02 | 0.04 | 0.04 |   98 |  100 |
  | A2         | 0.02 |  0.27 | 0.08 | 0.03 |   98 |  100 |
  | Avg w/o B2 | 0.03 |  0.18 | 0.07 | 0.03 |   98 |  100 |
  +------------+------+-------+------+------+------+------+

  d) Performance of prune_warp_delta_by_ref_idx only

  +------------+------+------+-------+------+------+------+
  | Class      |    Y |   Cb |    Cr | wAvg | Enc% | Dec% |
  +------------+------+------+-------+------+------+------+
  | A1         | 0.03 | 0.00 |  0.12 | 0.03 |   95 |  101 |
  | A2         | 0.07 | 0.11 | -0.07 | 0.07 |   96 |  100 |
  | Avg w/o B2 | 0.06 | 0.08 | -0.01 | 0.06 |   96 |  100 |
  +------------+------+------+-------+------+------+------+

2) Speed 4

  Overall performance (all three features combined)

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         | -0.01 | -0.09 | -0.01 | -0.02 |   90 |  101 |
  | A2         |  0.14 |  0.33 |  0.18 |  0.14 |   89 |  101 |
  | Avg w/o B2 |  0.09 |  0.20 |  0.12 |  0.09 |   89 |  101 |
  +------------+------+-------+-------+-------+------+------+
```
@leolzhao
leolzhao force-pushed the refinemv_interintra_warp_delta_opt branch from ffac155 to b928893 Compare July 15, 2026 22:40
@leolzhao
leolzhao merged commit 962f1c4 into AOMediaCodec:av2-enc Jul 16, 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