HeifEncodeOptions
The settings of a HEIF encode (#174), for ImageKodec.encodeHeic, ImageKodec.encodeHeic16, ImageKodec.encodeAvif and ImageKodec.encodeAvif16 (#176). Every parameter has a default, so name only the ones to change:
val heic = ImageKodec.encodeHeic(bitmap, HeifEncodeOptions(quality = 80, chroma = HeifChroma.Yuv444))Throws
when a value is out of its range
Constructors
Properties
the bits of each coded sample: 8, 10 or 12, or null for 8 from a KiteBitmap and for 10 lossy or 12 lossless from a KiteBitmap16.
the chroma subsampling of a lossy colour picture. The default, 4:2:0, averages each 2 by 2 block of chroma, centred where the decoder's upsampling expects it.
1 (fast) to 3 (thorough). 1 tests few intra modes and no transform skip, 2 adds 64 by 64 coding units, one level of transform split and rate-distortion optimised quantization, and 3 tests every mode and two levels of transform split with no early stops. In AV1, 1 tries one mode a block, square partitions down to 8 by 8 and two transform types; 2 adds filter intra, a transform split, 4 by 4 blocks, more transform types, a level search, loop restoration and, on screen content, intra block copy; 3 adds a second mode, angle deltas, rectangular partitions, a second split and every transform type throughout. In the inter frames of an AV1 sequence (#177), 1 predicts from the frame before alone, in a narrow motion search; 2 adds the frame before that, the two averaged, and a wider search; 3 searches wider still and codes more candidates.
for an animation (#177): above 0, a picture coded on its own, which a player can start from, at least every that many frames; 0, the default, codes the first frame alone that way and every later one from those before it, which is smallest. Still pictures ignore it.
codes the picture so that it decodes to exactly the input: RGB through the identity matrix of ITU-T H.273 in 4:4:4, or gray in 4:0:0, with quality and chroma ignored. A 16-bit input keeps exactly the samples a picture of bitDepth bits can give back through ImageKodec.decode16; other values move to the nearest of those.
how to show the stored pixels, as irot and imir properties: a reader that applies them, as ImageKodec.decode with applyOrientation does, shows bitmap.oriented(orientation). An EXIF block written with the image takes the same orientation, so the two never disagree.
0 to 100, higher is better and larger. The HEVC encoder codes at a QP of 46 less half the quality, rounded up, and at least 1 (46 at 0, 21 at 50, 6 at 80, 1 from 90 on), so that a quality gives about the SSIMULACRA 2 score of libheif's heif-enc -q at the same number. The AV1 encoder codes at a base_q_idx of 240 at 0, 117 at 50, 43 at 80 and 1 from 97 on, straight between, so that 50 and 80 give about the SSIMULACRA 2 score of libavif's avifenc -q 50 and -q 80.
the longest side of a thumbnail item to write beside the image, scaled down from it, or null for none. A picture no larger than this gets no thumbnail.
the side of the square tiles of a grid, a multiple of 8 from 64 to 8192: a picture wider or taller than this is written as a grid of tiles of this size, which the tile runner of ImageKodec.setTileRunner encodes, and the edge tiles are padded by repeating the last row and column. 512 is what phones write. Null writes one coded picture of any size the codec's levels hold.