Mercurial > mplayer.hg
annotate libmpcodecs/vf_pullup.c @ 10760:e652bc367e17
slight "grammar" fixes
author | gabucino |
---|---|
date | Sun, 31 Aug 2003 22:53:07 +0000 |
parents | b6b68224033d |
children | 012eeac10e16 |
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 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
5 #include "../config.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
6 #include "../mp_msg.h" |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
7 #include "../cpudetect.h" |
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 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
13 #include "../libvo/fastmemcpy.h" |
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 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
17 struct vf_priv_s { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
18 struct pullup_context *ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
19 int init; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
20 int fakecount; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
21 }; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
22 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
23 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
|
24 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
25 int i; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
26 void *retval=dst; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
27 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
28 for(i=0; i<height; i++) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
29 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
30 memcpy(dst, src, bytesPerLine); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
31 src+= srcStride; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
32 dst+= dstStride; |
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 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
35 return retval; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
36 } |
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 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
|
39 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
40 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
41 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
42 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
43 c->format = PULLUP_FMT_Y; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
44 c->nplanes = 3; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
45 pullup_preinit_context(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
46 c->bpp[0] = c->bpp[1] = c->bpp[2] = 8; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
47 c->w[0] = mpi->w; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
48 c->h[0] = mpi->h; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
49 c->w[1] = c->w[2] = mpi->chroma_width; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
50 c->h[1] = c->h[2] = mpi->chroma_height; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
51 c->stride[0] = mpi->width; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
52 c->stride[1] = c->stride[2] = mpi->chroma_width; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
53 c->background[1] = c->background[2] = 128; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
54 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
55 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
56 c->junk_left = c->junk_right = 1; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
57 c->junk_top = c->junk_bottom = 4; |
10738 | 58 c->verbose = 1; |
10664
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
59 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
60 if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
61 if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
62 if (gCpuCaps.has3DNow) c->cpu |= PULLUP_CPU_3DNOW; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
63 if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
64 if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
65 if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
66 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
67 pullup_init_context(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
68 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
69 vf->priv->init = 1; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
70 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
71 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
72 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
73 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
|
74 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
75 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
76 struct pullup_buffer *b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
77 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
78 if (mpi->type == MP_IMGTYPE_STATIC) return; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
79 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
80 if (!vf->priv->init) init_pullup(vf, mpi); |
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 b = pullup_get_buffer(c, 2); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
83 if (!b) return; /* shouldn't happen... */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
84 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
85 mpi->priv = b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
86 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
87 mpi->planes[0] = b->planes[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
88 mpi->planes[1] = b->planes[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
89 mpi->planes[2] = b->planes[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
90 mpi->stride[0] = c->stride[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
91 mpi->stride[1] = c->stride[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
92 mpi->stride[2] = c->stride[2]; |
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 mpi->flags |= MP_IMGFLAG_DIRECT; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
95 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
96 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
97 //mpi->width = mpi->stride[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
98 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
99 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
100 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
101 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
102 struct pullup_context *c = vf->priv->ctx; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
103 struct pullup_buffer *b; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
104 struct pullup_frame *f; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
105 mp_image_t *dmpi; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
106 int ret; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
107 int p; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
108 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
109 if (!vf->priv->init) init_pullup(vf, mpi); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
110 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
111 if (mpi->flags & MP_IMGFLAG_DIRECT) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
112 b = mpi->priv; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
113 mpi->priv = 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
114 } else { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
115 b = pullup_get_buffer(c, 2); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
116 if (!b) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
117 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
|
118 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
119 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
120 return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
121 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
122 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
|
123 c->stride[0], mpi->stride[0]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
124 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
125 memcpy_pic(b->planes[1], mpi->planes[1], |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
126 mpi->chroma_width, mpi->chroma_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
127 c->stride[1], mpi->stride[1]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
128 memcpy_pic(b->planes[2], mpi->planes[2], |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
129 mpi->chroma_width, mpi->chroma_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
130 c->stride[2], mpi->stride[2]); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
131 } |
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 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
134 p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 : |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
135 (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
136 //printf("p=%d\n", p); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
137 pullup_submit_field(c, b, p); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
138 pullup_submit_field(c, b, p^1); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
139 if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
140 pullup_submit_field(c, b, p); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
141 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
142 pullup_release_buffer(b, 2); |
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 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
145 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
146 /* Fake yes for first few frames (buffer depth) to keep from |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
147 * breaking A/V sync with G1's bad architecture... */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
148 if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
149 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
150 if (f->length < 2) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
151 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
152 f = pullup_get_frame(c); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
153 if (!f) return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
154 if (f->length < 2) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
155 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
156 return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
157 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
158 } |
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 /* If the frame isn't already exportable... */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
161 if (!f->buffer) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
162 /* FIXME: DR disabled for now */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
163 if (0) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
164 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
165 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
166 mpi->width, mpi->height); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
167 /* FIXME: draw into DR buffer */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
168 return vf_next_put_image(vf, dmpi); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
169 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
170 pullup_pack_frame(c, f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
171 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
172 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
173 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
174 mpi->width, mpi->height); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
175 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
176 dmpi->planes[0] = f->buffer->planes[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
177 dmpi->planes[1] = f->buffer->planes[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
178 dmpi->planes[2] = f->buffer->planes[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
179 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
180 dmpi->stride[0] = c->stride[0]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
181 dmpi->stride[1] = c->stride[1]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
182 dmpi->stride[2] = c->stride[2]; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
183 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
184 ret = vf_next_put_image(vf, dmpi); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
185 pullup_release_frame(f); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
186 return ret; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
187 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
188 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
189 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
|
190 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
191 /* FIXME - support more formats */ |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
192 switch (fmt) { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
193 case IMGFMT_YV12: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
194 case IMGFMT_IYUV: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
195 case IMGFMT_I420: |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
196 return vf_next_query_format(vf, fmt); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
197 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
198 return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
199 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
200 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
201 static int config(struct vf_instance_s* vf, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
202 int width, int height, int d_width, int d_height, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
203 unsigned int flags, unsigned int outfmt) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
204 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
205 if (height&3) return 0; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
206 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
|
207 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
208 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
209 static void uninit(struct vf_instance_s* vf) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
210 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
211 pullup_free_context(vf->priv->ctx); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
212 free(vf->priv); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
213 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
214 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
215 static int open(vf_instance_t *vf, char* args) |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
216 { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
217 struct vf_priv_s *p; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
218 vf->get_image = get_image; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
219 vf->put_image = put_image; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
220 vf->config = config; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
221 vf->query_format = query_format; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
222 vf->uninit = uninit; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
223 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
224 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
225 p->ctx = pullup_alloc_context(); |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
226 p->fakecount = 2; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
227 return 1; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
228 } |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
229 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
230 vf_info_t vf_info_pullup = { |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
231 "pullup (from field sequence to frames)", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
232 "pullup", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
233 "Rich Felker", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
234 "", |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
235 open, |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
236 NULL |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
237 }; |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
238 |
d47ca466c97b
pullup -- third generation inverse telecine engine. the backend
rfelker
parents:
diff
changeset
|
239 |