Skip to content

Multithread the encoder TIP frame build, loop filter and SSE - #5604

Open
YixinDu1 wants to merge 1 commit into
AOMediaCodec:av2-encfrom
YixinDu1:yixin/1020_mt_tip_aom
Open

YixinDu1 wants to merge 1 commit into
AOMediaCodec:av2-encfrom
YixinDu1:yixin/1020_mt_tip_aom

Conversation

@YixinDu1

Copy link
Copy Markdown
Contributor

Run the full-frame TIP work, that is the TIP frame build, its loop filter and the SSE of the TIP searches, on the tile encoder's worker threads. The band builds and band SSEs of the direct output rank search stay on the main thread. The work is split into row or column jobs that write disjoint output or integer partial sums, so the bitstream does not depend on the thread count. It uses the existing tile workers and stays serial until they exist.

Anchor: commit 224c347
CTC: AV2 CTC v8 (33 frames, RA)

Speed 4 (cpu-used=4)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  98.2 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 | 100.0 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.9 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 5 (cpu-used=5)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  99.0 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  99.6 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.8 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 6 (cpu-used=6)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  98.8 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  99.2 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.7 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 6 (cpu-used=6), threads=8, row-mt=1, classes A1 and A2 only
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  96.9 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  98.3 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

@YixinDu1
YixinDu1 marked this pull request as ready for review October 21, 2026 21:46
@YixinDu1
YixinDu1 force-pushed the yixin/1020_mt_tip_aom branch from 6490229 to 72b6159 Compare October 22, 2026 16:41
@YixinDu1

Copy link
Copy Markdown
Contributor Author

Hi @yunqingwang1, this is a similar patch to apply multi-threading to TIP. I also tested the tool off results of TIP and compare it against the patch savings:

image

At the CTC thread counts the patch recovers about 24% of that time on A1 (1.2 of 5.0) and about 42% on A2 (0.8 of 1.9).

@yeqing-wu

Copy link
Copy Markdown
Contributor

@yunqingwang1 , could you please help review again for this PR to see if you have any other comments?

Run the full-frame TIP work, that is the TIP frame build, its loop filter and
the SSE of the TIP searches, on the tile encoder's worker threads. The band
builds and band SSEs of the direct output rank search stay on the main thread.
The work is split into row or column jobs that write disjoint output or
integer partial sums, so the bitstream does not depend on the thread count. It
uses the existing tile workers and stays serial until they exist.

Anchor: commit 224c347
CTC: AV2 CTC v8 (33 frames, RA)

```
Speed 4 (cpu-used=4)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  98.2 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 | 100.0 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.9 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 5 (cpu-used=5)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  99.0 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  99.6 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.8 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 6 (cpu-used=6)
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  98.8 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  99.2 |    N/A |
  | Avg w/o B2   |  0.00 |  0.00 |  0.00 |  0.00 |  99.7 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+

Speed 6 (cpu-used=6), threads=8, row-mt=1, classes A1 and A2 only
  +--------------+-------+-------+-------+-------+-------+--------+
  | Class        |     Y |    Cb |    Cr |  wAvg |  Enc% |  Ratio |
  +--------------+-------+-------+-------+-------+-------+--------+
  | A1           |  0.00 |  0.00 |  0.00 |  0.00 |  96.9 |    N/A |
  | A2           |  0.00 |  0.00 |  0.00 |  0.00 |  98.3 |    N/A |
  +--------------+-------+-------+-------+-------+-------+--------+
```
@YixinDu1
YixinDu1 force-pushed the yixin/1020_mt_tip_aom branch from 72b6159 to a747273 Compare October 23, 2026 21:48
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