Mercurial > mplayer.hg
annotate libmpcodecs/vf_field.c @ 36712:a08c32f7e836
Add my name.
author | ib |
---|---|
date | Fri, 07 Feb 2014 20:37:59 +0000 |
parents | 7af3e6f901fd |
children |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
19 #include <stdio.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
20 #include <stdlib.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
21 #include <string.h> |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
9072
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 #include "mp_image.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
27 #include "vf.h" |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
28 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
29 struct vf_priv_s { |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
30 int field; |
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 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
33 //===========================================================================// |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
34 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
35 static int config(struct vf_instance *vf, |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
36 int width, int height, int d_width, int d_height, |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
37 unsigned int flags, unsigned int outfmt){ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
38 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
|
39 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
40 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
41 static int put_image(struct vf_instance *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
|
42 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
43 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
44 mpi->width, mpi->height/2); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
45 |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
46 // 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
|
47 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
|
48 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
|
49 if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ |
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
50 vf->dmpi->planes[1]=mpi->planes[1]+ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
51 mpi->stride[1]*vf->priv->field; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
52 vf->dmpi->stride[1]=2*mpi->stride[1]; |
10141
7d6a854a5fe5
cleanup, use vf->dmpi rather than vf->priv->dmpi for consistency
rfelker
parents:
9593
diff
changeset
|
53 vf->dmpi->planes[2]=mpi->planes[2]+ |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
54 mpi->stride[2]*vf->priv->field; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
55 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
|
56 } else |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
57 vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
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,vf->dmpi, pts); |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
60 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
61 |
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 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
64 static void uninit(struct vf_instance *vf) |
9443 | 65 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
66 free(vf->priv); |
9443 | 67 } |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
68 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
69 static int vf_open(vf_instance_t *vf, char *args){ |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
70 vf->config=config; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
71 vf->put_image=put_image; |
9443 | 72 vf->uninit=uninit; |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
73 vf->default_reqs=VFCAP_ACCEPT_STRIDE; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
74 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
|
75 if (args) sscanf(args, "%d", &vf->priv->field); |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
76 vf->priv->field &= 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
77 return 1; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
78 } |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
79 |
25221 | 80 const vf_info_t vf_info_field = { |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
81 "extract single field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
82 "field", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
83 "Rich Felker", |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
84 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30421
diff
changeset
|
85 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9443
diff
changeset
|
86 NULL |
9072
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
87 }; |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
88 |
d7237ee9db7f
new video filter to extract a single field using stride arithmetic,
rfelker
parents:
diff
changeset
|
89 //===========================================================================// |