Module webp

Source
Expand description

libwebp FFI.

Constants§

MODE_ARGB
MODE_Argb
MODE_BGR
MODE_BGRA
MODE_LAST
MODE_RGB
MODE_RGBA
MODE_RGBA_4444
MODE_RGB_565
MODE_YUV
MODE_YUVA
MODE_bgrA
MODE_rgbA
MODE_rgbA_4444
VP8_ENC_ERROR_BAD_DIMENSION
VP8_ENC_ERROR_BAD_WRITE
VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY
VP8_ENC_ERROR_FILE_TOO_BIG
VP8_ENC_ERROR_INVALID_CONFIGURATION
VP8_ENC_ERROR_LAST
VP8_ENC_ERROR_NULL_PARAMETER
VP8_ENC_ERROR_OUT_OF_MEMORY
VP8_ENC_ERROR_PARTITION0_OVERFLOW
VP8_ENC_ERROR_PARTITION_OVERFLOW
VP8_ENC_ERROR_USER_ABORT
VP8_ENC_OK
WEBP_CSP_ALPHA_BIT
WEBP_CSP_UV_MASK
WEBP_DECODER_ABI_VERSION
WEBP_ENCODER_ABI_VERSION
WEBP_HINT_DEFAULT
WEBP_HINT_GRAPH
WEBP_HINT_LAST
WEBP_HINT_PHOTO
WEBP_HINT_PICTURE
WEBP_MAX_DIMENSION
WEBP_PRESET_DEFAULT
WEBP_PRESET_DRAWING
WEBP_PRESET_ICON
WEBP_PRESET_PHOTO
WEBP_PRESET_PICTURE
WEBP_PRESET_TEXT
WEBP_YUV420
WEBP_YUV420A

Functions§

