Giter VIP home page Giter VIP logo

avif_experiments's Introduction

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

mkdir build
cd build
cmake ..
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

(base)  nick@xps  ~/dev/test/avif_experiments   master  build/avif_test_jpg_encode
avif version: 0.3.6
aom version: 1.0.0-2236-g0233da474
OpenCV version: 4.1.1-dev
image: images/test1.jpg width: 1280 heigth: 720 depth: CV_8U type: CV_8UC3
created avifImage ... 
allocated plains ... 
encoding avif ... 
encoding time:8568 ms
* ColorOBU size: 30384 bytes
output.size: 30646 bytes
writing avif_filename: images/test1.avif
writing y4m_filename: images/test1.y4m
Wrote: images/test1.y4m

Decoding Log

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.