/+junk/build-libffmpeg-for-chromium

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/build-libffmpeg-for-chromium

« back to all changes in this revision

Viewing changes to document.md

  • Committer: Gustav Hartvigsson
  • Date: 2021-06-07 20:27:50 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210607202750-5pxyhi0bzewu254g
Added first set of tests. (More to come).

Added script to do some processing of the LaTeX code to make nice looking tables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
geometry: margin=2cm
7
7
papersize: a4
8
8
mainfont: DejaVu Serif
9
 
fontsize: 12pt
 
9
fontsize: 11pt
10
10
---
11
11
 
12
12
# Abstract
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.
23
23
 
24
 
The note will conclude with a table that the improvements can make a difference
25
 
in responsiveness.
 
24
This note will show the differences between different versions of `libffmpeg.so`
 
25
in terms of decode lag, and discuss the findings.
26
26
 
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.
34
34
 
35
35
[^stadia]: Google's cloud gaming service.
36
36
 
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).
62
62
 
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
120
120
```
121
121
 
122
122
# Testing and Results
123
 
TODO
124
 
 
 
123
The web browser used is UngoogledChromium in a flatpak sandbox, started using
 
124
the following command:
 
125
```bash
 
126
flatpak run com.github.Eloston.UngoogledChromium
 
127
```
 
128
 
 
129
In `chrome://flags/` the following flags were set.
 
130
 
 
131
 
 
132
| **flag**                   | **value** |
 
133
|----------------------------|-----------|
 
134
| #ignore-gpu-blocklist      | enabled   |
 
135
| #enable-reader-mode        | enabled   |
 
136
| #enable-gpu-rasterization  | enabled   |
 
137
| #enable-vulkan             | enabled   |
 
138
 
 
139
 
 
140
Replacing the `libffmpeg.so` was done as follows:
 
141
```bash
 
142
cd ~/.local/share/flatpak/app/\
 
143
com.github.Eloston.UngoogledChromium/\
 
144
current/active/files/chromium/
 
145
 
 
146
mv libffmpeg.so old_libffmpeg.so_old
 
147
 
 
148
# Change dirctory to where the new libffmpeg.so was created
 
149
 
 
150
cp libffmpeg.so ~/.local/share/flatpak/app/\
 
151
com.github.Eloston.UngoogledChromium/\
 
152
current/active/files/chromium/
 
153
```
 
154
 
 
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.
 
162
 
 
163
[^StadiaEnhanced]: [https://github.com/ChristopherKlay/StadiaEnhanced](https://github.com/ChristopherKlay/StadiaEnhanced)
 
164
 
 
165
Between each session the computer idled for a bit before the next test was done.
 
166
 
 
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.
 
170
 
 
171
All tests with configuration options shown have been compiled
 
172
with `--enable-nonfree --enable-gpl --enable-version3`.
 
173
 
 
174
## Original
 
175
This version of `libffmpeg.so` was provided with UngoogledChromium.
 
176
 
 
177
## Hardware tables and microarchitecture optimised
 
178
**configuration options**
 
179
 
 
180
```
 
181
--enable-hardcoded-tables
 
182
--extra-cflags='-mtune=bdver3 -O2'
 
183
--extra-cxxflags='-mtune=bdver3 -O2'
 
184
--extra-objcflags='-mtune=bdver3 -O2'
 
185
--arch=amd64
 
186
--cpu=bdver3
 
187
```
 
188
 
 
189
**Test Results**
 
190
 
 
191
| **Test #** | **decode time (ms)** |
 
192
|------------|----------------------|
 
193
| 1          | 10.4                 |
 
194
| 2          | 10.0                 |
 
195
 
 
196
 
 
197
\pagebreak
125
198
# Refrences
126
199
[](){#ref:LeCuirot} _Le Cuirot, J,_ 2017, [FFmpeg-devel] build: Allow libffmpeg 
127
200
to be built for Chromium-based browsers, URL: