changeset 11641:b7c269232edd

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 :)
author rfelker
date Sun, 14 Dec 2003 01:38:41 +0000
parents 9d4c93e7d895
children c6694ea003d2
files libmpcodecs/pullup.c libmpcodecs/pullup.h
diffstat 2 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/pullup.c	Sat Dec 13 13:12:09 2003 +0000
+++ b/libmpcodecs/pullup.c	Sun Dec 14 01:38:41 2003 +0000
@@ -443,7 +443,7 @@
 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 @@
 	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 @@
 
 	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 */
--- a/libmpcodecs/pullup.h	Sat Dec 13 13:12:09 2003 +0000
+++ b/libmpcodecs/pullup.h	Sun Dec 14 01:38:41 2003 +0000
@@ -49,6 +49,8 @@
 	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;