1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-29 10:32:15 +00:00

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.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10957 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rfelker 2003-09-28 03:37:42 +00:00
parent 29b5d5b8f5
commit c2f9ef8fb2
3 changed files with 13 additions and 9 deletions

View File

@ -257,9 +257,10 @@ static void compute_metric(struct pullup_context *c,
{
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 @@ static void compute_metric(struct pullup_context *c,
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_preinit_context(struct pullup_context *c)
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);

View File

@ -48,6 +48,7 @@ struct pullup_context
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;

View File

@ -51,11 +51,12 @@ static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
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;