Compare commits

..

No commits in common. "main-riscv64" and "master" have entirely different histories.

5 changed files with 57 additions and 197 deletions

10
.gitignore vendored
View File

@ -1,3 +1,7 @@
/libavif-*.tar.gz /libavif-0.5.7.tar.gz
/results_* /libavif-0.7.1.tar.gz
/*.rpm /libavif-0.7.2.tar.gz
/libavif-0.7.3.tar.gz
/libavif-0.8.0.tar.gz
/libavif-0.8.1.tar.gz
/libavif-0.8.2.tar.gz

View File

@ -1,88 +0,0 @@
From b10d2697e9ed2fb09cb722335ff4342c353612b8 Mon Sep 17 00:00:00 2001
From: Yannis Guyon <yguyon@google.com>
Date: Mon, 12 Feb 2024 10:29:02 +0000
Subject: [PATCH] Encode alpha as 4:2:0 with SVT (#2004)
---
src/codec_svt.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/src/codec_svt.c b/src/codec_svt.c
index 58a92cdce..ea9efc2b5 100644
--- a/src/codec_svt.c
+++ b/src/codec_svt.c
@@ -7,6 +7,7 @@
#include "svt-av1/EbSvtAv1Enc.h"
+#include <stdint.h>
#include <string.h>
// The SVT_AV1_VERSION_MAJOR, SVT_AV1_VERSION_MINOR, SVT_AV1_VERSION_PATCHLEVEL, and
@@ -76,6 +77,7 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
avifResult result = AVIF_RESULT_UNKNOWN_ERROR;
EbColorFormat color_format = EB_YUV420;
+ uint8_t * uvPlanes = NULL; // 4:2:0 U and V placeholder for alpha because SVT-AV1 does not support 4:0:0.
EbBufferHeaderType * input_buffer = NULL;
EbErrorType res = EB_ErrorNone;
@@ -98,6 +100,7 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
y_shift = 1;
break;
case AVIF_PIXEL_FORMAT_YUV400:
+ // Setting color_format = EB_YUV400; results in "Svt[error]: Instance 1: Only support 420 now".
case AVIF_PIXEL_FORMAT_NONE:
case AVIF_PIXEL_FORMAT_COUNT:
default:
@@ -198,16 +201,38 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
}
EbSvtIOFormat * input_picture_buffer = (EbSvtIOFormat *)input_buffer->p_buffer;
- int bytesPerPixel = image->depth > 8 ? 2 : 1;
+ const uint32_t bytesPerPixel = image->depth > 8 ? 2 : 1;
+ const uint32_t uvHeight = (image->height + y_shift) >> y_shift;
if (alpha) {
input_picture_buffer->y_stride = image->alphaRowBytes / bytesPerPixel;
input_picture_buffer->luma = image->alphaPlane;
input_buffer->n_filled_len = image->alphaRowBytes * image->height;
+
+#if SVT_AV1_CHECK_VERSION(1, 8, 0)
+ // Simulate 4:2:0 UV planes. SVT-AV1 does not support 4:0:0 samples.
+ const uint32_t uvWidth = (image->width + y_shift) >> y_shift;
+ const uint32_t uvRowBytes = uvWidth * bytesPerPixel;
+ const uint32_t uvSize = uvRowBytes * uvHeight;
+ uvPlanes = avifAlloc(uvSize);
+ if (uvPlanes == NULL) {
+ goto cleanup;
+ }
+ memset(uvPlanes, 0, uvSize);
+ input_picture_buffer->cb = uvPlanes;
+ input_buffer->n_filled_len += uvSize;
+ input_picture_buffer->cr = uvPlanes;
+ input_buffer->n_filled_len += uvSize;
+ input_picture_buffer->cb_stride = uvWidth;
+ input_picture_buffer->cr_stride = uvWidth;
+#else
+ // This workaround was not needed before SVT-AV1 1.8.0.
+ // See https://github.com/AOMediaCodec/libavif/issues/1992.
+ (void)uvPlanes;
+#endif
} else {
input_picture_buffer->y_stride = image->yuvRowBytes[0] / bytesPerPixel;
input_picture_buffer->luma = image->yuvPlanes[0];
input_buffer->n_filled_len = image->yuvRowBytes[0] * image->height;
- uint32_t uvHeight = (image->height + y_shift) >> y_shift;
input_picture_buffer->cb = image->yuvPlanes[1];
input_buffer->n_filled_len += image->yuvRowBytes[1] * uvHeight;
input_picture_buffer->cr = image->yuvPlanes[2];
@@ -232,6 +257,9 @@ static avifResult svtCodecEncodeImage(avifCodec * codec,
result = dequeue_frame(codec, output, AVIF_FALSE);
cleanup:
+ if (uvPlanes) {
+ avifFree(uvPlanes);
+ }
if (input_buffer) {
if (input_buffer->p_buffer) {
avifFree(input_buffer->p_buffer);

View File

@ -1,63 +0,0 @@
* Sun Jun 13 13:40:21 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.9.1-2
- Rebuilt for aom v3.1.1
* Sun May 23 19:44:09 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.9.1-1
- Update to 0.9.1
- Close: rhbz#1937556
* Mon Mar 15 2021 Andreas Schneider <asn@redhat.com> - 0.9.0-1
- Update to version 0.9.0
* Wed Mar 10 2021 Leigh Scott <leigh123linux@gmail.com> - 0.8.4-5
- Build with aom
* Wed Mar 10 2021 Leigh Scott <leigh123linux@gmail.com> - 0.8.4-4
- Build without aom for new vmaf version
* Sat Feb 20 2021 Andreas Schneider <asn@redhat.com> - 0.8.4-4
- Build release with debug info
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Dec 14 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.4-2
- Rebuild for dav1d SONAME bump
* Wed Dec 09 05:52:07 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.4-1
- Update to version 0.8.4
* Mon Oct 19 2020 Andreas Schneider <asn@redhat.com> - 0.8.2-1
- Update to version 0.8.2
https://github.com/AOMediaCodec/libavif/blob/master/CHANGELOG.md
* Thu Aug 06 22:14:02 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.1-1
- Update to 0.8.1
* Wed Aug 05 21:17:23 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.0-1
- Update to 0.8.0
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-3
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri May 22 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.7.3-1
- Update to 0.7.3
* Wed Apr 29 2020 Andreas Schneider <asn@redhat.com> - 0.7.2-1
- Update to version 0.7.2
* https://github.com/AOMediaCodec/libavif/blob/master/CHANGELOG.md
* Wed Apr 29 2020 Andreas Schneider <asn@redhat.com> - 0.7.1-1
- Update to version 0.7.1
* Wed Mar 04 2020 Andreas Schneider <asn@redhat.com> - 0.5.7-1
- Update to version 0.5.7
* Wed Mar 04 2020 Andreas Schneider <asn@redhat.com> - 0.5.3-2
- Fix License
* Sun Feb 16 2020 Andreas Schneider <asn@redhat.com> - 0.5.3-1
- Initial version

View File

@ -1,34 +1,19 @@
# Build with aom # Force out of source build
%undefine __cmake_in_source_build
%bcond_without aom %bcond_without aom
# Build SVT-AV1
%bcond_without svt
%if (0%{?rhel} && 0%{?rhel} < 9) || 0%{?rhel} >= 10
%bcond_with rav1e
%else
%bcond_without rav1e
%endif
%if 0%{?rhel} >= 10
%bcond_with gtest
%else
%bcond_without gtest
%endif
%bcond_without check
Name: libavif Name: libavif
Version: 1.0.4 Version: 0.8.2
Release: %autorelease -e rvre0 Release: 1%{?dist}
Summary: Library for encoding and decoding .avif files Summary: Library for encoding and decoding .avif files
License: BSD-2-Clause License: BSD
URL: https://github.com/AOMediaCodec/libavif URL: https://github.com/AOMediaCodec/libavif
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# Encode alpha as 4:2:0 with SVT. Fix build with SVT-AV1 2.0.0
Patch0: https://github.com/AOMediaCodec/libavif/commit/b10d2697e9ed2fb09cb722335ff4342c353612b8.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
%{?with_check:%{?with_gtest:BuildRequires: gtest-devel}}
BuildRequires: nasm BuildRequires: nasm
%if %{with aom} %if %{with aom}
BuildRequires: pkgconfig(aom) BuildRequires: pkgconfig(aom)
@ -36,8 +21,7 @@ BuildRequires: pkgconfig(aom)
BuildRequires: pkgconfig(dav1d) BuildRequires: pkgconfig(dav1d)
BuildRequires: pkgconfig(libjpeg) BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libpng)
%{?with_rav1e:BuildRequires: pkgconfig(rav1e)} BuildRequires: pkgconfig(rav1e)
%{?with_svt:BuildRequires: pkgconfig(SvtAv1Enc)}
BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(zlib)
%description %description
@ -67,7 +51,7 @@ This package holds the commandline tools to encode and decode AVIF files.
%package -n avif-pixbuf-loader %package -n avif-pixbuf-loader
Summary: AVIF image loader for GTK+ applications Summary: AVIF image loader for GTK+ applications
BuildRequires: pkgconfig(gdk-pixbuf-2.0) BuildRequires: pkgconfig(gdk-pixbuf-2.0)
Requires: gdk-pixbuf2%{?_isa} Requires: gdk-pixbuf2
%description -n avif-pixbuf-loader %description -n avif-pixbuf-loader
Avif-pixbuf-loader contains a plugin to load AVIF images in GTK+ applications. Avif-pixbuf-loader contains a plugin to load AVIF images in GTK+ applications.
@ -76,30 +60,19 @@ Avif-pixbuf-loader contains a plugin to load AVIF images in GTK+ applications.
%autosetup -p1 %autosetup -p1
%build %build
%cmake \ %cmake %{?with_aom:-DAVIF_CODEC_AOM=1} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DAVIF_CODEC_DAV1D=1 \
%{?with_aom:-DAVIF_CODEC_AOM=1} \ -DAVIF_CODEC_RAV1E=1 \
-DAVIF_CODEC_DAV1D=1 \ -DAVIF_BUILD_APPS=1 \
%{?with_rav1e:-DAVIF_CODEC_RAV1E=1} \ -DAVIF_BUILD_GDK_PIXBUF=1
%{?with_svt:-DAVIF_CODEC_SVT=1} \
-DAVIF_BUILD_APPS=1 \
-DAVIF_BUILD_GDK_PIXBUF=1 \
%{?with_check:-DAVIF_BUILD_TESTS=1 -DAVIF_ENABLE_GTEST=%{with gtest}}
%cmake_build %cmake_build
%install %install
%cmake_install %cmake_install
%if %{with check}
%check
%ctest
%endif
%files %files
%license LICENSE %license LICENSE
# Do not glob the soname %{_libdir}/libavif.so.*
%{_libdir}/libavif.so.16*
%{_datadir}/thumbnailers/avif.thumbnailer
%files devel %files devel
%{_libdir}/libavif.so %{_libdir}/libavif.so
@ -116,4 +89,38 @@ Avif-pixbuf-loader contains a plugin to load AVIF images in GTK+ applications.
%{_libdir}/gdk-pixbuf-2.0/*/loaders/libpixbufloader-avif.so %{_libdir}/gdk-pixbuf-2.0/*/loaders/libpixbufloader-avif.so
%changelog %changelog
%autochangelog * Mon Oct 19 2020 Andreas Schneider <asn@redhat.com> - 0.8.2-1
- Update to version 0.8.2
https://github.com/AOMediaCodec/libavif/blob/master/CHANGELOG.md
* Thu Aug 06 22:14:02 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.1-1
- Update to 0.8.1
* Wed Aug 05 21:17:23 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.0-1
- Update to 0.8.0
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-3
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri May 22 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.7.3-1
- Update to 0.7.3
* Wed Apr 29 2020 Andreas Schneider <asn@redhat.com> - 0.7.2-1
- Update to version 0.7.2
* https://github.com/AOMediaCodec/libavif/blob/master/CHANGELOG.md
* Wed Apr 29 2020 Andreas Schneider <asn@redhat.com> - 0.7.1-1
- Update to version 0.7.1
* Wed Mar 04 2020 Andreas Schneider <asn@redhat.com> - 0.5.7-1
- Update to version 0.5.7
* Wed Mar 04 2020 Andreas Schneider <asn@redhat.com> - 0.5.3-2
- Fix License
* Sun Feb 16 2020 Andreas Schneider <asn@redhat.com> - 0.5.3-1
- Initial version

View File

@ -1 +1 @@
SHA512 (libavif-1.0.4.tar.gz) = 37f0de757180c6414778e688006940395960b316c25192d6beb97a07942aff4bd3b712dec2eff52cd26f5d72c352731442175dfeb90e2e1381133539760142b0 SHA512 (libavif-0.8.2.tar.gz) = 51034084b5a508763653e16512298c3ad57c07022327cf42c9e12728ac30e102c69dc43d6569cb39ee4a63cb81a98947b72201373d3a909b3f1b2f6f59aaa433