Skip to main content

Module alpha_processing

Module alpha_processing 

Source
Expand description

Translation of src/dsp/alpha_processing.c from libwebp v1.6.0.

Work package: WP4 (pixel ops).

§Deviations from upstream

Changes of representation that the ADRs allow, or behavior that the Rust side cannot reproduce exactly. Each records the reason.

  1. WebPMultARGBRows casts a byte pointer to uint32_t* in C. Rust has no safe reinterpretation, so the function takes &mut [u32] and a stride in u32 elements. The probe calls the C function with the stride in bytes, which reaches the same pixels.

§Checks not applicable

These checks do not apply, or cannot be made, with the reason:

  1. Big-endian sources. PackARGB_C and the WebPPackARGB pointer (WORDS_BIGENDIAN) are not compiled on little-endian hosts, which the reference configuration is.

Functions§

apply_alpha_multiply_c
Premultiplies the color channels of an RGBA or BGRA plane, or of an ARGB plane when alpha_first is set, in place.
dispatch_alpha_c
Copies the alpha plane into the A byte of each ARGB pixel of dst, which has dst_stride bytes per row. Returns whether an alpha value is not 0xff.
dispatch_alpha_to_green_c
Stores the alpha values in the green channel of each u32 pixel of dst, with the other channels zeroed. dst_stride counts u32 elements.
extract_alpha_c
Copies the A bytes of an ARGB plane to alpha. Returns whether every alpha value is 0xff.
extract_green_c
Copies the green byte of each u32 pixel to alpha.
pack_rgb_c
Packs len RGB or BGR pixels into opaque ARGB pixels. step is the number of bytes per pixel of the planes, 3 or 4, with the pixels of each plane at that stride.
webp_alpha_replace
Replaces every fully transparent pixel of src by color. The C dispatch pointer is AlphaReplace_C.
webp_apply_alpha_multiply
Premultiplies an RGBA, BGRA or ARGB plane of w by h pixels in place. alpha_first is set for ARGB, where alpha comes first.
webp_apply_alpha_multiply4444
Premultiplies an RGBA4444 plane of w by h pixels in place.
webp_dispatch_alpha
Dispatches the alpha values of alpha to the A bytes of dst. Returns whether an alpha value is not 0xff. The C dispatch pointer is DispatchAlpha_C.
webp_dispatch_alpha_to_green
Stores the alpha values in the green channel of dst. The C dispatch pointer is DispatchAlphaToGreen_C.
webp_extract_alpha
Extracts the alpha values of an ARGB byte plane. Returns whether every alpha value is 0xff. The C dispatch pointer is ExtractAlpha_C.
webp_extract_green
Copies the green byte of each u32 pixel to alpha. The C dispatch pointer is ExtractGreen_C.
webp_has_alpha8b
Whether any of the first length bytes of src is not 0xff. The C dispatch pointer is HasAlpha8b_C.
webp_has_alpha32b
Whether the alpha byte of any of the first length pixels of the RGBA byte plane src is not 0xff. The C dispatch pointer is HasAlpha32b_C.
webp_mult_argb_row
Premultiplies width ARGB pixels. The C dispatch pointer is WebPMultARGBRow_C.
webp_mult_argb_row_c
Premultiplies (or, with inverse, un-premultiplies) width ARGB pixels. Opaque pixels are unchanged and fully transparent ones become zero.
webp_mult_argb_rows
Premultiplies num_rows rows of ARGB pixels. stride counts u32 elements, where C counts bytes of the same buffer (ADR 0003).
webp_mult_row
Premultiplies one row of single values. The C dispatch pointer is WebPMultRow_C.
webp_mult_row_c
Premultiplies (or un-premultiplies) one row of single values with the alpha values of the same width.
webp_mult_rows
Premultiplies num_rows rows of single values, with the alpha values of each row in alpha.
webp_pack_rgb
Packs RGB or BGR planes into opaque ARGB pixels. The C dispatch pointer is PackRGB_C.