Question / Help Is Lancsoz really the best filter?

Muf

Forum Moderator
Well, I ended up just throwing the source image in OBS and doing my own comparison, and it seems there's definitely something wrong with OBS' Lanczos shader. I'm looking into it with Jim.

4iL7yS9.png


Y14EnzW.png
 

Videophile

Elgato
Well, I ended up just throwing the source image in OBS and doing my own comparison, and it seems there's definitely something wrong with OBS' Lanczos shader. I'm looking into it with Jim.

4iL7yS9.png


Y14EnzW.png
Im not seeing a big difference in this picture. Mind pointing them(it) out?
 

Muf

Forum Moderator
Im not seeing a big difference in this picture. Mind pointing them(it) out?
OBS' lanczos filter has pixelation. Slant edges aren't smooth, but have noticeable stair steps. In a still picture it might look subjectively better because it's sharper, but as the image moves, shapes will fall in and out of alignment with the pixel grid and this causes shimmering.
 

Videophile

Elgato
OBS' lanczos filter has pixelation. Slant edges aren't smooth, but have noticeable stair steps. In a still picture it might look subjectively better because it's sharper, but as the image moves, shapes will fall in and out of alignment with the pixel grid and this causes shimmering.
Yea reference Lanczos does look less bright, and darks are darker. Might be that shimmering issue. Well, its nice that you have figured this out, and hopefully Jim can fix it for the next release.
 

Boildown

Active Member
Its not going to be fixed except maybe in the multiplatform version. Use one of the other two options, most people think they're better.
 

FaHu

Member
After i seeing this thread i feel also a bit confused. In obs mp (studio) is even if you stream without downscalling the option from the filter enable and use able. So is it really still trie that the quality is better in any other setting than lanczos ? Or is there in obs studio even no different if you stream without downscaling
 

sam686

Member
On OBS and OBS-mp, downscale too much, if not exactly half width, half height, appears to produce poor results.

I went with OBS-mp, RGB colorspace, ffmpeg output, AVI, zlib video. I used my drawing of lines with text at 1024x576, letting OBS-mp downscale to 584x328. The result was some uneven brightness of lines and text. bicubic and lanczos both look quite bad as a downscale. Downscale my source drawings using my image viewer looks much better. This can be seen on a zip file containing a screenshot of video and a log file.

I later tested upscale 1024x576 to 1920x1080 and it looks just fine.
Downscaling at exactly half width, half height, using bilinear filter looks fine.
 

Attachments

  • downscale.zip
    63.7 KB · Views: 191

woodbyte

New Member
@sam686: That looks awful. But goes a long way to explain why 720p broadcasts from PS4 always looked more pleasing to me than those made by OBS for the same game source at 1080p.

I'm currently testing an alternative bicubic sampler (found here) in OBS and the results are promising. It's a straightforward port but I've attached it in case you want to give it a quick try. Replace the file found at "C:\Program Files (x86)\obs-studio\data\libobs" (backup original), restart OBS and make sure bicubic filtering is selected.

Thanks for taking the time to test it, and I hope future versions will finally address this issue.

EDIT: After further examination, this implementation while faster is blurry and equivalent to the one included in OBS but with different parameters for B and C (1,0). Will investigate further into sharper versions that match the quality produced by image editors.
 

Attachments

  • bicubic_scale.zip
    1.2 KB · Views: 114
Last edited:

sam686

Member
But goes a long way to explain why 720p broadcasts from PS4 always looked more pleasing to me than those made by OBS for the same game source at 1080p.
I have PS4, setting PS4 output to 720p makes PS4 downscale, it looks very good for stream/record at 720p, better then built-in ps4 stream. My Avermedia C027 capture don't support 1080p, so i am limited to 720p, 1080i, or lower. It appears that PS4's built in streaming have equally good scaling compared to setting PS4 output to 720p, but PS4's h264 encoder have somewhat poor stream quality compared to OBS / x264.

FFmpeg and FFDShow have more scaling options (bilinear, bicubic, lanczos, and more) that have very good downscale options, just about as good as image viewer. Might look at those open source programs to see how it is done.
 

woodbyte

New Member
Well, the sampler above produces a very similar image to the one your image viewer outputted, but personally I prefer sharper solutions like the bicubic sharper of Photoshop.

While I haven't come across a quick, single-pass downsampler that matches PS resizer, I have managed to get something that's sharper than the default OBS bicubic/lanczos filters yet cleaner/better behaved for both artificial tests like yours and for general use.

After testing a variety of shaders from different sources I decided to adopt Jinc. I followed this implementation with the added care that since we are downscaling it's best to do the sampling in linear space and then convert the colors back to sRGB (preserves small details like text better).

Here's the final source, and you can download it below along with a few others I experimented with.
 

Attachments

  • resampler_pack.zip
    13.9 KB · Views: 156
Last edited:

sam686

Member
After editing lanczos_scale.effect in OBS-mp, I have just got the quality really close to what the image viewer have it. Check out my screenshots in this zip file, and maybe try out my edits to lanczos in OBS-multiplatform.
 

Attachments

  • lanczos_edit.zip
    57.3 KB · Views: 3,269

woodbyte

New Member
Just tested your edit, and I rather like it. The scaling factor you introduced also works well for 1080->720p reduction. It's not as sharp as the original but in my opinion a lot more pleasant to look at.

Easily tweak-able too, so I'll mess with it for more or less sharpness depending on the source. Thanks for sharing.
 
D

Deleted member 50959

This is awesome, kudos woodbyte and sam686! Do you think these should replace the current filters in OBS?
 
Top