wip: deblock dispatch

This commit is contained in:
2026-05-25 23:14:24 +02:00
parent 418053db8d
commit 321f94bba9
3 changed files with 240 additions and 1 deletions
+55
View File
@@ -41,6 +41,46 @@ extern "C" {
* ----------------------------------------------------------------- */
typedef struct daedalus_decoder daedalus_decoder;
/* -------------------------------------------------------------------
* Per-edge deblock metadata. One entry per filter-edge; the caller
* derives these from H.264 §8.7.2.1 boundary-strength rules.
*
* Coordinate convention:
* mb_x / mb_y — the MB whose top-left this edge sits on (the "right"
* side for vertical edges, "bottom" side for horizontal
* edges, in H.264 spec's q-side convention).
* edge_idx — 0..3 within the MB:
* luma: edge 0 = MB boundary, edges 1..3 = internal
* at cols/rows 4, 8, 12.
* chroma: edge 0 = MB boundary, edge 1 = internal at
* col/row 4. edge_idx > 1 invalid for chroma.
* Edges at frame boundaries (top row of MBs for H edges;
* left column for V edges) MUST be bS=0 — the kernel
* reads p3 at four samples beyond the edge.
* orient — 0 = vertical edge (filtered horizontally across), 1 = horizontal.
* plane — 0 = luma, 1 = chroma Cb, 2 = chroma Cr. Cb and Cr
* always share the same filter parameters per H.264
* spec, but are listed separately so the caller can
* omit one or the other if needed.
* bS — 0 = skip this edge (no GPU work), 1..3 = bS<4 path
* (uses tc0), 4 = bS=4 "intra" path (ignores tc0).
* alpha, beta — H.264 §8.7.2.2 table 8-16/8-17 values, both 0..255.
* tc0[4] — per-4-cell segment strength along the edge (luma has
* 4 segments; chroma has 4 also, with 2 cells each).
* IGNORED when bS == 4.
* ----------------------------------------------------------------- */
struct daedalus_decoder_edge {
uint16_t mb_x;
uint16_t mb_y;
uint8_t edge_idx;
uint8_t orient;
uint8_t plane;
uint8_t bS;
uint8_t alpha;
uint8_t beta;
int8_t tc0[4];
};
/* -------------------------------------------------------------------
* Per-macroblock input. Mirrors §3 of DESIGN.md. The caller's
* libavcodec intercept populates this from the H264SliceContext
@@ -109,6 +149,21 @@ struct daedalus_decoder_mb_input {
* (the per-frame predicted buffer is zeroed at flush time so a NULL
* is indistinguishable from explicit zeros). */
const uint8_t *predicted; /* NULL or exactly 384 uint8_t */
/* Per-MB deblock edges — caller-derived per H.264 §8.7.2. Typical
* count: 4 V-luma + 4 H-luma + 2 V-Cb + 2 H-Cb + 2 V-Cr + 2 H-Cr
* = 16 edges per MB (omit zero-bS edges if preferred — frame
* boundaries MUST be bS=0 since the kernels read p3 at four
* samples beyond the edge). daedalus_decoder routes each entry
* to the appropriate luma/chroma × V/H × bS=4/<4 dispatch in
* flush_frame and pays a single Vulkan submit per non-empty
* (direction × bS-band) partition (≤8 deblock submits / frame
* total) per the Q1 architecture decision (one-submit-per-kernel
* for now; cmdbuf-builder deferred to Stage 4).
*
* NULL or n_edges == 0 → no deblock on this MB. */
const struct daedalus_decoder_edge *edges;
uint8_t n_edges;
};
/* -------------------------------------------------------------------