annotate libmpcodecs/vf_geq.c @ 24545:9e5126679d44

Replace stdint.h #include by functionally equivalent inttypes.h. The use of inttypes.h is more common throughout MPlayer and stdint.h can create problems on obscure systems like HP-UX, see Bugzilla #831.
author diego
date Tue, 18 Sep 2007 09:30:42 +0000
parents 918b0974e3a1
children 90302c23df72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
1 /*
5f216140e72b generic equation filter
michael
parents:
diff changeset
2 Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
5f216140e72b generic equation filter
michael
parents:
diff changeset
3
5f216140e72b generic equation filter
michael
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
5f216140e72b generic equation filter
michael
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
5f216140e72b generic equation filter
michael
parents:
diff changeset
6 the Free Software Foundation; either version 2 of the License, or
5f216140e72b generic equation filter
michael
parents:
diff changeset
7 (at your option) any later version.
5f216140e72b generic equation filter
michael
parents:
diff changeset
8
5f216140e72b generic equation filter
michael
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
5f216140e72b generic equation filter
michael
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
5f216140e72b generic equation filter
michael
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f216140e72b generic equation filter
michael
parents:
diff changeset
12 GNU General Public License for more details.
5f216140e72b generic equation filter
michael
parents:
diff changeset
13
5f216140e72b generic equation filter
michael
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
5f216140e72b generic equation filter
michael
parents:
diff changeset
15 along with this program; if not, write to the Free Software
5f216140e72b generic equation filter
michael
parents:
diff changeset
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5f216140e72b generic equation filter
michael
parents:
diff changeset
17 */
5f216140e72b generic equation filter
michael
parents:
diff changeset
18
5f216140e72b generic equation filter
michael
parents:
diff changeset
19 #include <stdio.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
20 #include <stdlib.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
21 #include <string.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
22 #include <math.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
23 #include <inttypes.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
24
5f216140e72b generic equation filter
michael
parents:
diff changeset
25 #include "config.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
26
5f216140e72b generic equation filter
michael
parents:
diff changeset
27 #include "mp_msg.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
28 #include "cpudetect.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
29
5f216140e72b generic equation filter
michael
parents:
diff changeset
30 // Needed to bring in lrintf.
5f216140e72b generic equation filter
michael
parents:
diff changeset
31 #define HAVE_AV_CONFIG_H
5f216140e72b generic equation filter
michael
parents:
diff changeset
32
5f216140e72b generic equation filter
michael
parents:
diff changeset
33 #include "libavcodec/avcodec.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
34 #include "libavcodec/dsputil.h"
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
35 #include "libavcodec/eval.h"
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
36 #include "libavutil/common.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
37
24020
918b0974e3a1 printf in mp_image.h was changed to fprintf in r17972.
cehoyos
parents: 23373
diff changeset
38 /* FIXME: common.h defines fprintf away when HAVE_AV_CONFIG
918b0974e3a1 printf in mp_image.h was changed to fprintf in r17972.
cehoyos
parents: 23373
diff changeset
39 * is defined, but mp_image.h needs fprintf.
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
40 */
24020
918b0974e3a1 printf in mp_image.h was changed to fprintf in r17972.
cehoyos
parents: 23373
diff changeset
41 #undef fprintf
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
42
5f216140e72b generic equation filter
michael
parents:
diff changeset
43 #ifdef HAVE_MALLOC_H
5f216140e72b generic equation filter
michael
parents:
diff changeset
44 #include <malloc.h>
5f216140e72b generic equation filter
michael
parents:
diff changeset
45 #endif
5f216140e72b generic equation filter
michael
parents:
diff changeset
46
5f216140e72b generic equation filter
michael
parents:
diff changeset
47 #include "img_format.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
48 #include "mp_image.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
49 #include "vf.h"
5f216140e72b generic equation filter
michael
parents:
diff changeset
50
5f216140e72b generic equation filter
michael
parents:
diff changeset
51
5f216140e72b generic equation filter
michael
parents:
diff changeset
52 struct vf_priv_s {
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
53 AVEvalExpr * e[3];
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
54 int framenum;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
55 mp_image_t *mpi;
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
56 };
5f216140e72b generic equation filter
michael
parents:
diff changeset
57
5f216140e72b generic equation filter
michael
parents:
diff changeset
58 static int config(struct vf_instance_s* vf,
5f216140e72b generic equation filter
michael
parents:
diff changeset
59 int width, int height, int d_width, int d_height,
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
60 unsigned int flags, unsigned int outfmt){
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
61 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
62 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
63
5f216140e72b generic equation filter
michael
parents:
diff changeset
64 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
5f216140e72b generic equation filter
michael
parents:
diff changeset
65 if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
5f216140e72b generic equation filter
michael
parents:
diff changeset
66 // ok, we can do pp in-place (or pp disabled):
5f216140e72b generic equation filter
michael
parents:
diff changeset
67 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
5f216140e72b generic equation filter
michael
parents:
diff changeset
68 mpi->type, mpi->flags, mpi->w, mpi->h);
5f216140e72b generic equation filter
michael
parents:
diff changeset
69 mpi->planes[0]=vf->dmpi->planes[0];
5f216140e72b generic equation filter
michael
parents:
diff changeset
70 mpi->stride[0]=vf->dmpi->stride[0];
5f216140e72b generic equation filter
michael
parents:
diff changeset
71 mpi->width=vf->dmpi->width;
5f216140e72b generic equation filter
michael
parents:
diff changeset
72 if(mpi->flags&MP_IMGFLAG_PLANAR){
5f216140e72b generic equation filter
michael
parents:
diff changeset
73 mpi->planes[1]=vf->dmpi->planes[1];
5f216140e72b generic equation filter
michael
parents:
diff changeset
74 mpi->planes[2]=vf->dmpi->planes[2];
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
75 mpi->stride[1]=vf->dmpi->stride[1];
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
76 mpi->stride[2]=vf->dmpi->stride[2];
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
77 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
78 mpi->flags|=MP_IMGFLAG_DIRECT;
5f216140e72b generic equation filter
michael
parents:
diff changeset
79 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
80
23219
cdf6ab5cf76d Fix "inline keyword not at beginning of declaration" warning.
diego
parents: 20466
diff changeset
81 static inline double getpix(struct vf_instance_s* vf, double x, double y, int plane){
20270
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
82 int xi, yi;
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
83 mp_image_t *mpi= vf->priv->mpi;
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
84 int stride= mpi->stride[plane];
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
85 uint8_t *src= mpi->planes[plane];
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
86 xi=x= FFMIN(FFMAX(x, 0), (mpi->w >> (plane ? mpi->chroma_x_shift : 0))-1);
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
87 yi=y= FFMIN(FFMAX(y, 0), (mpi->h >> (plane ? mpi->chroma_y_shift : 0))-1);
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
88
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
89 x-=xi;
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
90 y-=yi;
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
91
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
92 return
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
93 (1-y)*((1-x)*src[xi + yi * stride] + x*src[xi + 1 + yi * stride])
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
94 + y *((1-x)*src[xi + (yi+1) * stride] + x*src[xi + 1 + (yi+1) * stride]);
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
95 }
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
96
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
97 //FIXME cubic interpolate
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
98 //FIXME keep the last few frames
5f216140e72b generic equation filter
michael
parents:
diff changeset
99 static double lum(struct vf_instance_s* vf, double x, double y){
20270
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
100 return getpix(vf, x, y, 0);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
101 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
102
5f216140e72b generic equation filter
michael
parents:
diff changeset
103 static double cb(struct vf_instance_s* vf, double x, double y){
20270
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
104 return getpix(vf, x, y, 1);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
105 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
106
5f216140e72b generic equation filter
michael
parents:
diff changeset
107 static double cr(struct vf_instance_s* vf, double x, double y){
20270
eaddc65c500a bilinear interpolation
michael
parents: 20268
diff changeset
108 return getpix(vf, x, y, 2);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
109 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
110
5f216140e72b generic equation filter
michael
parents:
diff changeset
111 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
112 mp_image_t *dmpi;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
113 int x,y, plane;
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
114
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
115 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
116 // no DR, so get a new image! hope we'll get DR buffer:
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
117 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
118 MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
119 mpi->w,mpi->h);
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
120 }
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
121
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
122 dmpi= vf->dmpi;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
123 vf->priv->mpi= mpi;
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
124
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
125 vf_clone_mpi_attributes(dmpi, mpi);
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
126
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
127 for(plane=0; plane<3; plane++){
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
128 int w= mpi->w >> (plane ? mpi->chroma_x_shift : 0);
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
129 int h= mpi->h >> (plane ? mpi->chroma_y_shift : 0);
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
130 uint8_t *dst = dmpi->planes[plane];
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
131 int dst_stride= dmpi->stride[plane];
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
132 double const_values[]={
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
133 M_PI,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
134 M_E,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
135 0,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
136 0,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
137 w,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
138 h,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
139 vf->priv->framenum,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
140 w/(double)mpi->w,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
141 h/(double)mpi->h,
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
142 0
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
143 };
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
144 if (!vf->priv->e[plane]) continue;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
145 for(y=0; y<h; y++){
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
146 const_values[3]=y;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
147 for(x=0; x<w; x++){
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
148 const_values[2]=x;
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
149 dst[x+y* dst_stride]= ff_parse_eval(vf->priv->e[plane], const_values, vf);
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
150 }
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
151 }
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
152 }
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
153
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
154 vf->priv->framenum++;
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
155
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
156 return vf_next_put_image(vf,dmpi, pts);
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
157 }
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
158
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
159 static void uninit(struct vf_instance_s* vf){
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
160 if(!vf->priv) return;
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
161
20456
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
162 av_free(vf->priv);
52b0d09d347a cosmetic, reindentation, tab removal
ods15
parents: 20455
diff changeset
163 vf->priv=NULL;
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
164 }
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
165
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
166 //===========================================================================//
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
167 static int open(vf_instance_t *vf, char* args){
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
168 char eq[3][2000] = { { 0 }, { 0 }, { 0 } };
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
169 int plane;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
170
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
171 vf->config=config;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
172 vf->put_image=put_image;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
173 // vf->get_image=get_image;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
174 vf->uninit=uninit;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
175 vf->priv=av_malloc(sizeof(struct vf_priv_s));
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
176 memset(vf->priv, 0, sizeof(struct vf_priv_s));
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
177
20466
a5d299e877b2 make vf_geq read whitespace in equation param
ods15
parents: 20457
diff changeset
178 if (args) sscanf(args, "%1999[^:]:%1999[^:]:%1999[^:]", eq[0], eq[1], eq[2]);
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
179
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
180 if (!eq[1][0]) strncpy(eq[1], eq[0], sizeof(eq[0])-1);
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
181 if (!eq[2][0]) strncpy(eq[2], eq[1], sizeof(eq[0])-1);
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
182
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
183 for(plane=0; plane<3; plane++){
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
184 static const char *const_names[]={
5f216140e72b generic equation filter
michael
parents:
diff changeset
185 "PI",
5f216140e72b generic equation filter
michael
parents:
diff changeset
186 "E",
5f216140e72b generic equation filter
michael
parents:
diff changeset
187 "X",
5f216140e72b generic equation filter
michael
parents:
diff changeset
188 "Y",
5f216140e72b generic equation filter
michael
parents:
diff changeset
189 "W",
5f216140e72b generic equation filter
michael
parents:
diff changeset
190 "H",
5f216140e72b generic equation filter
michael
parents:
diff changeset
191 "N",
5f216140e72b generic equation filter
michael
parents:
diff changeset
192 "SW",
5f216140e72b generic equation filter
michael
parents:
diff changeset
193 "SH",
5f216140e72b generic equation filter
michael
parents:
diff changeset
194 NULL
5f216140e72b generic equation filter
michael
parents:
diff changeset
195 };
5f216140e72b generic equation filter
michael
parents:
diff changeset
196 static const char *func2_names[]={
5f216140e72b generic equation filter
michael
parents:
diff changeset
197 "lum",
5f216140e72b generic equation filter
michael
parents:
diff changeset
198 "cb",
5f216140e72b generic equation filter
michael
parents:
diff changeset
199 "cr",
5f216140e72b generic equation filter
michael
parents:
diff changeset
200 "p",
5f216140e72b generic equation filter
michael
parents:
diff changeset
201 NULL
5f216140e72b generic equation filter
michael
parents:
diff changeset
202 };
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
203 double (*func2[])(void *, double, double)={
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
204 lum,
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
205 cb,
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
206 cr,
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
207 plane==0 ? lum : (plane==1 ? cb : cr),
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
208 NULL
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
209 };
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
210 char * a;
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
211 vf->priv->e[plane] = ff_parse(eq[plane], const_names, NULL, NULL, func2, func2_names, &a);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
212
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
213 if (!vf->priv->e[plane]) {
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
214 mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s': %s\n", eq[plane], a);
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
215 }
20455
e36737b5ec2f update vf_geq to new ff_eval API
ods15
parents: 20270
diff changeset
216 }
20266
5f216140e72b generic equation filter
michael
parents:
diff changeset
217
5f216140e72b generic equation filter
michael
parents:
diff changeset
218 return 1;
5f216140e72b generic equation filter
michael
parents:
diff changeset
219 }
5f216140e72b generic equation filter
michael
parents:
diff changeset
220
5f216140e72b generic equation filter
michael
parents:
diff changeset
221 vf_info_t vf_info_geq = {
5f216140e72b generic equation filter
michael
parents:
diff changeset
222 "generic equation filter",
5f216140e72b generic equation filter
michael
parents:
diff changeset
223 "geq",
5f216140e72b generic equation filter
michael
parents:
diff changeset
224 "Michael Niedermayer",
5f216140e72b generic equation filter
michael
parents:
diff changeset
225 "",
5f216140e72b generic equation filter
michael
parents:
diff changeset
226 open,
5f216140e72b generic equation filter
michael
parents:
diff changeset
227 NULL
5f216140e72b generic equation filter
michael
parents:
diff changeset
228 };