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.
WebPMultARGBRowscasts a byte pointer touint32_t*in C. Rust has no safe reinterpretation, so the function takes&mut [u32]and a stride inu32elements. 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:
- Big-endian sources.
PackARGB_Cand theWebPPackARGBpointer (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_firstis set, in place. - dispatch_
alpha_ c - Copies the alpha plane into the A byte of each ARGB pixel of
dst, which hasdst_stridebytes 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
u32pixel ofdst, with the other channels zeroed.dst_stridecountsu32elements. - 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
u32pixel toalpha. - pack_
rgb_ c - Packs
lenRGB or BGR pixels into opaque ARGB pixels.stepis 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
srcbycolor. The C dispatch pointer isAlphaReplace_C. - webp_
apply_ alpha_ multiply - Premultiplies an RGBA, BGRA or ARGB plane of
wbyhpixels in place.alpha_firstis set for ARGB, where alpha comes first. - webp_
apply_ alpha_ multiply4444 - Premultiplies an RGBA4444 plane of
wbyhpixels in place. - webp_
dispatch_ alpha - Dispatches the alpha values of
alphato the A bytes ofdst. Returns whether an alpha value is not 0xff. The C dispatch pointer isDispatchAlpha_C. - webp_
dispatch_ alpha_ to_ green - Stores the alpha values in the green channel of
dst. The C dispatch pointer isDispatchAlphaToGreen_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
u32pixel toalpha. The C dispatch pointer isExtractGreen_C. - webp_
has_ alpha8b - Whether any of the first
lengthbytes ofsrcis not 0xff. The C dispatch pointer isHasAlpha8b_C. - webp_
has_ alpha32b - Whether the alpha byte of any of the first
lengthpixels of the RGBA byte planesrcis not 0xff. The C dispatch pointer isHasAlpha32b_C. - webp_
mult_ argb_ row - Premultiplies
widthARGB pixels. The C dispatch pointer isWebPMultARGBRow_C. - webp_
mult_ argb_ row_ c - Premultiplies (or, with
inverse, un-premultiplies)widthARGB pixels. Opaque pixels are unchanged and fully transparent ones become zero. - webp_
mult_ argb_ rows - Premultiplies
num_rowsrows of ARGB pixels.stridecountsu32elements, 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_rowsrows of single values, with the alpha values of each row inalpha. - webp_
pack_ rgb - Packs RGB or BGR planes into opaque ARGB pixels. The C dispatch pointer is
PackRGB_C.