Skip to content

Orientation partition pruning - #5275

Closed
chengchen-google wants to merge 1 commit into
AOMediaCodec:av2-encfrom
chengchen-google:candidate/patch_0006e
Closed

chengchen-google wants to merge 1 commit into
AOMediaCodec:av2-encfrom
chengchen-google:candidate/patch_0006e

Conversation

@chengchen-google

@chengchen-google chengchen-google commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Add a new speed feature to analyze the structure orientation of the source signal to prune horz/vert partition types.

The speed feature shows a good tradeoff for speed 5, A1

We turn it on for A1 only.

RA performance, baseline 4a8df58:

    Speed           A1 BD-Rate (YUV)  A1 Speedup    A1 Ratio
    Speed_4         +0.16%             +1.61%       10.1
    Speed_5         +0.14%             +3.09%       22.1
    
    Speed           A2 BD-Rate (YUV)  A2 Speedup    A2 Ratio
    Speed_4         +0.19%             +2.96%       15.6
    Speed_5         +0.21%             +2.89%       13.8

STATS_CHANGED

@leolzhao

leolzhao commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

As the loss for class A1 is relatively big and one MR #5253 about block partition speed up was just merged, please rebase the code and re-test it on top of this commit 45dc128.

@urvangjoshi

Copy link
Copy Markdown
Contributor

As the loss for class A1 is relatively big and one MR #5253 about block partition speed up was just merged, please rebase the code and re-test it on top of this commit 45dc128.

Any update on this @chengchen-google ?

@yeqing-wu

Copy link
Copy Markdown
Contributor

Let's run this PR on top of latest av2-enc branch, if the tradeoff cannot meet speed 4 minimum bar ratio, but >=15x for speed 5 or >=10x for speed 6, then merge them into speed 5 or speed 6 accordingly.

@chengchen-google

Copy link
Copy Markdown
Contributor Author

As the loss for class A1 is relatively big and one MR #5253 about block partition speed up was just merged, please rebase the code and re-test it on top of this commit 45dc128.

Any update on this @chengchen-google ?

Last time I tested on top of two-pass partition, the tradeoff is reduced.
I will rebase to the most recent head and test it.
I will report results as soon as possible.

@chengchen-google

Copy link
Copy Markdown
Contributor Author

Let's run this PR on top of latest av2-enc branch, if the tradeoff cannot meet speed 4 minimum bar ratio, but >=15x for speed 5 or >=10x for speed 6, then merge them into speed 5 or speed 6 accordingly.

I tested the PR on the most recent head: 4a8df58

The performance is:
'''

Speed Level A1 BD-Rate (YUV) A1 Speedup A1 Ratio A2 BD-Rate (YUV) A2 Speedup A2 Ratio
Speed 4 +0.16% +1.61% 10.1 +0.19% +2.96% 15.6
Speed 5 +0.14% +3.09% 22.1 +0.21% +2.89% 13.8
'''

I recommend to turn it on at speed 5.

@chengchen-google
chengchen-google marked this pull request as ready for review September 11, 2026 21:51
@chengchen-google

Copy link
Copy Markdown
Contributor Author

Let's run this PR on top of latest av2-enc branch, if the tradeoff cannot meet speed 4 minimum bar ratio, but >=15x for speed 5 or >=10x for speed 6, then merge them into speed 5 or speed 6 accordingly.

I tested the PR on the most recent head: 4a8df58

The performance is: '''

Speed Level A1 BD-Rate (YUV) A1 Speedup A1 Ratio A2 BD-Rate (YUV) A2 Speedup A2 Ratio
Speed 4 +0.16% +1.61% 10.1 +0.19% +2.96% 15.6
Speed 5 +0.14% +3.09% 22.1 +0.21% +2.89% 13.8
'''
I recommend to turn it on at speed 5.

In addition, the performance with a relaxed threshold on speed 6 is reported in a separate PR: #5402

@chengchen-google

Copy link
Copy Markdown
Contributor Author

Hi @yeqing-wu , could you take a look at this PR? The tradeoff shows it is good for speed 5.
Its follow-up PR as well: #5402

@yeqing-wu

