novomesk/qt-avif-image-plugin

Is dav1d supported through libavif?

jurplel opened this issue · 6 comments

I made a windows x32 msvc 2019 build that resulted in a dll of 748kb, but it does not seem to actually work when put in a program.
dav1d takes so much less time to build that I would prefer to use that instead of aom.

libavif can use dav1d but you need to enable it when building libavif -DAVIF_CODEC_DAV1D=ON

dav1d is decoder only. In Windows build I prefer AOM because it has both decoding and encoding support.

When you make an app which views AVIF images (but do not save), 32bit could be sufficient. If you want to save AVIF, 64bit is recommended, AVIF is very memory hungry at large resolutions.

I was able to build it successfully but it did not seem to function properly.
Here is a build script that mostly covers what I did (ignore some of the stuff involving arch, etc)

    git clone https://github.com/novomesk/qt-avif-image-plugin
    cd qt-avif-image-plugin
    git checkout v0.3.2
    cd ext/libavif/ext/
    git clone -b 0.7.1 --depth 1 https://code.videolan.org/videolan/dav1d.git


    set "arch=${{ parameters.arch }}"
    call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars%arch:~3,2%.bat"
    choco install wget meson

    cd qt-avif-image-plugin/ext/libavif/ext/dav1d
    wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/win64/nasm-2.14-win64.zip
    7z e -y nasm-2.14-win64.zip
    mkdir build
    cd build
    meson --default-library=static --buildtype release ..
    ninja
    
    cd ..\..\..\
    mkdir build
    cd build
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON ..
    ninja
    
    cd ..\..\..\
    qmake qt-avif-image-plugin.pro "INCLUDEPATH += $$PWD/ext/libavif/include" "LIBS += $$PWD/ext/libavif/build/"
    nmake

I also made this .pro file:

TARGET = qavif

HEADERS = src/qavifhandler_p.h
SOURCES = src/qavifhandler.cpp
OTHER_FILES = src/avif.json

SOURCES += src/main.cpp

LIBS += -Lext/libavif/build -lavif -Lext/libavif/ext/dav1d/build/src/ -ldav1d

INCLUDEPATH += ext/libavif/include

PLUGIN_TYPE = imageformats
PLUGIN_CLASS_NAME = QAVIFPlugin
load(qt_plugin)

CONFIG += release skip_target_version_ext strict_c++ warn_on
CONFIG -= separate_debug_info debug debug_and_release force_debug_info

QMAKE_TARGET_COMPANY = "Daniel Novomesky"
QMAKE_TARGET_PRODUCT = "qt-avif-image-plugin"
QMAKE_TARGET_DESCRIPTION = "Qt plug-in to allow Qt and KDE based applications to read/write AVIF images."
QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2020 Daniel Novomesky"

It links to the two .lib files successfully--I can't figure out why it isn't functional. Do you have any ideas?

I actually did end up getting it working--I was inadvertently mixing Qt versions

I am not sure if I understand. Now it is working or not? Do you need something more from me?

Sorry, it's working now. Sorry for the inconvenience.