History

avfilter/vf_estdif: allow to change two more options

Paul B Mahol committed 5 years ago

Commit aebdffb1 parent 946493e2 files · +18 −5Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vf_estdif.c+10−5
@@ -35,6 +35,8 @@ typedef struct ESTDIFContext { · 34 unmodified lines
3535 int deint; ///< which frames to deinterlace
3636 int rslope; ///< best edge slope search radius
3737 int redge; ///< best edge match search radius
38+ float ecost; ///< edge cost for edge matching
39+ float mcost; ///< middle cost for edge matching
3840 float dcost; ///< distance cost for edge matching
3941 int interp; ///< type of interpolation
4042 int linesize[4]; ///< bytes of pixel data per line for each plane
@@ -93,6 +95,8 @@ static const AVOption estdif_options[] = { · 52 unmodified lines
9395 CONST("interlaced", "only deinterlace frames marked as interlaced", 1, "deint"),
9496 { "rslope", "specify the search radius for edge slope tracing", OFFSET(rslope), AV_OPT_TYPE_INT, {.i64=1}, 1, MAX_R, FLAGS, },
9597 { "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, },
96100 { "dcost", "specify the distance cost for edge matching", OFFSET(dcost), AV_OPT_TYPE_FLOAT,{.dbl=0.5}, 0, 1, FLAGS, },
97101 { "interp", "specify the type of interpolation", OFFSET(interp), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, FLAGS, "interp" },
98102 CONST("2p", "two-point interpolation", 0, "interp"),
@@ -260,9 +264,10 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 161 unmodified lines
260264 const type *const next2_line = (const type *const)nnext2_line; \
261265 const type *const next3_line = (const type *const)nnext3_line; \
262266 const int interp = s->interp; \
267+ const int ecost = s->ecost * 32.f; \
263268 const int dcost = s->dcost * s->max; \
264269 const int end = width - 1; \
265− const atype f = redge + 2; \
270+ const atype mcost = s->mcost * s->redge * 4.f; \
266271 atype sd[S], sD[S], di = 0; \
267272 atype dmin = amax; \
268273 int k = *K; \
@@ -278,8 +283,8 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 9 unmodified lines
278283 sum += diff_##ss(next_line, next2_line, xx, yy); \
279284 } \
280285 \
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);\
283288 sD[i + rslope] += dcost * abs(i); \
284289 \
285290 dmin = FFMIN(sD[i + rslope], dmin); \
@@ -296,8 +301,8 @@ static void interpolate_##ss(ESTDIFContext *s, uint8_t *ddst, \ · 10 unmodified lines
296301 sum += diff_##ss(next_line, next2_line, xx, yy); \
297302 } \
298303 \
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);\
301306 sd[i + rslope] += dcost * abs(k + i); \
302307 \
303308 dmin = FFMIN(sd[i + rslope], dmin); \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t