Mercurial > mplayer.hg
annotate libmpcodecs/vf_swapuv.c @ 13596:3a2e1e6ae834
sync by Mizda Gabor <gabrov at dana dot hu>
author | diego |
---|---|
date | Sat, 09 Oct 2004 20:23:23 +0000 |
parents | 89da8ec89558 |
children | a3b524705922 |
rev | line source |
---|---|
8002 | 1 /* |
2 Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> | |
3 | |
4 This program is free software; you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 2 of the License, or | |
7 (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, write to the Free Software | |
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 */ | |
18 | |
19 #include <stdio.h> | |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 #include <inttypes.h> | |
23 #include <assert.h> | |
24 | |
25 #include "../config.h" | |
26 #include "../mp_msg.h" | |
27 | |
28 #ifdef HAVE_MALLOC_H | |
29 #include <malloc.h> | |
30 #endif | |
31 | |
32 #include "img_format.h" | |
33 #include "mp_image.h" | |
34 #include "vf.h" | |
35 #include "../libvo/fastmemcpy.h" | |
36 | |
37 | |
38 //===========================================================================// | |
39 | |
8050 | 40 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
41 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, | |
42 mpi->type, mpi->flags, mpi->w, mpi->h); | |
8002 | 43 |
8050 | 44 mpi->planes[0]=dmpi->planes[0]; |
45 mpi->planes[1]=dmpi->planes[2]; | |
46 mpi->planes[2]=dmpi->planes[1]; | |
47 mpi->stride[0]=dmpi->stride[0]; | |
48 mpi->stride[1]=dmpi->stride[2]; | |
49 mpi->stride[2]=dmpi->stride[1]; | |
50 mpi->width=dmpi->width; | |
8002 | 51 |
8050 | 52 mpi->flags|=MP_IMGFLAG_DIRECT; |
53 mpi->priv=(void*)dmpi; | |
8002 | 54 } |
55 | |
56 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ | |
8050 | 57 mp_image_t *dmpi; |
58 | |
59 if(mpi->flags&MP_IMGFLAG_DIRECT){ | |
60 dmpi=(mp_image_t*)mpi->priv; | |
61 } else { | |
62 dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); | |
8002 | 63 assert(mpi->flags&MP_IMGFLAG_PLANAR); |
64 dmpi->planes[0]=mpi->planes[0]; | |
65 dmpi->planes[1]=mpi->planes[2]; | |
66 dmpi->planes[2]=mpi->planes[1]; | |
67 dmpi->stride[0]=mpi->stride[0]; | |
68 dmpi->stride[1]=mpi->stride[2]; | |
69 dmpi->stride[2]=mpi->stride[1]; | |
8050 | 70 dmpi->width=mpi->width; |
71 } | |
8002 | 72 |
9934 | 73 vf_clone_mpi_attributes(dmpi, mpi); |
8050 | 74 |
75 return vf_next_put_image(vf,dmpi); | |
8002 | 76 } |
77 | |
78 //===========================================================================// | |
79 | |
80 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
81 switch(fmt) | |
82 { | |
83 case IMGFMT_YV12: | |
84 case IMGFMT_I420: | |
85 case IMGFMT_IYUV: | |
86 case IMGFMT_YVU9: | |
87 case IMGFMT_444P: | |
88 case IMGFMT_422P: | |
89 case IMGFMT_411P: | |
90 return vf_next_query_format(vf, fmt); | |
91 } | |
92 return 0; | |
93 } | |
94 | |
95 static int open(vf_instance_t *vf, char* args){ | |
96 vf->put_image=put_image; | |
8050 | 97 vf->get_image=get_image; |
8002 | 98 vf->query_format=query_format; |
99 return 1; | |
100 } | |
101 | |
102 vf_info_t vf_info_swapuv = { | |
103 "UV swaper", | |
104 "swapuv", | |
105 "Michael Niedermayer", | |
106 "", | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
107 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
108 NULL |
8002 | 109 }; |
110 | |
111 //===========================================================================// |