{"id":46821137,"url":"https://github.com/shiguredo/libyuv-rs","last_synced_at":"2026-04-02T20:00:08.358Z","repository":{"id":343392943,"uuid":"1176832720","full_name":"shiguredo/libyuv-rs","owner":"shiguredo","description":"Rust bindings for Google's libyuv image conversion and processing library","archived":false,"fork":false,"pushed_at":"2026-03-31T10:12:10.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2026-03-31T10:15:26.483Z","etag":null,"topics":["libyuv","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shiguredo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-09T12:28:16.000Z","updated_at":"2026-03-31T10:12:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shiguredo/libyuv-rs","commit_stats":null,"previous_names":["shiguredo/libyuv-rs"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/shiguredo/libyuv-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiguredo%2Flibyuv-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiguredo%2Flibyuv-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiguredo%2Flibyuv-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiguredo%2Flibyuv-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiguredo","download_url":"https://codeload.github.com/shiguredo/libyuv-rs/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiguredo%2Flibyuv-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31314768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["libyuv","rust"],"created_at":"2026-03-10T09:04:20.907Z","updated_at":"2026-04-02T20:00:08.347Z","avatar_url":"https://github.com/shiguredo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libyuv-rs\n\n[![crates.io](https://img.shields.io/crates/v/shiguredo_libyuv.svg)](https://crates.io/crates/shiguredo_libyuv)\n[![docs.rs](https://docs.rs/shiguredo_libyuv/badge.svg)](https://docs.rs/shiguredo_libyuv)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![GitHub Actions](https://github.com/shiguredo/libyuv-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/shiguredo/libyuv-rs/actions/workflows/ci.yml)\n[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?logo=discord\u0026logoColor=white)](https://discord.gg/shiguredo)\n\n## About Shiguredo's open source software\n\nWe will not respond to PRs or issues that have not been discussed on Discord. Also, Discord is only available in Japanese.\n\nPlease read \u003chttps://github.com/shiguredo/oss\u003e before use.\n\n## 時雨堂のオープンソースソフトウェアについて\n\n利用前に \u003chttps://github.com/shiguredo/oss\u003e をお読みください。\n\n## 概要\n\nGoogle の [libyuv](https://chromium.googlesource.com/libyuv/libyuv/) を利用した画像変換・処理ライブラリの Rust バインディングです。\n\nビルド時に libyuv のソースコードを git clone し、CMake でビルドした上で bindgen でバインディングを自動生成します。\n\n## 特徴\n\n- prebuilt バイナリによる高速ビルド (デフォルト)\n- ソースからのビルドも可能 (`--features source-build`)\n- YUV / RGB 間のフォーマット変換 (244 関数)\n- 画像のスケーリング (リサイズ)\n- 画像の回転 (0 / 90 / 180 / 270 度)\n- 画像の左右反転 (ミラー)\n- 画像の品質比較 (PSNR / SSIM)\n- アルファブレンド・補間\n- プレーン操作 (コピー / 塗りつぶし / 分割 / 結合)\n- ARGB 加工 (グレースケール / セピア / シェーディング / アルファ事前乗算)\n- 矩形描画\n- 静的ライブラリの全シンボルを `shiguredo_yuv_` プレフィックス付きに書き換えて他ライブラリとの衝突を回避\n- 高ビット深度 (10bit / 12bit / 16bit) 対応\n- HDR フォーマット (AR30 / AR64 / AB64) 対応\n- ハードウェアフォーマット (Android420 / MM21 / MT2T) 対応\n\n## 動作要件\n\n- Ubuntu 24.04 x86_64\n- Ubuntu 24.04 arm64\n- Ubuntu 22.04 x86_64\n- Ubuntu 22.04 arm64\n- macOS 26 arm64\n- macOS 15 arm64\n- Windows Server 2025 x86_64\n- Windows 11 x86_64\n\n## 対応フォーマット\n\n### YUV (3 プレーン)\n\n| フォーマット | クロマサブサンプリング | 備考 |\n|---|---|---|\n| I420 | 4:2:0 | 最も一般的 |\n| I422 | 4:2:2 | |\n| I444 | 4:4:4 | |\n| J420 / J422 / J444 | JPEG フルレンジ | |\n| I400 | グレースケール (Y のみ) | |\n\n### YUV (2 プレーン)\n\n| フォーマット | クロマ順序 | 備考 |\n|---|---|---|\n| NV12 | UV | H.264 / H.265 デコーダー出力で一般的 |\n| NV21 | VU | Android カメラ出力で一般的 |\n| NV24 | UV (4:4:4) | |\n\n### RGB\n\n| フォーマット | ピクセルサイズ |\n|---|---|\n| ARGB | 4 bytes |\n| ABGR | 4 bytes |\n| RGBA | 4 bytes |\n| BGRA | 4 bytes |\n| RGB24 | 3 bytes |\n| RAW | 3 bytes |\n| RGB565 | 2 bytes |\n| ARGB1555 | 2 bytes |\n| ARGB4444 | 2 bytes |\n\n### パック YUV\n\n| フォーマット | ピクセルサイズ | 備考 |\n|---|---|---|\n| YUY2 (YUYV) | 2 bytes | 4:2:2 パック |\n| UYVY | 2 bytes | 4:2:2 パック |\n\n### 高ビット深度\n\n| フォーマット | ビット深度 |\n|---|---|\n| I010 / I210 / I410 | 10bit |\n| I012 / I212 / I412 | 12bit |\n| P010 / P012 / P016 / P210 / P410 | 10-16bit |\n| AR30 / AB30 | 10bit packed |\n| AR64 / AB64 | 16bit |\n\n## ビルド\n\nデフォルトでは GitHub Releases から prebuilt バイナリをダウンロードしてビルドします。\n\n```bash\ncargo build\n```\n\n### ソースからビルド\n\nlibyuv をソースからビルドする場合は `source-build` feature を有効にしてください。\n\n```bash\ncargo build --features source-build\n```\n\nソースビルドには以下が必要です:\n\n- Git\n- C / C++ コンパイラ\n\n### docs.rs 向けビルド\n\nlibyuv がない環境では、docs.rs 向けのドキュメント生成のみ可能です。\n\n```bash\nDOCS_RS=1 cargo doc --no-deps\n```\n\n### 環境変数\n\n| 環境変数 | 説明 |\n|---|---|\n| `LIBYUV_TARGET` | prebuilt バイナリのプラットフォーム名を明示的に指定する |\n\n## 使い方\n\n### フォーマット変換\n\n```rust\nuse shiguredo_libyuv::{i420_to_argb, ArgbImageMut, I420Image, ImageSize};\n\nlet size = ImageSize::new(640, 480);\n\nlet src = I420Image {\n    y: \u0026y_plane,\n    y_stride: 640,\n    u: \u0026u_plane,\n    u_stride: 320,\n    v: \u0026v_plane,\n    v_stride: 320,\n};\n\nlet mut argb_buf = vec![0u8; 640 * 480 * 4];\nlet mut dst = ArgbImageMut {\n    data: \u0026mut argb_buf,\n    stride: 640 * 4,\n};\n\ni420_to_argb(\u0026src, \u0026mut dst, size)?;\n```\n\n### スケーリング\n\n```rust\nuse shiguredo_libyuv::{i420_scale, FilterMode, ImageSize};\n\nlet src_size = ImageSize::new(1920, 1080);\nlet dst_size = ImageSize::new(640, 360);\n\ni420_scale(\u0026src, src_size, \u0026mut dst, dst_size, FilterMode::Bilinear)?;\n```\n\n### 回転\n\n```rust\nuse shiguredo_libyuv::{i420_rotate, ImageSize, RotationMode};\n\nlet src_size = ImageSize::new(640, 480);\nlet dst_size = ImageSize::new(480, 640); // 90 度回転で幅と高さが入れ替わる\n\ni420_rotate(\u0026src, src_size, \u0026mut dst, dst_size, RotationMode::Rotate90)?;\n```\n\n### 品質比較\n\n```rust\nuse shiguredo_libyuv::{i420_psnr, i420_ssim, ImageSize};\n\nlet size = ImageSize::new(640, 480);\n\nlet psnr = i420_psnr(\u0026original, \u0026decoded, size)?;\nlet ssim = i420_ssim(\u0026original, \u0026decoded, size)?;\n```\n\n### NV12 から I420 への変換\n\n```rust\nuse shiguredo_libyuv::{nv12_to_i420, ImageSize, Nv12Image};\n\nlet size = ImageSize::new(640, 480);\n\nlet src = Nv12Image {\n    y: \u0026y_plane,\n    y_stride: 640,\n    uv: \u0026uv_plane,\n    uv_stride: 640,\n};\n\nnv12_to_i420(\u0026src, \u0026mut dst, size)?;\n```\n\n### アルファチャンネル付き変換\n\n```rust\nuse shiguredo_libyuv::{i420_alpha_to_argb, ImageSize};\n\nlet size = ImageSize::new(640, 480);\n\n// attenuate: アルファ事前乗算を行うかどうか\ni420_alpha_to_argb(\u0026src, \u0026alpha_plane, 640, \u0026mut dst, size, true)?;\n```\n\n## 設定\n\n### `FilterMode`\n\n| バリアント | 説明 |\n|---|---|\n| `FilterMode::None` | フィルタなし (最速、最低品質) |\n| `FilterMode::Linear` | 線形フィルタ (高速、適度な品質) |\n| `FilterMode::Bilinear` | バイリニア (中程度) |\n| `FilterMode::Box` | ボックスフィルタ (ダウンスケール時に有効) |\n\n### `RotationMode`\n\n| バリアント | 説明 |\n|---|---|\n| `RotationMode::None` | 回転なし (0 度) |\n| `RotationMode::Rotate90` | 時計回り 90 度 |\n| `RotationMode::Rotate180` | 180 度 |\n| `RotationMode::Rotate270` | 時計回り 270 度 (反時計回り 90 度) |\n\n### 画像バッファ型\n\nフォーマットごとに専用の型を提供しています。各型は `Image` (読み取り専用) と `ImageMut` (書き込み可能) のペアです。\n\n| 型の例 | フィールド | 用途 |\n|---|---|---|\n| `I420Image` / `I420ImageMut` | y, u, v + stride | 3 プレーン YUV 4:2:0 |\n| `I422Image` / `I422ImageMut` | y, u, v + stride | 3 プレーン YUV 4:2:2 |\n| `Nv12Image` / `Nv12ImageMut` | y, uv + stride | 2 プレーン NV12 |\n| `ArgbImage` / `ArgbImageMut` | data, stride | パック ARGB |\n| `I010Image` / `I010ImageMut` | y, u, v + stride (u16) | 10bit 3 プレーン YUV |\n| `P010Image` / `P010ImageMut` | y, uv + stride (u16) | 10bit 2 プレーン |\n| `Ar64Image` / `Ar64ImageMut` | data, stride (u16) | 16bit パック |\n\nその他: `I444Image`, `J420Image`, `H420Image`, `Nv21Image`, `AbgrImage`, `Rgb24Image`, `I400Image` など全フォーマットに対応する型があります。\n\n## モジュール構成\n\n| モジュール | 関数数 | 内容 |\n|---|---|---|\n| `convert` | 244 | フォーマット変換 |\n| `planar` | 67 | プレーン操作・ARGB 加工 |\n| `rotate` | 20 | 回転・転置 |\n| `scale` | 18 | スケーリング |\n| `compare` | 9 | 品質比較 (PSNR / SSIM) |\n\n## ライセンス\n\nApache License 2.0\n\n```text\nCopyright 2026-2026, Shiguredo Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiguredo%2Flibyuv-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshiguredo%2Flibyuv-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiguredo%2Flibyuv-rs/lists"}