[Ffmpeg-devel] Threading in libavcodec
Mon Jan 23 16:10:48 CET 2006
M?ns Rullg?rd wrote:
>>> Fourth, some random speed results (defaults, vhq4, NO bframes. X2
>>> 4200+ CPU).
>>> 1 thread : 1:48
>>> 2 threads : 1:05
>>> 3 threads : 1:06
>>> 4 threads : 1:08
>>> 16 threads: 1:11
>> So, as I said, it scales pretty well.
> What are those numbers? Minutes:seconds? Then it's a far cry from what I'd
> say scales well. A speedup of 1.66 for two threads is decent but hardly
> impressive. And before you can talk about scalability you'd need to test
> it on something with a few more CPUs.
Yeah they are minutes:seconds for encoding his test clip. The
problem with his algorithm (imo) is that he uses a busy wait loop like
while (nothingtodo) ; That means if you start more threads than you
have cpus, you're going to get a real performance hit. I did mine with
semaphores so the kernel handles what the threads do when there's no
work to do (and coincidently got the same 39% improvement in the 2
thread case, but stayed the same up to 4 threads).
In xvid VHQ1 mode, the motion search takes 50% of encoder time and
80% in VHQ4 mode. Based on that, the theoretical max improvement would
2 cpus: 25% - 40%
3 cpus: 33.% - 53.3%
4 cpus: 37.5% - 60%
More information about the ffmpeg-devel