mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-28 12:07:48 -06:00
Much of a layer buffer is often transparent (a stroked ring, a glow-padded text layer, a precomp canvas), yet every destination pixel sampled it bilinearly, and 8/16 bpc comps then re-quantised the layer's whole rotated bounding box. - Bilinear warps skip 16x16 source tiles whose pixels (and a one-pixel apron) all have zero alpha: their samples are transparent and were never drawn. - The fast affine warp reports the rectangle it changed and, given the comp's levels, quantises each pixel as it blends it, so draw_comp has nothing left to re-quantise for that layer. quantize_px moves to effectcraft-raster for this. - quantize_rect skips runs of four all-zero (+0.0) pixels, which quantise to themselves. - to_rgba8 / to_rgba8_over convert row by row instead of per 4-byte item. Every pixel stays bit-identical: tests compare the warp against the reference path, fused quantising against quantising after blending, and the zero-run skip against per-pixel quantising. With the previous commit, demo comp to H.264 (`cargo xtask bench --scenario demo --format h264 --frames 300`, 11 interleaved runs on a 16-thread Ryzen): wall 9.26 s -> 6.97 s median (-24.8%), 8.55 s -> 6.55 s min (-23.3%); CPU time -23%. Output byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>