diff options
author | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-12-14 01:38:41 +0000 |
---|---|---|
committer | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-12-14 01:38:41 +0000 |
commit | beb9c6afdcf737158d239f387082447f219487db (patch) | |
tree | 9af00d9560a30ce361890dbf965ff062d5eeb78c | |
parent | 75dc9534911ef4e80a0ac8cc039bf77513b3d45a (diff) | |
download | mpv-beb9c6afdcf737158d239f387082447f219487db.tar.bz2 mpv-beb9c6afdcf737158d239f387082447f219487db.tar.xz |
various updates:
simplify logic
eliminate stupid alternative affinity calculations (gave bad results)
favor output of clean duration-3 over duration-2 plus broken-1
(will give a more steady 3:2 pattern during telecine, w/ no quality loss)
options to adjust strictness of tests (but no way to set them presently :)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11642 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/pullup.c | 26 | ||||
-rw-r--r-- | libmpcodecs/pullup.h | 2 |
2 files changed, 12 insertions, 16 deletions
diff --git a/libmpcodecs/pullup.c b/libmpcodecs/pullup.c index 8a11d19bc9..6914d114c6 100644 --- a/libmpcodecs/pullup.c +++ b/libmpcodecs/pullup.c @@ -443,7 +443,7 @@ static void compute_breaks(struct pullup_context *c, struct pullup_field *f0) static void compute_affinity(struct pullup_context *c, struct pullup_field *f) { int i; - int max_l=0, max_r=0, l, t; + int max_l=0, max_r=0, l; if (f->flags & F_HAVE_AFFINITY) return; f->flags |= F_HAVE_AFFINITY; for (i = 0; i < c->metric_len; i++) { @@ -454,15 +454,6 @@ static void compute_affinity(struct pullup_context *c, struct pullup_field *f) if (max_l + max_r < 64) return; if (max_r > 2*max_l) f->affinity = -1; else if (max_l > 2*max_r) f->affinity = 1; - else if (max_l + max_r > 1024) { - l = t = 0; - for (i = 0; i < c->metric_len; i++) { - l += f->comb[i] - f->next->comb[i]; - t += ABS(f->comb[i] - f->next->comb[i]); - } - if (-l*4 > t) f->affinity = -1; - else if (l*4 > t) f->affinity = 1; - } } static void foo(struct pullup_context *c) @@ -490,16 +481,19 @@ static int decide_frame_length(struct pullup_context *c) switch (find_first_break(f0, 3)) { case 1: - return 1; + if (!c->strict_breaks && f0->affinity == 1 && f1->affinity == -1) + return 2; + else return 1; case 2: + /* FIXME: strictly speaking, f0->prev is no longer valid... :) */ + if (c->strict_pairs + && (f0->prev->breaks & BREAK_RIGHT) && (f2->breaks & BREAK_LEFT) + && (f0->affinity != 1 || f1->affinity != -1) ) + return 1; if (f1->affinity == 1) return 1; else return 2; case 3: - if (f1->affinity == 1) { - if (f0->affinity == 1 && f2->affinity == -1) return 3; - else return 1; - } - else if (f2->affinity == 1) return 2; + if (f2->affinity == 1) return 2; else return 3; default: /* 9 possibilities covered before switch */ diff --git a/libmpcodecs/pullup.h b/libmpcodecs/pullup.h index ff269e9e90..fec1b8b9f0 100644 --- a/libmpcodecs/pullup.h +++ b/libmpcodecs/pullup.h @@ -49,6 +49,8 @@ struct pullup_context int junk_left, junk_right, junk_top, junk_bottom; int verbose; int metric_plane; + int strict_breaks; + int strict_pairs; /* Internal data */ struct pullup_field *first, *last, *head; struct pullup_buffer *buffers; |