From 17dcc9c7d4350ffb8f57c1cba9cf20ff73ba5fdb Mon Sep 17 00:00:00 2001 From: Surma Date: Thu, 6 Feb 2020 09:27:40 -0800 Subject: [PATCH] Update AVIF encoder README --- codecs/avif_enc/README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/codecs/avif_enc/README.md b/codecs/avif_enc/README.md index fa482cef..843e0b7b 100644 --- a/codecs/avif_enc/README.md +++ b/codecs/avif_enc/README.md @@ -9,10 +9,33 @@ Run example.js ## API -### `RawImage decode(std::string buffer)` +### `Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)` -Decodes the given avif buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`. +Encodes the given image with given dimension to AVIF. Options looks like this: + +```c++ +struct AvifOptions { + // 0 = lossless + // 63 = worst quality + int minQuantizer; + int maxQuantizer; + + // [0 - 6] + // Creates 2^n tiles in that dimension + int tileRowsLog2; + int tileColsLog2; + + // 0 = slowest + // 10 = fastest + int speed; + + // 0 = 4:2:0 + // 1 = 4:2:2 + // 2 = 4:4:4 + int subsample; +}; +``` ### `void free_result()` -Frees the result created by `decode()`. +Frees the result created by `encode()`.