Mercurial > mplayer.hg
annotate libmpcodecs/vf_il.c @ 22433:d4faccf8bcd7
Remove hack that sets demuxer->video->pts after seeking, it seems no longer needed.
author | reimar |
---|---|
date | Sun, 04 Mar 2007 15:13:38 +0000 |
parents | 20aca9baf5d8 |
children | a124f3abc1ec |
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 /* |
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
|
2 Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> |
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
|
3 |
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
|
4 This program is free software; you can redistribute it and/or modify |
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
|
5 it under the terms of the GNU General Public License as published by |
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
|
6 the Free Software Foundation; either version 2 of the License, or |
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
|
7 (at your option) any later version. |
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
|
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
|
9 This program is distributed in the hope that it will be useful, |
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
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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
|
12 GNU General Public License for more details. |
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
|
13 |
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
|
14 You should have received a copy of the GNU General Public License |
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
|
15 along with this program; if not, write to the Free Software |
17367
401b440a6d76
Update licensing information: The FSF changed postal address.
diego
parents:
17012
diff
changeset
|
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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
|
17 */ |
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
|
18 |
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
|
19 #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
|
20 #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
|
21 #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
|
22 #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
|
23 #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
|
24 |
17012 | 25 #include "config.h" |
26 #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
|
27 |
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 #ifdef HAVE_MALLOC_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 <malloc.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 #endif |
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
|
31 |
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 #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
|
33 #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
|
34 #include "vf.h" |
17012 | 35 #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
|
36 |
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
|
37 |
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
|
38 //===========================================================================// |
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
|
39 |
8006 | 40 typedef struct FilterParam{ |
41 int interleave; | |
42 int swap; | |
43 }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
|
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 struct vf_priv_s { |
8006 | 46 FilterParam lumaParam; |
47 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
|
48 }; |
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 |
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 /***************************************************************************/ |
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 |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8051
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 |
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
|
58 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
|
59 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
|
60 for(y=0; y < m; 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
|
61 memcpy(dst + dstStride* y , src + srcStride*(y*2 + a), 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
|
62 memcpy(dst + dstStride*(y + m), src + srcStride*(y*2 + b), 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
|
63 } |
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
|
64 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
|
65 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
|
66 for(y=0; y < m; 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
|
67 memcpy(dst + dstStride* y*2 , src + srcStride*(y*2 + a), 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
|
68 memcpy(dst + dstStride*(y*2+1), src + srcStride*(y*2 + b), 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
|
69 } |
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
|
70 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
|
71 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
|
72 for(y=0; y < m; 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
|
73 memcpy(dst + dstStride*(y*2+a), src + srcStride* y , 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
|
74 memcpy(dst + dstStride*(y*2+b), src + srcStride*(y + m), 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
|
75 } |
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
|
76 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
|
77 } |
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
|
78 } |
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
|
79 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
80 static int put_image(struct vf_instance_s* 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
|
81 int w; |
8006 | 82 FilterParam *luma = &vf->priv->lumaParam; |
83 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
|
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 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
|
86 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
|
87 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
|
88 |
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 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
|
90 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
|
91 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
|
92 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
|
93 |
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 interleave(dmpi->planes[0], mpi->planes[0], |
8006 | 95 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
|
96 |
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
|
97 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
|
98 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
|
99 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
|
100 |
8006 | 101 interleave(dmpi->planes[1], mpi->planes[1], cw,ch, |
102 dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); | |
103 interleave(dmpi->planes[2], mpi->planes[2], cw,ch, | |
104 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
|
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 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17367
diff
changeset
|
107 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
|
108 } |
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
|
109 |
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
|
110 //===========================================================================// |
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
|
111 |
8006 | 112 static void parse(FilterParam *fp, char* args){ |
113 char *pos; | |
114 char *max= strchr(args, ':'); | |
115 | |
116 if(!max) max= args + strlen(args); | |
117 | |
118 pos= strchr(args, 's'); | |
119 if(pos && pos<max) fp->swap=1; | |
120 pos= strchr(args, 'i'); | |
121 if(pos && pos<max) fp->interleave=1; | |
122 pos= strchr(args, 'd'); | |
123 if(pos && pos<max) fp->interleave=-1; | |
124 } | |
125 | |
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
|
126 static int open(vf_instance_t *vf, char* args){ |
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 |
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
|
128 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
|
129 // 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
|
130 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
|
131 memset(vf->priv, 0, sizeof(struct vf_priv_s)); |
8006 | 132 |
133 if(args) | |
134 { | |
135 char *arg2= strchr(args,':'); | |
136 if(arg2) parse(&vf->priv->chromaParam, arg2+1); | |
137 parse(&vf->priv->lumaParam, args); | |
138 } | |
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
|
139 |
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 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
|
141 } |
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 |
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 vf_info_t vf_info_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
|
144 "(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
|
145 "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
|
146 "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
|
147 "", |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8123
diff
changeset
|
148 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
8123
diff
changeset
|
149 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
|
150 }; |
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
|
151 |
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
|
152 //===========================================================================// |