Skip to content

Prune uneven 4A/4B partitions with neighbor block boundaries - #5193

Open
urvangjoshi wants to merge 7 commits into
AOMediaCodec:av2-encfrom
urvangjoshi:mg__neighbor_boundary_prune_no_kf
Open

Prune uneven 4A/4B partitions with neighbor block boundaries#5193
urvangjoshi wants to merge 7 commits into
AOMediaCodec:av2-encfrom
urvangjoshi:mg__neighbor_boundary_prune_no_kf

Conversation

@urvangjoshi

@urvangjoshi urvangjoshi commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Use the best partitioning boundaries of left / above coding blocks to prune uneven 4way partitions -- by checking boundary alignment.

Only prune for inter frames.

  • Enabled for speed >= 1.
  • But disabled for resolution <= 270p.

Results for RA CTC 33 frames, speed 1:
(Anchor: 8d95884)

+---------+--------+--------+--------+--------+----------+
| Summary |   Y    |   U    |   V    |  YUV   | Enc-time |
+---------+--------+--------+--------+--------+----------+
| A1      |  0.08% |  0.04% |  0.11% |  0.08% | 97.10%   |
| A2      |  0.07% | -0.07% |  0.16% |  0.07% | 96.50%   |
|avg wo b2|  0.07% |  0.09% |  0.06% |  0.07% | 96.75%   |
+---------+--------+--------+--------+--------+----------+

Note: no changes at speed 4, because uneven 4way partitions are disabled at this speed.

Related: refactor a common av2_get_chroma_start_location() function.

STATS_CHANGED for speed >= 1.

@urvangjoshi
urvangjoshi marked this pull request as draft August 3, 2026 16:06
@urvangjoshi
urvangjoshi force-pushed the mg__neighbor_boundary_prune_no_kf branch from b2d1f56 to 1e4439d Compare August 3, 2026 16:31
@urvangjoshi
urvangjoshi marked this pull request as ready for review August 3, 2026 17:59
@leolzhao

leolzhao commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The trade off for class A2 is pretty good, however the trade off for class A1 is worse than the threshold. Currently, our rule is to make sure the trade off for both class A1 and A2 should satisfy the threshold. So, is it possible to add the qp dependent condition for this speed feature? For example, only turn on this speed feature for 4K sequence when qp is greater than one threshold? @urvangjoshi

@urvangjoshi

Copy link
Copy Markdown
Contributor Author

The trade off for class A2 is pretty good, however the trade off for class A1 is worse than the threshold. Currently, our rule is to make sure the trade off for both class A1 and A2 should satisfy the threshold. So, is it possible to add the qp dependent condition for this speed feature? For example, only turn on this speed feature for 4K sequence when qp is greater than one threshold? @urvangjoshi

Thanks @leolzhao for the suggestion! Let me try some variations in this direction.

Comment thread av2/encoder/partition_search.c Outdated
@yeqing-wu

Copy link
Copy Markdown
Contributor

Github uses markdown style in its conversation messages. To make sure that the results are not messed up by Github, please add ``` before and after the results.

Comment thread av2/common/av2_common_int.h
Comment thread av2/encoder/partition_search.c
Comment thread av2/encoder/speed_features.c Outdated
Comment thread av2/encoder/partition_search.c Outdated
Comment thread av2/encoder/partition_search.c Outdated
Comment thread av2/encoder/partition_search.c Outdated
Comment thread av2/encoder/partition_search.c Outdated
Comment thread av2/encoder/partition_search.c
Comment thread av2/encoder/partition_search.c
Comment thread av2/encoder/speed_features.h Outdated
@urvangjoshi
urvangjoshi force-pushed the mg__neighbor_boundary_prune_no_kf branch from 1e4439d to b879167 Compare August 6, 2026 16:36
@urvangjoshi

Copy link
Copy Markdown
Contributor Author

The trade off for class A2 is pretty good, however the trade off for class A1 is worse than the threshold. Currently, our rule is to make sure the trade off for both class A1 and A2 should satisfy the threshold. So, is it possible to add the qp dependent condition for this speed feature? For example, only turn on this speed feature for 4K sequence when qp is greater than one threshold? @urvangjoshi

@leolzhao : I made some tweaks to the code as follows:

  • Rewrote the code to remove some checks and add some higher level checks to avoid some computations.
  • Disabled this speed feature for <= 270p resolution, as I was seeing a large loss on a5 set only (~0.3%).
  • Reran on a cluster with more reliable timing.

With that, all sets seem to have a good trade-off now. See the updated commit message for latest results.

@urvangjoshi
urvangjoshi force-pushed the mg__neighbor_boundary_prune_no_kf branch from b879167 to 92734ee Compare August 6, 2026 17:20
@urvangjoshi

Copy link
Copy Markdown
Contributor Author

@leolzhao : I'm not sure why the CI run is failing in "common variable setup" phase. Seems to be a transient issue perhaps.
You may need to force-merge the PR.

Use the best partitioning boundaries of left / above coding blocks to
prune uneven 4way partitions -- by checking boundary alignment.

Only prune for inter frames.

Enabled for speed >= 1.

Results for RA CTC 33 frames, speed 1:
(Anchor: aa78cfb)

+---------+--------+--------+--------+--------+----------+
| Summary |   Y    |   U    |   V    |  YUV   | Enc-time |
+---------+--------+--------+--------+--------+----------+
| A1      |  0.10% |  0.03% |  0.06% |  0.10% | 97.88%   |
| A2      |  0.07% |  0.08% |  0.13% |  0.07% | 95.50%   |
|avg wo b2|  0.07% |  0.12% |  0.07% |  0.07% | 95.23%   |
+---------+--------+--------+--------+--------+----------+

Note: no changes at speed 4, because uneven 4way partitions seem to be
disabled / restricted at this speed.

Related: refactor a common av2_get_chroma_start_location() function.

STATS_CHANGED for speed >= 1.
@urvangjoshi
urvangjoshi force-pushed the mg__neighbor_boundary_prune_no_kf branch from 92734ee to b9fbdac Compare August 6, 2026 18:41
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