[Mplayer-cvslog] CVS: main/libmpcodecs pullup.c,1.11,1.12 pullup.h,1.4,1.5

Richard Felker CVS rfelker at mplayerhq.hu
Thu Dec 11 06:06:22 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv9607

Modified Files:
	pullup.c pullup.h 
Log Message:
allow for different combing metrics to be selected (not useful yet)


Index: pullup.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/pullup.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pullup.c	11 Dec 2003 05:03:52 -0000	1.11
+++ pullup.c	11 Dec 2003 05:06:17 -0000	1.12
@@ -172,6 +172,17 @@
 	return diff;
 }
 
+static int qpcomb_y(unsigned char *a, unsigned char *b, int s)
+{
+	int i, j, diff=0;
+	for (i=4; i; i--) {
+		for (j=0; j<8; j++)
+			diff += ABS(a[j] - 3*b[j-s] + 3*a[j+s] - b[j]);
+		a+=s; b+=s;
+	}
+	return diff;
+}
+
 #if 0
 static int licomb_y_test(unsigned char *a, unsigned char *b, int s)
 {
@@ -291,7 +302,7 @@
 static void alloc_metrics(struct pullup_context *c, struct pullup_field *f)
 {
 	f->diffs = calloc(c->metric_len, sizeof(int));
-	f->licomb = calloc(c->metric_len, sizeof(int));
+	f->comb = calloc(c->metric_len, sizeof(int));
 	/* add more metrics here as needed */
 }
 
@@ -341,7 +352,7 @@
 	f->affinity = 0;
 
 	compute_metric(c, f, parity, f->prev->prev, parity, c->diff, f->diffs);
-	compute_metric(c, parity?f->prev:f, 0, parity?f:f->prev, 1, c->licomb, f->licomb);
+	compute_metric(c, parity?f->prev:f, 0, parity?f:f->prev, 1, c->comb, f->comb);
 
 	/* Advance the circular list */
 	if (!c->first) c->first = c->head;
@@ -434,18 +445,19 @@
 	if (f->flags & F_HAVE_AFFINITY) return;
 	f->flags |= F_HAVE_AFFINITY;
 	for (i = 0; i < c->metric_len; i++) {
-		l = f->licomb[i] - f->next->licomb[i];
+		l = f->comb[i] - f->next->comb[i];
 		if (l > max_l) max_l = l;
 		if (-l > max_r) max_r = -l;
 	}
-	if (max_l + max_r < 64) return;
+	printf("%d %d\n", max_l, max_r);
+	if (max_l + max_r < 32) 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) {
+	else if (max_l + max_r > 512) {
 		l = t = 0;
 		for (i = 0; i < c->metric_len; i++) {
-			l += f->licomb[i] - f->next->licomb[i];
-			t += ABS(f->licomb[i] - f->next->licomb[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;
@@ -496,6 +508,7 @@
 		else if (f2->affinity == 1) return 2;
 		else if (f0->affinity == 1 && f2->affinity == -1) return 3;
 		else if (f2->affinity == -1) return 1;
+		else if (f0->affinity == 1) return 2;
 		else if (f2->affinity == 0 && f3->affinity == 1) return 3;
 		else return 2;
 	}
@@ -654,13 +667,14 @@
 	switch(c->format) {
 	case PULLUP_FMT_Y:
 		c->diff = diff_y;
-		c->licomb = licomb_y;
+		c->comb = licomb_y;
 #ifdef HAVE_MMX
 		if (c->cpu & PULLUP_CPU_MMX) {
 			c->diff = diff_y_mmx;
-			c->licomb = licomb_y_mmx;
+			c->comb = licomb_y_mmx;
 		}
 #endif
+		//c->comb = qpcomb_y;
 		break;
 #if 0
 	case PULLUP_FMT_YUY2:
@@ -680,7 +694,7 @@
 	f = c->head;
 	do {
 		free(f->diffs);
-		free(f->licomb);
+		free(f->comb);
 		f = f->next;
 		free(f->prev);
 	} while (f != c->head);

Index: pullup.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/pullup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pullup.h	8 Nov 2003 00:26:46 -0000	1.4
+++ pullup.h	11 Dec 2003 05:06:17 -0000	1.5
@@ -26,7 +26,7 @@
 	int breaks;
 	int affinity;
 	int *diffs;
-	int *licomb;
+	int *comb;
 	struct pullup_field *prev, *next;
 };
 
@@ -54,7 +54,7 @@
 	struct pullup_buffer *buffers;
 	int nbuffers;
 	int (*diff)(unsigned char *, unsigned char *, int);
-	int (*licomb)(unsigned char *, unsigned char *, int);
+	int (*comb)(unsigned char *, unsigned char *, int);
 	int metric_w, metric_h, metric_len, metric_offset;
 	struct pullup_frame *frame;
 };



More information about the MPlayer-cvslog mailing list