Skip to content

Prune BAWP by GOP usage at speed >= 4 - #5505

Merged
urvangjoshi merged 1 commit into
AOMediaCodec:av2-encfrom
xinxiong-xx:xin/bawp-gop-usage
Oct 8, 2026
Merged

urvangjoshi merged 1 commit into
AOMediaCodec:av2-encfrom
xinxiong-xx:xin/bawp-gop-usage

Conversation

@xinxiong-xx

Copy link
Copy Markdown

Prune BAWP by GOP usage at speed >= 4

At speed 4 the encoder searches BAWP on almost every inter frame. Blocks at high pyramid levels rarely choose it, yet its search takes a similar share of the encode time at every level.

This change measures, on each GOP's level-1 and level-2 frames, the share of the BAWP-eligible luma area whose final block uses BAWP. If the mean of the two shares is at most 0.5, BAWP is turned off on the GOP's frames at pyramid level >= 3. Intra and level-1 frames start a new GOP, frames at levels 1 and 2 are never pruned, and only frames coded earlier are used. The speed feature is prune_bawp_by_gop_usage.

STATS_CHANGED for speed >= 4.

CTC RA, A1 and A2, 33 frames (Anchor: 72fd5a2)

speed = 4

Class Y Cb Cr wAvg Enc% Dec%
A1 -0.00 -0.02 +0.15 +0.00 98.5 100.6
A2 +0.00 -0.00 -0.03 +0.00 98.2 100.5

speed = 5

Class Y Cb Cr wAvg Enc% Dec%
A1 +0.05 +0.17 +0.20 +0.06 98.8 99.9
A2 -0.01 -0.09 +0.03 -0.01 98.0 100.1

speed = 6

Class Y Cb Cr wAvg Enc% Dec%
A1 +0.00 +0.14 +0.12 +0.01 97.7 100.2
A2 -0.01 -0.19 -0.14 -0.02 96.8 99.4

@leolzhao

leolzhao commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Good trade off!

At speed 4 the encoder searches BAWP on almost every inter frame.
Blocks at high pyramid levels rarely choose it, yet its search takes a
similar share of the encode time at every level.

This change measures, on each GOP's level-1 and level-2 frames, the
share of the BAWP-eligible luma area whose final block uses BAWP. If the
mean of the two shares is at most 0.5, BAWP is turned off on the GOP's
frames at pyramid level >= 3. Intra and level-1 frames start a new GOP,
frames at levels 1 and 2 are never pruned, and only frames coded earlier
are used. The speed feature is prune_bawp_by_gop_usage.

STATS_CHANGED for speed >= 4.

CTC RA, A1 and A2, 33 frames (Anchor: 72fd5a2)

speed = 4

| Class      | Y     | Cb    | Cr    | wAvg  | Enc%  | Dec%  |
|------------|-------|-------|-------|-------|-------|-------|
| A1         | -0.00 | -0.02 | +0.15 | +0.00 | 98.5  | 100.6 |
| A2         | +0.00 | -0.00 | -0.03 | +0.00 | 98.2  | 100.5 |

speed = 5

| Class      | Y     | Cb    | Cr    | wAvg  | Enc%  | Dec%  |
|------------|-------|-------|-------|-------|-------|-------|
| A1         | +0.05 | +0.17 | +0.20 | +0.06 | 98.8  | 99.9  |
| A2         | -0.01 | -0.09 | +0.03 | -0.01 | 98.0  | 100.1 |

speed = 6

| Class      | Y     | Cb    | Cr    | wAvg  | Enc%  | Dec%  |
|------------|-------|-------|-------|-------|-------|-------|
| A1         | +0.00 | +0.14 | +0.12 | +0.01 | 97.7  | 100.2 |
| A2         | -0.01 | -0.19 | -0.14 | -0.02 | 96.8  | 99.4  |
@urvangjoshi
urvangjoshi merged commit 9325826 into AOMediaCodec:av2-enc Oct 8, 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.

4 participants