[Mplayer-cvslog] CVS: main/libmpcodecs pullup.c,NONE,1.1 pullup.h,NONE,1.1 vf_pullup.c,NONE,1.1 vf.c,1.88,1.89 Makefile,1.103,1.104
Richard Felker CVS
rfelker at mplayerhq.hu
Mon Aug 18 17:24:38 CEST 2003
- Previous message: [Mplayer-cvslog] CVS: main/libmpcodecs vf.c,1.87,1.88 vd_libmpeg2.c,1.25,1.26 mp_image.h,1.25,1.26 vf_softpulldown.c,1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/DOCS/en mplayer.1,1.413,1.414
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv13408
Modified Files:
vf.c Makefile
Added Files:
pullup.c pullup.h vf_pullup.c
Log Message:
pullup -- third generation inverse telecine engine. the backend
(pullup.[ch]) is not mplayer-specific and is designed to work well
with g2; vf_pullup.c is the g1 wrapper. see man page for details, and
keep in mind, this is a work in progress.
--- NEW FILE ---
#include <stdlib.h>
#include "pullup.h"
#ifdef HAVE_MMX
static int diff_y_mmx(unsigned char *a, unsigned char *b, int s)
{
int ret;
asm (
"movl $4, %%ecx \n\t"
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm7, %%mm7 \n\t"
".balign 16 \n\t"
"1: \n\t"
"movq (%%esi), %%mm0 \n\t"
"movq (%%esi), %%mm2 \n\t"
"addl %%eax, %%esi \n\t"
"movq (%%edi), %%mm1 \n\t"
"addl %%eax, %%edi \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
"movq %%mm1, %%mm3 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpckhbw %%mm7, %%mm2 \n\t"
"punpckhbw %%mm7, %%mm3 \n\t"
"paddw %%mm0, %%mm4 \n\t"
"paddw %%mm1, %%mm4 \n\t"
"paddw %%mm2, %%mm4 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"decl %%ecx \n\t"
"jnz fb \n\t"
"movq %%mm4, %%mm3 \n\t"
"punpcklwl %%mm7, %%mm4 \n\t"
"punpckhwl %%mm7, %%mm3 \n\t"
"paddl %%mm4, %%mm3 \n\t"
"movq %%mm3, %%mm2 \n\t"
"punpckllq %%mm7, %%mm3 \n\t"
"punpckhlq %%mm7, %%mm2 \n\t"
"paddl %%mm3, %%mm2 \n\t"
"movl %%mm2, %eax"
"emms \n\t"
: "=a" (ret)
: "S" (a), "D" (b), "a" (s)
:
);
return ret;
}
#endif
#define ABS(a) (((a)^((a)>>31))-((a)>>31))
static int diff_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]-b[j]);
a+=s; b+=s;
}
return diff;
}
static int licomb_y(unsigned char *a, unsigned char *b, int s)
{
int i, j, diff=0;
for (i=8; i; i--) {
for (j=0; j<8; j++)
diff += ABS((a[j]<<1) - b[j-s] - b[j])
+ ABS((b[j]<<1) - a[j] - a[j+s]);
a+=s; b+=s;
}
return diff;
}
static void alloc_buffer(struct pullup_context *c, struct pullup_buffer *b)
{
int i;
if (b->planes) return;
b->planes = calloc(c->nplanes, sizeof(unsigned char *));
for (i = 0; i < c->nplanes; i++) {
b->planes[i] = malloc(c->h[i]*c->stride[i]);
/* Deal with idiotic 128=0 for chroma: */
memset(b->planes[i], c->background[i], c->h[i]*c->stride[i]);
}
}
struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity)
{
if (parity+1 & 1) b->lock[0]++;
if (parity+1 & 2) b->lock[1]++;
return b;
}
void pullup_release_buffer(struct pullup_buffer *b, int parity)
{
if (parity+1 & 1) b->lock[0]--;
if (parity+1 & 2) b->lock[1]--;
}
struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity)
{
int i;
/* Try first to get the sister buffer for the previous field */
if (parity < 2 && c->last && parity != c->last->parity
&& !c->last->buffer->lock[parity]) {
alloc_buffer(c, c->last->buffer);
return pullup_lock_buffer(c->last->buffer, parity);
}
/* Prefer a buffer with both fields open */
for (i = 0; i < c->nbuffers; i++) {
if (c->buffers[i].lock[0]) continue;
if (c->buffers[i].lock[1]) continue;
alloc_buffer(c, &c->buffers[i]);
return pullup_lock_buffer(&c->buffers[i], parity);
}
if (parity == 2) return 0;
/* Search for any half-free buffer */
for (i = 0; i < c->nbuffers; i++) {
if (parity+1 & 1 && c->buffers[i].lock[0]) continue;
if (parity+1 & 2 && c->buffers[i].lock[1]) continue;
alloc_buffer(c, &c->buffers[i]);
return pullup_lock_buffer(&c->buffers[i], parity);
}
return 0;
}
static void compute_metric(struct pullup_context *c,
struct pullup_field *fa, int pa,
struct pullup_field *fb, int pb,
int (*func)(unsigned char *, unsigned char *, int), int *dest)
{
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 w = c->metric_w*xstep;
if (!fa->buffer || !fb->buffer) return;
/* Shortcut for duplicate fields (e.g. from RFF flag) */
if (fa->buffer == fb->buffer && pa == pb) {
memset(dest, 0, c->metric_len * sizeof(int));
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;
for (y = c->metric_h; y; y--) {
for (x = 0; x < w; x += xstep) {
*dest++ = func(a + x, b + x, s);
}
a += ystep; b += ystep;
}
}
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));
/* add more metrics here as needed */
}
static struct pullup_field *make_field_queue(struct pullup_context *c, int len)
{
struct pullup_field *head, *f;
f = head = calloc(1, sizeof(struct pullup_field));
alloc_metrics(c, f);
for (; len > 0; len--) {
f->next = calloc(1, sizeof(struct pullup_field));
f->next->prev = f;
f = f->next;
alloc_metrics(c, f);
}
f->next = head;
head->prev = f;
return head;
}
static void check_field_queue(struct pullup_context *c)
{
if (c->head->next == c->first) {
struct pullup_field *f = calloc(1, sizeof(struct pullup_field));
alloc_metrics(c, f);
f->prev = c->head;
f->next = c->first;
c->head->next = f;
c->first->prev = f;
}
}
int pullup_submit_field(struct pullup_context *c, struct pullup_buffer *b, int parity)
{
struct pullup_field *f;
/* Grow the circular list if needed */
check_field_queue(c);
/* Cannot have two fields of same parity in a row; drop the new one */
if (c->last && c->last->parity == parity) return 0;
f = c->head;
f->parity = parity;
f->buffer = pullup_lock_buffer(b, parity);
f->flags = 0;
f->breaks = 0;
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);
/* Advance the circular list */
if (!c->first) c->first = c->head;
c->last = c->head;
c->head = c->head->next;
}
void pullup_flush_fields(struct pullup_context *c)
{
struct pullup_field *f;
for (f = c->first; f && f != c->head; f = f->next) {
pullup_release_buffer(f->buffer, f->parity);
f->buffer = 0;
}
c->first = c->last = 0;
}
#define F_HAVE_BREAKS 1
#define F_HAVE_AFFINITY 2
#define BREAK_LEFT 1
#define BREAK_RIGHT 2
static int queue_length(struct pullup_field *begin, struct pullup_field *end)
{
int count = 1;
struct pullup_field *f;
if (!begin || !end) return 0;
for (f = begin; f != end; f = f->next) count++;
return count;
}
static int find_first_break(struct pullup_field *f, int max)
{
int i;
for (i = 0; i < max; i++) {
if (f->breaks & BREAK_RIGHT || f->next->breaks & BREAK_LEFT)
return i+1;
f = f->next;
}
return 0;
}
static void compute_breaks(struct pullup_context *c, struct pullup_field *f0)
{
int i;
struct pullup_field *f1 = f0->next;
struct pullup_field *f2 = f1->next;
struct pullup_field *f3 = f2->next;
int l, max_l=0, max_r=0;
if (f0->flags & F_HAVE_BREAKS) return;
f0->flags |= F_HAVE_BREAKS;
/* Special case when fields are 100% identical */
if (f0->buffer == f2->buffer && f1->buffer != f3->buffer) {
f0->breaks |= BREAK_LEFT;
f2->breaks |= BREAK_RIGHT;
return;
}
for (i = 0; i < c->metric_len; i++) {
l = f2->diffs[i] - f3->diffs[i];
if (l > max_l) max_l = l;
if (-l > max_r) max_r = -l;
}
/* Don't get tripped up when differences are mostly quant error */
if (max_l + max_r < 64) return;
if (max_l > 4*max_r) f1->breaks |= BREAK_LEFT;
if (max_r > 4*max_l) f2->breaks |= BREAK_RIGHT;
//printf("max_l=%d max_r=%d\n", max_l, max_r);
}
static void compute_affinity(struct pullup_context *c, struct pullup_field *f)
{
int i;
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++) {
l = f->licomb[i] - f->next->licomb[i];
if (l > max_l) max_l = l;
if (-l > max_r) max_r = -l;
}
if (max_l + max_r < 64) return;
if (max_r > 3*max_l) f->affinity = -1;
else if (max_l > 3*max_r) f->affinity = 1;
}
static void foo(struct pullup_context *c)
{
struct pullup_field *f = c->first;
int i, n = queue_length(f, c->last);
for (i = 0; i < n; i++) {
if (i < n-3) compute_breaks(c, f);
compute_affinity(c, f);
f = f->next;
}
}
static int decide_frame_length(struct pullup_context *c)
{
int n;
struct pullup_field *f0 = c->first;
struct pullup_field *f1 = f0->next;
struct pullup_field *f2 = f1->next;
struct pullup_field *f3 = f2->next;
struct pullup_field *f4 = f3->next;
struct pullup_field *f5 = f4->next;
if (queue_length(c->first, c->last) < 6) return 0;
foo(c);
n = find_first_break(f0, 3);
switch (n) {
case 1:
return 1;
case 2:
if (f0->affinity == -1 || f1->affinity == 1) return 1;
else return 2;
case 3:
if (f1->affinity == -1 && f2->affinity != -1) return 2;
else if (f1->affinity == 1 && f0->affinity != 1) return 1;
else return 3;
default:
if (f0->affinity == -1 && f1->affinity != -1) return 1;
else if (f1->affinity == 1 && f2->affinity == -1) return 1;
else return 2;
}
}
static void print_aff_and_breaks(struct pullup_context *c, struct pullup_field *f)
{
int i;
int max_l, max_r, l;
struct pullup_field *f0 = f;
const char aff_l[] = "+..", aff_r[] = "..+";
printf("\naffinity: ");
for (i = 0; i < 6; i++) {
printf("%c%d%c", aff_l[1+f->affinity], i, aff_r[1+f->affinity]);
f = f->next;
}
f = f0;
printf("\nbreaks: ");
for (i=0; i<6; i++) {
printf("%c%d%c", f->breaks & BREAK_LEFT ? '|' : '.', i, f->breaks & BREAK_RIGHT ? '|' : '.');
f = f->next;
}
printf("\n");
}
struct pullup_frame *pullup_get_frame(struct pullup_context *c)
{
int i;
struct pullup_frame *fr = c->frame;
int n = decide_frame_length(c);
if (!n) return 0;
if (fr->lock) return 0;
print_aff_and_breaks(c, c->first);
printf("duration: %d \n", n);
fr->lock++;
fr->length = n;
fr->parity = c->first->parity;
fr->buffer = 0;
for (i = 0; i < n; i++) {
/* We cheat and steal the buffer without release+relock */
fr->fields[i] = c->first->buffer;
c->first->buffer = 0;
c->first = c->first->next;
}
/* Export the entire frame as one buffer, if possible! */
if (n == 2 && fr->fields[0] == fr->fields[1]) {
fr->buffer = fr->fields[0];
pullup_lock_buffer(fr->buffer, 2);
return fr;
}
/* (loop is in case we ever support frames longer than 3 fields) */
for (i = 1; i < n-1; i++) {
if (fr->fields[i] == fr->fields[i-1]
|| fr->fields[i] == fr->fields[i+1]) {
fr->buffer = fr->fields[i];
pullup_lock_buffer(fr->buffer, 2);
break;
}
}
return fr;
}
static void copy_field(struct pullup_context *c, struct pullup_buffer *dest,
struct pullup_buffer *src, int parity)
{
int i, j;
unsigned char *d, *s;
for (i = 0; i < c->nplanes; i++) {
s = src->planes[i] + parity*c->stride[i];
d = dest->planes[i] + parity*c->stride[i];
for (j = c->h[i]>>1; j; j--) {
memcpy(d, s, c->stride[i]);
s += c->stride[i]<<1;
d += c->stride[i]<<1;
}
}
}
void pullup_pack_frame(struct pullup_context *c, struct pullup_frame *fr)
{
int i;
int par = fr->parity;
if (fr->buffer) return;
if (fr->length < 2) return; /* FIXME: deal with this */
for (i = 0; i < fr->length; i++)
{
if (fr->fields[i]->lock[par ^ (i&1) ^ 1]) continue;
fr->buffer = fr->fields[i];
pullup_lock_buffer(fr->buffer, 2);
copy_field(c, fr->buffer, fr->fields[i+(i>0?-1:1)], par^(i&1)^1);
return;
}
fr->buffer = pullup_get_buffer(c, 2);
copy_field(c, fr->buffer, fr->fields[0], par);
copy_field(c, fr->buffer, fr->fields[1], par^1);
}
void pullup_release_frame(struct pullup_frame *fr)
{
int i;
for (i = 0; i < fr->length; i++)
pullup_release_buffer(fr->fields[i], fr->parity ^ (i&1));
if (fr->buffer) pullup_release_buffer(fr->buffer, 2);
fr->lock--;
}
struct pullup_context *pullup_alloc_context()
{
struct pullup_context *c;
c = calloc(1, sizeof(struct pullup_context));
return c;
}
void pullup_preinit_context(struct pullup_context *c)
{
c->bpp = calloc(c->nplanes, sizeof(int));
c->w = calloc(c->nplanes, sizeof(int));
c->h = calloc(c->nplanes, sizeof(int));
c->stride = calloc(c->nplanes, sizeof(int));
c->background = calloc(c->nplanes, sizeof(int));
}
void pullup_init_context(struct pullup_context *c)
{
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_len = c->metric_w * c->metric_h;
c->head = make_field_queue(c, 8);
c->frame = calloc(1, sizeof (struct pullup_frame));
c->frame->fields = calloc(3, sizeof (struct pullup_buffer *));
switch(c->format) {
case PULLUP_FMT_Y:
c->diff = diff_y;
c->licomb = licomb_y;
#ifdef HAVE_MMX
if (c->cpu & PULLUP_CPU_MMX) c->diff = diff_y_mmx;
#endif
break;
#if 0
case PULLUP_FMT_YUY2:
c->diff = diff_yuy2;
break;
case PULLUP_FMT_RGB32:
c->diff = diff_rgb32;
break;
#endif
}
}
void pullup_free_context(struct pullup_context *c)
{
/* FIXME: free! */
}
--- NEW FILE ---
#define PULLUP_CPU_MMX 1
#define PULLUP_CPU_MMX2 2
#define PULLUP_CPU_3DNOW 4
#define PULLUP_CPU_3DNOWEXT 8
#define PULLUP_CPU_SSE 16
#define PULLUP_CPU_SSE2 32
#define PULLUP_FMT_Y 1
#define PULLUP_FMT_YUY2 2
#define PULLUP_FMT_UYVY 3
#define PULLUP_FMT_RGB32 4
struct pullup_buffer
{
int lock[2];
unsigned char **planes;
};
struct pullup_field
{
int parity;
struct pullup_buffer *buffer;
unsigned int flags;
int breaks;
int affinity;
int *diffs;
int *licomb;
struct pullup_field *prev, *next;
};
struct pullup_frame
{
int lock;
int length;
int parity;
struct pullup_buffer **fields;
struct pullup_buffer *buffer;
};
struct pullup_context
{
/* Public interface */
int format;
int nplanes;
int *bpp, *w, *h, *stride, *background;
unsigned int cpu;
int junk_left, junk_right, junk_top, junk_bottom;
/* Internal data */
struct pullup_field *first, *last, *head;
struct pullup_buffer *buffers;
int nbuffers;
int (*diff)(unsigned char *, unsigned char *, int);
int (*licomb)(unsigned char *, unsigned char *, int);
int metric_w, metric_h, metric_len, metric_offset;
struct pullup_frame *frame;
};
struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity);
void pullup_release_buffer(struct pullup_buffer *b, int parity);
struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity);
int pullup_submit_field(struct pullup_context *c, struct pullup_buffer *b, int parity);
void pullup_flush_fields(struct pullup_context *c);
struct pullup_frame *pullup_get_frame(struct pullup_context *c);
void pullup_pack_frame(struct pullup_context *c, struct pullup_frame *fr);
void pullup_release_frame(struct pullup_frame *fr);
struct pullup_context *pullup_alloc_context();
void pullup_preinit_context(struct pullup_context *c);
void pullup_init_context(struct pullup_context *c);
void pullup_free_context(struct pullup_context *c);
--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../config.h"
#include "../mp_msg.h"
#include "../cpudetect.h"
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "../libvo/fastmemcpy.h"
#include "pullup.h"
struct vf_priv_s {
struct pullup_context *ctx;
int init;
int fakecount;
};
static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
for(i=0; i<height; i++)
{
memcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
return retval;
}
static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
if (mpi->flags & MP_IMGFLAG_PLANAR) {
c->format = PULLUP_FMT_Y;
c->nplanes = 3;
pullup_preinit_context(c);
c->bpp[0] = c->bpp[1] = c->bpp[2] = 8;
c->w[0] = mpi->w;
c->h[0] = mpi->h;
c->w[1] = c->w[2] = mpi->chroma_width;
c->h[1] = c->h[2] = mpi->chroma_height;
c->stride[0] = mpi->width;
c->stride[1] = c->stride[2] = mpi->chroma_width;
c->background[1] = c->background[2] = 128;
}
c->junk_left = c->junk_right = 1;
c->junk_top = c->junk_bottom = 4;
if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX;
if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2;
if (gCpuCaps.has3DNow) c->cpu |= PULLUP_CPU_3DNOW;
if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT;
if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE;
if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2;
pullup_init_context(c);
vf->priv->init = 1;
}
static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
if (mpi->type == MP_IMGTYPE_STATIC) return;
if (!vf->priv->init) init_pullup(vf, mpi);
b = pullup_get_buffer(c, 2);
if (!b) return; /* shouldn't happen... */
mpi->priv = b;
mpi->planes[0] = b->planes[0];
mpi->planes[1] = b->planes[1];
mpi->planes[2] = b->planes[2];
mpi->stride[0] = c->stride[0];
mpi->stride[1] = c->stride[1];
mpi->stride[2] = c->stride[2];
mpi->flags |= MP_IMGFLAG_DIRECT;
mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
//mpi->width = mpi->stride[0];
}
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
struct pullup_frame *f;
mp_image_t *dmpi;
int ret;
int p;
if (!vf->priv->init) init_pullup(vf, mpi);
if (mpi->flags & MP_IMGFLAG_DIRECT) {
b = mpi->priv;
mpi->priv = 0;
} else {
b = pullup_get_buffer(c, 2);
if (!b) {
mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n");
f = pullup_get_frame(c);
pullup_release_frame(f);
return 0;
}
memcpy_pic(b->planes[0], mpi->planes[0], mpi->w, mpi->h,
c->stride[0], mpi->stride[0]);
if (mpi->flags & MP_IMGFLAG_PLANAR) {
memcpy_pic(b->planes[1], mpi->planes[1],
mpi->chroma_width, mpi->chroma_height,
c->stride[1], mpi->stride[1]);
memcpy_pic(b->planes[2], mpi->planes[2],
mpi->chroma_width, mpi->chroma_height,
c->stride[2], mpi->stride[2]);
}
}
p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 :
(mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0);
//printf("p=%d\n", p);
pullup_submit_field(c, b, p);
pullup_submit_field(c, b, p^1);
if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
pullup_submit_field(c, b, p);
pullup_release_buffer(b, 2);
f = pullup_get_frame(c);
/* Fake yes for first few frames (buffer depth) to keep from
* breaking A/V sync with G1's bad architecture... */
if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0;
if (f->length < 2) {
pullup_release_frame(f);
f = pullup_get_frame(c);
if (!f) return 0;
if (f->length < 2) {
pullup_release_frame(f);
return 0;
}
}
/* If the frame isn't already exportable... */
if (!f->buffer) {
/* FIXME: DR disabled for now */
if (0) {
dmpi = vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->width, mpi->height);
/* FIXME: draw into DR buffer */
return vf_next_put_image(vf, dmpi);
}
pullup_pack_frame(c, f);
}
dmpi = vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->width, mpi->height);
dmpi->planes[0] = f->buffer->planes[0];
dmpi->planes[1] = f->buffer->planes[1];
dmpi->planes[2] = f->buffer->planes[2];
dmpi->stride[0] = c->stride[0];
dmpi->stride[1] = c->stride[1];
dmpi->stride[2] = c->stride[2];
ret = vf_next_put_image(vf, dmpi);
pullup_release_frame(f);
return ret;
}
static int query_format(struct vf_instance_s* vf, unsigned int fmt)
{
/* FIXME - support more formats */
switch (fmt) {
case IMGFMT_YV12:
case IMGFMT_IYUV:
case IMGFMT_I420:
return vf_next_query_format(vf, fmt);
}
return 0;
}
static int config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
if (height&3) return 0;
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
}
static void uninit(struct vf_instance_s* vf)
{
pullup_free_context(vf->priv->ctx);
free(vf->priv);
}
static int open(vf_instance_t *vf, char* args)
{
struct vf_priv_s *p;
vf->get_image = get_image;
vf->put_image = put_image;
vf->config = config;
vf->query_format = query_format;
vf->uninit = uninit;
vf->default_reqs = VFCAP_ACCEPT_STRIDE;
vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
p->ctx = pullup_alloc_context();
p->fakecount = 2;
return 1;
}
vf_info_t vf_info_pullup = {
"pullup (from field sequence to frames)",
"pullup",
"Rich Felker",
"",
open,
NULL
};
Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- vf.c 18 Aug 2003 14:49:06 -0000 1.88
+++ vf.c 18 Aug 2003 15:24:08 -0000 1.89
@@ -71,6 +71,7 @@
extern vf_info_t vf_info_dsize;
extern vf_info_t vf_info_decimate;
extern vf_info_t vf_info_softpulldown;
+extern vf_info_t vf_info_pullup;
// list of available filters:
static vf_info_t* filter_list[]={
@@ -131,6 +132,7 @@
&vf_info_dsize,
&vf_info_decimate,
&vf_info_softpulldown,
+ &vf_info_pullup,
NULL
};
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/Makefile,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- Makefile 11 Aug 2003 20:04:30 -0000 1.103
+++ Makefile 18 Aug 2003 15:24:08 -0000 1.104
@@ -14,7 +14,7 @@
VIDEO_SRCS_OPT=vd_realvid.c vd_ffmpeg.c vd_dshow.c vd_dmo.c vd_vfw.c vd_vfwex.c vd_odivx.c vd_divx4.c vd_xanim.c vd_xvid.c vd_libdv.c vd_qtvideo.c vd_theora.c
VIDEO_SRCS=dec_video.c vd.c $(VIDEO_SRCS_NAT) $(VIDEO_SRCS_LIB) $(VIDEO_SRCS_OPT)
-VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c
+VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c vf_pullup.c pullup.c
ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c ve_xvid.c ve_qtvideo.c ve_nuv.c
NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/decode144.c native/decode288.c
- Previous message: [Mplayer-cvslog] CVS: main/libmpcodecs vf.c,1.87,1.88 vd_libmpeg2.c,1.25,1.26 mp_image.h,1.25,1.26 vf_softpulldown.c,1.1,1.2
- Next message: [Mplayer-cvslog] CVS: main/DOCS/en mplayer.1,1.413,1.414
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list