Files
squoosh/codecs/avif/enc
Aryan Pingle e217740e53 Update libavif (#1381)
* Update libavif (v1.0.0-main)

* Update libavif for improved compression and speed
* v1.0.0 deprecates usage of min and max-quantizers; we use `quality` and `qualityAlpha` instead
* Renamed `maxSpeed` to `MAX_EFFORT` for better readability

* Update libavif (v1.0.1-main)

* Refactor variable names for clarity

* Update libaom (v3.7.0)

* Add checks for API return values

* Rename variables for readability

Changes `cqlevel` to `quality`, and `cqAlphaLevel` to `qualityAlpha`

* Minor patches in logic

* Minor patches in lossless calculation

* Add chroma subsampling options to AVIF

* Add skeleton for sharp downsampling param

* Try to use libsharpyuv

* Encoder working, decoder isnt

* Make sure sharpyuv is disabled for decoder

* Add AVIF_LOCAL flags for sharp yuv

* Get AVIF sharp YUV working

* Clean up AVIF makefiles

* AVIF: Make sharpyuv conditional on subsample

* AVIF: Flags to speed up sharpyuv build

* AVIF: Minor refactoring in enc.cpp

* AVIF: Minor refactoring & renaming

* AVIF: Use smart pointers to prevent memory leaks

* AVIF: Minor refactoring

* AVIF: Revert defaultoptions logic change

---------

Co-authored-by: Surma <surma@surma.dev>
Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2024-01-24 08:04:33 +00:00
..
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2024-01-24 08:04:33 +00:00
2020-08-05 14:40:15 +01:00

AVIF encoder

Example

Run example.js

API

Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)

Encodes the given image with given dimension to AVIF. Options looks like this:

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;
};