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
This commit is contained in:
rfelker 2003-12-14 01:38:41 +00:00
parent 75dc953491
commit beb9c6afdc
2 changed files with 12 additions and 16 deletions

View File

@ -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 */

View File

@ -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;