Vapoursynth DPIR Deblock
DPIR Deblock removes compression artifacts with DPIR (Deep Plug-and-Play Image Restoration), a neural network that runs on an NVIDIA graphics card through PyTorch, optionally accelerated with TensorRT. DPIR Deblock (mlrt) runs the same networks through vs-mlrt with more hardware choices.
Filtering → Vapoursynth → DeBlock

What it does
Every frame is restored with DPIR's deblocking model (color model for RGB, gray model for gray clips). Strength tells the network how strong the compression artifacts are; higher values remove more blocking but also more detail.
Requirements
- Windows with an NVIDIA graphics card (CUDA) and Hybrid's torch add-on (package vsdpir).
- TRT additionally needs Torch-TensorRT from the torch add-on; it cannot be used together with the TensorRT of vs-mlrt in one script.
Settings
| Control | Parameter | Range | Hybrid default | Meaning |
|---|---|---|---|---|
| Strength | strength | 0.001 – 1000 | 50 | Deblocking strength; the network gets strength/100 as noise level (useful range about 0–100). |
| Tile (w/h) | tile | 0 – 8192 | 0 / 0 | Process the frame in tiles of this size to save GPU memory; 0 = whole frame. |
| Tile pad | tile_pad | 0 – 64 | 8 | Overlap of the tiles; only with tiles. |
| Streams | num_streams | 1 – 64 | 1 | Number of CUDA streams working in parallel. |
| Device | device_index | 0 – 4 | 0 | CUDA device to use. |
| TRT | trt | on/off | off | Compile the model with TensorRT (much faster; the first run builds an engine, which takes a while). |
| FP16 | – | on/off | off | Converts the clip to half precision so DPIR runs in FP16 (faster, less memory). |
Example
Default settings on a 640×356 10-bit YUV 4:2:0 source (padded to 640×360 for mod 8):
clip = core.std.AddBorders(clip=clip, left=0, right=0, top=2, bottom=2) # add borders to achieve mod 8 (vsDPIRDeblock) - 640x360 # adjusting color space from YUV420P10 to RGBS for vsDPIRDeblock clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="470bg", range_in_s="limited", range_s="full") # deblocking using DPIRDeblock clip = DPIR(clip, strength=50.000, task="deblock", device_index=0) clip = core.std.Crop(clip=clip, left=0, right=0, top=2, bottom=2) # removing added borders from mod requirement (vsDPIRDeblock) - 640x356 # adjusting output color from RGBS to YUV420P10 for NVEncModel clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited", dither_type="error_diffusion")
How Hybrid calls it
- The clip is padded to a multiple of 8, converted to 32-bit float RGB (half precision with FP16; gray clips to gray), restored, cropped back and converted back.
- Strength and Device are always written; tiles, Tile pad and Streams only when they differ from the defaults.
- With TRT the engines are cached in the Engine Path folder of Hybrid's path settings (the temp folder if it is empty).
- DPIR Deblock also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
vs-dpir
vs-dpir by HolyWu brings DPIR to VapourSynth via PyTorch (PyTorch 2.6+, VapourSynth R66+; TensorRT 10.7+ and Torch-TensorRT 2.6+ for trt). It accepts RGBH, RGBS, GRAYH and GRAYS clips and needs CUDA. The strength can also be a gray clip for per-pixel strength; the default is 50 for deblocking and 5 for denoising. TensorRT engines are cached per model, size, precision, GPU and TensorRT version.
Sources
- vs-dpir README
- DPIR (the original network)
- Hybrid's tooltips