changeset 10956:fdcd0d571912

support for selecting which plane to use for metrics in the pullup core (one of the chroma planes could be used for much lower cpu load at the expense of some accuracy) and turning off verbose mode.
author rfelker
date Sun, 28 Sep 2003 03:37:42 +0000
parents 6d1388df591b
children 4d4d0c1c7142
files libmpcodecs/pullup.c libmpcodecs/pullup.h libmpcodecs/vf_pullup.c
diffstat 3 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/pullup.c	Sun Sep 28 01:45:54 2003 +0000
+++ b/libmpcodecs/pullup.c	Sun Sep 28 03:37:42 2003 +0000
@@ -257,9 +257,10 @@
 {
 	unsigned char *a, *b;
 	int x, y;
-	int xstep = c->bpp[0];
-	int ystep = c->stride[0]<<3;
-	int s = c->stride[0]<<1; /* field stride */
+	int mp = c->metric_plane;
+	int xstep = c->bpp[mp];
+	int ystep = c->stride[mp]<<3;
+	int s = c->stride[mp]<<1; /* field stride */
 	int w = c->metric_w*xstep;
 
 	if (!fa->buffer || !fb->buffer) return;
@@ -270,8 +271,8 @@
 		return;
 	}
 
-	a = fa->buffer->planes[0] + pa * c->stride[0] + c->metric_offset;
-	b = fb->buffer->planes[0] + pb * c->stride[0] + c->metric_offset;
+	a = fa->buffer->planes[mp] + pa * c->stride[mp] + c->metric_offset;
+	b = fb->buffer->planes[mp] + pb * c->stride[mp] + c->metric_offset;
 
 	for (y = c->metric_h; y; y--) {
 		for (x = 0; x < w; x += xstep) {
@@ -634,12 +635,13 @@
 
 void pullup_init_context(struct pullup_context *c)
 {
+	int mp = c->metric_plane;
 	if (c->nbuffers < 10) c->nbuffers = 10;
 	c->buffers = calloc(c->nbuffers, sizeof (struct pullup_buffer));
 
-	c->metric_w = (c->w[0] - (c->junk_left + c->junk_right << 3)) >> 3;
-	c->metric_h = (c->h[0] - (c->junk_top + c->junk_bottom << 1)) >> 3;
-	c->metric_offset = c->junk_left*c->bpp[0] + (c->junk_top<<1)*c->stride[0];
+	c->metric_w = (c->w[mp] - (c->junk_left + c->junk_right << 3)) >> 3;
+	c->metric_h = (c->h[mp] - (c->junk_top + c->junk_bottom << 1)) >> 3;
+	c->metric_offset = c->junk_left*c->bpp[mp] + (c->junk_top<<1)*c->stride[mp];
 	c->metric_len = c->metric_w * c->metric_h;
 	
 	c->head = make_field_queue(c, 8);
--- a/libmpcodecs/pullup.h	Sun Sep 28 01:45:54 2003 +0000
+++ b/libmpcodecs/pullup.h	Sun Sep 28 03:37:42 2003 +0000
@@ -48,6 +48,7 @@
 	unsigned int cpu;
 	int junk_left, junk_right, junk_top, junk_bottom;
 	int verbose;
+	int metric_plane;
 	/* Internal data */
 	struct pullup_field *first, *last, *head;
 	struct pullup_buffer *buffers;
--- a/libmpcodecs/vf_pullup.c	Sun Sep 28 01:45:54 2003 +0000
+++ b/libmpcodecs/vf_pullup.c	Sun Sep 28 03:37:42 2003 +0000
@@ -51,11 +51,12 @@
 		c->stride[0] = mpi->width;
 		c->stride[1] = c->stride[2] = mpi->chroma_width;
 		c->background[1] = c->background[2] = 128;
+		c->metric_plane = 0;
 	}
 
 	c->junk_left = c->junk_right = 1;
 	c->junk_top = c->junk_bottom = 4;
-	c->verbose = 1;
+	c->verbose = 0;
 
 	if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX;
 	if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2;