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