diff --git a/src/daedalus_decoder.c b/src/daedalus_decoder.c index 8394df6..90cacad 100644 --- a/src/daedalus_decoder.c +++ b/src/daedalus_decoder.c @@ -298,21 +298,27 @@ static int dispatch_deblock_pass( uint8_t *, size_t, size_t, const daedalus_h264_deblock_meta *); + /* daedalus-fourier kernel naming convention: + * _v = "v_loop_filter" — filter applied VERTICALLY across a + * HORIZONTAL edge. Use for our orient=1 (H edge). + * _h = "h_loop_filter" — filter applied HORIZONTALLY across a + * VERTICAL edge. Use for our orient=0 (V edge). + * The names refer to the FILTER DIRECTION, not the edge direction. */ deblock_dispatch_fn fn; if (target_plane == 0) { - if (target_orient == 0) - fn = target_bS_intra ? daedalus_dispatch_h264_deblock_luma_v_intra - : daedalus_dispatch_h264_deblock_luma_v; - else + if (target_orient == 0) /* V edge → h_loop_filter */ fn = target_bS_intra ? daedalus_dispatch_h264_deblock_luma_h_intra : daedalus_dispatch_h264_deblock_luma_h; + else /* H edge → v_loop_filter */ + fn = target_bS_intra ? daedalus_dispatch_h264_deblock_luma_v_intra + : daedalus_dispatch_h264_deblock_luma_v; } else { if (target_orient == 0) - fn = target_bS_intra ? daedalus_dispatch_h264_deblock_chroma_v_intra - : daedalus_dispatch_h264_deblock_chroma_v; - else fn = target_bS_intra ? daedalus_dispatch_h264_deblock_chroma_h_intra : daedalus_dispatch_h264_deblock_chroma_h; + else + fn = target_bS_intra ? daedalus_dispatch_h264_deblock_chroma_v_intra + : daedalus_dispatch_h264_deblock_chroma_v; } return fn(dec->dctx, sub, scratch, stride, n, meta_scratch); diff --git a/tests/test_deblock_smoke.c b/tests/test_deblock_smoke.c index 16d5524..7a686a8 100644 --- a/tests/test_deblock_smoke.c +++ b/tests/test_deblock_smoke.c @@ -105,28 +105,43 @@ static int build_mb_edges(int mb_x, int mb_y, int last_mb_x, int last_mb_y, (e == 0) ? 4 : (int)(1 + xs64() % 3), /*boundary?*/ (e == 0 && mb_y == 0)); - /* V chroma Cb: 2 edges. */ + /* V chroma Cb: 2 edges. Read DEBLOCK_CHROMA_MODE env at runtime: + * unset / "all" → both edges (current default test). + * "intra_only" → only bS=4 boundary edge. + * "none" → all chroma edges bS=0 (luma-only test). + * Lets us bisect substrate divergence without rebuilding. */ + int chroma_intra_only = 0, chroma_none = 0; + const char *cm = getenv("DEBLOCK_CHROMA_MODE"); + if (cm) { + if (!strcmp(cm, "intra_only")) chroma_intra_only = 1; + else if (!strcmp(cm, "none")) chroma_none = 1; + } + for (int e = 0; e < 2; e++) EDGE(0, /*Cb*/1, e, (e == 0) ? 4 : (int)(1 + xs64() % 3), + (chroma_none) || (chroma_intra_only && e != 0) || (e == 0 && mb_x == 0)); /* H chroma Cb. */ for (int e = 0; e < 2; e++) EDGE(1, 1, e, (e == 0) ? 4 : (int)(1 + xs64() % 3), + (chroma_none) || (chroma_intra_only && e != 0) || (e == 0 && mb_y == 0)); /* V chroma Cr. */ for (int e = 0; e < 2; e++) EDGE(0, /*Cr*/2, e, (e == 0) ? 4 : (int)(1 + xs64() % 3), + (chroma_none) || (chroma_intra_only && e != 0) || (e == 0 && mb_x == 0)); /* H chroma Cr. */ for (int e = 0; e < 2; e++) EDGE(1, 2, e, (e == 0) ? 4 : (int)(1 + xs64() % 3), + (chroma_none) || (chroma_intra_only && e != 0) || (e == 0 && mb_y == 0)); #undef EDGE