annotate libmpcodecs/vf_field.c @ 9394:b58dcfbbca5a

-fPIC compileable
author michael
date Tue, 11 Feb 2003 15:06:44 +0000
parents d7237ee9db7f
children 7df93217d82c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
5 #include "../config.h"
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
6 #include "../mp_msg.h"
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
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
11 #include "../libvo/fastmemcpy.h"
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 mp_image_t *dmpi;
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
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
20 static int config(struct vf_instance_s* vf,
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
21 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
22 unsigned int flags, unsigned int outfmt){
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
23 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
24 }
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
25
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
26 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
27 if(mpi->flags&MP_IMGFLAG_DIRECT){
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
28 // we've used DR, so we're ready...
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
29 return vf_next_put_image(vf,(mp_image_t*)mpi->priv);
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
30 }
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
31
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
32 vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt,
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
33 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
34 mpi->width, mpi->height/2);
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
35
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
36 // set up mpi as a double-stride image of dmpi:
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
37 vf->priv->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
38 vf->priv->dmpi->stride[0]=2*mpi->stride[0];
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
39 if(vf->priv->dmpi->flags&MP_IMGFLAG_PLANAR){
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
40 vf->priv->dmpi->planes[1]=mpi->planes[1]+
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
41 mpi->stride[1]*vf->priv->field;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
42 vf->priv->dmpi->stride[1]=2*mpi->stride[1];
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
43 vf->priv->dmpi->planes[2]=mpi->planes[2]+
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
44 mpi->stride[2]*vf->priv->field;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
45 vf->priv->dmpi->stride[2]=2*mpi->stride[2];
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
46 } else
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
47 vf->priv->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
48
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
49 return vf_next_put_image(vf,vf->priv->dmpi);
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
50 }
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
51
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
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
54 // FIXME - do we need to free dmpi on uninit?
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
55
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
56 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
57 vf->config=config;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
58 vf->put_image=put_image;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
59 vf->default_reqs=VFCAP_ACCEPT_STRIDE;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
60 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
61 if (args) sscanf(args, "%d", &vf->priv->field);
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
62 vf->priv->field &= 1;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
63 return 1;
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
64 }
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
65
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
66 vf_info_t vf_info_field = {
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
67 "extract single field",
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
68 "field",
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
69 "Rich Felker",
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
70 "",
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
71 open
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
d7237ee9db7f new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff changeset
74 //===========================================================================//