Copy link
Copy Markdown
Contributor

@urvangjoshi, I believe this is the base PR that you mentioned. For speed 5, the minimum ratio is 15x. A1 exceeds the ratio, but A2 is still below it. Are you all comfortable with this? Alternatively, can we adjust the threshold to ensure that it achieves the minimum ratio? @yunqingwang1 and @leolzhao

@urvangjoshi

Copy link
Copy Markdown
Contributor

@urvangjoshi, I believe this is the base PR that you mentioned. For speed 5, the minimum ratio is 15x. A1 exceeds the ratio, but A2 is still below it. Are you all comfortable with this? Alternatively, can we adjust the threshold to ensure that it achieves the minimum ratio? @yunqingwang1 and @leolzhao

I agree that trade-off doesn't seem good enough. Do you agree @chengchen-google ?
@yeqing-wu : what I meant is that other PR should not be approved in this case.

@yeqing-wu

Copy link
Copy Markdown
Contributor

@urvangjoshi, I believe this is the base PR that you mentioned. For speed 5, the minimum ratio is 15x. A1 exceeds the ratio, but A2 is still below it. Are you all comfortable with this? Alternatively, can we adjust the threshold to ensure that it achieves the minimum ratio? @yunqingwang1 and @leolzhao

I agree that trade-off doesn't seem good enough. Do you agree @chengchen-google ? @yeqing-wu : what I meant is that other PR should not be approved in this case.

@urvangjoshi, I see. I noticed that the code between #5275 and #5402 is quite similar, with the only difference being that #5402 only applies to speed 6 with 4k resolution, while #5275 applies to all speeds >= 5. I reviewed #5402 and approved it since the ratio is above the bar, but I did not approve #5275. If the code in #5402 also applies to other speeds besides speed 6 with 4k resolution, @chengchen-google could you please modify the code in #5402 to ensure that it only applies to speed 6 with 4k resolution, so that it aligns with the commit message?

The speed feature shows a good tradeoff for speed 5, A1.

We turn it on for A1 only.

RA performance:

Speed   	A1 BD-Rate (YUV)  A1 Speedup	A1 Ratio
Speed_4		+0.16%	           +1.61%	10.1
Speed_5		+0.14%	           +3.09%	22.1

Speed   	A2 BD-Rate (YUV)  A2 Speedup	A2 Ratio
Speed_4		+0.19%		   +2.96%	15.6
Speed_5		+0.21%		   +2.89%	13.8

STATS_CHANGED

Change-Id: Iea96600b64fdd27c83efc1250d46b4a90ccb5878
@chengchen-google

Copy link
Copy Markdown
Contributor Author

@urvangjoshi, I believe this is the base PR that you mentioned. For speed 5, the minimum ratio is 15x. A1 exceeds the ratio, but A2 is still below it. Are you all comfortable with this? Alternatively, can we adjust the threshold to ensure that it achieves the minimum ratio? @yunqingwang1 and @leolzhao

I agree that trade-off doesn't seem good enough. Do you agree @chengchen-google ? @yeqing-wu : what I meant is that other PR should not be approved in this case.

@urvangjoshi, I see. I noticed that the code between #5275 and #5402 is quite similar, with the only difference being that #5402 only applies to speed 6 with 4k resolution, while #5275 applies to all speeds >= 5. I reviewed #5402 and approved it since the ratio is above the bar, but I did not approve #5275. If the code in #5402 also applies to other speeds besides speed 6 with 4k resolution, @chengchen-google could you please modify the code in #5402 to ensure that it only applies to speed 6 with 4k resolution, so that it aligns with the commit message?

H @yeqing-wu and @urvangjoshi , I agree that this PR's ratio is not good for A2, speed 5.
I modified the PR so that it is only turned on for A1, speed 5.

The follow-up PR #5402 also only works for A1, speed 6.

They are now consistent and both satisfy the bar.

@yeqing-wu

Copy link
Copy Markdown
Contributor

I think we only need to merge #5402 and discard this PR, right?

@chengchen-google

Copy link
Copy Markdown
Contributor Author

I think we only need to merge #5402 and discard this PR, right?

Technically yes. I need to change the PR title and description.

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