annotate libmpcodecs/vf_swapuv.c @ 8046:30a9a6358ee9

cleanup - round 2.
author pontscho
date Sat, 02 Nov 2002 17:07:19 +0000
parents 84ff79ba83f0
children 5f630596d004
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
1 /*
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
2 Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
3
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
6 the Free Software Foundation; either version 2 of the License, or
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
7 (at your option) any later version.
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
8
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
12 GNU General Public License for more details.
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
13
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
15 along with this program; if not, write to the Free Software
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
17 */
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
18
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
19 #include <stdio.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
20 #include <stdlib.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
21 #include <string.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
22 #include <inttypes.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
23 #include <assert.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
24
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
25 #include "../config.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
26 #include "../mp_msg.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
27
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
28 #ifdef HAVE_MALLOC_H
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
29 #include <malloc.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
30 #endif
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
31
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
32 #include "img_format.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
33 #include "mp_image.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
34 #include "vf.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
35 #include "../libvo/fastmemcpy.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
36
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
37
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
38 //===========================================================================//
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
39
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
40
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
41 struct vf_priv_s {
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
42 };
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
43
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
44
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
45 /***************************************************************************/
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
46
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
47
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
48 static int config(struct vf_instance_s* vf,
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
49 int width, int height, int d_width, int d_height,
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
50 unsigned int flags, unsigned int outfmt){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
51
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
52 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
53 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
54
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
55 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
56 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
57
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
58 assert(mpi->flags&MP_IMGFLAG_PLANAR);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
59
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
60 dmpi->planes[0]=mpi->planes[0];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
61 dmpi->planes[1]=mpi->planes[2];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
62 dmpi->planes[2]=mpi->planes[1];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
63 dmpi->stride[0]=mpi->stride[0];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
64 dmpi->stride[1]=mpi->stride[2];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
65 dmpi->stride[2]=mpi->stride[1];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
66
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
67 return vf_next_put_image(vf,dmpi);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
68 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
69
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
70 //===========================================================================//
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
71
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
72 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
73 switch(fmt)
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
74 {
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
75 case IMGFMT_YV12:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
76 case IMGFMT_I420:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
77 case IMGFMT_IYUV:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
78 case IMGFMT_YVU9:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
79 case IMGFMT_444P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
80 case IMGFMT_422P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
81 case IMGFMT_411P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
82 return vf_next_query_format(vf, fmt);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
83 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
84 return 0;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
85 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
86
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
87 static int open(vf_instance_t *vf, char* args){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
88 vf->config=config;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
89 vf->put_image=put_image;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
90 // vf->get_image=get_image;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
91 vf->query_format=query_format;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
92 vf->priv=malloc(sizeof(struct vf_priv_s));
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
93 memset(vf->priv, 0, sizeof(struct vf_priv_s));
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
94
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
95 return 1;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
96 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
97
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
98 vf_info_t vf_info_swapuv = {
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
99 "UV swaper",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
100 "swapuv",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
101 "Michael Niedermayer",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
102 "",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
103 open
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
104 };
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
105
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
106 //===========================================================================//