Production Codec and Filter Walkthroughs
These larger algorithms need their image geometry, coefficient tables, and scratch ownership to be meaningful. Follow the pinned production call chains below; the smaller runnable examples teach the same SIMD integration patterns.
Convolution: Production Call Chain
This source walkthrough traces the actual zen/zenresize implementation at
33c7c10c0a5cd07a299b61ce2e239d6cbae57a4d. Follow the chain in order; these links include the definitions that a
standalone copy would otherwise omit.
- Streaming row processing.
- simd::filter_h_row_f32 and incant!.
- Generated NEON/WASM filter_h_row_f32_impl selects channels.
- filter_h_4ch<T: F32x4Backend> accumulates each weighted RGBA pixel.
- F32WeightTable owns the coefficient/extent contract.
Four channels use one f32x4 per pixel; three-channel and general-channel paths are separate algorithms. The bounds of the input, output and weight table must agree. The complete implementation includes those types; the previous shortened snippet omitted its scalar paths. Do not infer that a generic token alone enables features: the generated caller supplies the context.
Gaussian Blur: Production Call Chain
This source walkthrough traces the actual zen/zenpipe implementation at
12b468e3e0a8ef46e2eeb1c92d7b1a859e53036a. Follow the chain in order; these links include the definitions that a
standalone copy would otherwise omit.
- SIMD dispatch functions.
- gaussian_blur_plane_dispatch_simd generates NEON/WASM contexts and selects the algorithm.
- gaussian_blur_fir_generic<T: F32x8Backend + F32x8Convert + Copy> performs the FIR passes.
- stackblur_plane_generic handles the selected large-radius path.
- FilterContext owns reusable scratch allocations.
The full chain includes image dimensions, edge padding, kernel selection, and scratch-buffer ownership. These are required for a faithful blur example. The previous partial snippet omitted their definitions. Generated entry functions can call generic helpers directly; nested incant! also supports tier-specific helpers, so explicit suffixed calls are not universally required.
Quantization: Production Call Chain
This source walkthrough traces the actual zen/zenjpeg implementation at
fad6a0afd2efed488f4048efe5112753e20412c7. Follow the chain in order; these links include the definitions that a
standalone copy would otherwise omit.
- QuantTableSimd and ZeroBiasSimd define the 8×8 block and threshold inputs.
- quantize_block calls incant!(mage_quantize_block(...)).
- The macro generates the f32x8/i32x8 quantization body.
The body scales coefficients, forms a threshold mask, calls to_i32_round(), bitcasts the mask to i32, blends, and stores natural-order coefficients. Check the coefficient range and rounding contract before claiming identical results on all ISAs. A separately named quantize_block_with_zero_bias_simd in quant/mod.rs is currently a scalar loop; its name alone is not evidence of this dispatch chain.
Color Conversion: Verify the Actual Path
This source walkthrough traces the actual zen/zenjpeg implementation at
fad6a0afd2efed488f4048efe5112753e20412c7. Follow the chain in order; these links include the definitions that a
standalone copy would otherwise omit.
- rgb_to_ycbcr_planes validates dimensions, allocates output planes and iterates batches.
- simd::rgb_to_ycbcr_x4 performs scalar FMA and rounds/clamps each lane.
The current function converts interleaved RGB8 into separate Y/Cb/Cr byte planes. Despite the helper module name simd, this path is scalar arithmetic. The previous float-plane magetypes example did not describe this production chain and has been removed. For a complete, current dispatched color-transfer example, use the linear-srgb gamma chain in the transcendental guide.