Mercurial > mplayer.hg
annotate libmpcodecs/vf_pullup.c @ 21001:0a9d4999368b
group together "quant_type" and quant_*_matrix since they are related
author | gpoirier |
---|---|
date | Sat, 18 Nov 2006 12:35:29 +0000 |
parents | 20aca9baf5d8 |
children | a124f3abc1ec |
rev | line source |
---|---|
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
7 #include "cpudetect.h" | |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
8 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
9 #include "img_format.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
10 #include "mp_image.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
11 #include "vf.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
12 |
17012 | 13 #include "libvo/fastmemcpy.h" |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
14 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
15 #include "pullup.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
16 |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
17 #undef MAX |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
18 #define MAX(a,b) ((a)>(b)?(a):(b)) |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
19 |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
20 struct vf_priv_s { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
21 struct pullup_context *ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
22 int init; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
23 int fakecount; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
24 char *qbuf; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
25 }; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
26 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
27 static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
28 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
29 int i; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
30 void *retval=dst; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
31 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
32 for(i=0; i<height; i++) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
33 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
34 memcpy(dst, src, bytesPerLine); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
35 src+= srcStride; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
36 dst+= dstStride; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
37 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
38 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
39 return retval; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
40 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
41 |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
42 static inline void *il_memcpy_pic(void *dst, void *src0, void *src1, int w, int h, int ds, int ss) |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
43 { |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
44 int i; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
45 void *retval=dst; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
46 ss += ss; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
47 |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
48 for(i=h>>1; i; i--) |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
49 { |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
50 memcpy(dst, src0, w); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
51 src0 += ss; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
52 dst += ds; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
53 memcpy(dst, src1, w); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
54 src1 += ss; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
55 dst += ds; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
56 } |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
57 |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
58 return retval; |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
59 } |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
60 |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
61 static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
62 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
63 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
64 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
65 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
66 c->format = PULLUP_FMT_Y; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
67 c->nplanes = 4; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
68 pullup_preinit_context(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
69 c->bpp[0] = c->bpp[1] = c->bpp[2] = 8; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
70 c->w[0] = mpi->w; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
71 c->h[0] = mpi->h; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
72 c->w[1] = c->w[2] = mpi->chroma_width; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
73 c->h[1] = c->h[2] = mpi->chroma_height; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
74 c->w[3] = ((mpi->w+15)/16) * ((mpi->h+15)/16); |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
75 c->h[3] = 2; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
76 c->stride[0] = mpi->width; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
77 c->stride[1] = c->stride[2] = mpi->chroma_width; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
78 c->stride[3] = c->w[3]; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
79 c->background[1] = c->background[2] = 128; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
80 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
81 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
82 if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
83 if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
84 if (gCpuCaps.has3DNow) c->cpu |= PULLUP_CPU_3DNOW; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
85 if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
86 if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
87 if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
88 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
89 pullup_init_context(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
90 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
91 vf->priv->init = 1; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
92 vf->priv->qbuf = malloc(c->w[3]); |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
93 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
94 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
95 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
96 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
97 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
98 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
99 struct pullup_buffer *b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
100 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
101 if (mpi->type == MP_IMGTYPE_STATIC) return; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
102 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
103 if (!vf->priv->init) init_pullup(vf, mpi); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
104 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
105 b = pullup_get_buffer(c, 2); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
106 if (!b) return; /* shouldn't happen... */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
107 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
108 mpi->priv = b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
109 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
110 mpi->planes[0] = b->planes[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
111 mpi->planes[1] = b->planes[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
112 mpi->planes[2] = b->planes[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
113 mpi->stride[0] = c->stride[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
114 mpi->stride[1] = c->stride[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
115 mpi->stride[2] = c->stride[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
116 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
117 mpi->flags |= MP_IMGFLAG_DIRECT; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
118 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
119 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
120 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
121 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
122 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
123 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
124 struct pullup_buffer *b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
125 struct pullup_frame *f; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
126 mp_image_t *dmpi; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
127 int ret; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
128 int p; |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
129 int i; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
130 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
131 if (!vf->priv->init) init_pullup(vf, mpi); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
132 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
133 if (mpi->flags & MP_IMGFLAG_DIRECT) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
134 b = mpi->priv; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
135 mpi->priv = 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
136 } else { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
137 b = pullup_get_buffer(c, 2); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
138 if (!b) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
139 mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n"); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
140 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
141 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
142 return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
143 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
144 memcpy_pic(b->planes[0], mpi->planes[0], mpi->w, mpi->h, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
145 c->stride[0], mpi->stride[0]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
146 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
147 memcpy_pic(b->planes[1], mpi->planes[1], |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
148 mpi->chroma_width, mpi->chroma_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
149 c->stride[1], mpi->stride[1]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
150 memcpy_pic(b->planes[2], mpi->planes[2], |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
151 mpi->chroma_width, mpi->chroma_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
152 c->stride[2], mpi->stride[2]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
153 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
154 } |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
155 if (mpi->qscale) { |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
156 memcpy(b->planes[3], mpi->qscale, c->w[3]); |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
157 memcpy(b->planes[3]+c->w[3], mpi->qscale, c->w[3]); |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
158 } |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
159 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
160 p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 : |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
161 (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
162 pullup_submit_field(c, b, p); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
163 pullup_submit_field(c, b, p^1); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
164 if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
165 pullup_submit_field(c, b, p); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
166 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
167 pullup_release_buffer(b, 2); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
168 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
169 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
170 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
171 /* Fake yes for first few frames (buffer depth) to keep from |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
172 * breaking A/V sync with G1's bad architecture... */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
173 if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
174 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
175 if (f->length < 2) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
176 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
177 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
178 if (!f) return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
179 if (f->length < 2) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
180 pullup_release_frame(f); |
14954
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
181 if (!(mpi->fields & MP_IMGFIELD_REPEAT_FIRST)) |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
182 return 0; |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
183 f = pullup_get_frame(c); |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
184 if (!f) return 0; |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
185 if (f->length < 2) { |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
186 pullup_release_frame(f); |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
187 return 0; |
fe1dfcfcc3bf
1000l to me: could break a/v sync and eventually cause buffer exhaustion on soft-telecined input that's ugly
rfelker
parents:
13267
diff
changeset
|
188 } |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
189 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
190 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
191 |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
192 #if 0 |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
193 /* Average qscale tables from both frames. */ |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
194 if (mpi->qscale) { |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
195 for (i=0; i<c->w[3]; i++) { |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
196 vf->priv->qbuf[i] = (f->ofields[0]->planes[3][i] |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
197 + f->ofields[1]->planes[3][i+c->w[3]])>>1; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
198 } |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
199 } |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
200 #else |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
201 /* Take worst of qscale tables from both frames. */ |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
202 if (mpi->qscale) { |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
203 for (i=0; i<c->w[3]; i++) { |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
204 vf->priv->qbuf[i] = MAX(f->ofields[0]->planes[3][i], f->ofields[1]->planes[3][i+c->w[3]]); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
205 } |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
206 } |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
207 #endif |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
208 |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
209 /* If the frame isn't already exportable... */ |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
210 while (!f->buffer) { |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
211 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
212 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
213 mpi->width, mpi->height); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
214 /* FIXME: Is it ok to discard dmpi if it's not direct? */ |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
215 if (!(dmpi->flags & MP_IMGFLAG_DIRECT)) { |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
216 pullup_pack_frame(c, f); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
217 break; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
218 } |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
219 /* Direct render fields into output buffer */ |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
220 #if 0 |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
221 /* Write-order copy seems to have worse cache performance |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
222 * than read-order, but both should be checked on |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
223 * various cpus to see which is actually better...*/ |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
224 il_memcpy_pic(dmpi->planes[0], f->ofields[0]->planes[0], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
225 f->ofields[1]->planes[0] + c->stride[0], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
226 mpi->w, mpi->h, dmpi->stride[0], c->stride[0]); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
227 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
228 il_memcpy_pic(dmpi->planes[1], f->ofields[0]->planes[1], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
229 f->ofields[1]->planes[1] + c->stride[1], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
230 mpi->chroma_width, mpi->chroma_height, |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
231 dmpi->stride[1], c->stride[1]); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
232 il_memcpy_pic(dmpi->planes[2], f->ofields[0]->planes[2], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
233 f->ofields[1]->planes[2] + c->stride[2], |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
234 mpi->chroma_width, mpi->chroma_height, |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
235 dmpi->stride[2], c->stride[2]); |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
236 } |
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
237 #else |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
238 my_memcpy_pic(dmpi->planes[0], f->ofields[0]->planes[0], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
239 mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
240 my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0], |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
241 f->ofields[1]->planes[0] + c->stride[0], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
242 mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
243 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
244 my_memcpy_pic(dmpi->planes[1], f->ofields[0]->planes[1], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
245 mpi->chroma_width, mpi->chroma_height/2, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
246 dmpi->stride[1]*2, c->stride[1]*2); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
247 my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1], |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
248 f->ofields[1]->planes[1] + c->stride[1], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
249 mpi->chroma_width, mpi->chroma_height/2, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
250 dmpi->stride[1]*2, c->stride[1]*2); |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
251 my_memcpy_pic(dmpi->planes[2], f->ofields[0]->planes[2], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
252 mpi->chroma_width, mpi->chroma_height/2, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
253 dmpi->stride[2]*2, c->stride[2]*2); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
254 my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2], |
11628
6fc547235443
simplified frame decision logic and reduced the occurrance of length=1
rfelker
parents:
10956
diff
changeset
|
255 f->ofields[1]->planes[2] + c->stride[2], |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
256 mpi->chroma_width, mpi->chroma_height/2, |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
257 dmpi->stride[2]*2, c->stride[2]*2); |
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
258 } |
12548
8584fdad0188
old changes in my local tree i forgot to commit - minor fixes
rfelker
parents:
11629
diff
changeset
|
259 #endif |
10773
012eeac10e16
direct render frames whose fields are not in a common buffer, rather
rfelker
parents:
10738
diff
changeset
|
260 pullup_release_frame(f); |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
261 if (mpi->qscale) { |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
262 dmpi->qscale = vf->priv->qbuf; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
263 dmpi->qstride = mpi->qstride; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
264 dmpi->qscale_type = mpi->qscale_type; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
265 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
266 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
267 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
268 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
269 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
270 mpi->width, mpi->height); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
271 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
272 dmpi->planes[0] = f->buffer->planes[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
273 dmpi->planes[1] = f->buffer->planes[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
274 dmpi->planes[2] = f->buffer->planes[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
275 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
276 dmpi->stride[0] = c->stride[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
277 dmpi->stride[1] = c->stride[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
278 dmpi->stride[2] = c->stride[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
279 |
11629
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
280 if (mpi->qscale) { |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
281 dmpi->qscale = vf->priv->qbuf; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
282 dmpi->qstride = mpi->qstride; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
283 dmpi->qscale_type = mpi->qscale_type; |
341f3c870013
pass quantizer tables through (averaging values when fields come from
rfelker
parents:
11628
diff
changeset
|
284 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
285 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
286 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
287 return ret; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
288 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
289 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
290 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
291 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
292 /* FIXME - support more formats */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
293 switch (fmt) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
294 case IMGFMT_YV12: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
295 case IMGFMT_IYUV: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
296 case IMGFMT_I420: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
297 return vf_next_query_format(vf, fmt); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
298 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
299 return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
300 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
301 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
302 static int config(struct vf_instance_s* vf, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
303 int width, int height, int d_width, int d_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
304 unsigned int flags, unsigned int outfmt) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
305 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
306 if (height&3) return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
307 return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
308 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
309 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
310 static void uninit(struct vf_instance_s* vf) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
311 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
312 pullup_free_context(vf->priv->ctx); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
313 free(vf->priv); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
314 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
315 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
316 static int open(vf_instance_t *vf, char* args) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
317 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
318 struct vf_priv_s *p; |
12549 | 319 struct pullup_context *c; |
14970
5d566b4628d0
direct rendering support drastically improves speed, but it's buggy. :( disabled for now...
rfelker
parents:
14954
diff
changeset
|
320 //vf->get_image = get_image; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
321 vf->put_image = put_image; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
322 vf->config = config; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
323 vf->query_format = query_format; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
324 vf->uninit = uninit; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
325 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
326 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
12549 | 327 p->ctx = c = pullup_alloc_context(); |
14973 | 328 p->fakecount = 1; |
15037
dde2f0454527
1l! mplayer's verbose variable is not a flag but a signed number
rfelker
parents:
14973
diff
changeset
|
329 c->verbose = verbose>0; |
12549 | 330 c->junk_left = c->junk_right = 1; |
331 c->junk_top = c->junk_bottom = 4; | |
332 c->strict_breaks = 0; | |
13267 | 333 c->metric_plane = 0; |
12549 | 334 if (args) { |
13267 | 335 sscanf(args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane); |
12549 | 336 } |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
337 return 1; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
338 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
339 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
340 vf_info_t vf_info_pullup = { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
341 "pullup (from field sequence to frames)", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
342 "pullup", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
343 "Rich Felker", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
344 "", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
345 open, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
346 NULL |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
347 }; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
348 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
349 |