Browse Source

lavfi/selectivecolor: fix neutral color filtering

Neutrals are supposed to be anything not black (0,0,0) and not white
(N,N,N).

Previous neutral filtering code was too strict by excluding colors with
any of its RGB component maxed instead of just the white color.

Reported-by: Royi Avital <royiavital@yahoo.com>
tags/n4.1
Clément Bœsch 6 years ago
parent
commit
eb1860e017
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavfilter/vf_selectivecolor.c

+ 1
- 1
libavfilter/vf_selectivecolor.c View File

@@ -344,7 +344,7 @@ static inline int selective_color_##nbits(AVFilterContext *ctx, ThreadData *td,
const int max_color = FFMAX3(r, g, b); \ const int max_color = FFMAX3(r, g, b); \
const int is_white = (r > 1<<(nbits-1) && g > 1<<(nbits-1) && b > 1<<(nbits-1)); \ const int is_white = (r > 1<<(nbits-1) && g > 1<<(nbits-1) && b > 1<<(nbits-1)); \
const int is_neutral = (r || g || b) && \ const int is_neutral = (r || g || b) && \
r != (1<<nbits)-1 && g != (1<<nbits)-1 && b != (1<<nbits)-1; \
(r != (1<<nbits)-1 || g != (1<<nbits)-1 || b != (1<<nbits)-1); \
const int is_black = (r < 1<<(nbits-1) && g < 1<<(nbits-1) && b < 1<<(nbits-1)); \ const int is_black = (r < 1<<(nbits-1) && g < 1<<(nbits-1) && b < 1<<(nbits-1)); \
const uint32_t range_flag = (r == max_color) << RANGE_REDS \ const uint32_t range_flag = (r == max_color) << RANGE_REDS \
| (r == min_color) << RANGE_CYANS \ | (r == min_color) << RANGE_CYANS \


Loading…
Cancel
Save