zoomvtools 1.1.1

Video motion vector analysis utilities in pure Rust
Documentation
# REDUCE KNOWLEDGE BASE

**Generated:** 2026-04-17

## OVERVIEW

Downsampling filters for pyramid construction at 2x reduction. Quality/speed trade-offs selected by reduce mode.

## STRUCTURE

```
src/reduce/
├── average/    # 2x2 box filter (fastest)
├── triangle/   # 3-tap kernel (1/4, 1/2, 1/4)
├── bilinear/   # 4-tap weighted (mid quality)
├── quadratic/  # 6-tap kernel (best quality)
├── cubic/      # 6-tap kernel (sharp detail)
└── reduce.rs   # Module root, dispatch
```

## WHERE TO LOOK

| Path | Role | Notes |
|------|------|-------|
| `average/` | 2x2 box filter | Fastest; baseline speed path |
| `triangle/` | 3-tap kernel | Weights `(1/4, 1/2, 1/4)` |
| `bilinear/` | 4-tap weighted | Speed/quality midpoint |
| `quadratic/` | 6-tap kernel | Best quality |
| `cubic/` | 6-tap kernel | Preserves sharp detail |

## CONVENTIONS (REDUCE-SPECIFIC)

- Two-pass flow: vertical pass then horizontal pass. Never mix H+V math in one pass.
- Each filter directory: `rust.rs`, `avx2.rs`, `tests.rs`; `avx2.rs` compiles only with `avx2` feature.
- Kernel coefficients documented in each `rust.rs`.
- Entry point consumed by `MVPlane::reduce_to()`.
- Scalar and AVX2 paths must produce equivalent per-pass results.
- Edge handling identical across all filter variants.

## ANTI-PATTERNS

- Mixing horizontal+vertical math in one pass; breaks shared pass semantics.
- Diverging coefficients between scalar and AVX2 implementations.
- Changing kernel constants without updating docs and tests in the same filter.
- Per-call scratch allocation in hot loops instead of reusable buffers.