Skip to content

on-device upscaling mvp: ncnn spike + phase 1 - #2

Open
sleepy-snowflake wants to merge 7 commits into
mainfrom
feature/local-upscale-mvp
Open

sleepy-snowflake wants to merge 7 commits into
mainfrom
feature/local-upscale-mvp

Conversation

@sleepy-snowflake

Copy link
Copy Markdown
Owner

Implements Phase 0 (native spike) + Phase 1 (on-device MVP) per docs/phases.md.

Spike (Phase 0)

  • Vendored ncnn 20260526 android-vulkan prebuilt (arm64-v8a + armeabi-v7a) under app/libs/ncnn/ with VERSION.txt provenance
  • CMake + externalNativeBuild; JNI bridge (upscale_jni.cpp / NcnnBridge.kt): init/loadModel/upscaleTile/release, error-code semantics only
  • Bundled realesr-animevideov3 x2+x4 ncnn models (+meta.json, BSD-3-Clause)
  • Debug-only "Engine self-check" smoke screen: one 256px tile before/after with GPU/CPU ms timings

MVP (Phase 1)

  • Engine toggle (Cloud | On-device) + model dropdown on UploadScreen
  • Oversize dialog (>1024px long edge): shrink-and-upscale (recommended), one-shot cloud w/ connectivity gate, full-res gated by preflight heap math (greyed + reason when impossible)
  • Full local pipeline: decode -> EXIF -> sRGB -> alpha flatten -> replicate-filled 256px tiles -> NCNN inference -> feathered blend -> JPEG encode -> existing Downloads save path
  • Honest progress via existing Processing state ("On-device · tile n/N · GPU|CPU"), cancel between tiles
  • 4096px output cap enforced in DownscaleFit; largeHeap enabled; sticky GPU->CPU fallback
  • Unit tests: tiler coverage/seams/blending + preflight math (CI now runs testDebugUnitTest)

Notes

  • UpscaleState untouched; ApiService.kt untouched except cancellation guards in UpscaleViewModel cloud branch
  • docs/phases.md checkboxes updated; architecture.md adjusted (replicate-fill tiles instead of pad+crop, actual blob names data/output)
  • ARM-only ncnn: physical device testing required (emulators won't run it)

Device QA checklist

  • Camera photo -> correct-side-up sharp x4 output
  • Low-RAM device survives big photos
  • CPU path exercised (airplane mode)
  • Cloud flow regression check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant