core: per-channel worker: issue an edge only when needed.

This is required to make worker algorithm compatible with edge counting.
The latter will be re-added.
Re-add "core: implement rise-fall counting for overlapping pulses to be handled correctly."

Revert "Revert "core: implement rise-fall counting for overlapping pulses to be handled correctly.""

This reverts commit 6f1bc8c24003e555aca4de531738d0f199d7630a.
core: edge counting: issue an actual edge only if needed (channel map modification is non-zero).
options: split definitions into a separate file.
all: sanitize includes, move common typedefs to common.h.
core, pulse_worker: split per-channel worker thread into a separate class.

This is needed for per-source "multichannel" workers.