项目作者: hortovanyi

项目描述 :
AVIF (AV1 Still Image File Format) is a new still image format based on AV1. This project contains a few experiments in c++
高级语言: C
项目地址: git://github.com/hortovanyi/avif_experiments.git
创建时间: 2019-08-21T05:13:23Z
项目社区:https://github.com/hortovanyi/avif_experiments

开源协议:

下载


AVIF Experiments

AVIF (AV1 Still Image File Format) is a new still image format based on AV1.

In this project, a test jpg image is encoded into an avif file and stored in the images directory. At present the starting image names are hardcoded, and subsequent images are written with appended names (minus the . type).

It has two executable programs:

  1. avif_test_jpg_encode - takes the test1.jpg image and outputs test1.avif and test1.y4m
  2. avif_decode_test - uses test1.avif and displays the images as well as writes it to test1_avif_decode.jpg.

Dependencies

The build has dependencies on OpenCV, libaom, libavif and dav1d. As libavif had no install instructions, the libavif.a was copied to a project lib directory, with the avif/avif.h copied the include folder.

Building

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make

When succesful, there will be two executables per above.

Results

As can be seen by the following encoding log output, the time for encoding was 8.5 seconds (originally around 12 seconds). I tried experimenting with the number of threads and tiling settings, but it only had a slight improvement. Searching around on the internet, it suggested that libaom, encoding is indeed slow.

Changing the Quantizer values from AVIF_QUANTIZER_LOSSLESS, dramaticully decreased the size of the test1.avif file to ~30 KB. This is a significant decrease from the original test1.jpg file size of ~282 KB.

The decoding time was 45 milliseconds for test1.avif in the Decoding log. Which was very impressive. Note I’d compiled libavf to decode using dav1d.

At present, based on the encoding time, AVIF isn’t suitable, for the intended need (of a different project) for capturing and writing images to disk at 30 fps(frames per second) becuase of the slow encoding time per frame.

Encoding Log

  1. (base) nick@xps ~/dev/test/avif_experiments master build/avif_test_jpg_encode
  2. avif version: 0.3.6
  3. aom version: 1.0.0-2236-g0233da474
  4. OpenCV version: 4.1.1-dev
  5. image: images/test1.jpg width: 1280 heigth: 720 depth: CV_8U type: CV_8UC3
  6. created avifImage ...
  7. allocated plains ...
  8. encoding avif ...
  9. encoding time:8568 ms
  10. * ColorOBU size: 30384 bytes
  11. output.size: 30646 bytes
  12. writing avif_filename: images/test1.avif
  13. writing y4m_filename: images/test1.y4m
  14. Wrote: images/test1.y4m

Decoding Log

  1. (base) nick@xps ~/dev/test/avif_experiments master build/avif_decode_test
  2. avif version: 0.3.6
  3. dav1d version: 0.4.0-19-g3d94fb9
  4. aom version: 1.0.0-2236-g0233da474
  5. OpenCV version: 4.1.1-dev
  6. decoding avif ....
  7. decoding time: 45 ms
  8. avif image: images/test1.avif width: 1280 height: 720 depth: 8 format: YUV420
  9. converting avif from yuv to rgb ...
  10. creating opencv image ...
  11. copying planes to opencv image ...
  12. writing jpg_filename: images/test1_avif_decode.jpg
  13. Saved jpg file.