webp_blend_alpha
webp_cleanup_transparent_area
Helper function: given a width x height plane of RGBA or YUV(A) samples clean-up or smoothen the YUV or RGB samples under fully transparent area, to help compressibility (no guarantee, though).
webp_config_init
Should always be called, to initialize a fresh WebPConfig structure before modification.
webp_config_init_internal
Internal, version-checked, entry point
webp_config_lossless_preset
Activate the lossless compression mode with the desired efficiency level between 0 (fastest, lowest compression) and 9 (slower, best compression).
webp_config_preset
This function will initialize the configuration according to a predefined set of parameters (referred to by ‘preset’) and a given quality factor.
webp_decode
Non-incremental version. This version decodes the full data at once, taking ‘config’ into account.
webp_decode_argb
Same as WebPDecodeRGBA, but returning A, R, G, B, A, R, G, B… ordered data.
webp_decode_argb_into
webp_decode_bgr
Same as WebPDecodeRGB, but returning B, G, R, B, G, R… ordered data.
webp_decode_bgr_into
webp_decode_bgra
Same as WebPDecodeRGBA, but returning B, G, R, A, B, G, R, A… ordered data.
webp_decode_rgb
Same as WebPDecodeRGBA, but returning R, G, B, R, G, B… ordered data. If the bitstream contains transparency, it is ignored.
webp_decode_rgb_into
RGB and BGR variants. Here too the transparency information, if present, will be dropped and ignored.
webp_decode_rgba
Decodes WebP images pointed to by ‘data’ and returns RGBA samples, along with the dimensions in *width and *height.
webp_decode_rgba_into
These five functions are variants of the above ones, that decode the image directly into a pre-allocated buffer ‘output_buffer’.
webp_decode_yuv
Decode WebP images pointed to by ‘data’ to Y’UV format(*).
webp_decode_yuv_into
WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly into pre-allocated luma/chroma plane buffers.
webp_decodebgra_into
webp_encode
Main call
webp_encode_bgr
One-stop-shop call! No questions asked:
webp_encode_bgra
One-stop-shop call! No questions asked:
webp_encode_lossless_bgr
One-stop-shop call! No questions asked:
webp_encode_lossless_bgra
One-stop-shop call! No questions asked:
webp_encode_lossless_rgb
One-stop-shop call! No questions asked:
webp_encode_lossless_rgba
One-stop-shop call! No questions asked:
webp_encode_rgb
One-stop-shop call! No questions asked:
webp_encode_rgba
One-stop-shop call! No questions asked:
webp_free
Releases memory returned by the WebPDecode*() functions (from decode.h).
webp_free_dec_buffer
Free any memory associated with the buffer. Must always be called last.
webp_get_decoder_version
Return the decoder’s version number, packed in hexadecimal using 8bits for each of major/minor/revision.
webp_get_encoder_version
Return the encoder’s version number, packed in hexadecimal using 8bits for each of major/minor/revision.
webp_get_features_internal
Internal, version-checked, entry point.
webp_get_info
Retrieve basic header information: width, height.
webp_iappend
Copies and decodes the next available data.
webp_idec_get_rgb
Returns the RGB/A image decoded so far.
webp_idec_get_yuva
Same as above function to get a YUVA image.
webp_idecode
Instantiate a new incremental decoder object with the requested configuration.
webp_idecoded_area
Generic call to retrieve information about the displayable area.
webp_idelete
Deletes the WebPIDecoder object and associated memory.
webp_inew_decoder
Creates a new incremental decoder with the supplied buffer parameter.
webp_inew_rgb
This function allocates and initializes an incremental-decoder object, which will output the RGB/A samples specified by ‘csp’ into a preallocated buffer ‘output_buffer’.
webp_inew_yuv
Deprecated version of the above, without the alpha plane.
webp_inew_yuva
This function allocates and initializes an incremental-decoder object, which will output the raw luma/chroma samples into a preallocated planes if supplied.
webp_init_dec_buffer_internal
Internal, version-checked, entry point
webp_init_decoder_config_internal
Internal, version-checked, entry point
webp_iupdate
A variant of the above function to be used when data buffer contains partial data from the beginning.
webp_memory_write
WebPMemoryWrite: a special WebPWriterFunction that writes to memory using the following WebPMemoryWriter object (to be set as a custom_ptr).
webp_memory_writer_clear
The following must be called to deallocate writer->mem memory.
webp_memory_writer_init
The following must be called first before any use.
webp_picture_alloc
Convenience allocation / deallocation based on picture->width/height
webp_picture_argb_to_yuva
Converts picture->argb data to the YUV420A format.
webp_picture_argb_to_yuva_dithered
Same as WebPPictureARGBToYUVA(), but the conversion is done using pseudo-random dithering with a strength ‘dithering’ between 0.0 (no dithering) and 1.0 (maximum dithering).
webp_picture_copy
Copy the pixels of *src into *dst, using WebPPictureAlloc.
webp_picture_crop
self-crops a picture to the rectangle defined by top/left/width/height.
webp_picture_distortion
Compute PSNR, SSIM or LSIM distortion metric between two pictures.
webp_picture_free
Release the memory allocated by WebPPictureAlloc() or WebPPictureImport*().
webp_picture_has_transparency
Scan the picture ‘picture’ for the presence of non fully opaque alpha values.
webp_picture_import_bgr
webp_picture_import_bgra
webp_picture_import_bgrx
webp_picture_import_rgb
Colorspace conversion function to import RGB samples.
webp_picture_import_rgba
Same as webp_picture_import_rgb, but for RGBA buffer.
webp_picture_import_rgbx
Imports the RGB direct from the 32-bit format input buffer ignoring the alpha channel.
webp_picture_init
Should always be called, to initialize the structure.
webp_picture_init_internal
Internal, version-checked, entry point
webp_picture_is_view
Returns true if the ‘picture’ is actually a view and therefore does not own the memory for pixels.
webp_picture_rescale
Rescale a picture to new dimension width x height.
webp_picture_sharp_argb_to_yuva
Performs ‘sharp’ RGBA->YUVA420 downsampling and colorspace conversion.
webp_picture_smart_argb_to_yuva
kept for backward compatibility
webp_picture_view
Extracts a view from ‘src’ picture into ‘dst’.
webp_picture_yuva_to_argb
Converts picture->yuv to picture->argb and sets picture->use_argb to true.
webp_plane_distortion
Compute the single distortion for packed planes of samples.
webp_validate_config
Returns true if ‘config’ is non-NULL and all configuration parameters are within their valid ranges.

Type Aliases§

VP8StatusCode
Enumeration of the status codes.
WebPAuxStats
Structure for storing auxiliary statistics.
WebPBitstreamFeatures
Features gathered from the bitstream.
WebPCSPMode
Colorspaces.
WebPConfig
Compression parameters.
WebPDecBuffer
WebPDecBuffer: Generic structure for describing the output sample buffer.
WebPDecoderConfig
Main object storing the configuration for advanced decoding.
WebPDecoderOptions
Decoding options
WebPEncCSP
Color spaces.
WebPEncodingError
Encoding error conditions.
WebPIDecoder
WebPImageHint
Image characteristics hint for the underlying encoder.
WebPMemoryWriter
WebPMemoryWrite: a special WebPWriterFunction that writes to memory using the following WebPMemoryWriter object (to be set as a custom_ptr).
WebPPicture
Main exchange structure (input samples, output bytes, statistics)
WebPPreset
Enumerate some predefined settings for WebPConfig, depending on the type of source picture.
WebPProgressHook
Progress hook, called from time to time to report progress.
WebPRGBABuffer
WebPDecBuffer: Generic structure for describing the output sample buffer.
WebPWriterFunction
Signature for output function.
WebPYUVABuffer
WebPDecBuffer: Generic structure for describing the output sample buffer.