Skip to content

Commit

Permalink
Run filters even though none are active
Browse files Browse the repository at this point in the history
This allows scaling to be performed even if/when no other filters are specified.

Most likely has an effect on issues #95 and #86
  • Loading branch information
pesintta committed Mar 11, 2018
1 parent 7ef6ad5 commit 3f01e86
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3f01e86

Please sign in to comment.