History

avfilter/vf_minterpolate: if metadata lavfi.scd.mafd exists, we'll use it first

Limin Wang committed 7 years ago

Commit d88e1c91 parent 339593c1 file · +12 −4Browse files

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

Unified · Split

libavfilter/vf_minterpolate.c+12−4
@@ -832,11 +832,19 @@ static int detect_scene_change(MIContext *mi_ctx) · 831 unmodified lines
832832 ptrdiff_t linesize2 = mi_ctx->frames[2].avf->linesize[0];
833833
834834 if (mi_ctx->scd_method == SCD_METHOD_FDIFF) {
835− double ret = 0, mafd, diff;
835+ double ret = 0, mafd = HUGE_VAL, diff;
836836 uint64_t sad;
837− mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
838− emms_c();
839− mafd = (double) sad / (me_ctx->height * me_ctx->width * 3);
837+ AVDictionaryEntry *e_mafd = NULL;
838+ char *tail = NULL;
839+
840+ e_mafd = av_dict_get(mi_ctx->frames[2].avf->metadata, "lavfi.scd.mafd", NULL, AV_DICT_MATCH_CASE);
841+ if (e_mafd)
842+ mafd = strtod(e_mafd->value, &tail);
843+ if (*tail || mafd == HUGE_VAL) {
844+ mi_ctx->sad(p1, linesize1, p2, linesize2, me_ctx->width, me_ctx->height, &sad);
845+ emms_c();
846+ mafd = (double) sad / (me_ctx->height * me_ctx->width * 3);
847+ }
840848 diff = fabs(mafd - mi_ctx->prev_mafd);
841849 ret = av_clipf(FFMIN(mafd, diff), 0, 100.0);
842850 mi_ctx->prev_mafd = mafd;

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