Skip to content

About

Offline on-device AI image upscaling and face restoration for Android (arm64-v8a) powered by ONNX Runtime (QNN/NNAPI) and NCNN Vulkan. Features an indie darkroom Material 3 interface with a pinch-to-zoom before/after loupe, native 2×/4× models, and zero cloud uploads.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PixelForge Logo

PixelForge

Offline on-device AI image upscaling & restoration for Android (arm64-v8a).
No cloud uploads. No queues. Built with Jetpack Compose, ONNX Runtime (QNN / NNAPI), NCNN Vulkan, and MediaPipe.


Features

  • Dual-Backend Super-Resolution
    • Fast Photo (realesr-general-x4v3): Runs via ONNX Runtime targeting Qualcomm QNN HTP / Android NNAPI (with multi-threaded CPU fallback) for fast everyday photo upscaling.
    • Anime & Text (realesr-animevideov3): Native 2× and 4× NCNN Vulkan models tuned for crisp line art, screenshots, and text.
    • Ultra Photo (realesrgan-x4plus): Optional 23-RRDB heavy model (downloadable on demand inside the app) for maximum texture reconstruction.
  • Selective Face Restoration
    • On-device face detection with MediaPipe BlazeFace (blaze_face_short_range.tflite).
    • Supports optional neural portrait restoration (GFPGAN v1.4 ONNX pack) or lightweight local clarity enhancement blended smoothly with radial feathering.
  • Darkroom Inspection & Export
    • Pinch-to-zoom, double-tap loupe, and aspect-preserving before/after split comparison.
    • EXIF-orientation-aware OOM-safe decoding, alpha channel preservation, WorkManager foreground execution, and Scoped Storage export (PNG, JPEG, WEBP) to Pictures/PixelForge.

Architecture

app/src/main/
├── cpp/                     # C++17 NCNN + Vulkan inference engine & mutex-guarded JNI bridge
├── java/com/pixelforge/app/
│   ├── bridge/              # NativeLoader & RealesrganBridge
│   ├── core/                # EXIF-safe Bitmap decoding, ImageAnalyzer, MediaStoreUtils
│   ├── data/                # Room database (v2), DataStore settings, ModelManager, cache
│   ├── di/                  # Hilt modules
│   ├── domain/              # Models, repository contracts, use cases
│   ├── engine/              # EngineSelector, OrtNpuUpscaleEngine, NcnnUpscaleEngine, FaceRestorationPipeline, PostProcessor
│   ├── presentation/        # Darkroom Material 3 Compose UI (Home, Editor, Processing, Result, History, Settings)
│   └── worker/              # WorkManager foreground UpscaleWorker
└── assets/models/           # Bundled compact models (ONNX general-x4v3, NCNN animevideov3, BlazeFace)

Building from Source

Prerequisites

  • Android Studio / JDK 17
  • Android SDK compileSdk = 35, minSdk = 31, and Android NDK + CMake 3.22.1
  • arm64-v8a prebuilt NCNN + glslang static libraries placed in app/src/main/jniLibs/arm64-v8a/ (excluded from git via .gitignore):
    1. Download ncnn-20260113-android-vulkan.zip from Tencent/ncnn releases.
    2. Copy the arm64-v8a/include and arm64-v8a/lib directories into app/src/main/jniLibs/arm64-v8a/.
    3. libomp.so is copied automatically from your local NDK by the copyLibOmp Gradle task.

Commands

# Run unit tests and Android Lint
./gradlew testDebugUnitTest lintDebug

# Build and install debug APK on a connected arm64-v8a device
./gradlew installDebug

# Run on-device instrumentation & engine smoke tests
./gradlew connectedDebugAndroidTest

# Build release APK
./gradlew assembleRelease

Roadmap

See ROADMAP.md for planned improvements to inference speed, image quality, and UX.

Credits & Upstream Projects

License

Licensed under the GNU General Public License v3.0.

About

Offline on-device AI image upscaling and face restoration for Android (arm64-v8a) powered by ONNX Runtime (QNN/NNAPI) and NCNN Vulkan. Features an indie darkroom Material 3 interface with a pinch-to-zoom before/after loupe, native 2×/4× models, and zero cloud uploads.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages