View Full Version : Blocky resize
dark.soft
15th July 2005, 14:02
I have tried to resize a 720p movie to 480x272, using virtualdub's internal resize filter, bicubic 0.60. The problem is that when I playback the video with media player classic, it's all blocky, like if there isn't antialiasing. There is a scene at the beginning of Kill Bill Vol.1 with a house with diagonal roof lines. They're all blocky. The same happens with avisynth. Is there a solution?
chilledinsanity
16th July 2005, 02:18
that's weird, the only thing I'll ever notice getting block are extremely red scenes. I guess you could try Lanczos, but that will likely be even blockier as it sharpens the image a bit. You could always do bilinear, but you'll lose some quality, I'm surprised bicubic isn't working well. Maybe try a lower value than .6?
dark.soft
16th July 2005, 11:13
Well, I tried avery resizing method before posting, but the problem is there with every filter. Red block like every other codec, it's only when I encode the video in x264 and I play it back that red becomes blocky.
Leak
16th July 2005, 11:26
There is a scene at the beginning of Kill Bill Vol.1 with a house with diagonal roof lines. They're all blocky. The same happens with avisynth. Is there a solution?
Would you mind posting an image? I can't quite imagine how what you describe looks, and how it could/should happen...
np: Richard Devine - Vecpr (Aleamapper)
dark.soft
16th July 2005, 11:57
I'll post an image soon. I can describe this effect as aliasing. When I watch the video at original size it looks normal, but at full screen I notice aliasing. If I raise the resolution, the effect gradually vanishes.
dark.soft
16th July 2005, 12:22
On top there is the original resized image (bicubic 0.60), on bottom the same image at 300 % (almost fullscreen on my 1600x1200 monitor)
http://img340.imageshack.us/img340/3834/example1va.jpg (http://www.imageshack.us)
Leak
16th July 2005, 15:47
On top there is the original resized image (bicubic 0.60), on bottom the same image at 300 % (almost fullscreen on my 1600x1200 monitor)
Ummm... how did you play it back?
I.e. were you using your video card's overlay, or VMR9 and some of MPC's pixelshader scaling methods?
After all, what "becomes blocky" is the output of your player application, and that's depending on what method is used to scale it to 300% - of course, if you scale it down first and thus throw out a lot of information, it's bound to look like @$$ when scaled back to fullscreen...
Think about it - at 300% every pixel in the source becomes a 3x3 pixel block, which of course will look blocky; you can't expect wonders, especially when resizing needs to be done in realtime...
np: Biosphere - Le Grand Dome (Cirque)
neuron2
16th July 2005, 16:31
You might improve it by sizing up to several times what you want, then applying a spatial smoother, and then sizing it back to the desired size (super resolution processing). I tried it quickly using 3 times oversizing and it seems to be effective. You'll lose a little sharpness, but it is not too bad. I used VirtualDub's box blur as the smoother.
As Leak says, a diagonal line of pixels is going to resize to a series of blocks if you do this without super resolution processing.
dark.soft
16th July 2005, 16:58
The image is taken from virtualdub, but if I play it with mpc it's also blocky (using VMR9 renderless for directshow video, bicubic resizing 0.6 and "use texture surfaces and render video in 2d"). Obviously I don't expect great quality by playing this in full screen, but I would like more softness and antialiasing rather than blockyness.
neuron2
16th July 2005, 17:00
You don't seem to have taken note of the replies by Leak and I.
dark.soft
16th July 2005, 17:02
Neuron2, your solution could be great! I'll try it immediately. The sharpness loss is acceptable since I think it's better that those ugly blocks!
neuron2
16th July 2005, 17:04
Here's my quick hack. Warning, it's large.
http://neuron2.net/misc/house.jpg
When you do it, leave the final resize off while you preview the box blur. Then when things look smooth and not too blurry (your tradeoff), add the final resize. Of course, don't use nearest neighbor!
dark.soft
16th July 2005, 17:07
GREAT! Much better! I wonder if there is a way to have antialiasing by resizing the image one time (720p ->480x272), so that the pixels would all be real and not interpolated.
dark.soft
16th July 2005, 17:12
Well, here's what you've done: starting from my 480x272 image, you have upsampled it 3 times and then blurred it. Now, there is a way to do this in real time playback? And there is a way to antialias the 480x272 file starting from the 720p? What I do want is a 480x272 file that, when played back, isn't aliased, so I'd want to know if this is possible during playback or doable as a filter.
neuron2
16th July 2005, 17:13
Why do you resize down to 480x272 when you are going to resize it up later for display?
The process of antialiasing the original would be similar to the process already described. Just use the original size at the first step and resize back to 480x272 at the last step. I don't know how it will look when subsequently resized in real time for display, though. Please let us know. :)
The bigger the storage size you can have the better.
dark.soft
16th July 2005, 17:19
Well, here's my filter chain:
bicubic 0.60 resize to 480x272
bicubic 0.60 resize to 1440x816
box blur radius 3 power 3
bicubic 0.60 resize to 480x272
Now the image is smoother, wich is a nice result. But I was wondering if there is a way to smooth the video without all these passages. I mean: when virtualdub resizes from 1280x720 to 480x272, it should have enough pixels to do the antialiasing by basing his calculations on the already existing pixels. So, can this antialiasing be done with less passages, obtaining more quality?
EDIT: well, I'm trying what you said on your last edit
neuron2
16th July 2005, 17:21
There's no need for two resizes at the start. It can be collapsed into one, i.e., resize from 720x480.
dark.soft
16th July 2005, 17:59
I tried upsampling the video up to 4000xsomething and then applying the blur, but without success. The only way is to apply immediately the blur and then resize to 480x272, but unfortunately the result isn't so sharp as I was expecting. I'd like a filter wich does the antialiasing while resizing, resulting in superior sharpness.
Leak
16th July 2005, 21:06
I tried upsampling the video up to 4000xsomething and then applying the blur, but without success. The only way is to apply immediately the blur and then resize to 480x272, but unfortunately the result isn't so sharp as I was expecting.
Ummm... why do you want to encode at 480x272 in the first place? What's the resolution of your source material? :confused:
No matter what you do, if you throw away loads of image information by downscaling your video, there is no way to bring back the same level of sharpness (less image information automatically means more blur), and you'll probably introduce a lot of artifacts in the process if you use a sharpener on top of that.
Look at your "original resized" image up there - unscaled, it's quite sharp on my TFT (which makes artifacts and blurriness much more noticeable compared to a CRT), but the more you stretch it the more blurry it *will* get.
Also, I'm afraid you won't find a PC that's able to do the resizing you do in your script in real time, it's just too much work.
I'd like a filter wich does the antialiasing while resizing, resulting in superior sharpness.
If you absolutely must resize the heck out of it, try at least using Lanczos resize instead of Bicubic. Dunno if there's a filter to do that in VirtualDub, though - if you want to do any advanced image filtering, look into AviSynth...
But if you're working from, say, a 720x480 source, why not keep it that size and just crop away any black bars at the borders? Why resize it at all?
np: Electric Birds - Painted Rooms (Gradations)
LocalH
17th July 2005, 00:44
Yeah, I'm pretty sure the built-in VirtualDub resize filter can do Lanczos.
At the very most, if you're planning on watching it on a computer, you might want to crop to 704 and then resize to 640, but I wouldn't touch the vertical resolution other than by cropping. Lately, I've been working mostly with DVDs so I've been working based on 720 pixels, but the way it sounds it would be best for you to use a width of 640.
neuron2
17th July 2005, 02:14
Ummm... why do you want to encode at 480x272 in the first place? I asked that, too, but he didn't answer me.
dark.soft
17th July 2005, 11:02
I wanted to encode at 480x272 because I was planning to watch it on a VGA pocket pc, so I need the file to be small in size (and so also in resolution). I don't want the same sharpness as before, I only don't want aliasing, I know that downsizing I lose a lot of pixels. But now doesn't matter, because today I'm going to make a cruise (I don't know if it's the correct term). So, goodbye and thanks for your help :D .
scharfis_brain
17th July 2005, 11:30
as chroma is getting downsampled to YV12 for compression, your chroma resolution is halfed in both directions (240x136)
I think this is the cause of the stairstepping on saturad red or blue borders...
There is nothing to do against it.
LocalH
17th July 2005, 17:23
Yes, the only way to mitigate the chroma stairsteps is for your player to interpolate the chroma on playback. Since it's a Pocket PC, I'm thinking it probably can't do that (although if the player has an option to do so, might want to try it if your player can handle it).
Leak
18th July 2005, 07:50
I wanted to encode at 480x272 because I was planning to watch it on a VGA pocket pc, so I need the file to be small in size (and so also in resolution).
Well, if that's what you want to do, you're set - if your pocket PC doesn't upscale the result like you did, you won't get those artifacts...
neuron2
18th July 2005, 14:26
It sounds to me like he wants to have one file that he can play on both. In that case, he should render the big one and then downsize for display on the pocket PC.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.