Skip to content

Commit

Permalink
media-libs/kvazaar: add 2.3.0
Browse files Browse the repository at this point in the history
Includes two new backports for remaining missing arches (x86 + sparc).

See: ultravideo/kvazaar#392
See: ultravideo/kvazaar#391
Bug: https://bugs.gentoo.org/902217
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
  • Loading branch information
matoro committed Mar 1, 2024
1 parent a94b944 commit 0201b13
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 2 deletions.
1 change: 1 addition & 0 deletions media-libs/kvazaar/Manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DIST greatest-1.2.1.tar.gz 19792 BLAKE2B e6abd20eebf3223311fcd62e341595318dd00f192cf4b62ef3f0443a3e10fee71f4283f836931fee52672f2b37398f86046ae97220c2b6c6045fec9f9bf5cda8 SHA512 c17162fa222c84fef7826ba5202aae573d516a71bc2c59c8991db2a76f7069ed53d00aaab1b792e0c7e4243fae38183764c2e7ae0a61faf2ff13e78b29ccc211
DIST kvazaar-2.1.0.tar.gz 605962 BLAKE2B 0d61af55ab0caef2247524e8c564f9c24cfb479fcbd721f43e4409899e1a187a0e6de0b08a052cfb144ea31da906ba1c2160d6712828d6e55f0826d87f5c96ba SHA512 14b29f48908e004cf1b4f1f0c338b7b134a34140edcd58a645b4529c506cd567ebe3d56aa66e469dc417e1baa29bb8a476825b78825e810ac68a029191ad32ec
DIST kvazaar-2.2.0.tar.gz 617414 BLAKE2B 6ddb88ddea315d80e0af87a13127f235c184ae829492d1ff456899d2a24669b3deca25a320a8bdcf6e2cebc2c24e33c0678ac7bf51d2634a46781f66497bed54 SHA512 476abe251d7f555911851bc5a7dca84a96c0cd243c6a45dd59b808b8adf2b0787f69101a061bd48dfb6fe54a0aea046417f21fc826f14f518cada25c6d22aec4
DIST kvazaar-2.3.0.tar.gz 593939 BLAKE2B a8cdc94699c6e64ef5e80336191342cb5aadfa83cc494400dd34a177836c081291e5cc176e29bf68ad8debdf3a83ca7d5c2ffd657ac96b901a0f5258e3894788 SHA512 b416e24a887a6e83b25530c6d47675fb176568c04295c944094041629b585b968133465605b9ee85e0ebebe1041774d5670cb90ee76271cb2f5c8059244297b5
31 changes: 31 additions & 0 deletions media-libs/kvazaar/files/kvazaar-2.3.0-backport-c6f2ba4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
https://bugs.gentoo.org/902217
https://github.com/ultravideo/kvazaar/issues/391
https://github.com/ultravideo/kvazaar/commit/c6f2ba4711d42285636da97b133a7b5aa49c9533

From c6f2ba4711d42285636da97b133a7b5aa49c9533 Mon Sep 17 00:00:00 2001
From: Joose Sainio <joose.sainio@tuni.fi>
Date: Thu, 1 Feb 2024 10:47:16 +0200
Subject: [PATCH] fix unaligned access on array_checksum_generic8

