An open API service indexing awesome lists of open source software.

https://github.com/sdcb/libyuv-build


https://github.com/sdcb/libyuv-build

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# libyuv-build

[![Build libyuv](https://github.com/sdcb/libyuv-build/actions/workflows/build.yml/badge.svg)](https://github.com/sdcb/libyuv-build/actions/workflows/build.yml)
[![Test libyuv](https://github.com/sdcb/libyuv-build/actions/workflows/test.yml/badge.svg)](https://github.com/sdcb/libyuv-build/actions/workflows/test.yml)
[![NuGet](https://github.com/sdcb/libyuv-build/actions/workflows/nuget.yml/badge.svg)](https://github.com/sdcb/libyuv-build/actions/workflows/nuget.yml)

Pre-built [libyuv](https://chromium.googlesource.com/libyuv/libyuv) native binaries and NuGet packages for multiple platforms.

## What is libyuv?

libyuv is an open source project from Google that includes YUV scaling and conversion functionality. It provides highly optimized routines for:

- YUV conversion (I420, NV12, NV21, YUY2, UYVY, etc.)
- Color space conversion (YUV ↔ RGB/ARGB/BGRA)
- Scaling and rotating
- Planar functions

## Supported Platforms

| Platform | Architecture | NuGet Package |
|----------|--------------|---------------|
| Windows | x64 | `Sdcb.LibYuv.runtime.win-x64` |
| Windows | x86 | `Sdcb.LibYuv.runtime.win-x86` |
| Windows | arm64 | `Sdcb.LibYuv.runtime.win-arm64` |
| macOS | arm64 | `Sdcb.LibYuv.runtime.osx-arm64` |
| Linux (glibc) | x64 | `Sdcb.LibYuv.runtime.linux-x64` |
| Linux (glibc) | arm64 | `Sdcb.LibYuv.runtime.linux-arm64` |
| Linux (musl/Alpine) | x64 | `Sdcb.LibYuv.runtime.linux-musl-x64` |
| Linux (musl/Alpine) | arm64 | `Sdcb.LibYuv.runtime.linux-musl-arm64` |
| Android | arm64 | `Sdcb.LibYuv.runtime.android-arm64` |
| Android | x64 | `Sdcb.LibYuv.runtime.android-x64` |

## Installation

Install via NuGet Package Manager:

```bash
# For Windows x64
dotnet add package Sdcb.LibYuv.runtime.win-x64

# For Linux x64
dotnet add package Sdcb.LibYuv.runtime.linux-x64

# For macOS arm64
dotnet add package Sdcb.LibYuv.runtime.osx-arm64

# For Android arm64
dotnet add package Sdcb.LibYuv.runtime.android-arm64
```

## Usage Example

Here's a simple P/Invoke example in C#:

```csharp
using System;
using System.Runtime.InteropServices;

class LibYuv
{
const string LibName = "libyuv";

[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int I420ToARGB(
IntPtr src_y, int src_stride_y,
IntPtr src_u, int src_stride_u,
IntPtr src_v, int src_stride_v,
IntPtr dst_argb, int dst_stride_argb,
int width, int height);

[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ARGBToI420(
IntPtr src_argb, int src_stride_argb,
IntPtr dst_y, int dst_stride_y,
IntPtr dst_u, int dst_stride_u,
IntPtr dst_v, int dst_stride_v,
int width, int height);
}
```

## Build Compatibility

### Linux (glibc)
- **x64**: Built on OracleLinux 7 (glibc 2.17) - Compatible with CentOS 7+, RHEL 7+, Debian 8+, Ubuntu 14.04+
- **arm64**: Built on OracleLinux 8 (glibc 2.28) - Compatible with RHEL 8+, Debian 10+, Ubuntu 20.04+

### Linux (musl)
- Built on Alpine 3.22 (musl-libc 1.2.5) - Compatible with Alpine 3.13+

### Android
- Built with Android NDK, API Level 24+ (Android 7.0+)

## CI/CD Workflows

This repository includes three GitHub Actions workflows:

1. **build.yml** - Compiles libyuv for all supported platforms
2. **test.yml** - Runs native tests on various OS versions and Docker containers
3. **nuget.yml** - Creates and publishes NuGet packages

## License

This project is licensed under the [BSD 3-Clause License](LICENSE).

libyuv itself is licensed under the BSD 3-Clause License by Google.

## Links

- [libyuv Official Repository](https://chromium.googlesource.com/libyuv/libyuv)
- [libyuv Documentation](https://chromium.googlesource.com/libyuv/libyuv/+/HEAD/docs/)
- [NuGet Packages](https://github.com/sdcb/libyuv-build/packages)