Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -32,7 +32,13 @@ typedef struct ChromaNRContext { · 31 unmodified lines | ||
| 32 | 32 | const AVClass *class; |
| 33 | 33 | |
| 34 | 34 | float threshold; |
| 35 | + float threshold_y; | |
| 36 | + float threshold_u; | |
| 37 | + float threshold_v; | |
| 35 | 38 | int thres; |
| 39 | + int thres_y; | |
| 40 | + int thres_u; | |
| 41 | + int thres_v; | |
| 36 | 42 | int sizew; |
| 37 | 43 | int sizeh; |
| 38 | 44 | int stepw; |
| @@ -91,6 +97,9 @@ static int filter_slice##name(AVFilterContext *ctx, void *arg, int jobnr, int nb · 52 unmodified lines | ||
| 91 | 97 | const int sizew = s->sizew; \ |
| 92 | 98 | const int sizeh = s->sizeh; \ |
| 93 | 99 | const int thres = s->thres; \ |
| 100 | + const int thres_y = s->thres_y; \ | |
| 101 | + const int thres_u = s->thres_u; \ | |
| 102 | + const int thres_v = s->thres_v; \ | |
| 94 | 103 | const int h = s->planeheight[1]; \ |
| 95 | 104 | const int w = s->planewidth[1]; \ |
| 96 | 105 | const int slice_start = (h * jobnr) / nb_jobs; \ |
| @@ -142,6 +151,8 @@ static int filter_slice##name(AVFilterContext *ctx, void *arg, int jobnr, int nb · 45 unmodified lines | ||
| 142 | 151 | const int V = in_vptr[xx]; \ |
| 143 | 152 | \ |
| 144 | 153 | if (FFABS(cu - U) + FFABS(cv - V) + FFABS(cy - Y) < thres && \ |
| 154 | + FFABS(cu - U) < thres_u && FFABS(cv - V) < thres_v && \ | |
| 155 | + FFABS(cy - Y) < thres_y && \ | |
| 145 | 156 | xx != x && yy != y) { \ |
| 146 | 157 | su += U; \ |
| 147 | 158 | sv += V; \ |
| @@ -172,6 +183,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 24 unmodified lines | ||
| 172 | 183 | AVFrame *out; |
| 173 | 184 | |
| 174 | 185 | s->thres = s->threshold * (1 << (s->depth - 8)); |
| 186 | + s->thres_y = s->threshold_y * (1 << (s->depth - 8)); | |
| 187 | + s->thres_u = s->threshold_u * (1 << (s->depth - 8)); | |
| 188 | + s->thres_v = s->threshold_v * (1 << (s->depth - 8)); | |
| 175 | 189 | |
| 176 | 190 | out = ff_get_video_buffer(outlink, outlink->w, outlink->h); |
| 177 | 191 | if (!out) { |
| @@ -217,11 +231,14 @@ static int config_input(AVFilterLink *inlink) · 39 unmodified lines | ||
| 217 | 231 | #define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM |
| 218 | 232 | |
| 219 | 233 | static const AVOption chromanr_options[] = { |
| 220 | − { "thres", "set u/v threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl=30}, 1, 200, VF }, | |
| 234 | + { "thres", "set y+u+v threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl=30}, 1, 200, VF }, | |
| 221 | 235 | { "sizew", "set horizontal size", OFFSET(sizew), AV_OPT_TYPE_INT, {.i64=5}, 1, 100, VF }, |
| 222 | 236 | { "sizeh", "set vertical size", OFFSET(sizeh), AV_OPT_TYPE_INT, {.i64=5}, 1, 100, VF }, |
| 223 | 237 | { "stepw", "set horizontal step", OFFSET(stepw), AV_OPT_TYPE_INT, {.i64=1}, 1, 50, VF }, |
| 224 | 238 | { "steph", "set vertical step", OFFSET(steph), AV_OPT_TYPE_INT, {.i64=1}, 1, 50, VF }, |
| 239 | + { "threy", "set y threshold", OFFSET(threshold_y), AV_OPT_TYPE_FLOAT, {.dbl=200},1, 200, VF }, | |
| 240 | + { "threu", "set u threshold", OFFSET(threshold_u), AV_OPT_TYPE_FLOAT, {.dbl=200},1, 200, VF }, | |
| 241 | + { "threv", "set v threshold", OFFSET(threshold_v), AV_OPT_TYPE_FLOAT, {.dbl=200},1, 200, VF }, | |
| 225 | 242 | { NULL } |
| 226 | 243 | }; |
| 227 | 244 | |