Files
daedalus-v4l2/daemon
claude-noether 814b74d0bb daemon: per-frame decode_us + periodic stats summary (#11 step 1)
Establishes observable baseline metrics before any daedalus-fourier
kernel substitution lands.  Step 1 of the daemon-rewrite arc tracked
at daedalus-v4l2#11.

Changes
-------
- Per-frame `decoder: OK ...` log line now carries decode_us=N (the
  send_packet + receive_frame wall-clock cost in microseconds —
  exclusively the libavcodec round-trip, not the bitstream pack /
  SPS-PPS synth / pack-to-planes work).
- New "decoder stats" summary line every DAEDALUS_STATS_EVERY (60)
  decoded frames, reporting: codec, frame count, window seconds,
  fps, avg decode_us, MBs/s throughput, bytes/MB bitrate.

Sample
------
  decoder stats: codec=h264 frames=300 window=12.32s fps=24.35
                 avg_decode_us=4216.4 mbs_per_s=87643 bs_b_per_mb=1.56

What this tells us
------------------
Steady-state on higgs (Pi CM5) decoding bbb_720p_h264.mp4:
~4 ms decode_us, ~90 K MBs/s, well under the daedalus-fourier
NEON kernel ceilings (IDCT 4×4 @ 175 Mblocks/s, deblock @ 92 Medges/s,
qpel mc20 @ 131 Mblocks/s — all 100-1000× over our actual workload).

Means the 4 ms/frame is mostly libavcodec's CABAC + MV prediction +
intra prediction overhead, NOT the pixel-math primitives.
Substituting a single primitive would shave only a small slice of
the 4 ms.  Useful as guidance for the upcoming substitution work —
we'll pick the primitive with the largest cycle cost relative to
the alternative, and measure CPU saved per substitution.

No behaviour change: counters are static + unsynchronised (the
chardev event loop is single-threaded); reset when codec_id changes.
clock_gettime(CLOCK_MONOTONIC) for timing.
2026-05-21 20:17:09 +02:00
..

daemon/ — daedalus-v4l2 userspace decoder daemon

Userspace daemon that:

  1. Connects to the kernel module's chardev
  2. Receives bitstream + V4L2 control blobs
  3. Parses bitstream via dlopen'd FFmpeg
  4. Dispatches per-block work via daedalus_dispatch_* from sibling daedalus-fourier
  5. Returns decoded frames to kernel

Status

Scaffold only. Phase 8.3 not yet started.

Build dependencies (planned)

  • libdaedalus_core.a from sibling daedalus-fourier (static link)
  • FFmpeg dev headers (for AVPacket/AVCodec interface types) + runtime FFmpeg .so (loaded via dlopen)
  • libv4l2 (for V4L2 control struct definitions)
  • pthread

Build (when implemented)

mkdir build && cd build
cmake .. -DDAEDALUS_FOURIER_DIR=/path/to/daedalus-fourier
make

Layout (planned)

  • CMakeLists.txt
  • src/main.c — event loop, chardev connection
  • src/parser.c — FFmpeg dlopen wrapper + per-codec dispatch
  • src/decode_vp9.c, src/decode_av1.c, src/decode_h264.c — per-codec block walkers
  • src/frame_io.c — frame allocation, return to kernel

License

BSD-2-Clause (matches daedalus-fourier sibling).

Phase 8.3 starting point

A standalone program that:

  1. Opens a .ivf or .mp4
  2. Pulls codec packets via dlopen'd avformat
  3. Calls dlopen'd avcodec to parse (without decoding)
  4. Walks the block-level metadata
  5. Validates output structure

No kernel involvement yet — just confirm the parse path works.