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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
1 /*
26727
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
2 * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
3 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
4 * This file is part of MPlayer.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
5 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
7 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
9 * (at your option) any later version.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
10 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
14 * GNU General Public License for more details.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
15 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
16 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
19 */
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
20
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
21 #include <stdio.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
22 #include <stdlib.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
23 #include <string.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
24 #include <inttypes.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
25 #include <assert.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
26
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15030
diff changeset
27 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15030
diff changeset
28 #include "mp_msg.h"
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
29
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
30 #ifdef HAVE_MALLOC_H
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
31 #include <malloc.h>
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
32 #endif
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
33
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
34 #include "img_format.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
35 #include "mp_image.h"
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
36 #include "vf.h"
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
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
41 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
42 mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt,
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
43 mpi->type, mpi->flags, mpi->w, mpi->h);
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
44
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
45 mpi->planes[0]=dmpi->planes[0];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
46 mpi->planes[1]=dmpi->planes[2];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
47 mpi->planes[2]=dmpi->planes[1];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
48 mpi->stride[0]=dmpi->stride[0];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
49 mpi->stride[1]=dmpi->stride[2];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
50 mpi->stride[2]=dmpi->stride[1];
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
51 mpi->width=dmpi->width;
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
52
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
53 mpi->flags|=MP_IMGFLAG_DIRECT;
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
54 mpi->priv=(void*)dmpi;
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
55 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
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
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
58 mp_image_t *dmpi;
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
59
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
60 if(mpi->flags&MP_IMGFLAG_DIRECT){
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
61 dmpi=(mp_image_t*)mpi->priv;
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
62 } else {
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
63 dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
64 assert(mpi->flags&MP_IMGFLAG_PLANAR);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
65 dmpi->planes[0]=mpi->planes[0];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
66 dmpi->planes[1]=mpi->planes[2];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
67 dmpi->planes[2]=mpi->planes[1];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
68 dmpi->stride[0]=mpi->stride[0];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
69 dmpi->stride[1]=mpi->stride[2];
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
70 dmpi->stride[2]=mpi->stride[1];
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
71 dmpi->width=mpi->width;
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
72 }
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
73
9934
89da8ec89558 vf_clone_mpi_attributes()
michael
parents: 9593
diff changeset
74 vf_clone_mpi_attributes(dmpi, mpi);
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
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
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
77 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
78
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
79 //===========================================================================//
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
80
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
81 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
82 switch(fmt)
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
83 {
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
84 case IMGFMT_YV12:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
85 case IMGFMT_I420:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
86 case IMGFMT_IYUV:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
87 case IMGFMT_YVU9:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
88 case IMGFMT_444P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
89 case IMGFMT_422P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
90 case IMGFMT_411P:
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
91 return vf_next_query_format(vf, fmt);
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
92 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
93 return 0;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
94 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
95
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
96 static int open(vf_instance_t *vf, char* args){
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
97 vf->put_image=put_image;
8050
5f630596d004 - DR support
arpi
parents: 8002
diff changeset
98 vf->get_image=get_image;
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
99 vf->query_format=query_format;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
100 return 1;
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
101 }
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
102
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
103 const vf_info_t vf_info_swapuv = {
15030
diego
parents: 9934
diff changeset
104 "UV swapper",
8002
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
105 "swapuv",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
106 "Michael Niedermayer",
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
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
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
110 };
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
111
84ff79ba83f0 (useless) UV plane swapper
michael
parents:
diff changeset
112 //===========================================================================//