nx_deblock.nx
buildroot/runtime/nx_deblock.nx
about
nx_deblock.nx -- in-loop deblocking filter for 8x8 block-grid
reconstructions. Substrate primitive that smooths the quantisation
discontinuities at block boundaries without touching real edges.
Algorithm (simple, public): for each boundary (horizontal between
rows 7-8, 15-16, ...; vertical between cols 7-8, 15-16, ...) take
the four pixels straddling the line:
p1, p0 | q0, q1
If the local variation is small (|p1-p0| < T && |q0-q1| < T && |p0-q0|
< T2), apply a low-pass filter that pulls p0 and q0 toward the
average across the boundary. Otherwise leave the pixels alone
(preserves real edges).
This is structurally what H.263 Annex J and H.264's deblocking
filter do; the simple variant here re-derives from the underlying
public idea (filter only smooth regions) without copying their
boundary-strength tables or per-block-mode dispatch. Quality is
modest; the row goes from LOSE to WIN on the substrate axis once
the feature exists. Stronger variants are named improvements.
genealogy_id: itu_t_h_263_annex_j + h264_8_7_deblock + jpeg2000_visual +
nx_video_codec_v1_q10
lineage_id: nishi_deblock_q10
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_video_codec.nx
structs
| none |
consts
| 33 | const NX_DB_VERDICT_UNKNOWN: i64 = 0 |
| 34 | const NX_DB_VERDICT_OK: i64 = 1 |
| 35 | const NX_DB_VERDICT_BAD_PARAMS: i64 = 2 |
| 36 | const NX_DB_VERDICT_N: i64 = 3 |
| 38 | const NX_DB_BLOCK: i64 = 8 |
| 39 | const NX_DB_T1: i64 = 16 // |p1-p0| threshold |
| 40 | const NX_DB_T2: i64 = 32 // |p0-q0| threshold |
functions
| 42 | func _db_abs(x: i64) -> i64 called by 1: _db_filter4 |
| 60 | func _db_filter4(p1: i64, p0: i64, q0: i64, q1: i64, |
| 88 | func nx_deblock_horizontal(img: *i64, W: i64, H: i64) -> i64 |
| 113 | func nx_deblock_vertical(img: *i64, W: i64, H: i64) -> i64 |
| 138 | func nx_deblock(img: *i64, W: i64, H: i64) -> i64 |
| 144 | func nx_deblock_verdict_is_valid(v: i64) -> i64 |