Log in

View Full Version : Resizing still results in blurry image quality-> in search for good filter...


Benedikt
15th January 2006, 20:56
Hi there,

first I'd like to say sorry for possible newbie questions, but I've been thinking about this for quite a long time: Which resizing filter do you use for downsizing content, without getting too unsharp image quality? What I'd like to do is to preserve image sharpness without adding too much "artificial" sharpness via dedicated (sharpen) filters. Lanczos results always seem a bit blurry (hard to tell), would there be any enhancement in using Lanczos4? Or are there better, sharper resizing filters out there which I don't know?

Please, would you be so kind and :script: you are using, especially for downsizing DVB content (720x576) to correct 4:3 PAL?

mg262
15th January 2006, 21:01
720 x 576 is (or can be) perfectly correct 4:3 PAL. The reason is that pixels don't have to be square -- and (afaik) every encoder has options which will let you specify the correct aspect ratio of the clip.

If you describe what exactly you're trying to do, you may get more specific answers...

Pookie
15th January 2006, 21:46
As mg262 mentioned.

http://www.avisynth.org/index.php?page=Resize

There's not that many to try out. See which one works best for your situation.

I like Spline36Resize, which is new with v2.56.

Benedikt
15th January 2006, 23:17
720 x 576 is (or can be) perfectly correct 4:3 PAL. The reason is that pixels don't have to be square -- and (afaik) every encoder has options which will let you specify the correct aspect ratio of the clip.

If you describe what exactly you're trying to do, you may get more specific answers...
Well, I have an anamorphic (16:9) recorded DVB-clip, which is MPEG2 and from my DVB-S (satellite) system. The clip has a resolution of 720x576 pixels. If I open the clip via DGMPEGdec to produce a D2V file (for later avisynth processing), DGMpegDec already misinterprets the clip as 4:3, resulting in a vertically stretched clip. So I have to resize the clip from 720x576 to 720x400 with avisynth later to get the correct aspect ratio again.
Is there a way to read the file correctly as anamorphic, so I can skip resizing? Am I overlooking something?

mg262
15th January 2006, 23:30
I believe that aspect ratio is not something that makes sense within the AVISynth framework, so it's not really the fault of DGMpegDec. But it doesn't matter -- you don't need that information in AVISynth, just in your final encode.

The script may look wrong when you open it up, because whatever you are viewing it in doesn't have the correct aspect ratio, but this makes no difference to the final encode. if you're using VirtualDub(Mod), try right clicking on the picture and selecting 16:9. (Tadaa!)

What are you planning to encode to? What encoder are you thinking of using?

Incidentally, 720x400 is not a valid PAL resolution.

Benedikt
15th January 2006, 23:54
I believe that aspect ratio is not something that makes sense within the AVISynth framework, so it's not really the fault of DGMpegDec. But it doesn't matter -- you don't need that information in AVISynth, just in your final encode.

The script may look wrong when you open it up, because whatever you are viewing it in doesn't have the correct aspect ratio, but this makes no difference to the final encode. if you're using VirtualDub(Mod), try right clicking on the picture and selecting 16:9. (Tadaa!)

What are you planning to encode to? What encoder are you thinking of using?

Incidentally, 720x400 is not a valid PAL resolution.
Okay, first: thanks for your help. I was encoding with MeGui to a 4:3 xvid-mp3 Matroska file.

But I just figured out that you don't need resizing at all, because XVID features an "aspect ratio" function, and also with mkvmerge you can fix an aspect ratio of 16:9, utilizing the full 720x576 resolution. So it's just affecting the player software how to decode the video file?

It's just I've always done rips in 4:3, and a resolution of 720x[less than 576]. Are there any downsides of doing 16:9 anamorphic rips in full 720x576 resolution and aspect ratio set to 16:9? If valid, where do you set the aspect ratio? At the video encoder (xvid) or at the container muxing tool (mkvmerge or others)?

/edit: where/how do I set the aspect ratio for x264?

mg262
16th January 2006, 00:06
So it's just affecting the player software how to decode the video file?Yes, I think that's essentially it.

I should add at this point that I haven't played around with this stuff myself... but I would definitely try using the relevant Xvid tab first. Apart from anything else, that lets you save processing settings.

Cf this thread: http://forum.doom9.org/showthread.php?t=104559

Actually, I just ran across something suggesting that MeGUI has a "custom aspect ratio" option somewhere. Worth hunting for... ;)

Benedikt
16th January 2006, 00:20
Yes, I think that's essentially it.

I should add at this point that I haven't played around with this stuff myself... but I would definitely try using the relevant Xvid tab first. Apart from anything else, that lets you save processing settings.

Cf this thread: http://forum.doom9.org/showthread.php?t=104559

Actually, I just ran across something suggesting that MeGUI has a "custom aspect ratio" option somewhere. Worth hunting for... ;)
I can't find that option, BUT:
As I wrote, Xvid features a "SAR" option where you can adjust the aspect ratio to 16:9. But x264 only has a "sample aspect ratio: ...x..." option. Well now, how to interpret that? Setting it to 720x404 or something has no visible effect. How can I set x264 to choose the right aspect ratio (I don't want to set it in Matroska, because I use AVIs too...)?
/edit: this just came across my mind - what is better in terms of encoding quality: a.) a non resized anamorphic 720x576 rip or b.) a resized non-anamorphic 720x405 clip. the former has no resizing algorithm affecting image quality but has a higher resolution to process, the latter has vice versa...

