Skip to content

Commit 55ed193

Browse files
committed
add arm64 support and update native components
1 parent 5efe677 commit 55ed193

13 files changed

Lines changed: 105 additions & 5 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build AVIF binaries
2+
3+
on:
4+
push:
5+
# any branch
6+
branches: [ "*" ]
7+
workflow_dispatch: # Allows manual triggering
8+
9+
jobs:
10+
build-amd64:
11+
runs-on: ubuntu-24.04-arm
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo apt-get install -y build-essential nasm cmake ninja-build libjpeg-dev libpng-dev libtiff-dev libwebp-dev libaom-dev libyuv-dev zlib1g-dev
22+
23+
- name: Build libavif binaries
24+
run: |
25+
cd libavif
26+
mkdir -p build
27+
cd build
28+
cmake -DBUILD_SHARED_LIBS=OFF -DCONFIG_PIC=1 -DCMAKE_BUILD_TYPE=Release -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=ON -G Ninja ..
29+
ninja
30+
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: c-native-artifact
35+
path: |
36+
libavif/build/avifenc
37+
libavif/build/avifdec
38+
if-no-files-found: error
39+
# Retain artifacts for 1 day
40+
retention-days: 1
41+

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libavif"]
2+
path = libavif
3+
url = https://github.com/AOMediaCodec/libavif.git

libavif

Submodule libavif added at e6823be

src/Native.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@ public static class Native {
1010

1111
private static string OSFolder {
1212
get {
13-
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
14-
return "linux";
13+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
14+
{
15+
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
16+
return "linux-x64";
17+
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
18+
return "linux-arm64";
19+
throw new InvalidOperationException("Only x64 and arm64 are supported on Linux.");
20+
}
1521

16-
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
17-
if(Environment.Is64BitProcess)
22+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
23+
{
24+
if (Environment.Is64BitProcess)
1825
return "win-x64";
1926

2027
throw new InvalidOperationException("Only x64 is supported on Windows.");

src/NeoSolve.ImageSharp.AVIF.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>1.2.1</Version>
4+
<Version>1.3.0</Version>
55
<Description>Avif encoding and decoding support via avifenc/avifdec binary (included) for ImageSharp</Description>
66
<PackageLicenseExpression>MIT</PackageLicenseExpression>
77
<TargetFramework>net8.0</TargetFramework>

src/native/linux-arm64/avifdec

6.77 MB
Binary file not shown.

src/native/linux-arm64/avifenc

6.83 MB
Binary file not shown.

src/native/linux-x64/avifdec

9.07 MB
Binary file not shown.

src/native/linux-x64/avifenc

9.12 MB
Binary file not shown.

src/native/linux/avifdec

-13.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)