https://github.com/the-database/animejanai-inference
https://github.com/the-database/animejanai-inference
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/the-database/animejanai-inference
- Owner: the-database
- Created: 2026-06-11T18:01:32.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-06-15T00:40:11.000Z (about 1 month ago)
- Last Synced: 2026-06-15T02:28:53.497Z (about 1 month ago)
- Language: C++
- Size: 507 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# animejanai-inference
Inference shim for the native mpv AnimeJaNai pipeline. `libaji` exposes a
strict C ABI (`include/aji.h`) that `vf_animejanai` in the
[the-database/mpv](https://github.com/the-database/mpv) fork loads at
runtime — mpv never links TensorRT, so the backend and TRT version can be
swapped without rebuilding the player, and on Windows the MSVC-built shim
coexists with a mingw-built mpv.
Current backend: TensorRT (`src/aji_trt.cpp`) with CUDA pre/post kernels
(`src/kernels.cu`): NV12/P010 → fp16 NCHW RGB (BT.709 limited) → engine →
NV12/P010, all device-side. Phase 0 spike scope; chain selection,
engine building, colorspace metadata and CUDA graphs land here in phase 1.
## Build (Linux)
Needs CUDA toolkit 13.x and TensorRT 10.x (default path:
`~/sdk/tensorrt/usr`, override with `-DAJI_TRT_ROOT=`).
```sh
CUDACXX=/usr/local/cuda/bin/nvcc cmake -B build -S .
cmake --build build -j
```
## Engine
```sh
trtexec --onnx=models/.onnx --fp16 \
--minShapes=input:1x3x64x64 --optShapes=input:1x3x1080x1920 \
--maxShapes=input:1x3x1088x1920 --saveEngine=models/.engine
```
## Harness (no player needed)
```sh
ffmpeg -i clip.mkv -frames:v 12 -pix_fmt p010le -f rawvideo in.raw
./build/aji_harness --engine models/.engine --input in.raw \
--width 1400 --height 1080 --format p010 --output out.raw
```
Reports device-side ms/frame for the full pre+infer+post chain
(RTX 5090 reference: ~3.8 ms at 1920x1080→4K fp16).
## mpv usage (spike)
```sh
mpv --hwdec=nvdec \
--vf=animejanai=engine=models/.engine:lib=build/libaji.so video.mkv
```