Hi Guys,
Maybe this [1] might help to increase performance.
I'm not sure which ffmpeg is supported now, but maybe that's a good
argument to upgrade.
Cheers
Sebastian
[1] https://developer.nvidia.com/ffmpeg
Hi Michael,
we use a modified version of the ffmpeg plugin with changes in
OpenSceneGraph\src\osgPlugins\ffmpeg\FFmpegDecoderVideo.cpp
to move the threads to different processors. (full modified file
attached) It's a crude bit of code,
but it allows us to decode and show 2 1920x1080 movies at 30 fps.
I've pulled out just the code for cpu affinity, this should work with
osg 3.4.2 as well as git master.
Regards, Laurens.
+ #define RESERVERD_CORES 2
+ static int next_cpu = RESERVERD_CORES;
void FFmpegDecoderVideo::decodeLoop()
{
FFmpegPacket packet;
double pts;
+ {
+ int num_cpus = OpenThreads::GetNumberOfProcessors();
+ if (num_cpus > RESERVERD_CORES + 1) {
+ int cpu = next_cpu;
+ ++next_cpu;
+ if (next_cpu >= num_cpus) next_cpu -= num_cpus -
RESERVERD_CORES;
+ if (cpu >= num_cpus) cpu -= num_cpus - RESERVERD_CORES;
+ OpenThreads::SetProcessorAffinityOfCurrentThread(cpu);
+ OSG_WARN << "FFmpegDecoderVideo::run :
OpenThreads::SetProcessorAffinityOfCurrentThread" << cpu << std::endl;
+ }
+ }
On Thu, Oct 5, 2017 at 4:54 PM, Robert Osfield <robert.osfi...@gmail.com
<mailto:robert.osfi...@gmail.com>> wrote:
Hi Michael,
On 5 October 2017 at 15:41, Michael Maurus <michael.mau...@web.de
<mailto:michael.mau...@web.de>> wrote:
This was actually a nice hint.
Only one of my CPUs was working at full capacity.
I haven't looked at the code recently so I'm a bit cold on the
ffmpeg implementation side. I don't recall any external way to
control the threads that the ffmpeg creates.
From what it sounds like is the threads that the ffmpeg plugin is
creating is inheriting the affinity of the thread that created
them. In OSG master there is finer grained control over the
affinity setting behaviour, in your case it might be appropriate to
disable the default setting of affinity.
In an ideal world you want to decided which threads you want to run
on what threads, but this reques knowledge of all the threads, their
needs, and the hardware you are working on.
FYI, the OSG by default tries to make a best guess based on your the
number of CPU cores the OS says the machine has and the
configuration of your viewer, this scheme doesn't know about any
extra threads that plugins might create though. This scheme is more
hardwired in OSG-3.4 and prior releases, so master might be the
thing to use if you do end up needing more control.
Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
<mailto:osg-users@lists.openscenegraph.org>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org