Mercurial > mplayer.hg
annotate libmpcodecs/vf_swapuv.c @ 27180:1a35c35a631e
Split simpleCopy into packedCopy and planarCopy. SoC Patch from Keiji Costantini
author | lu_zero |
---|---|
date | Sun, 06 Jul 2008 03:26:32 +0000 |
parents | 82601a38e2a7 |
children | df67d03dde3b |
rev | line source |
---|---|
8002 | 1 /* |
26727 | 2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
8002 | 20 |
21 #include <stdio.h> | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 #include <inttypes.h> | |
25 #include <assert.h> | |
26 | |
17012 | 27 #include "config.h" |
28 #include "mp_msg.h" | |
8002 | 29 |
30 #ifdef HAVE_MALLOC_H | |
31 #include <malloc.h> | |
32 #endif | |
33 | |
34 #include "img_format.h" | |
35 #include "mp_image.h" | |
36 #include "vf.h" | |
37 | |
38 | |
39 //===========================================================================// | |
40 | |
8050 | 41 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
42 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, | |
43 mpi->type, mpi->flags, mpi->w, mpi->h); | |
8002 | 44 |
8050 | 45 mpi->planes[0]=dmpi->planes[0]; |
46 mpi->planes[1]=dmpi->planes[2]; | |
47 mpi->planes[2]=dmpi->planes[1]; | |
48 mpi->stride[0]=dmpi->stride[0]; | |
49 mpi->stride[1]=dmpi->stride[2]; | |
50 mpi->stride[2]=dmpi->stride[1]; | |
51 mpi->width=dmpi->width; | |
8002 | 52 |
8050 | 53 mpi->flags|=MP_IMGFLAG_DIRECT; |
54 mpi->priv=(void*)dmpi; | |
8002 | 55 } |
56 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
57 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
8050 | 58 mp_image_t *dmpi; |
59 | |
60 if(mpi->flags&MP_IMGFLAG_DIRECT){ | |
61 dmpi=(mp_image_t*)mpi->priv; | |
62 } else { | |
63 dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); | |
8002 | 64 assert(mpi->flags&MP_IMGFLAG_PLANAR); |
65 dmpi->planes[0]=mpi->planes[0]; | |
66 dmpi->planes[1]=mpi->planes[2]; | |
67 dmpi->planes[2]=mpi->planes[1]; | |
68 dmpi->stride[0]=mpi->stride[0]; | |
69 dmpi->stride[1]=mpi->stride[2]; | |
70 dmpi->stride[2]=mpi->stride[1]; | |
8050 | 71 dmpi->width=mpi->width; |
72 } | |
8002 | 73 |
9934 | 74 vf_clone_mpi_attributes(dmpi, mpi); |
8050 | 75 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
76 return vf_next_put_image(vf,dmpi, pts); |
8002 | 77 } |
78 | |
79 //===========================================================================// | |
80 | |
81 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
82 switch(fmt) | |
83 { | |
84 case IMGFMT_YV12: | |
85 case IMGFMT_I420: | |
86 case IMGFMT_IYUV: | |
87 case IMGFMT_YVU9: | |
88 case IMGFMT_444P: | |
89 case IMGFMT_422P: | |
90 case IMGFMT_411P: | |
91 return vf_next_query_format(vf, fmt); | |
92 } | |
93 return 0; | |
94 } | |
95 | |
96 static int open(vf_instance_t *vf, char* args){ | |
97 vf->put_image=put_image; | |
8050 | 98 vf->get_image=get_image; |
8002 | 99 vf->query_format=query_format; |
100 return 1; | |
101 } | |
102 | |
25221 | 103 const vf_info_t vf_info_swapuv = { |
15030 | 104 "UV swapper", |
8002 | 105 "swapuv", |
106 "Michael Niedermayer", | |
107 "", | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
108 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8050
diff
changeset
|
109 NULL |
8002 | 110 }; |
111 | |
112 //===========================================================================// |