Skip to content

Conversation

tristanphease
Copy link
Contributor

@tristanphease tristanphease commented Aug 11, 2025

Adds a lossy vp8 encoder. Works to encode images with e.g.

let mut webp_encoder = WebPEncoder::new(&mut buffer);
let mut encoder_params = EncoderParams::default();
encoder_params.use_lossy = true;
encoder_params.lossy_quality = 95;
webp_encoder.set_params(encoder_params);
webp_encoder.encode(
    &res.to_rgb8(),
    res.width(),
    res.height(),
    image_webp::ColorType::Rgb8,
);

Currently:

  • Converts an image to yuv and encodes it
  • Picks macroblock luma mode / chroma mode based on getting the transformed coefficients and working out what is cheapest
  • Has a quality parameter for choosing the quantization of the image

Still more more specific encoding features that could be implemented but perhaps for a future PR.
There's quite a lot of changes and I think there's more cleanup to do, have done some rework of some of the decoder code as well to support using the same objects and functions in both.

@tristanphease tristanphease marked this pull request as ready for review August 24, 2025 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant