Skip to content

Enable TIP RefineMV and tighten the TIP output early exit at speed >= 5 - #5504

Merged
urvangjoshi merged 1 commit into
AOMediaCodec:av2-encfrom
xinxiong-xx:xin/tip-refinemv-s5
Oct 8, 2026
Merged

urvangjoshi merged 1 commit into
AOMediaCodec:av2-encfrom
xinxiong-xx:xin/tip-refinemv-s5

Conversation

@xinxiong-xx

Copy link
Copy Markdown

Speed >= 5 turns TIP RefineMV off (enable_tip_refinemv = 0) to save encode time. With the TIP unit memo (commit a80be19) and the early termination of the TIP direct output search (commit 4d9c07d), most of that encode time is gone.

This change keeps TIP RefineMV on at speed >= 5, and lowers the margin of the TIP direct output early exit from 20% to 0% at speed >= 5. The margin becomes the speed feature
hl_sf.tip_direct_output_early_term_margin_pct, 20 by default. enable_tip_refinemv is a sequence-level flag, so the decoder also runs TIP RefineMV at speed >= 5.

STATS_CHANGED for speed >= 5.

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

speed = 5

Class Y Cb Cr wAvg Enc% Dec%
A1 -0.64 -0.39 -0.40 -0.62 102.3 120.6
A2 -0.65 -0.28 -0.24 -0.62 102.1 121.9

speed = 6

Class Y Cb Cr wAvg Enc% Dec%
A1 -0.84 -0.65 -0.39 -0.81 102.6 120.5
A2 -0.84 -0.50 -0.35 -0.80 102.9 123.5

@yeqing-wu

Copy link
Copy Markdown
Contributor

Hi everyone, enable_tip_refinemv was disabled previously for the entire sequence because it does not have a frame-level flag. enable_tip_refinemv caused significant encoding time, and disabling it offers a good trade-off. However, recently, @xinxiong-xx made great optimizations to TIP (the TIP unit memo, commit a80be19) and the early termination of the TIP direct output search (commit 4d9c07d). As a result, the encoding time caused by TIP refinements has been significantly reduced. Therefore, we’ve removed the disabling of enable_tip_refinemv in this PR to restore the gain, with only a 2% increase in encoding time. @yunqingwang1, I’m not sure if you’d like to apply the same changes to RTC coding or LC coding.

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

Looks great! One minor comment.

Comment thread av2/encoder/encoder.c Outdated
@yunqingwang1

Copy link
Copy Markdown
Contributor

Hi everyone, enable_tip_refinemv was disabled previously for the entire sequence because it does not have a frame-level flag. enable_tip_refinemv caused significant encoding time, and disabling it offers a good trade-off. However, recently, @xinxiong-xx made great optimizations to TIP (the TIP unit memo, commit a80be19) and the early termination of the TIP direct output search (commit 4d9c07d). As a result, the encoding time caused by TIP refinements has been significantly reduced. Therefore, we’ve removed the disabling of enable_tip_refinemv in this PR to restore the gain, with only a 2% increase in encoding time. @yunqingwang1, I’m not sure if you’d like to apply the same changes to RTC coding or LC coding.

Thanks - will check it.

@yunqingwang1

Copy link
Copy Markdown
Contributor

Very good tradeoff!

Speed >= 5 turns TIP RefineMV off (enable_tip_refinemv = 0) to save
encode time. With the TIP unit memo (commit a80be19) and the early
termination of the TIP direct output search (commit 4d9c07d), most of
that encode time is gone.

This change keeps TIP RefineMV on at speed >= 5, and lowers the margin
of the TIP direct output early exit from 20% to 0% at speed >= 5. The
margin becomes the speed feature
hl_sf.tip_direct_output_early_term_margin_pct, 20 by default.
enable_tip_refinemv is a sequence-level flag, so the decoder also runs
TIP RefineMV at speed >= 5.

STATS_CHANGED for speed >= 5.

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

speed = 5

| Class      | Y     | Cb    | Cr    | wAvg  | Enc%  | Dec%  |
|------------|-------|-------|-------|-------|-------|-------|
| A1         | -0.64 | -0.39 | -0.40 | -0.62 | 102.3 | 120.6 |
| A2         | -0.65 | -0.28 | -0.24 | -0.62 | 102.1 | 121.9 |

speed = 6

| Class      | Y     | Cb    | Cr    | wAvg  | Enc%  | Dec%  |
|------------|-------|-------|-------|-------|-------|-------|
| A1         | -0.84 | -0.65 | -0.39 | -0.81 | 102.6 | 120.5 |
| A2         | -0.84 | -0.50 | -0.35 | -0.80 | 102.9 | 123.5 |
@urvangjoshi
urvangjoshi merged commit 9c3d545 into AOMediaCodec:av2-enc Oct 8, 2026
8 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