Mercurial > mplayer.hg
annotate libmpcodecs/vf_field.c @ 21708:3275c971bbea
small wording/markup improvements
author | diego |
---|---|
date | Fri, 22 Dec 2006 05:33:17 +0000 |
parents | 20aca9baf5d8 |
children | f8d4f8eff72b |
rev | line source |
---|---|
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
7 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
8 #include "mp_image.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
9 #include "vf.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
10 |
17012 | 11 #include "libvo/fastmemcpy.h" |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
12 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
13 struct vf_priv_s { |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
14 int field; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
15 }; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
16 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
17 //===========================================================================// |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
18 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
19 static int config(struct vf_instance_s* vf, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
20 int width, int height, int d_width, int d_height, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
21 unsigned int flags, unsigned int outfmt){ |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
22 return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
23 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
24 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
25 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
26 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
27 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
28 mpi->width, mpi->height/2); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
29 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
30 // set up mpi as a double-stride image of dmpi: |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
31 vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
32 vf->dmpi->stride[0]=2*mpi->stride[0]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
33 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
34 vf->dmpi->planes[1]=mpi->planes[1]+ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
35 mpi->stride[1]*vf->priv->field; |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
36 vf->dmpi->stride[1]=2*mpi->stride[1]; |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
37 vf->dmpi->planes[2]=mpi->planes[2]+ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
38 mpi->stride[2]*vf->priv->field; |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
39 vf->dmpi->stride[2]=2*mpi->stride[2]; |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
40 } else |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
41 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
42 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
43 return vf_next_put_image(vf,vf->dmpi, pts); |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
44 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
45 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
46 //===========================================================================// |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
47 |
9443 | 48 static void uninit(struct vf_instance_s* vf) |
49 { | |
50 free(vf->priv); | |
51 } | |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
52 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
53 static int open(vf_instance_t *vf, char* args){ |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
54 vf->config=config; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
55 vf->put_image=put_image; |
9443 | 56 vf->uninit=uninit; |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
57 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
58 vf->priv=calloc(1, sizeof(struct vf_priv_s)); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
59 if (args) sscanf(args, "%d", &vf->priv->field); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
60 vf->priv->field &= 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
61 return 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
62 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
63 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
64 vf_info_t vf_info_field = { |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
65 "extract single field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
66 "field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
67 "Rich Felker", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
68 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9443
diff
changeset
|
69 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9443
diff
changeset
|
70 NULL |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
71 }; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
72 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
73 //===========================================================================// |