From 13fd6ff0649d2e51e772a8e985d085b68d5a57b9 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 6 Apr 2015 07:35:09 -0700 Subject: [PATCH] libobs: Use bilinear low res scale effect The normal scaling methods cannot sample enough pixels to create an accurate output image when the output size is under half the base size, so use the bilinear low resolution scaling effect in that case instead to ensure a more accurate low resolution image. --- libobs/obs-video.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libobs/obs-video.c b/libobs/obs-video.c index fa1b436e0..b50f304d1 100644 --- a/libobs/obs-video.c +++ b/libobs/obs-video.c @@ -156,6 +156,14 @@ static inline void render_main_texture(struct obs_core_video *video, 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; + } + switch (video->scale_type) { case OBS_SCALE_BILINEAR: return video->default_effect; case OBS_SCALE_LANCZOS: return video->lanczos_effect; -- GitLab