At the first commit of v0.93 (after the release of v0.92),
there is a "Merge the 3 threading models into a single one".
753eef83
Has anybody made before/after performance tests at this change?
Because the memory usage seems to be ~50% more (850 Mb vs. 1250 Mb at 4K/10-bit content)
and sometimes the CPU load is also higher with ~10% (55% vs 60% at 4K/8-bit content),
comparing the libdav1d 0.92 final and the 0.93 first commit with the new threading model.
I use libdav1d and FFmpeg 4.4.1 static x64 builds with my video player application,
on Windows 10, with a Core i7 CPU, probably AVX2 compatible.
The programatic difference can be that the FFmpeg lib uses unique thread number
calculation/configuration at the older libdav1d (in libavcodec/libdav1d.c),
which seems to be better than the new libdav1d internal code.
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
...
Linked items
0
Link issues together to show that they're related.
Learn more.
Performance has been tested extensively and generally shown to be equal or better while requiring less active threads.
If you are using a new dav1d, you should stop using the old framethreads and tilethreads options, and just specify a thread count you want using -threads.
Note that there is no "0.9.3", and you should always compare the very latest version, not the first version, as additional improvements have been made to the threading implementation.
(my CPU is not enough strong to decode 8K AV1 content, so I do testing with the 4k AV1 streams)
Btw. there is a small bug in FFmpeg too: there is a 1.5 multiplier at the thread count.
Removing it, I get a little less memory footprint (now it's only 50% more, not double).
I still see higher CPU load at 8-bit content (the 2. video), but I have no proper tool to measure the real decoding speed.
Maybe the FFmpeg's thread config is still wrong, but I don't know how could it be better.
The 'n_threads' is set to the number of logical cores (it seems).
I've tested/compiled a newer (01 Nov, 2021) libdav1d version too, but I don't see significant difference relative to the "threading model change" commit.
Btw. there is a small bug in FFmpeg too: there is a 1.5 multiplier at the thread count. Removing it, I get a little less memory footprint (now it's only 50% more, not double). I still see higher CPU load at 8-bit content (the 2. video), but I have no proper tool to measure the real decoding speed.
It's not a bug. It was done on purpose back in the day for the old threading model, but for the new one it's no longer needed. I'll backport the commit that removed that to the 4.4 branch.
Regarding the memory footprint, there isn't really an issue in the model, just in defaults. In the old system, FFmpeg would use n_threads = 1.5 * n_cores, and then use n_tilethreads == n_framethreads and n_tilethreads * n_framethreads == n_threads. Frame threads account for the large majority of memory usage, and n_framethreads = sqrt(1.5 * n_cores), and therefore memory is proportional to sqrt(1.5 * n_cores).
In the new system, we use (by default) max_framedelay = n_threads, and n_threads = n_cores. This means memory usage is now proportional to that (n_cores), which is higher than before for n_cores > 1 integer values.
This can easily be addressed by using a default max_framedelay = ceil(sqrt(n_threads)), but that introduces a libm dependency which I'm not sure we want to add. But that would perform roughly equally well on most content and use less memory.
I'm downloading one of the videos now to look further into this, it's slow & will take a while (~2hrs ETA).
I've prepared FFmpeg executables with different versions of LibdAV1d:
"v0.92 release", "Sept 3. 2021." (threading model change) and "Nov 5. 2021."
At pure/native decoding, the new threading model seems to be faster,
the only remaining disadvantage is the bigger memory footprint:
~350 Mb vs ~570 Mb at the 2nd (4k/8-bit) test file.
Speed test results of FFmpeg.exe with 3 different libdav1d versions on Intel Core i7 8650U / 16G RAM / Win10:
(command line is: ffmpeg441_[libdav1d_version].exe -i 4K_NEW_ZEALAND_ASCENDING.mp4 -f null -)