21
21
from source and how to produce `libffmpeg.so` on a GNU/Linux system, as the
22
22
standard `make script` does not produce it.
24
The note will conclude with a table that the improvements can make a difference
24
This note will show the differences between different versions of `libffmpeg.so`
25
in terms of decode lag, and discuss the findings.
27
27
# Introduction and Motivation
28
28
The author of was playing games on Stadia[^stadia] and using a plug-in for
29
29
Chrome(ium) measured that the decode time was higher than optimal when playing
30
30
intensive games (in the order of 10+ ms) running on his older
31
31
hardware[^hardware] without hardware acceleration, and the quite high CPU usage.
32
The author wanted to see if using a specific microarchitecture (m-arch)
33
would lower the decode lag.
32
The author wanted to see if using a specific microarchitecture (m-arch) when
33
compiling the library would lower the decode lag.
35
35
[^stadia]: Google's cloud gaming service.
58
58
Piledriver microarchitecture [(Wikipedia, Piledriver)](#ref:WikPiledriver),
59
59
which is AMD's 15th microarchitecture family. This would make it one of the
60
60
`bdver` class microarchitectures
61
[GCC Manual (2021)](#ref:GccManual).
61
[(GCC Manual, 2021)](#ref:GccManual).
63
63
Configure the build system for ffmpeg to use the correct architecture. This
64
64
could be a bit of trail-and-error to figure out, when building: target the
122
122
# Testing and Results
123
The web browser used is UngoogledChromium in a flatpak sandbox, started using
124
the following command:
126
flatpak run com.github.Eloston.UngoogledChromium
129
In `chrome://flags/` the following flags were set.
132
| **flag** | **value** |
133
|----------------------------|-----------|
134
| #ignore-gpu-blocklist | enabled |
135
| #enable-reader-mode | enabled |
136
| #enable-gpu-rasterization | enabled |
137
| #enable-vulkan | enabled |
140
Replacing the `libffmpeg.so` was done as follows:
142
cd ~/.local/share/flatpak/app/\
143
com.github.Eloston.UngoogledChromium/\
144
current/active/files/chromium/
146
mv libffmpeg.so old_libffmpeg.so_old
148
# Change dirctory to where the new libffmpeg.so was created
150
cp libffmpeg.so ~/.local/share/flatpak/app/\
151
com.github.Eloston.UngoogledChromium/\
152
current/active/files/chromium/
155
Measuring of decode time was done using the Stadia Enhanced[^StadiaEnhanced],
156
that provides a way of monitoring -- among other thing -- how long it takes to
157
decode a frame (the decode lag). The test consisted of playing _DOOM: Eternal -
158
The Ancient Gods: Part 1_ in an almost canned test that consisted of playing
159
the same for 25 minutes and manually looking at the information provided by
160
the Stadia Enhanced plug-in. Generally, the decode time goes up the longer the
161
play session is, but seems level off after 25 minutes.
163
[^StadiaEnhanced]: [https://github.com/ChristopherKlay/StadiaEnhanced](https://github.com/ChristopherKlay/StadiaEnhanced)
165
Between each session the computer idled for a bit before the next test was done.
167
Bellow follows the results, each subsection starts with what flags were used to
168
build the version of ffmpeg used in that test, the exception being the 'original'
169
test, that will only provide decode times.
171
All tests with configuration options shown have been compiled
172
with `--enable-nonfree --enable-gpl --enable-version3`.
175
This version of `libffmpeg.so` was provided with UngoogledChromium.
177
## Hardware tables and microarchitecture optimised
178
**configuration options**
181
--enable-hardcoded-tables
182
--extra-cflags='-mtune=bdver3 -O2'
183
--extra-cxxflags='-mtune=bdver3 -O2'
184
--extra-objcflags='-mtune=bdver3 -O2'
191
| **Test #** | **decode time (ms)** |
192
|------------|----------------------|
126
199
[](){#ref:LeCuirot} _Le Cuirot, J,_ 2017, [FFmpeg-devel] build: Allow libffmpeg
127
200
to be built for Chromium-based browsers, URL: