Skip to main content

Video/Image filter to undo upscaling.

Project description

Descale

Video/Image filter to undo upscaling.

This fork only supports VapourSynth, none of the new options are mapped in AviSynth. PRs to add AviSynth support are welcome, but apart from that the AviSynth plugin can be considered frozen.

Usage

The VapourSynth plugin itself supports every constant input format. If the format is subsampled, left-aligned chroma planes are always assumed.

descale.Debilinear(clip src, int width, int height, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Debicubic(clip src, int width, int height, float b=0.0, float c=0.5, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Delanczos(clip src, int width, int height, int taps=3, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Despline16(clip src, int width, int height, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Despline36(clip src, int width, int height, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Despline64(clip src, int width, int height, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Depoint(clip src, int width, int height, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

descale.Decustom(clip src, int width, int height, func custom_kernel, int taps=3, float blur=1.0, float[] post_conv=[], float src_left=0.0, float src_top=0.0, float src_width=width, float src_height=height, int border_handling=0, clip ignore_mask=None, bool force=false, bool force_h=false, bool force_v=false, int opt=0)

The border_handling argument can take the following values:

  • 0: Assume the image was resized with mirror padding
  • 1: Assume the image was resized with zero padding
  • 2: Assume the image was resized with extend padding, where the outermost row was extended infinitely far

The opt argument can take the following values:

  • 0: Automatically decide based on CPU capabilities
  • 1: No SIMD instructions
  • 2: Use AVX2

The AviSynth+ plugin is used similarly, but without the descale namespace. Custom kernels and ignore masks are only supported in the VapourSynth plugin.

Custom kernels

# Debilinear
core.descale.Decustom(src, w, h, custom_kernel=lambda x: 1.0 - x, taps=1)

# Delanczos
import math
def sinc(x):
    return 1.0 if x == 0 else math.sin(x * math.pi) / (x * math.pi)
taps = 3
core.descale.Decustom(src, w, h, custom_kernel=lambda x: sinc(x) * sinc(x / taps), taps=taps)

How does this work?

Resampling can be described as A x = b.

A is an n x m matrix with m being the input dimension and n the output dimension. x is the original vector with m elements, b is the vector after resampling with n elements. We want to solve this equation for x.

To do this, we extend the equation with the transpose of A: A' A x = A' b.

A' A is now a banded symmetrical m x m matrix and A' b is a vector with m elements.

This enables us to use LDLT decomposition on A' A to get LD L' = A' A. LD and L are both triangular matrices.

Then we solve LD y = A' b with forward substitution, and finally L' x = y with back substitution.

We now have the original vector x.

Installation

Pre-compiled wheels are available on PyPI for:

  • Windows: x86_64
  • Linux: x86_64 and aarch64 (glibc & musl)
  • macOS: x86_64 (10.13+) and arm64 (11.0+)
pip install vapoursynth-descale

Compilation

Building the VapourSynth plugin:

uv build --wheel

For the AviSynth+ plugin:

meson setup build -Dlibtype=avisynth && meson compile -C build

Project details


Release history Release notifications | RSS feed

This version

12

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vapoursynth_descale-12.tar.gz (25.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vapoursynth_descale-12-py3-none-win_amd64.whl (39.8 kB view details)

Uploaded Python 3Windows x86-64

vapoursynth_descale-12-py3-none-musllinux_1_2_x86_64.whl (38.1 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

vapoursynth_descale-12-py3-none-musllinux_1_2_aarch64.whl (25.5 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

vapoursynth_descale-12-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (37.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

vapoursynth_descale-12-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (25.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

vapoursynth_descale-12-py3-none-macosx_11_0_arm64.whl (25.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

vapoursynth_descale-12-py3-none-macosx_10_13_x86_64.whl (35.7 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file vapoursynth_descale-12.tar.gz.

File metadata

  • Download URL: vapoursynth_descale-12.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vapoursynth_descale-12.tar.gz
Algorithm Hash digest
SHA256 c64d8bd37cad9d455cbe8e3f3139a61c8b97af4425aba48d48ff31989a1f5a89
MD5 403b2eab313f3e7be6912ef5d9b615ff
BLAKE2b-256 0e67b9336f58a1f8b45d9e811715db936e2a36fafba3b33dfaa1865a41b37aa7

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12.tar.gz:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a0b258a281f6f110a450396194d44bc00b77d2395392f9d1fbee832dfdb5c0de
MD5 93497be1f19f3f2a6f8242a09a271efe
BLAKE2b-256 f83bf4490aed9b49376894e84509b408a35dffeae047d326d8dca3ddae32d6e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-win_amd64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9730cbd412d836da4cbc98ac03488b2776a9ebe2b15d0436441dd79e6a008b02
MD5 87043f0bc0508cb58d616ce104670e77
BLAKE2b-256 c7e0719b80d3d358d156177186422f479003ab53d29df658d1ea4a847991abb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-musllinux_1_2_x86_64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 038d1e6f9cff7a0c1bdb6fe7cd22d4e0a43cca7847b1516c9fe597c784445fc9
MD5 bb422bd060808987830567d28b5c86a1
BLAKE2b-256 4d6796847fae3818d0a5314f7e9b5f88fef314ff92e88bf221834d31251b93d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-musllinux_1_2_aarch64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9969dca2a6feb7cd5ff2b60e9198aa529f3db02f49d5c88556b3fbcaa822f05d
MD5 e69e060f49829edcded3072fd573cd8f
BLAKE2b-256 4bd1a819ce28422ab16ecce9c0bfbb9a9683f143fba6e3558a08f4c587fbd7e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4a4b3494ac88b769333070ab279bb2d6590f37947f1669a6d628107007456793
MD5 21aed50e272465ba01d792bf64aa7f41
BLAKE2b-256 e7a999c648526f966cd00ca8decbb71194f51536e49e018738a87cd540404427

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 101f146b32a3d5f7439f4aba663576fb74ab146b29cce520bb1d0b240bb1b2d2
MD5 84283d2e6f4bd81b7051b2a0be5451f5
BLAKE2b-256 ab565ebbaa1734f423df497a3fca46b9ce1d134b71ae724422e35b9e0437436f

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-macosx_11_0_arm64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_descale-12-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_descale-12-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9206419849d74db3bac8fb5821f3feb5286450ad2df5f31776ba1e3ba6140347
MD5 f7a81407a0f35bb3d9e4549f0a384d30
BLAKE2b-256 1fc54951c7f7cb9c309c7b62e539d9cd126acaefe761568f0c02fabf81bb5fde

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_descale-12-py3-none-macosx_10_13_x86_64.whl:

Publisher: build.yml on Jaded-Encoding-Thaumaturgy/vapoursynth-descale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page