I own a netcam with onboard motion detection, but I missed the config option 'detection area'.
Since I also have a Synology NAS (DS209), I used the included camera license and also set up motion detection running on the NAS. This is nice to compare the configuration of 2 MD-triggers, and they both have different notification mechanisms, each with their (dis)advantages.

Anyway, recently someone with the same NAS asked to configure his IP-cam (foscam), which has very limited options for MD and notification. Also the camera seems to have not so good brightness regulation, which is causing a lot of false detections in the NAS-software as well.

So I tried motion, and I love the flexibility in configuration. (capturing sources, motion detection parameters, and it's intermediate output to tweak the detection parameters)
However I'm (almost) running into a performance problem.

When I setup motionĀ for my netcam, the NAS has a cpu-load of 15-25% (MJPEG 640x480@2fps).
But the built in surveillance software can process the same mjpeg-stream (@10fps) with only a load of 1%.
On top of that, when I pause the motion detection, the load remains almost the same.

I already recompiled motion with the latest toolchain from synology (and hope some more optimizations would improve the situation).
Is there a way to find out what is causing this cpu-load (decompressing jpeg, noise-filter, motion-detection, updating reference-image, ...?)

I already added some timing info before compiling, and it looks like decompressing the jpeg takes ca 35-40ms. (passed time, not cpu-time)
so @2fps, lets say motion needs 100ms to decompress, which means 10% of the second is gone...
but how can the synology-surveillance station run @10fps with such a low load, and how can I 'port' this to motion?

so summarized:
-how can I find out which part of motion is 'eating' cpu-cycles
-is there a way to find out how synology-software is decoding jpegs? or why it's faster?

Hope someone can help me further.

Best regards,

PS. the cpu is "Marvell Kirkwood mv6281 ARM Processor":
Processor : ARM926EJ-S rev 1 (v5l)
BogoMIPS : 1192.75
Features : swp half thumb fastmult edsp
I read http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionPerformanceNonPCPlatforms it confirms the challenge to run on embedded hardware, but with 5 times the bogomips, and the fact that the built-in synology software does a lot better. I would like to pinpoint the bottleneck, and if possible implement a solution.