Repository navigation
perf(decode): enable frame/slice threading - #72
Merged
Merged
Conversation
Use half of the logical cores for decoding (at least one), with FF_THREAD_FRAME | FF_THREAD_SLICE so FFmpeg picks the usable mode. DIA_THREADS overrides the count for A/B measurements and 1 disables threading. Measured on a 1080p 600-frame B-heavy stream: decoding 200 frames drops from 363 ms to 89 ms and 600 frames from 1048 ms to 246 ms on a 10-core host. Fixes #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #71: enable FFmpeg frame/slice threading.
thread_countdefaults to half of the logical cores (minimum 1), leaving headroom for the UI, audio and the rest of the system.thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE; FFmpeg reports the active mode inactive_thread_type.DIA_THREADSoverrides the count (1disables threading) for A/B measurements.Benchmark
big_buck_bunny.h264, 1920x1080, 600 frames (B 494 / P 103 / I 3), 10-core host, decode-only measurements:Backward/large seeks benefit most; short forward jumps from #66 improve less in absolute terms. Slice threading stays inactive on single-slice streams.
Verification
ctest: 72/72 pass (seek/step tests with frame threading enabled).tidy.sh ffmpeg/decoder.cpp: 0 issues.Notes
DIA_THREADS=1gives the old single-threaded behaviour when comparing.Fixes #71