feat(codec): implement software H.264 encode/decode round-trip

Add FFmpeg-based encoder/decoder with SPS/PPS extradata, Annex-B output

normalization, low-latency libx264 settings, and a round-trip unit test.

Includes review hardening: cached SwsContext, bitrate-only rate control,

std::byte/uin8_t cast helpers, and richer test assertions.
This commit is contained in:
2026-09-07 10:07:50 +02:00
parent 50369995c7
commit 71218b1b1f
12 changed files with 946 additions and 32 deletions
+5 -5
View File
@@ -20,10 +20,10 @@ previous one is validated.
**Goal**: encode raw pixel buffers to H.264 and decode them back, purely with
FFmpeg software paths.
- Add `libavcodec`, `libavutil`, `libswscale` dependencies.
- Implement `EncoderFactory::create()` and `Encoder::encode()`.
- Implement `DecoderFactory::create()` and `Decoder::decode()`.
- Round-trip test: synthetic RGB frames → H.264 → decoded RGB.
- [x] Add `libavcodec`, `libavutil`, `libswscale` dependencies.
- [x] Implement `EncoderFactory::create()` and `Encoder::encode()`.
- [x] Implement `DecoderFactory::create()` and `Decoder::decode()`.
- [x] Round-trip test: synthetic RGB frames → H.264 → decoded RGB.
**Validation**: unit test produces visually/structurally correct round-trip
frames.
@@ -89,4 +89,4 @@ where available.
## Current phase
Phase 2software H.264 encode/decode.
Phase 3PipeWire screen capture.