Mercurial > mplayer.hg
annotate libmpcodecs/vf_il.c @ 30918:be200e917ae1
Remove unused OPTFLAGS variable from config.mak.
author | diego |
---|---|
date | Thu, 25 Mar 2010 19:53:05 +0000 |
parents | a972c1a4a012 |
children | 7af3e6f901fd |
rev | line source |
---|---|
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
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 */ | |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
20 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
21 #include <stdio.h> |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
22 #include <stdlib.h> |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
23 #include <string.h> |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
24 #include <inttypes.h> |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
25 #include <assert.h> |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
26 |
17012 | 27 #include "mp_msg.h" |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
28 #include "img_format.h" |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
29 #include "mp_image.h" |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
30 #include "vf.h" |
17012 | 31 #include "libvo/fastmemcpy.h" |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
32 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
33 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
34 //===========================================================================// |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
35 |
8006 | 36 typedef struct FilterParam{ |
37 int interleave; | |
38 int swap; | |
39 }FilterParam; | |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
40 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
41 struct vf_priv_s { |
8006 | 42 FilterParam lumaParam; |
43 FilterParam chromaParam; | |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
44 }; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
45 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
46 /***************************************************************************/ |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
47 |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8051
diff
changeset
|
48 static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int interleave, int swap){ |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
49 const int a= swap; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
50 const int b= 1-a; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
51 const int m= h>>1; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
52 int y; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
53 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
54 switch(interleave){ |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
55 case -1: |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
56 for(y=0; y < m; y++){ |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
57 fast_memcpy(dst + dstStride* y , src + srcStride*(y*2 + a), w); |
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
58 fast_memcpy(dst + dstStride*(y + m), src + srcStride*(y*2 + b), w); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
59 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
60 break; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
61 case 0: |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
62 for(y=0; y < m; y++){ |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
63 fast_memcpy(dst + dstStride* y*2 , src + srcStride*(y*2 + a), w); |
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
64 fast_memcpy(dst + dstStride*(y*2+1), src + srcStride*(y*2 + b), w); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
65 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
66 break; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
67 case 1: |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
68 for(y=0; y < m; y++){ |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
69 fast_memcpy(dst + dstStride*(y*2+a), src + srcStride* y , w); |
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
17906
diff
changeset
|
70 fast_memcpy(dst + dstStride*(y*2+b), src + srcStride*(y + m), w); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
71 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
72 break; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
73 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
74 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
75 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
76 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
77 int w; |
8006 | 78 FilterParam *luma = &vf->priv->lumaParam; |
79 FilterParam *chroma= &vf->priv->chromaParam; | |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
80 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
81 mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
82 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
83 mpi->w,mpi->h); |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
84 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
85 if(mpi->flags&MP_IMGFLAG_PLANAR) |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
86 w= mpi->w; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
87 else |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
88 w= mpi->w * mpi->bpp/8; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
89 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
90 interleave(dmpi->planes[0], mpi->planes[0], |
8006 | 91 w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
92 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
93 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
94 int cw= mpi->w >> mpi->chroma_x_shift; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
95 int ch= mpi->h >> mpi->chroma_y_shift; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
96 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
97 interleave(dmpi->planes[1], mpi->planes[1], cw,ch, |
8006 | 98 dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
99 interleave(dmpi->planes[2], mpi->planes[2], cw,ch, |
8006 | 100 dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
101 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
102 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
103 return vf_next_put_image(vf,dmpi, pts); |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
104 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
105 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
106 //===========================================================================// |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
107 |
8006 | 108 static void parse(FilterParam *fp, char* args){ |
109 char *pos; | |
110 char *max= strchr(args, ':'); | |
111 | |
112 if(!max) max= args + strlen(args); | |
113 | |
114 pos= strchr(args, 's'); | |
115 if(pos && pos<max) fp->swap=1; | |
116 pos= strchr(args, 'i'); | |
117 if(pos && pos<max) fp->interleave=1; | |
118 pos= strchr(args, 'd'); | |
119 if(pos && pos<max) fp->interleave=-1; | |
120 } | |
121 | |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
122 static int vf_open(vf_instance_t *vf, char *args){ |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
123 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
124 vf->put_image=put_image; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
125 // vf->get_image=get_image; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
126 vf->priv=malloc(sizeof(struct vf_priv_s)); |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
127 memset(vf->priv, 0, sizeof(struct vf_priv_s)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
128 |
8006 | 129 if(args) |
130 { | |
131 char *arg2= strchr(args,':'); | |
132 if(arg2) parse(&vf->priv->chromaParam, arg2+1); | |
133 parse(&vf->priv->lumaParam, args); | |
134 } | |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
135 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
136 return 1; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
137 } |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
138 |
25221 | 139 const vf_info_t vf_info_il = { |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
140 "(de)interleave", |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
141 "il", |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
142 "Michael Niedermayer", |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
143 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
29263
diff
changeset
|
144 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8123
diff
changeset
|
145 NULL |
8004
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
146 }; |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
147 |
30789258ca66
(de)interleave filter (can be used to split/merge an interlaced image so other non interlaced filters an be used with idividual fields)
michael
parents:
diff
changeset
|
148 //===========================================================================// |