Hex.pm API Docs

Elixir binding for libyuv.

libyuv is an open source project that includes YUV scaling and conversion functionality.

  • Scale YUV to prepare content for compression, with point, bilinear or box filter.
  • Convert to YUV from webcam formats for compression.
  • Convert to RGB formats for rendering/effects.
  • Rotate by 90/180/270 degrees to adjust for mobile devices in portrait mode.
  • Optimized for SSSE3/AVX2 on x86/x64.
  • Optimized for Neon/SVE2/SME on Arm.
  • Optimized for MSA on Mips.
  • Optimized for RVV on RISC-V.

Formats

Formats (FOURCC) supported by libyuv are detailed here.

Core Formats

There are 2 core formats supported by libyuv - I420 and ARGB. All YUV formats can be converted to/from I420. All RGB formats can be converted to/from ARGB.

Filtering functions such as scaling and planar functions work on I420 and/or ARGB.

Planar Formats

FormatPlanesDescription
I4203Y full resolution. U half width, half height. V half width, half height

Packed Formats

FormatBits Per PixelPixel Memory Layout
RAW (RGB)24<<r::8, g::8, b::8>>
RGB2424<<b::8, g::8, r::8>>
ARGB32<<b::8, g::8, r::8, a::8>>
ABGR32<<r::8, g::8, b::8, a::8>>
BGRA32<<a::8, r::8, g::8, b::8>>
RGBA32<<a::8, b::8, g::8, r::8>>
RGB56516<<r::5, g::6, b::5>>
RGB155516<<a::1, r::5, g::6, b::5>>
RGB444416<<a::4, r::4, g::4, b::4>>
AR3032<<a::2, r::10, g::10, b::10>>
AB3032<<a::2, b::10, g::10, r::10>>

Installation

The package can be installed by adding ex_yuv to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_yuv, "~> 0.2.0"}
  ]
end