Mercurial > mplayer.hg
annotate libmpcodecs/vf_telecine.c @ 24479:6fb4555fba27
Remove unused demux_ty_FindESPacket parameter
author | reimar |
---|---|
date | Fri, 14 Sep 2007 19:55:09 +0000 |
parents | 5c3c7efd9b75 |
children | 8a6f80593529 |
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 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
90 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
|
91 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
92 /* FIXME - figure out which other formats work */ |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
93 switch (fmt) { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
94 case IMGFMT_YV12: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
95 case IMGFMT_IYUV: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
96 case IMGFMT_I420: |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
97 return vf_next_query_format(vf, fmt); |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
98 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
99 return 0; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
100 } |
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 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
|
103 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
|
104 unsigned int flags, unsigned int outfmt) |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
105 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
106 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
|
107 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
108 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
109 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
|
110 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
111 free(vf->priv); |
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 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
114 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
|
115 { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
116 //vf->config = config; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
117 vf->put_image = put_image; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
118 //vf->query_format = query_format; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
119 vf->uninit = uninit; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
120 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
121 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
|
122 vf->priv->frame = 1; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
123 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
|
124 vf->priv->frame--; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
125 return 1; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
126 } |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
127 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
128 vf_info_t vf_info_telecine = { |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
129 "telecine filter", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
130 "telecine", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
131 "Rich Felker", |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
132 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9468
diff
changeset
|
133 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9468
diff
changeset
|
134 NULL |
9468
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
135 }; |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
136 |
356963ad4784
filter for applying 3:2 telecine to 23.976 fps progressive material.
rfelker
parents:
diff
changeset
|
137 |