mirror of
https://github.com/Nexoniarz/YAPF.git
synced 2026-11-03 04:54:26 +00:00
YAPF v1: fast byte-aligned format, SIMD, tools and plugins
Format (version 1, replaces the earlier experimental versions): - per-tile YCoCg-R or subtract-green colour transform, 8-bit modular - 12 row filters per 8-row band (Left, Gradient, Up-right, Up-average, Up 1-8 rows), none with more than a one-add serial dependency - residuals in groups of 8 at the group's width (w bits x 8 = w bytes), 4-bit control codes with repeat-previous-width runs chosen by DP - constant and stored tiles, independent 64x64 tiles, mips, GPU hints - all sizes validated before decoding; corrupt input is rejected Library: - SIMD on by default: SSSE3 (runtime CPUID check; GCC, Clang, MSVC, MinGW) and NEON on ARM64; -DYAPF_NO_SIMD for plain C - yapf_load_memory, yapf_load_mt, yapf_load_memory_mt - 6-10x faster decoding than PNG (stb_image) on one core; -O2 and -O3 builds perform the same - fixes for macOS (sysconf) and the Windows import library exports Tools and integrations: - `yapf` CLI: convert PNG/JPG/TGA/BMP/PSD/GIF <-> YAPF, info, bench, thumbnail, mips - JavaScript and Python bindings (byte-identical to the C encoder) - GIMP 3 plugin: exports the flattened image, optional mipmaps - Blender extension: import (also as plane), export, drag and drop - VS Code preview, Figma plugin, Photoshop scripts, Linux MIME type and thumbnailer - Makefile, updated build.sh / build.bat, tools/build_release.sh - tests/test_yapf.c (784 checks) and bindings/js/test.js Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b9b8c93a22
commit
2ca726e3af
48 changed files with 14905 additions and 710 deletions
15
extensions/linux/README.md
Normal file
15
extensions/linux/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Linux desktop integration
|
||||
|
||||
Makes file managers recognise `.yapf` files (MIME type `image/x-yapf`) and
|
||||
show **thumbnails** for them.
|
||||
|
||||
```sh
|
||||
sh extensions/linux/install.sh # for your user
|
||||
sudo sh extensions/linux/install.sh --system
|
||||
```
|
||||
|
||||
Thumbnails are made by `yapf thumbnail` (from the `yapf` tool, which must be
|
||||
on your `PATH` — `sudo make install` puts it in `/usr/local/bin`). They work
|
||||
in file managers that use freedesktop thumbnailers: GNOME Files (Nautilus),
|
||||
Nemo, Caja, and Thunar (with tumbler). KDE Dolphin uses its own plugin
|
||||
system and is not covered yet.
|
||||
18
extensions/linux/install.sh
Executable file
18
extensions/linux/install.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Registers the YAPF MIME type and thumbnailer for the current user, so file
|
||||
# managers that use freedesktop thumbnailers (GNOME Files, Nemo, Caja,
|
||||
# Thunar with tumbler) show .yapf previews. Needs `yapf` on your PATH.
|
||||
# sh extensions/linux/install.sh (current user)
|
||||
# sudo sh extensions/linux/install.sh --system
|
||||
set -e
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
if [ "$1" = "--system" ]; then data=/usr/share; else data=${XDG_DATA_HOME:-$HOME/.local/share}; fi
|
||||
|
||||
command -v yapf >/dev/null 2>&1 || echo "warning: 'yapf' is not on your PATH; thumbnails need it" >&2
|
||||
|
||||
mkdir -p "$data/mime/packages" "$data/thumbnailers"
|
||||
cp "$here/yapf-mime.xml" "$data/mime/packages/yapf.xml"
|
||||
cp "$here/yapf.thumbnailer" "$data/thumbnailers/yapf.thumbnailer"
|
||||
update-mime-database "$data/mime" >/dev/null 2>&1 || true
|
||||
echo "Installed the image/x-yapf MIME type and thumbnailer into $data"
|
||||
echo "Restart your file manager (e.g. 'nautilus -q') and clear ~/.cache/thumbnails/fail if needed."
|
||||
12
extensions/linux/yapf-mime.xml
Normal file
12
extensions/linux/yapf-mime.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Registers .yapf files as image/x-yapf (shared-mime-info). -->
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="image/x-yapf">
|
||||
<comment>YAPF image</comment>
|
||||
<generic-icon name="image-x-generic"/>
|
||||
<magic priority="60">
|
||||
<match type="string" value="YAPF" offset="0"/>
|
||||
</magic>
|
||||
<glob pattern="*.yapf"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
4
extensions/linux/yapf.thumbnailer
Normal file
4
extensions/linux/yapf.thumbnailer
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[Thumbnailer Entry]
|
||||
TryExec=yapf
|
||||
Exec=yapf thumbnail %i %o %s
|
||||
MimeType=image/x-yapf;
|
||||
Loading…
Reference in a new issue