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

Unified · Split

2 files
  1. doc/filters.texi +8 −0
  2. libavfilter/vf_estdif.c +10 −5
doc/filters.texi+8−0
@@ -11711,6 +11711,14 @@ Allowed range is from 1 to 15. · 11710 unmodified lines
11711Specify the search radius for best edge matching. Default value is 2.11711Specify the search radius for best edge matching. Default value is 2.
11712Allowed range is from 0 to 15.11712Allowed range is from 0 to 15.
11713 11713
11714@item ecost
11715Specify the edge cost for edge matching. Default value is 0.03125.
11716Allowed range is from 0 to 1.
11717
11718@item mcost
11719Specify the middle cost for edge matching. Default value is 0.5.
11720Allowed range is from 0 to 1.
11721
11714@item dcost11722@item dcost
11715Specify the distance cost for edge matching. Default value is 0.5.11723Specify the distance cost for edge matching. Default value is 0.5.
11716Allowed range is from 0 to 1.11724Allowed range is from 0 to 1.
libavfilter/vf_estdif.c+10−5
@@ -35,6 +35,8 @@ typedef struct ESTDIFContext { · 34 unmodified lines
35 int deint; ///< which frames to deinterlace35 int deint; ///< which frames to deinterlace
36 int rslope; ///< best edge slope search radius36 int rslope; ///< best edge slope search radius
37 int redge; ///< best edge match search radius37 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 matching40 float dcost; ///< distance cost for edge matching
39 int interp; ///< type of interpolation41 int interp; ///< type of interpolation
40 int linesize[4]; ///< bytes of pixel data per line for each plane42 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); \

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