Question / Help Downscale Filter? Why?

SumDim

Member
Why is a downscale filter needed for doing 1:1 mapping (i.e. 1920x1080 base to 1920x1080 output)?

The UI forces me to use a downscale filter, even suggesting I use bilinear ("Fastest, but blurry if scaling").
But I'm not scaling. So why am I wasting CPU cycles and not keeping my native capture to be passed onto the encoder?
 

SumDim

Member
"Downscale filter is not used if the base resolution is the same as output resolution."

Care to point me to the source file where the string comparison is made or documentation that says this?
 

SumDim

Member
The UI is setup to force the user to choose a downscale filter. I am questioning why this is the case and am not assuming anything here.
I cannot assume that filter selection is being ignored or being applied in the case of 1:1 mapping as the UI does not reinforce that line of thinking.

If it is indeed no downscaling is done, then great. However, I'm not just going to take someone's word for it here, especially if its not coming from Jim.
Thank you R1CH for directing me to the source file of interest.

After review, I am not left any more confident that no downscaling is being applied. I say this, because I found two good examples of code that under the hood surprised me.

First example below shows "equalness" as a 16 pixel differential. If a user typed in 1920x1080 as their base and 1904x1064 as their output, the user isn't going to know that OBS is treating them to be the same. Who would this apply to? A Q/A Automation engineer evaluating OBS may want to use this technique to force a downscale with a certain filter to see that it loads correctly. But OBS isn't allowing that so he gets unexpected results.

static inline bool resolution_close(struct obs_core_video *video, uint32_t width, uint32_t height)
{
long width_cmp = (long)video->base_width - (long)width;
long height_cmp = (long)video->base_height - (long)height;

return labs(width_cmp) <= 16 && labs(height_cmp) <= 16;
}

Another example. If the scaled output is less than 50% of the base canvas size, OBS forces bilinear scaling.

static inline gs_effect_t *get_scale_effect_internal(
struct obs_core_video *video)
{
/* if the dimension is under half the size of the original image,
* bicubic/lanczos can't sample enough pixels to create an accurate
* image, so use the bilinear low resolution effect instead */
if (video->output_width < (video->base_width / 2) &&
video->output_height < (video->base_height / 2)) {
return video->bilinear_lowres_effect; <--------------------------------- BILINEAR
}
-- snip;

Who would this apply to? Streamers trying to capture at one size and scaling down by more than 50% to another size. Play a game in 4K and downscale to 720p, and you are forced to use bilinear scaling. And somehow people are supposed to know this?

Look at what the downscale filter setting is when I just monkey with the resolution settings. Here's an example of when I change from 2K to less than 50%. Notice, I set it to Lanczos. Which is being used, Lanczos or Bilinear? Does the Log have a bug? Is the code buggy? I mean c'mon. No, this is not obvious.

21:09:25.560: video settings reset:
21:09:25.560: base resolution: 2560x1440
21:09:25.560: output resolution: 928x522
21:09:25.560: downscale filter: Lanczos
21:09:25.560: fps: 60/1
21:09:25.560: format: NV12
21:09:25.569: Settings changed (video)

Back to this code:
-- snip
if (resolution_close(video, width, height)) {
return video->default_effect;
--- snip

If default_effect is initialized to no downscaling filter being applied and the effect loop is not invoking a downscale filter because of this, THAT is the technical answer to my question.
I've yet to prove this and I'm not too thrilled about building OBS source and setting breakpoints to find the truth. I'll leave that to R1CH and Jim to chime in.

However, regardless of all of this, the real solution to all the problems mentioned above is to change the Video Output UI to be more informative to the user AND to take these special situations into account by disabling or setting the downscaling filter combobox appropriately to fully reflect the state of the program.
 
Last edited:

R1CH

Forum Admin
Developer
There are plenty of parts of the UI that aren't used if they aren't needed. Why should I be forced to enter an auto reconnect timeout when I'm only recording? Why do I need to choose a stream type? Why do I have to pick a recording quality? Downscale is no different, if it's not needed then it won't be used.
 

BardiBard

Member
Hello,

I wanted to add onto this thread because I have the same issue.
Even though you say there is no downscale filter added if "Base (Canvas) Resolution" and "Output (Scaled) Resolution" are identical, the downscale filter is still being used, causing a slightly blurry overall output of the recorded video.

For comparison:

(No Downscale Filter, other 1:1 capturing program)
Bxf5IKI.png

(OBS, 60FPS, Lanczos, 1920x1440 Base and Output, 20,000 BitRate, x264)
FlbRCxF.jpg

As it's called Open Broadcaster Software and it being Open Source with countless plugins to use, I wonder if anyone could create a "No Downscale Filter"-Plugin.

As how OBS currently works, it still applies the filter, causing the overall picture to become blurry.
 
Last edited:

koala

Active Member
The 2 images are not of identical resolution and not identical aspect ratio. The OBS one is squeezed. It does not reproduce the native resolution of the game. Its height is 2 pixels (or so) less than the first one, while the horizontal pixels are identical. That means the person who recorded this picture, made OBS actually rescale from a y resolution to a (y-2) resolution while keeping x identical. The blurriness is expected.

It's also possible that the person who used OBS to record the game resized the source that contains the game by 2 pixels by accident. Or the game was resized vertically by 2 pixels after adding the source in OBS. This is difficult to detect if you don't explicitly look for it.

Or he used a media player that did this for display. Try Media Player Classic for playback and for saving single frames as *.jpg/*.png for comparison.
 

Osiris

Active Member
There is NO downscaling being done when the canvas and output resolution are the same. I mean you cannot downscale something when the 2 values are identical.
I can't really tell much difference between the 2 pictures, any bluriness might just as well be quality loss from encoding.
 
Last edited:

TIMORLANG

Member
I know this string is pretty old and likely heavily ignored now. But why not just switch to bilinear and compare those results?
 

Rdelaura

Member
Not sure if anyone will reply at this time since this is old but what if you downscaled in the output tab instead of your video settings (which are the same). How can you control which filter it's using to downscale?
 

rockbottom

Active Member
They are not the same. Use the Video Settings if you are recording/streaming in the same resolution. (GPU)

But if you want to add a DS filter to your streams, right click on source > Scale Filtering (CPU)

Also works with the Multi-RTMP Output.
 

Rdelaura

Member
Thanks. 2 PC setup. 3440x1440 from game puter, NDI output to stream PC w/ Display at 2440x1440 downscaled streaming to 936p and recording at 1440p (no downscale)
 
Top