Mercurial > mplayer.hg
annotate libmpcodecs/vf_telecine.c @ 24627:d715488fed0e
Update translations to not recommend -vc dummy (it is too crash-happy)
but -vc null like the English variant does.
author | reimar |
---|---|
date | Fri, 28 Sep 2007 18:38:05 +0000 |
parents | 8a6f80593529 |
children | 00fff9a3b735 |
rev | line source |
---|---|
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
7 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
8 #include "img_format.h" |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
9 #include "mp_image.h" |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
10 #include "vf.h" |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
11 |
17012 | 12 #include "libvo/fastmemcpy.h" |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
13 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
14 struct vf_priv_s { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
15 int frame; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
16 }; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
17 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
18 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
19 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
20 mp_image_t *dmpi; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
21 int ret; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
22 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
23 vf->priv->frame = (vf->priv->frame+1)%4; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
24 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
25 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
26 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
27 MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
28 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
29 ret = 0; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
30 // 0/0 1/1 2/2 2/3 3/0 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
31 switch (vf->priv->frame) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
32 case 0: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
33 my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
34 mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
35 dmpi->stride[0]*2, mpi->stride[0]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
36 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
37 my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
38 mpi->planes[1]+mpi->stride[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
39 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
40 dmpi->stride[1]*2, mpi->stride[1]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
41 my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
42 mpi->planes[2]+mpi->stride[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
43 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
44 dmpi->stride[2]*2, mpi->stride[2]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
45 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
46 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
47 case 1: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
48 case 2: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
49 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
50 dmpi->stride[0], mpi->stride[0]); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
51 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
52 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
53 mpi->chroma_width, mpi->chroma_height, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
54 dmpi->stride[1], mpi->stride[1]); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
55 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
56 mpi->chroma_width, mpi->chroma_height, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
57 dmpi->stride[2], mpi->stride[2]); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
58 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
59 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) || ret; |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
60 case 3: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
61 my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
62 mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
63 dmpi->stride[0]*2, mpi->stride[0]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
64 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
65 my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
66 mpi->planes[1]+mpi->stride[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
67 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
68 dmpi->stride[1]*2, mpi->stride[1]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
69 my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
70 mpi->planes[2]+mpi->stride[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
71 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
72 dmpi->stride[2]*2, mpi->stride[2]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
73 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
74 ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
75 my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
76 dmpi->stride[0]*2, mpi->stride[0]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
77 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
78 my_memcpy_pic(dmpi->planes[1], mpi->planes[1], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
79 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
80 dmpi->stride[1]*2, mpi->stride[1]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
81 my_memcpy_pic(dmpi->planes[2], mpi->planes[2], |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
82 mpi->chroma_width, mpi->chroma_height/2, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
83 dmpi->stride[2]*2, mpi->stride[2]*2); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
84 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
85 return ret; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
86 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
87 return 0; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
88 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
89 |
24605
8a6f80593529
Disable unused query_format functions for now until they are
diego
parents:
23666
diff
changeset
|
90 #if 0 |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
91 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
92 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
93 /* FIXME - figure out which other formats work */ |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
94 switch (fmt) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
95 case IMGFMT_YV12: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
96 case IMGFMT_IYUV: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
97 case IMGFMT_I420: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
98 return vf_next_query_format(vf, fmt); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
99 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
100 return 0; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
101 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
102 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
103 static int config(struct vf_instance_s* vf, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
104 int width, int height, int d_width, int d_height, |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
105 unsigned int flags, unsigned int outfmt) |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
106 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
107 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
108 } |
24605
8a6f80593529
Disable unused query_format functions for now until they are
diego
parents:
23666
diff
changeset
|
109 #endif |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
110 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
111 static void uninit(struct vf_instance_s* vf) |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
112 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
113 free(vf->priv); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
114 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
115 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
116 static int open(vf_instance_t *vf, char* args) |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
117 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
118 //vf->config = config; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
119 vf->put_image = put_image; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
120 //vf->query_format = query_format; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
121 vf->uninit = uninit; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
122 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
123 vf->priv = calloc(1, sizeof(struct vf_priv_s)); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
124 vf->priv->frame = 1; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
125 if (args) sscanf(args, "%d", &vf->priv->frame); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
126 vf->priv->frame--; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
127 return 1; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
128 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
129 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
130 vf_info_t vf_info_telecine = { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
131 "telecine filter", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
132 "telecine", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
133 "Rich Felker", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
134 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9468
diff
changeset
|
135 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9468
diff
changeset
|
136 NULL |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
137 }; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
138 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
139 |