Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

descale: add fractional resolution support #70

Closed
LightArrowsEXE opened this issue Feb 21, 2023 · 0 comments
Closed

descale: add fractional resolution support #70

LightArrowsEXE opened this issue Feb 21, 2023 · 0 comments

Comments

@LightArrowsEXE
Copy link
Member

LightArrowsEXE commented Feb 21, 2023

See: https://github.com/YomikoR/GetFnative

For more specific use-cases, pitfalls, and examples, I suggest asking @Moelancholy and sam.

Example code of how you currently do fractional rescaling:

    from getfnative import descale_cropping_args  # type:ignore

    # Fractional descale.
    clip_y = get_y(clip)

    de_args = descale_cropping_args(clip_y, src_height=720.2, base_height=722, base_width=get_w(722))
    up_args = de_args | dict(width=clip.width, height=clip.height)
    ss_args = {k: v * 2 for k, v in de_args.items() if str(k).startswith('src_') and isinstance(v, (int, float))}

    descaled = Catrom.descale(clip_y, **de_args)
    upscaled = Catrom.scale(descaled, **up_args)

    cmask = descale_detail_mask(clip_y, upscaled)

    # Reupscaling.
    w2x = Waifu2x(cuda=True, tiles=4, overlap=16, num_streams=2) \
        .scale(descaled, descaled.width * 2, descaled.height * 2)
    scaled = SSIM.scale(w2x, clip.width, clip.height, **ss_args)  # type:ignore

    # Merging with detail mask and denoised chroma.
    scaled = join(core.std.MaskedMerge(scaled, clip_y, cmask), clip)
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

No branches or pull requests

2 participants