[FFmpeg-devel] [PATCH 13/39] lavc/ffv1: drop redundant PlaneContext.quant_table

Michael Niedermayer michael at niedermayer.cc
Thu Jul 18 20:40:04 EEST 2024


On Thu, Jul 18, 2024 at 10:20:09AM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2024-07-18 00:32:38)
> > the data for each decoder task should be together and not scattered around
> > more than needed, reducing cache efficiency
> > 
> > putting all this extra code in the inner per pixel loop is not ok
> > especially not for the sake of avoiding a memcpy of a few hundread bytes multiple levels of loops outside
> 
> A nice theory, but in practice this patchset makes single-threaded
> decoding about 4% faster overall, on a 1920x1080 10bit sample. That's
> just the ffv1 parts (up to patch 28), full set also improves frame
> threading performance as follows:
> threads         improvement
> ---------------------------
> 2                  52% (yes really)
> 4                  16%
> 8                  12%

I do want the speed improvements, yes.

But
you compare frame threading when slice threading performed
much better than frame threading prior to the patch

also id like to see the individual changes which look like they should
make teh code slower, to be tested individually. If they make the code slower
they should be dropped

Also the code has a bug, benchmarks may theoretically changes once it is fixed

using matrixbench
-i matrixbench_mpeg2.mpg -an -vcodec ffv1  -slices 4 -t 100 -coder 1  -context 1 -bitexact /tCmp/ffv1.2-11.avi

prior patchset:
time ./ffmpeg -thread_type slice  -threads 1 -i /tmp/ffv1.2-11.avi -f null -
real	0m31.976s
user	0m32.001s
sys	0m0.080s

time ./ffmpeg -thread_type slice  -threads 2 -i /tmp/ffv1.2-11.avi -f null -
real	0m18.086s
user	0m34.199s
sys	0m0.089s

time ./ffmpeg   -threads 2 -i /tmp/ffv1.2-11.avi -f null -
real	0m33.578s
user	0m33.611s
sys	0m0.052s

time ./ffmpeg -thread_type slice  -threads 4 -i /tmp/ffv1.2-11.avi -f null -
real	0m9.189s
user	0m33.608s
sys	0m0.073s

time ./ffmpeg   -threads 4 -i /tmp/ffv1.2-11.avi -f null -
real	0m11.159s
user	0m32.712s
sys	0m0.124s


post patchset:
time ./ffmpeg -thread_type slice  -threads 1 -i /tmp/ffv1.2-11.avi -f null -
eal	0m31.755s
user	0m31.758s
sys	0m0.096s

time ./ffmpeg -thread_type slice  -threads 2 -i /tmp/ffv1.2-11.avi -f null -
real	0m17.481s
user	0m33.385s
sys	0m0.076s

time ./ffmpeg   -threads 2 -i /tmp/ffv1.2-11.avi -f null -
real	0m16.893s
user	0m33.465s
sys	0m0.113s

time ./ffmpeg -thread_type slice  -threads 4 -i /tmp/ffv1.2-11.avi -f null -
real	0m9.180s
user	0m33.500s
sys	0m0.088s

time ./ffmpeg   -threads 4 -i /tmp/ffv1.2-11.avi -f null -
real	0m8.811s
user	0m33.338s
sys	0m0.061s



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240718/247de809/attachment.sig>


More information about the ffmpeg-devel mailing list