From 3f01e86445afe12af84166eeaf8c57595417386c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Date: Sun, 11 Mar 2018 16:40:34 +0200 Subject: [PATCH] Run filters even though none are active This allows scaling to be performed even if/when no other filters are specified. Most likely has an effect on issues #95 and #86 --- video.c | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/video.c b/video.c index 8e12e936..5f59c0fd 100644 --- a/video.c +++ b/video.c @@ -1773,39 +1773,36 @@ static VASurfaceID *VaapiApplyFilters(VaapiDecoder * decoder, int top_field) if (!decoder->Interlaced) deinterlace->flags = VA_DEINTERLACING_ONE_FIELD; - /* This block of code skips various filters in-flight if source/settings - disallow running the filter in question */ - filter_count = 0; - for (unsigned int i = 0; i < decoder->filter_n; ++i) { - - /* Skip deinterlacer if disabled or source is not interlaced */ - if (decoder->filters[i] == *decoder->vpp_deinterlace_buf) { - if (!decoder->Interlaced) - continue; - if (deinterlace->algorithm == VAProcDeinterlacingNone) - continue; - } + vaUnmapBuffer(decoder->VaDisplay, *decoder->vpp_deinterlace_buf); + } - /* Skip denoise if value is set to 0 ("off") */ - if (decoder->vpp_denoise_buf && decoder->filters[i] == *decoder->vpp_denoise_buf) { - if (!VideoDenoise[decoder->Resolution]) - continue; - } + /* This block of code skips various filters in-flight if source/settings + disallow running the filter in question */ + filter_count = 0; + for (unsigned int i = 0; i < decoder->filter_n; ++i) { - /* Skip skin tone enhancement if value is set to 0 ("off") */ - if (decoder->vpp_stde_buf && decoder->filters[i] == *decoder->vpp_stde_buf) { - if (!VideoSkinToneEnhancement) - continue; - } + /* Skip deinterlacer if disabled or source is not interlaced */ + if (decoder->filters[i] == *decoder->vpp_deinterlace_buf) { + if (!decoder->Interlaced) + continue; + if (deinterlace->algorithm == VAProcDeinterlacingNone) + continue; + } - filters_to_run[filter_count++] = decoder->filters[i]; + /* Skip denoise if value is set to 0 ("off") */ + if (decoder->vpp_denoise_buf && decoder->filters[i] == *decoder->vpp_denoise_buf) { + if (!VideoDenoise[decoder->Resolution]) + continue; } - vaUnmapBuffer(decoder->VaDisplay, *decoder->vpp_deinterlace_buf); - } + /* Skip skin tone enhancement if value is set to 0 ("off") */ + if (decoder->vpp_stde_buf && decoder->filters[i] == *decoder->vpp_stde_buf) { + if (!VideoSkinToneEnhancement) + continue; + } - if (!filter_count) - return NULL; /* no postprocessing if no filters applied */ + filters_to_run[filter_count++] = decoder->filters[i]; + } va_status = VaapiPostprocessSurface(decoder->vpp_ctx, decoder->PlaybackSurface, *surface, filters_to_run, filter_count,