annotate libmpcodecs/vf_il.c @ 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)
author michael
date Thu, 31 Oct 2002 20:03:08 +0000
parents
children 694502344370
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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
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 "../config.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 #include "../mp_msg.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
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"
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 #include "../libvo/fastmemcpy.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
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
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 {
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
42 int 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
43 int chroma;
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 int 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
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
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 static int config(struct vf_instance_s* vf,
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 width, int height, int d_width, int d_height,
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 unsigned int flags, unsigned int outfmt){
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
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 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
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 }
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 static int interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int interleave, int 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
59 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
60 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
61 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
62 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
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 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
65 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
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 , 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 + 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
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 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
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 , 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
74 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
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 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
78 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
79 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
80 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
81 }
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 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
83 }
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
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 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
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 int 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
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 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
90 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
91 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
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 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
95 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
96 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
97
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 interleave(dmpi->planes[0], mpi->planes[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
99 w, mpi->h, dmpi->stride[0], mpi->stride[0], vf->priv->interleave, vf->priv->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
100
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 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
102 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
103 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
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 if(vf->priv->chroma){
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 interleave(dmpi->planes[1], mpi->planes[1], cw,ch,
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 dmpi->stride[1], mpi->stride[1], vf->priv->interleave, vf->priv->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
109 interleave(dmpi->planes[2], mpi->planes[2], cw,ch,
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 dmpi->stride[2], mpi->stride[2], vf->priv->interleave, vf->priv->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
111 }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
112 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
113 for(y=0; y < ch; 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
114 memcpy(dmpi->planes[1] + dmpi->stride[1]*y, mpi->planes[1] + mpi->stride[1]*y, cw);
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
115 for(y=0; y < ch; 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
116 memcpy(dmpi->planes[2] + dmpi->stride[2]*y, mpi->planes[2] + mpi->stride[2]*y, cw);
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
117 }
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
118 }
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
119
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
120 return vf_next_put_image(vf,dmpi);
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
121 }
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
122
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
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 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
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 /* we support all formats :) */
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 return vf_next_query_format(vf, fmt);
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 }
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
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 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
131 char *pos, *max;
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
132
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
133 vf->config=config;
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
134 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
135 // 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
136 vf->query_format=query_format;
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 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
138 memset(vf->priv, 0, 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
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 if(args==NULL) return 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
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 max= args + strlen(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
143
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 pos= strchr(args, '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
145 if(pos && pos<max) vf->priv->swap=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
146 pos= strchr(args, 'c');
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 if(pos && pos<max) vf->priv->chroma=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
148 pos= strchr(args, 'i');
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
149 if(pos && pos<max) vf->priv->interleave=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
150 pos= strchr(args, 'd');
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 if(pos && pos<max) vf->priv->interleave=-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
152
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
153 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
154 }
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
155
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
156 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
157 "(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
158 "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
159 "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
160 "",
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
161 open
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
162 };
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
163
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
164 //===========================================================================//