Closed Bug 1536783 Opened 5 years ago Closed 5 years ago

Use multiple tilethreads with dav1d

Categories

(Core :: Audio/Video: Playback, defect, P3)

67 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox67 --- fixed
firefox68 --- fixed

People

(Reporter: E.M.terHoeven, Assigned: achronop)

References

Details

Attachments

(1 file)

Playback of AV1 content with the dav1d decoder is unnecessarily slow because only a single tilethread is used. Using multiple tilethread speeds up decoding and reduces latency. At least 2 tilethreads should be used by default, and 4 on systems with 4+ cores.

In general it's better with dav1d to use tilethreads instead of framethreads, because they have a smaller impact on latency and memory usage than framethreads.

My suggestions would be:

  • Tilethreads: min(4, logical_processors)
  • Framethreads: logical_processors/2

Here's a playlist with 4K and 8K AV1 videos to test: https://www.youtube.com/playlist?list=PLvndfuQ5JldKMffLOhQ6pLdO0euZfq_40

Blocks: dav1d
Summary: Use multiple framethreads with dav1d → Use multiple tilethreads with dav1d
Rank: 25
Priority: -- → P3

This is a snapshot from dav1d channel in IRC:

<nevcairiel> I would generally recommend 2 tile threads and as many frame threads as you can comfortably accept latency for (up to num of logical cores)
15:55
<nevcairiel> that seems to best match the way current videos are being encoded
15:56
<unlord> but I was testing Nightly last night with 0.2.1 and also saw that it wasn't performing better than libaom
15:57
<jamrial> i'm with nevcairiel, i haven't really seen much improvement with more than two tile threads, at least with the stuff being currently served on youtube and such
15:59
<nevcairiel> tile threads matching tile count would probably be ideal, maybe dav1d can help to do that in the future, but until then, 2 is what current content uses mostly
15:59
<BBB> it sounds like the content has 2 tiles then?
15:59
<BBB> or maybe even 1
15:59
<nevcairiel> afaik youtube encodes with 2 tiles

I think using 2 tile threads would be sufficient for now, given that the ideal number depends on the number of tiles that a video has rather than the number of logical processors. When dav1d is able to set a dynamic number of tile threads according to the content we can optimize it further.

Assignee: nobody → achronop
Status: UNCONFIRMED → NEW
Ever confirmed: true

(In reply to Alex Chronopoulos [:achronop] from comment #1)

There is indeed some discussion about how many tilethreads are optimal on certain systems on certain content. But in each case, 2 tilethreads are (way) better than 1 tilethread, making it the dominant strategy. For now using two tilethreads would be fine, later we can decide a even more near-optimal implementation.

Pushed by achronopoulos@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d8b11f27f89
Use two tile threads in dav1d decoder for performance improvement. r=TD-Linux
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68

Should this be uplifted?

Flags: needinfo?(achronop)

Comment on attachment 9052525 [details]
Bug 1536783 - Use two tile threads in dav1d decoder for performance improvement. r?TD-Linux

Beta/Release Uplift Approval Request

  • Feature/Bug causing the regression: None
  • User impact if declined: Increase performance of dav1d decoder. It's one line change that will give us performance boost on AV1 video playback.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Very low risk. It has been working on Nightly for some day without an issue. It one line change.
  • String changes made/needed:
Flags: needinfo?(achronop)
Attachment #9052525 - Flags: approval-mozilla-beta?

Comment on attachment 9052525 [details]
Bug 1536783 - Use two tile threads in dav1d decoder for performance improvement. r?TD-Linux

Limited & safe patch improving significantly the performance of AV1 video playback, uplift approved for 67 beta 6, thanks.

Attachment #9052525 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: