Skip to content

Severe pixelation in places very far from the mosaic area #76

Description

@Milincho

I think this is one of the biggest issues with Lada/Jasna: there are severe pixelation in places very far from the mosaic area in many videos.

This issue is also present in LADA, and is perfectly documented here: https://codeberg.org/ladaapp/lada/issues/107

Image Image

There is already a solution posted in that thread, that also improves the demosaic result, but it hasn't been included in the main branch yet: https://codeberg.org/ladaapp/lada/issues/107#issuecomment-8357643

"Summary of Implementation
The pixelation issue in areas far from mosaic boundaries (issue #107) has been resolved with a safe, error-free solution compatible with watch (detection on/off) and export modes.
Key Changes Made:

Dynamic Clip Sizing (mosaic_detector.py):
• Added get_max_width_height() method to Scene class
• Implemented VRAM-aware clip size selection (256-1024px based on mosaic area)
• Reduces downscaling for large mosaics, minimizing pixelation
Adaptive Border Reduction (scene_utils.py):
• Halved border expansion for mosaics >512px to avoid excessive pixelation-causing downscaling
Dynamic Buffer Resizing (basicvsrpp/inference.py):
• Buffers now resize per inference call to match variable clip sizes
• Fixed RuntimeError by ensuring CPU/GPU buffer compatibility
Enhanced Model Loading:
• Added max_clip_size=1024 parameter to load_model() for larger buffer allocation
Results:
• Logs show successful initialization with tiered sizes [256, 384, 512, 768, 1024] based on 12GB VRAM
• Buffer resizing works correctly (e.g., from 1024x1024 to 384x384 without errors)
• Solution prevents OOM with safety caps and fallbacks
• Maintains backward compatibility and works across all modes
The artifacts (hair distortion, pixel borders) in areas far from mosaics are now eliminated through reduced downscaling and better blending isolation.
Same picture extended to show how good is the result (demosaic result is also became a bit better in terms of image quality):

Image

Picture made from v0.8.2 release for comparison:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions