View Full Version : dumb fast deblocker desired
Katie Boundary
10th October 2022, 05:18
I've looked at existing deblock filters and I find that they're a little... over-engineered. I'm interested in something that works as follows:
1 - splits the image into 8x8 or 16x16 blocks;
2 - performs a Gaussian blur on the four corner pixels of each block, except for the four corner pixels of the image; and
3 - performs a horizontal or vertical (as appropriate) Gaussian blur on the 24 or 56 edge pixels of each block, except for the pixels at the image edges
Does such a filter exist?
anton_foy
10th October 2022, 08:24
I've looked at existing deblock filters and I find that they're a little... over-engineered. I'm interested in something that works as follows:
1 - splits the image into 8x8 or 16x16 blocks;
2 - performs a Gaussian blur on the four corner pixels of each block, except for the four corner pixels of the image; and
3 - performs a horizontal or vertical (as appropriate) Gaussian blur on the 24 or 56 edge pixels of each block, except for the pixels at the image edges
Does such a filter exist?
You have blockyness (blocks) in the image and you want to blur the block-edges and corners but not the image (correct?). But if the blocks/blockyness is part of the actual image what do you mean to not touch the image? Did I miss something here? Or did you mean the outer pixels of the whole image to leave untouched?
johnmeyer
10th October 2022, 15:30
How do you propose getting your 8x8 or 16x16 blocks to line up with the block artifacts in each frame? I think that is a far bigger problem than how you do the blurring. Block artifacts tend to wander.
This is what DCT blocking looks like (download and zoom in). I'm not sure your proposed solution would work.
https://i.imgur.com/LHB4V9f.png
Katie Boundary
11th October 2022, 03:51
did you mean the outer pixels of the whole image to leave untouched?
Yes, that is literally exactly what I said.
How do you propose getting your 8x8 or 16x16 blocks to line up with the block artifacts in each frame?
There's no need to line anything up. That's just where they are, always, unless the image was cropped or resized after compression.
Block artifacts tend to wander.
I've never seen that happen.
This is what DCT blocking looks like (download and zoom in). I'm not sure your proposed solution would work.
That looks pretty uniformly divided into 8x8 blocks to me.
anton_foy
11th October 2022, 08:23
You can test your idea by making a mask image with your desired grid (8x8 for example) with black background and white lines where you want it to blur.
Mask=ImageReader("8x8mask.png")
Blur=blur(1.0) # or whatever blur
Mt_merge(source,blur,mask, luma=true, u=3, v=3)
There is probably a faster / easier / better way to script it but this way you will at least see how it works.
DTL
11th October 2022, 11:06
Have you check old Mdeblock plugin - https://forum.doom9.org/showthread.php?p=1968764#post1968764 ?
http://avisynth.nl/index.php/MDeblock
ChaosKing
11th October 2022, 12:08
Basically a mask like this? + the example by anton_foy
This is a mask for 1 + 2. I don't fully undestand point 3.
https://i.imgur.com/pUOIHSu.png
DTL
11th October 2022, 12:52
The size of gaussian blur for 8x8 block is not defined. The 8x8 block is very small and typical gaussian blur of even 2 samples half width may significantly degrade the all block sharpness.
ChaosKing
11th October 2022, 13:31
The size of gaussian blur for 8x8 block is not defined. The 8x8 block is very small and typical gaussian blur of even 2 samples half width may significantly degrade the all block sharpness.
This shouldn't be a problem with the mask approach?
Blur whole image, use mask to merge original with blured image.
Quadratic
11th October 2022, 14:26
Deblock_QED works by programmatically generating an 8x8 mask and merging with the filter.
https://github.com/HomeOfVapourSynthEvolution/havsfunc/blob/master/havsfunc.py#L375-L379
kedautinh12
11th October 2022, 14:58
Deblock_QED works by programmatically generating an 8x8 mask and merging with the filter.
https://github.com/HomeOfVapourSynthEvolution/havsfunc/blob/master/havsfunc.py#L375-L379
AVS+ ver:
https://github.com/Dogway/Avisynth-Scripts/blob/23515d5ca598503c789fca687f8032846a58ac4c/EX%20mods/DeblockPack.avsi#L34
DTL
11th October 2022, 15:28
This shouldn't be a problem with the mask approach?
Blur whole image, use mask to merge original with blured image.
This may cause grid-like effect of output. Sharp center 4x4 of 8x8 block and wide blured edges.
Katie Boundary
16th October 2022, 09:01
Basically a mask like this? + the example by anton_foy
This is a mask for 1 + 2. I don't fully undestand point 3.
https://i.imgur.com/pUOIHSu.png
I have no idea what this mask is supposed to be...
ChaosKing
16th October 2022, 12:53
I have no idea what this mask is supposed to be...
It's just an example. In this example it would be a mask for a video resolution of 40x32. White = apply 100%, black = don't touch video. (ignore the grid pattern. It's just for the visualisation of individual pixel)
1 - splits the image into 8x8 or 16x16 blocks;
- see orange box for single box example
2 - performs a Gaussian blur on the four corner pixels of each block, except for the four corner pixels of the image;
- the white spots are the pixels which would be blured
- For a single 8x8 block the blue dots is where you would blur as described in you second point.
I don't undestand your 3. point: "Gaussian blur on the 24 or 56 edge pixels of each block, except for the pixels at the image edges"
- What do you mean by 24 or 56 edge pixel of each block?
https://i.imgur.com/IOEijsx.pngs
StainlessS
16th October 2022, 13:44
I don't undestand your 3. point: "Gaussian blur on the 24 or 56 edge pixels of each block, except for the pixels at the image edges"
- What do you mean by 24 or 56 edge pixel of each block?
Seems to me like she dont want your blue corners blurred, only [EDIT: your orange] block edges.
8 x 8 block:: Edge length excluding corners = 8-2 = 6 : times 4 edges = (8-2) * 4 = 24
16 x 16 block:: Edge length excluding corners = 16-2 = 14 : times 4 edges = (16-2) * 4 = 56
Would probably look quite nasty not blurring corners too.
anton_foy
17th October 2022, 02:21
Seems to me like she dont want your blue corners blurred, only [EDIT: your orange] block edges.
8 x 8 block:: Edge length excluding corners = 8-2 = 6 : times 4 edges = (8-2) * 4 = 24
16 x 16 block:: Edge length excluding corners = 16-2 = 14 : times 4 edges = (16-2) * 4 = 56
Would probably look quite nasty not blurring corners too.
I was understand not to blur the edges and corners of the full image?
StainlessS
17th October 2022, 19:40
Yes, those full image edges/corners are to be treated as special cases, without any blurring.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.