Skip to content

QVAC-17990 Add standalone ESRGAN upscaler API#1901

Merged
gianni-cor merged 28 commits into
mainfrom
feat/QVAC-17990-standalone-esrgan-upscale
May 8, 2026
Merged

QVAC-17990 Add standalone ESRGAN upscaler API#1901
gianni-cor merged 28 commits into
mainfrom
feat/QVAC-17990-standalone-esrgan-upscale

Conversation

@gabrielgrigoras-serv

@gabrielgrigoras-serv gabrielgrigoras-serv commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a standalone ESRGAN upscaler API to @qvac/diffusion-cpp.

This allows callers to upscale existing encoded image bytes without loading or running a diffusion model.

New public API:

const { EsrganUpscaler } = require('@qvac/diffusion-cpp')

const upscaler = new EsrganUpscaler({
  files: {
    esrgan: '/absolute/path/to/RealESRGAN_x4plus_anime_6B.pth'
  },
  config: {
    upscaler_tile_size: 128
  },
  logger: console
})

await upscaler.load()

const response = await upscaler.upscale(inputImageBytes, {
  repeats: 1
})

await response.onUpdate(data => {
  // PNG bytes
}).await()

await upscaler.unload()

Additional PR details

Implemented:

  • named export EsrganUpscaler
  • standalone native ESRGAN model wrapper
  • standalone native binding methods
  • shared ESRGAN repeat-upscale helper
  • shared image decode/encode helper
  • PNG/JPEG byte input support
  • PNG byte output
  • repeats support with positive integer validation
  • files.esrgan validation without requiring files.model
  • CI-safe JS integration coverage
  • native image codec unit coverage
  • -shared backend loader between ImgStableDiffusion and EsrganUpscaler
  • cancel parity between standalone and post-generation ESRGAN upscale
  • ESRGAN e2e cancel coverage
  • ESRGAN cross-instance coexistence coverage
  • official Real-ESRGAN repo/model download references

Validation

  • test:dts passed
  • lint passed
  • test:cpp:build passed
  • test:cpp:run passed
  • ESRGAN e2e integration test passed

Results:

  • C++ tests: 102 ran, 100 passed, 2 skipped
  • ESRGAN e2e: 5/5 tests passed, 57/57 assertions passed

Skipped C++ tests require local FLUX2 img2img assets and are unrelated to this PR.

Notes

  • SDK/plugin exposure is out of scope
  • docs/examples are planned under QVAC-17992 unless reviewers prefer them here

Comment thread packages/diffusion-cpp/index.js Outdated
Comment thread packages/diffusion-cpp/addon/src/utils/ImageCodec.cpp
Comment thread packages/diffusion-cpp/addon/src/utils/EsrganUpscaler.cpp
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (2/1)
- 1 Team Lead OR Management approval ✅ (1/1)



---
*This comment is automatically updated when reviews change.*

@gianni-cor gianni-cor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up after commits 237b776..2982390. Most behavioral items from the previous reviews landed cleanly — these five are what's still missing before this can ship.

Numbering matches the recap shared offline.

Comment thread packages/diffusion-cpp/addon/src/model-interface/EsrganUpscalerModel.cpp Outdated
Comment thread packages/diffusion-cpp/index.js

@gianni-cor gianni-cor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more observation while comparing the diffusion-cpp JS contract against qvac-lib-infer-llamacpp-llm. Not blocking — flagging for a follow-up.

Comment thread packages/diffusion-cpp/index.js Outdated
@kinsta

kinsta Bot commented May 8, 2026

Copy link
Copy Markdown

Preview deployments for qvac-docs-staging ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: 1216b5281e464186727a3c3f9c65161c683dd374

Deployment ID: 1264e256-fd92-4cc6-a58a-a91bfcebc026

Static site name: qvac-docs-staging-fazwv

gabrielgrigoras-serv and others added 3 commits May 8, 2026 19:12
Add a standalone-esrgan-upscale example and a README usage section
covering the new EsrganUpscaler named export. The previous CHANGELOG
entry was the only user-facing reference to the new public class;
this commit makes it discoverable from the README index, the Other
Examples list, and a runnable example script that mirrors the existing
generate-image-esrgan-upscale flow but without the diffusion phase.
@gianni-cor

Copy link
Copy Markdown
Contributor

/review

@gianni-cor

Copy link
Copy Markdown
Contributor

/review

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.

6 participants