commit | 96f34d945ac7dac229feddfa94dbae66e202b838 | [log] [tgz] |
---|---|---|
author | Yannis Guyon <yguyon@google.com> | Mon Nov 29 16:49:26 2021 +0100 |
committer | Yannis Guyon <yguyon@google.com> | Mon Nov 29 16:49:26 2021 +0100 |
tree | d1aa68444383b11744ab53420d3add23c02ac333 | |
parent | c39192c3e02ab03a48dabd5a76a0a63407e059f9 [diff] |
Split Get() into Identity and Features Usual clients such as php-src begin by identifying the bitstream's format and only after start to parse it for width, height etc. Splitting the function in two avoids a stream rewind and/or parsing the same data twice. Change-Id: I4fc814e442bebe6f48d94f634c7e86dd07c73867
libavifinfo is a standalone library that can be used to extract the width, height, bit depth and number of channels from an AVIF payload.
See avifinfo.h
for details on the API and avifinfo.c
for the implementation. See avifinfo_test.cc
for usage examples.
libavifinfo can be used when only a few AVIF features are needed and when linking to or including libavif is not an option. For decoding an image or extracting more features, please rely on libavif.
AvifInfoFeatures features; if (AvifInfoGet(bytes, number_of_available_bytes, &features) == kAvifInfoOk) { // Use 'features.width' etc. }
Note: AvifInfoGet()
is designed to return the same avifImage
field values as avifDecoderRead()
. However libavifinfo is more permissive and may return features of images considered invalid by libavif.
avifinfo.c
is written in C. To build from this directory:
mkdir build && \ cd build && \ cmake .. && \ cmake --build . --config Release
Tests are written in C++. GoogleTest is required.
mkdir build && \ cd build && \ cmake .. -DAVIFINFO_BUILD_TESTS=ON && \ cmake --build . --config Debug && \ ctest .
Google C/C++ Style Guide is used in this project.
If you would like to contribute to libavifinfo, please follow the steps for libaom at https://aomedia.googlesource.com/aom/#submitting-patches.
Bug reports can be filed in the Alliance for Open Media issue tracker.