---
src/strategies/generic/nal-generic.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/src/strategies/generic/nal-generic.c b/src/strategies/generic/nal-generic.c
index 1762c8ba..075c8264 100644
--- a/src/strategies/generic/nal-generic.c
+++ b/src/strategies/generic/nal-generic.c
@@ -157,6 +157,13 @@ static void array_checksum_generic8(const kvz_pixel* data,
assert(SEI_HASH_MAX_LENGTH >= 4);

for (y = 0; y < height; ++y) {
+ if (y*stride % 8 != 0) {
+ for (x = 0; x < width; ++x) {
+ uint8_t mask = (uint8_t)((x & 0xff) ^ (y & 0xff) ^ (x >> 8) ^ (y >> 8));
+ checksum += (data[(y * stride) + x] & 0xff) ^ mask;
+ }
+ continue;
+ }
for (xp = 0; xp < width/8; ++xp) {
const int x = xp * 8;
const uint64_t mask = ckmap[(xp&31)+32*(y&255)] ^ ((uint64_t)((x >> 8) ^ (y >> 8)) * 0x101010101010101);
36 changes: 36 additions & 0 deletions media-libs/kvazaar/files/kvazaar-2.3.0-backport-pr392.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
https://bugs.gentoo.org/902217
https://github.com/ultravideo/kvazaar/pull/392

From b10fc25cb980e1dbab8f42c38280f57765f93a37 Mon Sep 17 00:00:00 2001
From: matoro <matoro@users.noreply.github.com>
Date: Thu, 1 Feb 2024 18:35:23 -0500
Subject: [PATCH] Ignore "*get_pc_thunk.*" symbols in exported symbols test

On i386 (32-bit x86) and sparc, gcc generates references to these
functions which load the current PC into the specified register. These
references are then resolved at link-time. Examples of what these
symbols look like:

../src/.libs/libkvazaar.a:libkvazaar_la-cfg.o:00000000 T __x86.get_pc_thunk.ax
../src/.libs/libkvazaar.a:libkvazaar_la-cabac.o:0000000000000000 W __sparc_get_pc_thunk.l7

Since these are platform symbols inserted by the toolchain, ignore them.
The regex is specified as tightly as possible, and based on a quick
search these appear to be the only two platforms affected.
---
tests/test_external_symbols.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_external_symbols.sh b/tests/test_external_symbols.sh
index b9b3d5957..4983078bf 100755
--- a/tests/test_external_symbols.sh
+++ b/tests/test_external_symbols.sh
@@ -4,7 +4,7 @@

set -eu${BASH+o pipefail}

-if nm -go --defined-only ../src/.libs/libkvazaar.a | grep -v ' kvz_'; then
+if nm -go --defined-only ../src/.libs/libkvazaar.a | grep -Ev ' (kvz_|__[a-z0-9]+(_|\.)get_pc_thunk\.)'; then
printf '%s\n' 'Only symbols prefixed with "kvz_" should be exported from libkvazaar.'
false
fi
69 changes: 69 additions & 0 deletions media-libs/kvazaar/kvazaar-2.3.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

GREATEST_PV="1.2.1"

if [[ ${PV} = *9999 ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/ultravideo/kvazaar"
else
SRC_URI="https://github.com/ultravideo/kvazaar/archive/v${PV}.tar.gz -> ${P}.tar.gz
test? ( https://github.com/silentbicycle/greatest/archive/v${GREATEST_PV}.tar.gz -> greatest-${GREATEST_PV}.tar.gz )"
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv"
fi
inherit autotools flag-o-matic multilib-minimal

DESCRIPTION="Open-source HEVC encoder"
HOMEPAGE="http://ultravideo.cs.tut.fi/ https://github.com/ultravideo/kvazaar"

LICENSE="LGPL-2.1"
# subslot = libkvazaar major
SLOT="0/6"
IUSE="static-libs test"
REQUIRED_USE="test? ( static-libs )"

RESTRICT="!test? ( test )"
ASM_DEP=">=dev-lang/yasm-1.2.0"
RDEPEND=""
DEPEND="${RDEPEND}
test? (
media-video/ffmpeg
media-video/hevc-hm
)
abi_x86_32? ( ${ASM_DEP} )
abi_x86_64? ( ${ASM_DEP} )
"

PATCHES=(
"${FILESDIR}/${PN}-2.3.0-backport-pr392.patch"
"${FILESDIR}/${PN}-2.3.0-backport-c6f2ba4.patch"
)

src_prepare() {
default
sed -e "/^dist_doc_DATA/s/COPYING //" -i Makefile.am || die
eautoreconf
if use test && [[ ${PV} != *9999 ]]; then
# https://bugs.gentoo.org/show_bug.cgi?id=595932
rmdir "${S}/greatest" || die
mv "${WORKDIR}/greatest-${GREATEST_PV}" "${S}/greatest" || die
fi
# Some m4 macros append Werror, we do not want that.
append-flags "-Wno-error"
}

multilib_src_configure() {
ECONF_SOURCE="${S}" econf \
--disable-werror \
$(use_enable static-libs static)
}

multilib_src_test() {
KVZ_TEST_VALGRIND=0 emake check
}

multilib_src_install_all() {
find "${ED}" -name '*.la' -delete || die
}
4 changes: 2 additions & 2 deletions media-libs/kvazaar/kvazaar-9999.ebuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
Expand All @@ -11,7 +11,7 @@ if [[ ${PV} = *9999 ]] ; then
else
SRC_URI="https://github.com/ultravideo/kvazaar/archive/v${PV}.tar.gz -> ${P}.tar.gz
test? ( https://github.com/silentbicycle/greatest/archive/v${GREATEST_PV}.tar.gz -> greatest-${GREATEST_PV}.tar.gz )"
KEYWORDS="~amd64 ~arm ~loong ~mips ~riscv"
KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv"
fi
inherit autotools flag-o-matic multilib-minimal

Expand Down

0 comments on commit 0201b13

Please sign in to comment.