Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -35,6 +35,8 @@ typedef struct ESTDIFContext { · 34 unmodified lines | |||
| 35 | int deint; ///< which frames to deinterlace | 35 | int deint; ///< which frames to deinterlace |
| 36 | int rslope; ///< best edge slope search radius | 36 | int rslope; ///< best edge slope search radius |
| 37 | int redge; ///< best edge match search radius | 37 | int redge; ///< best edge match search radius |
| 38 | float ecost; ///< edge cost for edge matching | ||
| 39 | float mcost; ///< middle cost for edge matching | ||
| 38 | float dcost; ///< distance cost for edge matching | 40 | float dcost; ///< distance cost for edge matching |
| 39 | int interp; ///< type of interpolation | 41 | int interp; ///< type of interpolation |
| 40 | int linesize[4]; ///< bytes of pixel data per line for each plane | 42 | int linesize[4]; ///< bytes of pixel data per line for each plane |
| @@ -93,6 +95,8 @@ static const AVOption estdif_options[] = { · 52 unmodified lines | |||
| 93 | CONST("interlaced", "only deinterlace frames marked as interlaced", 1, "deint"), | 95 | CONST("interlaced", "only deinterlace frames marked as interlaced", 1, "deint"), |
| 94 | { "rslope", "specify the search radius for edge slope tracing", OFFSET(rslope), AV_OPT_TYPE_INT, {.i64=1}, 1, MAX_R, FLAGS, }, | 96 | { "rslope", "specify the search radius for edge slope tracing", OFFSET(rslope), AV_OPT_TYPE_INT, {.i64=1}, 1, MAX_R, FLAGS, }, |
| 95 | { "redge", "specify the search radius for best edge matching", OFFSET(redge), AV_OPT_TYPE_INT, {.i64=2}, 0, MAX_R, FLAGS, }, | 97 | { "redge", "specify the search radius for best edge matching", OFFSET(redge), AV_OPT_TYPE_INT, {.i64=2}, 0, MAX_R, FLAGS, }, |
| 98 | { "ecost", "specify the edge cost for edge matching", OFFSET(ecost), AV_OPT_TYPE_FLOAT,{.dbl=0.03125},0,1,FLAGS, }, | ||
| 99 | { "mcost", "specify the middle cost for edge matching", OFFSET(mcost), AV_OPT_TYPE_FLOAT,{.dbl=0.5}, 0, 1, FLAGS, }, | ||
| 96 | { "dcost", "specify the distance cost for edge matching", OFFSET(dcost), AV_OPT_TYPE_FLOAT,{.dbl=0.5}, 0, 1, FLAGS, }, | 100 | { "dcost", "specify the distance cost for edge matching", OFFSET(dcost), AV_OPT_TYPE_FLOAT,{.dbl=0.5}, 0, 1, FLAGS, }, |
| 97 | { "interp", "specify the type of interpolation", OFFSET(interp), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, FLAGS, "interp" }, | 101 | { "interp", "specify the type of interpolation", OFFSET(interp), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, FLAGS, "interp" }, |
| 98 | CONST("2p", "two-point interpolation", 0, "interp"), | 102 | CONST("2p", "two-point interpolation", 0, "interp"), |
| @@ -260,9 +264,10 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 161 unmodified lines | |||
| 260 | const type *const next2_line = (const type *const)nnext2_line; \ | 264 | const type *const next2_line = (const type *const)nnext2_line; \ |
| 261 | const type *const next3_line = (const type *const)nnext3_line; \ | 265 | const type *const next3_line = (const type *const)nnext3_line; \ |
| 262 | const int interp = s->interp; \ | 266 | const int interp = s->interp; \ |
| 267 | const int ecost = s->ecost * 32.f; \ | ||
| 263 | const int dcost = s->dcost * s->max; \ | 268 | const int dcost = s->dcost * s->max; \ |
| 264 | const int end = width - 1; \ | 269 | const int end = width - 1; \ |
| 265 | const atype f = redge + 2; \ | 270 | const atype mcost = s->mcost * s->redge * 4.f; \ |
| 266 | atype sd[S], sD[S], di = 0; \ | 271 | atype sd[S], sD[S], di = 0; \ |
| 267 | atype dmin = amax; \ | 272 | atype dmin = amax; \ |
| 268 | int k = *K; \ | 273 | int k = *K; \ |
| @@ -278,8 +283,8 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 9 unmodified lines | |||
| 278 | sum += diff_##ss(next_line, next2_line, xx, yy); \ | 283 | sum += diff_##ss(next_line, next2_line, xx, yy); \ |
| 279 | } \ | 284 | } \ |
| 280 | \ | 285 | \ |
| 281 | sD[i + rslope] = sum; \ | 286 | sD[i + rslope] = ecost * sum; \ |
| 282 | sD[i + rslope] += f * cost_##ss(prev_line, next_line, end, x, i); \ | 287 | sD[i + rslope] += mcost * cost_##ss(prev_line, next_line, end, x, i);\ |
| 283 | sD[i + rslope] += dcost * abs(i); \ | 288 | sD[i + rslope] += dcost * abs(i); \ |
| 284 | \ | 289 | \ |
| 285 | dmin = FFMIN(sD[i + rslope], dmin); \ | 290 | dmin = FFMIN(sD[i + rslope], dmin); \ |
| @@ -296,8 +301,8 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 10 unmodified lines | |||
| 296 | sum += diff_##ss(next_line, next2_line, xx, yy); \ | 301 | sum += diff_##ss(next_line, next2_line, xx, yy); \ |
| 297 | } \ | 302 | } \ |
| 298 | \ | 303 | \ |
| 299 | sd[i + rslope] = sum; \ | 304 | sd[i + rslope] = ecost * sum; \ |
| 300 | sd[i + rslope] += f * cost_##ss(prev_line, next_line, end, x, k + i); \ | 305 | sd[i + rslope] += mcost * cost_##ss(prev_line, next_line, end, x, k+i);\ |
| 301 | sd[i + rslope] += dcost * abs(k + i); \ | 306 | sd[i + rslope] += dcost * abs(k + i); \ |
| 302 | \ | 307 | \ |
| 303 | dmin = FFMIN(sd[i + rslope], dmin); \ | 308 | dmin = FFMIN(sd[i + rslope], dmin); \ |