foxyshadis
16th January 2006, 02:27
At lower bitrates, non-anamorphic nets you better quality. With a higher bitrate, you'll have only imperceptibly more artifacts but when shown resized on a fuller screen the extra vertical resolution will be much more pleasing. That's the whole idea behind anamorphic, after all. Unfortunately I don't have any guidelines for where the cutoff range is.

Benedikt
16th January 2006, 02:39
At lower bitrates, non-anamorphic nets you better quality. With a higher bitrate, you'll have only imperceptibly more artifacts but when shown resized on a fuller screen the extra vertical resolution will be much more pleasing. That's the whole idea behind anamorphic, after all. Unfortunately I don't have any guidelines for where the cutoff range is.
Well, thanks very much for that explanation.
One more question: What do you all do, actually? Do you still prefer to resize your content to non-anamorphic, or is ist now safe to use anamorphic content, especially as Matroska deals with it so easily. I'd love to know how you do your 16:9 rips/encodes, and why. Still the "old-school" way (with resizing) or anamorphic?

mg262
16th January 2006, 11:56
I can't find that option, BUT:
As I wrote, Xvid features a "SAR" option where you can adjust the aspect ratio to 16:9. But x264 only has a "sample aspect ratio: ...x..." option. Well now, how to interpret that? Setting it to 720x404 or something has no visible effect. How can I set x264 to choose the right aspect ratio (I don't want to set it in Matroska, because I use AVIs too...)?
Once we left AVISynth territory what I said was based on searching -- and I found plenty of threads discussing this last night. I'm sure you are just as good at using search as I am ;).

I've never had any 16:9 material to rip, I think. If I encoded it I would always always go anamorphic -- but then I'm not of the "fit five movies onto one DVD!" school of thought...

DarkNite
16th January 2006, 19:01
For me the deciding factor is the bitrate I'll be using, or more specifically, the bits per pixel the codec will have to work with.

If I'm shooting for Matroska as my file format I would be more inclined to set the flag in mkvmerge as I know that is the most likely to be respected by the splitter/player. I have never seen a player respect the aspect ratio flag set in an XviD stream that's in an AVI, at least not at default settings, but I haven't tried it in a long time.

"How can I set x264 to choose the right aspect ratio (I don't want to set it in Matroska, because I use AVIs too...)?"


What exactly are you trying to do? It sounds like you want to avoid any chance that you may have to encode this source more than once. Well, if you're shooting for AVC in mkv and AVI then, IMO, you have to make the decision of whether or not to go anamorphic first. For AVI I would resize to a 1:1 PAR just to avoid possible issues. For Matroska I try to go anamorphic whenever possible.

Benedikt
17th January 2006, 00:14
For me the deciding factor is the bitrate I'll be using, or more specifically, the bits per pixel the codec will have to work with.

If I'm shooting for Matroska as my file format I would be more inclined to set the flag in mkvmerge as I know that is the most likely to be respected by the splitter/player. I have never seen a player respect the aspect ratio flag set in an XviD stream that's in an AVI, at least not at default settings, but I haven't tried it in a long time.

What exactly are you trying to do? It sounds like you want to avoid any chance that you may have to encode this source more than once. Well, if you're shooting for AVC in mkv and AVI then, IMO, you have to make the decision of whether or not to go anamorphic first. For AVI I would resize to a 1:1 PAR just to avoid possible issues. For Matroska I try to go anamorphic whenever possible.

Hmm, interesting read, thanks. Well, to be honest, I'll try to keep Matroska from now on and to forget .avi at all. I think now is the right moment to switch to Matroska at all.
So I'll try to do my next 16:9 rips in anamorphic, just to test if there's a higher quality achievable. Maybe the rips get really sharper than resized anamorphic content, but to be honest, with higher bitrates I almost didn't see a difference, at least on my PC monitor.

DarkNite
17th January 2006, 09:01
Getting back to the thread topic, you can always try LimitedSharpen, or iiP and resize within those calls using the dest_x, and dest_y variables. If you get a basic understanding of what the settings do and apply them even halfway correctly then either of those can eliminate the "soft resize".

They have always been good to me. Then again I end my calls with ,iloveyou=true). ;)

Benedikt
17th January 2006, 11:15
Getting back to the thread topic, you can always try LimitedSharpen, or iiP and resize within those calls using the dest_x, and dest_y variables. If you get a basic understanding of what the settings do and apply them even halfway correctly then either of those can eliminate the "soft resize".

LimitedSharpen seems way too heavy for my Athlon T-Bird 1200. I think Spline36Resize does the job quite well. :)

Didée
17th January 2006, 11:38
LimitedSharpen seems way too heavy for my Athlon T-Bird 1200.
Give a try on LimitedSharpenFaster() - Manao included the script in the package of MaskTools v2.0a18 (http://manao4.free.fr/masktools-v2.0a18.zip). Should run at bearable speeds even on weaker CPUs.
As a start, try something like LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,dest_x=???,dest_y=???,Smode=4,strength=50~100)

foxyshadis
18th January 2006, 00:41
Question, since the topic is resizing, what is the difference between spline16 and spline36? I have a good idea of what spline resizing is; so is it something like a first order (linear) 6-point curve fit vs. third order (cubic)? That's the best guess I have, I'm afraid I don't understand the source code for them.