Skip to main content

decimate_weighted

Function decimate_weighted 

Source
fn decimate_weighted(
    p0: PremulRgba8,
    p1: PremulRgba8,
    p2: PremulRgba8,
    p3: PremulRgba8,
) -> PremulRgba8
Expand description

Blend 4 RGBA pixels using [1,3,3,1]/8 binomial weights.

Computes (p0 + 3×p1 + 3×p2 + p3) / 8 using efficient integer arithmetic (right shift). This binomial pattern approximates a Gaussian and contributes variance=0.75 to the blur. Adds 4 before the shift to implement round-to-nearest instead of floor division.